From d7f85019b02a643d34a901e036c69c1d0b677d0c Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 4 Dec 2023 18:07:49 +0100 Subject: [PATCH] initial commit for the generated client --- .gitignore | 362 + Algolia.Search.sln | 25 + .../Abtesting/Api/AbtestingClient.cs | 1781 +++ algoliasearch/Abtesting/Client/ApiClient.cs | 736 ++ .../Abtesting/Client/ApiException.cs | 62 + algoliasearch/Abtesting/Client/ApiResponse.cs | 160 + algoliasearch/Abtesting/Client/ClientUtils.cs | 244 + .../Abtesting/Client/Configuration.cs | 593 + .../Abtesting/Client/ExceptionFactory.cs | 16 + .../Abtesting/Client/FileParameter.cs | 74 + .../Abtesting/Client/GlobalConfiguration.cs | 61 + .../Abtesting/Client/IAsynchronousClient.cs | 94 + .../Client/IReadableConfiguration.cs | 111 + .../Abtesting/Client/ISynchronousClient.cs | 87 + algoliasearch/Abtesting/Client/Multimap.cs | 289 + .../Abtesting/Client/OpenAPIDateConverter.cs | 23 + .../Abtesting/Client/RequestOptions.cs | 68 + .../Abtesting/Client/WebRequestPathBuilder.cs | 47 + algoliasearch/Abtesting/Models/ABTest.cs | 355 + .../Abtesting/Models/ABTestResponse.cs | 164 + .../Abtesting/Models/AbTestsVariant.cs | 168 + .../Models/AbTestsVariantSearchParams.cs | 191 + .../Abtesting/Models/AbstractOpenAPISchema.cs | 70 + .../Abtesting/Models/AddABTestsRequest.cs | 183 + .../Abtesting/Models/AddABTestsVariant.cs | 288 + .../Abtesting/Models/CurrenciesValue.cs | 169 + .../Abtesting/Models/CustomSearchParams.cs | 133 + algoliasearch/Abtesting/Models/ErrorBase.cs | 147 + .../Abtesting/Models/FilterEffects.cs | 141 + .../Models/FilterEffectsEmptySearch.cs | 135 + .../Abtesting/Models/FilterEffectsOutliers.cs | 135 + .../Abtesting/Models/ListABTestsResponse.cs | 165 + algoliasearch/Abtesting/Models/Variant.cs | 411 + algoliasearch/Algolia.Search.csproj | 34 + .../Analytics/Api/AnalyticsClient.cs | 4731 +++++++ algoliasearch/Analytics/Client/ApiClient.cs | 736 ++ .../Analytics/Client/ApiException.cs | 62 + algoliasearch/Analytics/Client/ApiResponse.cs | 160 + algoliasearch/Analytics/Client/ClientUtils.cs | 244 + .../Analytics/Client/Configuration.cs | 593 + .../Analytics/Client/ExceptionFactory.cs | 16 + .../Analytics/Client/FileParameter.cs | 74 + .../Analytics/Client/GlobalConfiguration.cs | 61 + .../Analytics/Client/IAsynchronousClient.cs | 94 + .../Client/IReadableConfiguration.cs | 111 + .../Analytics/Client/ISynchronousClient.cs | 87 + algoliasearch/Analytics/Client/Multimap.cs | 289 + .../Analytics/Client/OpenAPIDateConverter.cs | 23 + .../Analytics/Client/RequestOptions.cs | 68 + .../Analytics/Client/WebRequestPathBuilder.cs | 47 + .../Analytics/Models/AbstractOpenAPISchema.cs | 70 + .../Analytics/Models/AverageClickEvent.cs | 164 + .../Analytics/Models/ClickPosition.cs | 150 + .../Analytics/Models/ClickThroughRateEvent.cs | 191 + .../Analytics/Models/ConversionRateEvent.cs | 191 + algoliasearch/Analytics/Models/Direction.cs | 42 + algoliasearch/Analytics/Models/ErrorBase.cs | 147 + .../Models/GetAverageClickPositionResponse.cs | 165 + .../Models/GetClickPositionsResponse.cs | 135 + .../Models/GetClickThroughRateResponse.cs | 192 + .../Models/GetConversationRateResponse.cs | 192 + .../Models/GetNoClickRateResponse.cs | 192 + .../Models/GetNoResultsRateResponse.cs | 192 + .../Models/GetSearchesCountResponse.cs | 150 + .../Models/GetSearchesNoClicksResponse.cs | 135 + .../Models/GetSearchesNoResultsResponse.cs | 135 + .../Analytics/Models/GetStatusResponse.cs | 134 + .../Models/GetTopCountriesResponse.cs | 135 + .../Analytics/Models/GetTopFilterAttribute.cs | 149 + .../Models/GetTopFilterAttributesResponse.cs | 135 + .../Models/GetTopFilterForAttribute.cs | 197 + .../GetTopFilterForAttributeResponse.cs | 135 + .../Models/GetTopFiltersNoResultsResponse.cs | 135 + .../Models/GetTopFiltersNoResultsValue.cs | 182 + .../Models/GetTopFiltersNoResultsValues.cs | 150 + .../Analytics/Models/GetTopHitsResponse.cs | 288 + .../Models/GetTopSearchesResponse.cs | 288 + .../Analytics/Models/GetUsersCountResponse.cs | 150 + .../Analytics/Models/NoClickRateEvent.cs | 191 + .../Analytics/Models/NoResultsRateEvent.cs | 191 + algoliasearch/Analytics/Models/OrderBy.cs | 55 + algoliasearch/Analytics/Models/SearchEvent.cs | 149 + .../Analytics/Models/SearchNoClickEvent.cs | 164 + .../Analytics/Models/SearchNoResultEvent.cs | 164 + algoliasearch/Analytics/Models/TopCountry.cs | 149 + algoliasearch/Analytics/Models/TopHit.cs | 149 + .../Analytics/Models/TopHitWithAnalytics.cs | 236 + .../Analytics/Models/TopHitsResponse.cs | 135 + .../Models/TopHitsResponseWithAnalytics.cs | 135 + algoliasearch/Analytics/Models/TopSearch.cs | 164 + .../Models/TopSearchWithAnalytics.cs | 266 + .../Analytics/Models/TopSearchesResponse.cs | 135 + .../TopSearchesResponseWithAnalytics.cs | 135 + .../Analytics/Models/UserWithDate.cs | 149 + .../Ingestion/Api/IngestionClient.cs | 6925 ++++++++++ algoliasearch/Ingestion/Client/ApiClient.cs | 736 ++ .../Ingestion/Client/ApiException.cs | 62 + algoliasearch/Ingestion/Client/ApiResponse.cs | 160 + algoliasearch/Ingestion/Client/ClientUtils.cs | 244 + .../Ingestion/Client/Configuration.cs | 587 + .../Ingestion/Client/ExceptionFactory.cs | 16 + .../Ingestion/Client/FileParameter.cs | 74 + .../Ingestion/Client/GlobalConfiguration.cs | 61 + .../Ingestion/Client/IAsynchronousClient.cs | 94 + .../Client/IReadableConfiguration.cs | 111 + .../Ingestion/Client/ISynchronousClient.cs | 87 + algoliasearch/Ingestion/Client/Multimap.cs | 289 + .../Ingestion/Client/OpenAPIDateConverter.cs | 23 + .../Ingestion/Client/RequestOptions.cs | 68 + .../Ingestion/Client/WebRequestPathBuilder.cs | 47 + .../Ingestion/Models/AbstractOpenAPISchema.cs | 70 + algoliasearch/Ingestion/Models/ActionType.cs | 49 + algoliasearch/Ingestion/Models/AuthAPIKey.cs | 133 + .../Ingestion/Models/AuthAPIKeyPartial.cs | 123 + algoliasearch/Ingestion/Models/AuthAlgolia.cs | 158 + .../Ingestion/Models/AuthAlgoliaPartial.cs | 143 + algoliasearch/Ingestion/Models/AuthBasic.cs | 156 + .../Ingestion/Models/AuthBasicPartial.cs | 141 + .../Models/AuthGoogleServiceAccount.cs | 158 + .../Models/AuthGoogleServiceAccountPartial.cs | 143 + algoliasearch/Ingestion/Models/AuthInput.cs | 426 + .../Ingestion/Models/AuthInputPartial.cs | 426 + algoliasearch/Ingestion/Models/AuthOAuth.cs | 182 + .../Ingestion/Models/AuthOAuthPartial.cs | 162 + .../Ingestion/Models/Authentication.cs | 252 + .../Ingestion/Models/AuthenticationCreate.cs | 185 + .../Models/AuthenticationCreateResponse.cs | 182 + .../Ingestion/Models/AuthenticationSearch.cs | 134 + .../Models/AuthenticationSortKeys.cs | 61 + .../Ingestion/Models/AuthenticationType.cs | 61 + .../Ingestion/Models/AuthenticationUpdate.cs | 170 + .../Models/AuthenticationUpdateResponse.cs | 182 + .../Ingestion/Models/BigCommerceChannel.cs | 145 + .../Ingestion/Models/BigCommerceMetafield.cs | 158 + .../Ingestion/Models/BigQueryDataType.cs | 42 + .../Ingestion/Models/DeleteResponse.cs | 134 + algoliasearch/Ingestion/Models/Destination.cs | 256 + .../Ingestion/Models/DestinationCreate.cs | 190 + .../Models/DestinationCreateResponse.cs | 182 + .../Ingestion/Models/DestinationIndexName.cs | 168 + .../Models/DestinationIndexPrefix.cs | 134 + .../Ingestion/Models/DestinationInput.cs | 288 + .../Ingestion/Models/DestinationSearch.cs | 134 + .../Ingestion/Models/DestinationSortKeys.cs | 55 + .../Ingestion/Models/DestinationType.cs | 49 + .../Ingestion/Models/DestinationUpdate.cs | 174 + .../Models/DestinationUpdateResponse.cs | 182 + .../Ingestion/Models/DockerImageType.cs | 49 + .../Ingestion/Models/DockerRegistry.cs | 43 + .../Ingestion/Models/DockerSourceDiscover.cs | 158 + .../Ingestion/Models/DockerSourceStreams.cs | 134 + algoliasearch/Ingestion/Models/ErrorBase.cs | 147 + algoliasearch/Ingestion/Models/Event.cs | 269 + .../Ingestion/Models/EventSortKeys.cs | 49 + algoliasearch/Ingestion/Models/EventStatus.cs | 66 + algoliasearch/Ingestion/Models/EventType.cs | 54 + .../Models/ListAuthenticationsResponse.cs | 157 + .../Models/ListDestinationsResponse.cs | 157 + .../Ingestion/Models/ListEventsResponse.cs | 180 + .../Ingestion/Models/ListSourcesResponse.cs | 157 + .../Ingestion/Models/ListTasksResponse.cs | 157 + .../Ingestion/Models/MappingTypeCSV.cs | 60 + algoliasearch/Ingestion/Models/MethodType.cs | 42 + .../Models/OnDemandDateUtilsInput.cs | 158 + .../Ingestion/Models/OnDemandTrigger.cs | 143 + .../Ingestion/Models/OnDemandTriggerInput.cs | 124 + .../Ingestion/Models/OnDemandTriggerType.cs | 37 + algoliasearch/Ingestion/Models/OrderKeys.cs | 43 + algoliasearch/Ingestion/Models/Pagination.cs | 166 + algoliasearch/Ingestion/Models/Platform.cs | 43 + .../Ingestion/Models/PlatformNone.cs | 37 + .../Ingestion/Models/PlatformWithNone.cs | 288 + algoliasearch/Ingestion/Models/RecordType.cs | 43 + algoliasearch/Ingestion/Models/Run.cs | 363 + .../Ingestion/Models/RunListResponse.cs | 180 + algoliasearch/Ingestion/Models/RunOutcome.cs | 48 + algoliasearch/Ingestion/Models/RunProgress.cs | 133 + .../Ingestion/Models/RunReasonCode.cs | 73 + algoliasearch/Ingestion/Models/RunResponse.cs | 158 + algoliasearch/Ingestion/Models/RunSortKeys.cs | 49 + algoliasearch/Ingestion/Models/RunStatus.cs | 60 + algoliasearch/Ingestion/Models/RunType.cs | 48 + .../Models/ScheduleDateUtilsInput.cs | 137 + .../Ingestion/Models/ScheduleTrigger.cs | 191 + .../Ingestion/Models/ScheduleTriggerInput.cs | 148 + .../Ingestion/Models/ScheduleTriggerType.cs | 37 + algoliasearch/Ingestion/Models/Source.cs | 256 + .../Ingestion/Models/SourceBigCommerce.cs | 199 + .../Ingestion/Models/SourceBigQuery.cs | 248 + algoliasearch/Ingestion/Models/SourceCSV.cs | 219 + .../Ingestion/Models/SourceCommercetools.cs | 210 + .../Ingestion/Models/SourceCreate.cs | 189 + .../Ingestion/Models/SourceCreateResponse.cs | 181 + .../Ingestion/Models/SourceDocker.cs | 205 + algoliasearch/Ingestion/Models/SourceInput.cs | 472 + algoliasearch/Ingestion/Models/SourceJSON.cs | 167 + .../Ingestion/Models/SourceSearch.cs | 134 + .../Ingestion/Models/SourceSortKeys.cs | 55 + algoliasearch/Ingestion/Models/SourceType.cs | 66 + .../Ingestion/Models/SourceUpdate.cs | 160 + .../Models/SourceUpdateCommercetools.cs | 145 + .../Ingestion/Models/SourceUpdateDocker.cs | 186 + .../Ingestion/Models/SourceUpdateInput.cs | 426 + .../Ingestion/Models/SourceUpdateResponse.cs | 181 + .../Ingestion/Models/SubscriptionTrigger.cs | 124 + .../Models/SubscriptionTriggerType.cs | 37 + algoliasearch/Ingestion/Models/Task.cs | 322 + algoliasearch/Ingestion/Models/TaskCreate.cs | 255 + .../Ingestion/Models/TaskCreateResponse.cs | 158 + .../Ingestion/Models/TaskCreateTrigger.cs | 334 + algoliasearch/Ingestion/Models/TaskInput.cs | 288 + algoliasearch/Ingestion/Models/TaskSearch.cs | 134 + .../Ingestion/Models/TaskSortKeys.cs | 61 + algoliasearch/Ingestion/Models/TaskUpdate.cs | 202 + .../Ingestion/Models/TaskUpdateResponse.cs | 158 + algoliasearch/Ingestion/Models/Trigger.cs | 334 + algoliasearch/Ingestion/Models/TriggerType.cs | 49 + .../Ingestion/Models/TriggerUpdateInput.cs | 134 + algoliasearch/Ingestion/Models/Window.cs | 158 + algoliasearch/Insights/Api/InsightsClient.cs | 1119 ++ algoliasearch/Insights/Client/ApiClient.cs | 736 ++ algoliasearch/Insights/Client/ApiException.cs | 62 + algoliasearch/Insights/Client/ApiResponse.cs | 160 + algoliasearch/Insights/Client/ClientUtils.cs | 244 + .../Insights/Client/Configuration.cs | 593 + .../Insights/Client/ExceptionFactory.cs | 16 + .../Insights/Client/FileParameter.cs | 74 + .../Insights/Client/GlobalConfiguration.cs | 61 + .../Insights/Client/IAsynchronousClient.cs | 94 + .../Insights/Client/IReadableConfiguration.cs | 111 + .../Insights/Client/ISynchronousClient.cs | 87 + algoliasearch/Insights/Client/Multimap.cs | 289 + .../Insights/Client/OpenAPIDateConverter.cs | 23 + .../Insights/Client/RequestOptions.cs | 68 + .../Insights/Client/WebRequestPathBuilder.cs | 47 + .../Insights/Models/AbstractOpenAPISchema.cs | 70 + .../Insights/Models/AddToCartEvent.cs | 36 + .../Insights/Models/AddedToCartObjectIDs.cs | 352 + .../Models/AddedToCartObjectIDsAfterSearch.cs | 398 + algoliasearch/Insights/Models/ClickEvent.cs | 36 + .../Insights/Models/ClickedFilters.cs | 299 + .../Insights/Models/ClickedObjectIDs.cs | 280 + .../Models/ClickedObjectIDsAfterSearch.cs | 370 + .../Insights/Models/ConversionEvent.cs | 36 + .../Insights/Models/ConvertedFilters.cs | 299 + .../Insights/Models/ConvertedObjectIDs.cs | 299 + .../Models/ConvertedObjectIDsAfterSearch.cs | 345 + algoliasearch/Insights/Models/Discount.cs | 288 + algoliasearch/Insights/Models/ErrorBase.cs | 147 + algoliasearch/Insights/Models/EventsItems.cs | 748 ++ .../Insights/Models/EventsResponse.cs | 139 + .../Insights/Models/InsightsEvents.cs | 135 + algoliasearch/Insights/Models/ObjectData.cs | 156 + .../Insights/Models/ObjectDataAfterSearch.cs | 175 + algoliasearch/Insights/Models/Price.cs | 288 + .../Insights/Models/PurchaseEvent.cs | 36 + .../Insights/Models/PurchasedObjectIDs.cs | 352 + .../Models/PurchasedObjectIDsAfterSearch.cs | 398 + algoliasearch/Insights/Models/ViewEvent.cs | 36 + .../Insights/Models/ViewedFilters.cs | 299 + .../Insights/Models/ViewedObjectIDs.cs | 299 + .../Monitoring/Api/MonitoringClient.cs | 2123 +++ algoliasearch/Monitoring/Client/ApiClient.cs | 736 ++ .../Monitoring/Client/ApiException.cs | 62 + .../Monitoring/Client/ApiResponse.cs | 160 + .../Monitoring/Client/ClientUtils.cs | 244 + .../Monitoring/Client/Configuration.cs | 571 + .../Monitoring/Client/ExceptionFactory.cs | 16 + .../Monitoring/Client/FileParameter.cs | 74 + .../Monitoring/Client/GlobalConfiguration.cs | 61 + .../Monitoring/Client/IAsynchronousClient.cs | 94 + .../Client/IReadableConfiguration.cs | 111 + .../Monitoring/Client/ISynchronousClient.cs | 87 + algoliasearch/Monitoring/Client/Multimap.cs | 289 + .../Monitoring/Client/OpenAPIDateConverter.cs | 23 + .../Monitoring/Client/RequestOptions.cs | 68 + .../Client/WebRequestPathBuilder.cs | 47 + .../Models/AbstractOpenAPISchema.cs | 70 + algoliasearch/Monitoring/Models/ErrorBase.cs | 147 + .../Models/GetInventory403Response.cs | 123 + algoliasearch/Monitoring/Models/Incident.cs | 138 + .../Monitoring/Models/IncidentsInner.cs | 138 + .../Monitoring/Models/IncidentsResponse.cs | 124 + .../Monitoring/Models/IndexingTimeResponse.cs | 123 + .../Models/IndexingTimeResponseMetrics.cs | 124 + .../Models/InfrastructureResponse.cs | 123 + .../Models/InfrastructureResponseMetrics.cs | 205 + .../Monitoring/Models/InventoryResponse.cs | 124 + .../Monitoring/Models/LatencyResponse.cs | 123 + .../Models/LatencyResponseMetrics.cs | 124 + algoliasearch/Monitoring/Models/Metric.cs | 66 + algoliasearch/Monitoring/Models/Period.cs | 60 + .../Monitoring/Models/ProbesMetric.cs | 135 + algoliasearch/Monitoring/Models/Region.cs | 121 + algoliasearch/Monitoring/Models/Server.cs | 216 + .../Monitoring/Models/ServerStatus.cs | 36 + algoliasearch/Monitoring/Models/Status.cs | 55 + .../Monitoring/Models/StatusResponse.cs | 124 + algoliasearch/Monitoring/Models/TimeInner.cs | 135 + algoliasearch/Monitoring/Models/Type.cs | 36 + .../Api/PersonalizationClient.cs | 1587 +++ .../Personalization/Client/ApiClient.cs | 736 ++ .../Personalization/Client/ApiException.cs | 62 + .../Personalization/Client/ApiResponse.cs | 160 + .../Personalization/Client/ClientUtils.cs | 244 + .../Personalization/Client/Configuration.cs | 587 + .../Client/ExceptionFactory.cs | 16 + .../Personalization/Client/FileParameter.cs | 74 + .../Client/GlobalConfiguration.cs | 61 + .../Client/IAsynchronousClient.cs | 94 + .../Client/IReadableConfiguration.cs | 111 + .../Client/ISynchronousClient.cs | 87 + .../Personalization/Client/Multimap.cs | 289 + .../Client/OpenAPIDateConverter.cs | 23 + .../Personalization/Client/RequestOptions.cs | 68 + .../Client/WebRequestPathBuilder.cs | 47 + .../Models/AbstractOpenAPISchema.cs | 70 + .../Models/DeleteUserProfileResponse.cs | 158 + .../Personalization/Models/ErrorBase.cs | 147 + .../Personalization/Models/EventScoring.cs | 173 + .../Personalization/Models/FacetScoring.cs | 149 + .../Models/GetUserTokenResponse.cs | 182 + .../Models/PersonalizationStrategyParams.cs | 175 + .../SetPersonalizationStrategyResponse.cs | 134 + .../Api/QuerySuggestionsClient.cs | 2091 +++ .../QuerySuggestions/Client/ApiClient.cs | 736 ++ .../QuerySuggestions/Client/ApiException.cs | 62 + .../QuerySuggestions/Client/ApiResponse.cs | 160 + .../QuerySuggestions/Client/ClientUtils.cs | 244 + .../QuerySuggestions/Client/Configuration.cs | 587 + .../Client/ExceptionFactory.cs | 16 + .../QuerySuggestions/Client/FileParameter.cs | 74 + .../Client/GlobalConfiguration.cs | 61 + .../Client/IAsynchronousClient.cs | 94 + .../Client/IReadableConfiguration.cs | 111 + .../Client/ISynchronousClient.cs | 87 + .../QuerySuggestions/Client/Multimap.cs | 289 + .../Client/OpenAPIDateConverter.cs | 23 + .../QuerySuggestions/Client/RequestOptions.cs | 68 + .../Client/WebRequestPathBuilder.cs | 47 + .../Models/AbstractOpenAPISchema.cs | 70 + ...seQuerySuggestionsConfigurationResponse.cs | 182 + ...eQuerySuggestionsConfigurationWithIndex.cs | 134 + .../QuerySuggestions/Models/BaseResponse.cs | 139 + .../QuerySuggestions/Models/ErrorBase.cs | 147 + .../QuerySuggestions/Models/Facet.cs | 139 + .../Models/GetConfigStatus200Response.cs | 196 + .../Models/GetLogFile200Response.cs | 172 + .../QuerySuggestions/Models/Languages.cs | 288 + .../QuerySuggestions/Models/LogLevel.cs | 49 + .../Models/QuerySuggestionsConfiguration.cs | 203 + .../QuerySuggestionsConfigurationResponse.cs | 304 + .../QuerySuggestionsConfigurationWithIndex.cs | 227 + .../QuerySuggestions/Models/SourceIndex.cs | 270 + .../Recommend/Api/RecommendClient.cs | 1879 +++ algoliasearch/Recommend/Client/ApiClient.cs | 736 ++ .../Recommend/Client/ApiException.cs | 62 + algoliasearch/Recommend/Client/ApiResponse.cs | 160 + algoliasearch/Recommend/Client/ClientUtils.cs | 244 + .../Recommend/Client/Configuration.cs | 645 + .../Recommend/Client/ExceptionFactory.cs | 16 + .../Recommend/Client/FileParameter.cs | 74 + .../Recommend/Client/GlobalConfiguration.cs | 61 + .../Recommend/Client/IAsynchronousClient.cs | 94 + .../Client/IReadableConfiguration.cs | 111 + .../Recommend/Client/ISynchronousClient.cs | 87 + algoliasearch/Recommend/Client/Multimap.cs | 289 + .../Recommend/Client/OpenAPIDateConverter.cs | 23 + .../Recommend/Client/RequestOptions.cs | 68 + .../Recommend/Client/WebRequestPathBuilder.cs | 47 + .../Recommend/Models/AbstractOpenAPISchema.cs | 70 + .../Models/AdvancedSyntaxFeatures.cs | 42 + .../Recommend/Models/AlternativesAsExact.cs | 48 + algoliasearch/Recommend/Models/Anchoring.cs | 55 + .../Recommend/Models/AroundPrecision.cs | 288 + .../Models/AroundPrecisionFromValueInner.cs | 133 + .../Recommend/Models/AroundRadius.cs | 288 + .../Recommend/Models/AroundRadiusAll.cs | 36 + .../Recommend/Models/AutomaticFacetFilter.cs | 164 + .../Recommend/Models/AutomaticFacetFilters.cs | 288 + .../Recommend/Models/BaseRecommendRequest.cs | 176 + .../Models/BaseRecommendationsQuery.cs | 184 + .../Recommend/Models/BaseSearchParams.cs | 700 + .../Models/BaseSearchParamsWithoutQuery.cs | 680 + .../Recommend/Models/BaseSearchResponse.cs | 632 + .../Models/BaseTrendingFacetsQuery.cs | 148 + .../Models/BaseTrendingItemsQuery.cs | 193 + algoliasearch/Recommend/Models/Condition.cs | 172 + algoliasearch/Recommend/Models/Consequence.cs | 197 + .../Recommend/Models/ConsequenceHide.cs | 134 + .../Recommend/Models/ConsequenceParams.cs | 1546 +++ .../Recommend/Models/ConsequenceQuery.cs | 288 + .../Models/ConsequenceQueryObject.cs | 145 + .../Recommend/Models/DeletedAtResponse.cs | 149 + algoliasearch/Recommend/Models/Distinct.cs | 288 + algoliasearch/Recommend/Models/Edit.cs | 157 + algoliasearch/Recommend/Models/EditType.cs | 43 + algoliasearch/Recommend/Models/ErrorBase.cs | 147 + .../Models/ExactOnSingleWordQuery.cs | 49 + algoliasearch/Recommend/Models/Exhaustive.cs | 180 + .../Recommend/Models/FacetFilters.cs | 288 + .../Recommend/Models/FacetOrdering.cs | 143 + algoliasearch/Recommend/Models/Facets.cs | 125 + algoliasearch/Recommend/Models/FacetsStats.cs | 165 + .../Models/GetRecommendTaskResponse.cs | 124 + .../Models/GetRecommendationsParams.cs | 135 + .../Models/GetRecommendationsResponse.cs | 124 + .../Recommend/Models/HighlightResult.cs | 288 + .../Recommend/Models/HighlightResultOption.cs | 188 + .../Recommend/Models/IgnorePlurals.cs | 288 + .../Models/IndexSettingsAsSearchParams.cs | 917 ++ algoliasearch/Recommend/Models/MatchLevel.cs | 49 + .../Recommend/Models/MatchedGeoLocation.cs | 150 + .../Recommend/Models/MixedSearchFilters.cs | 288 + algoliasearch/Recommend/Models/Mode.cs | 43 + .../Recommend/Models/NumericFilters.cs | 288 + .../Recommend/Models/OptionalFilters.cs | 288 + algoliasearch/Recommend/Models/Params.cs | 177 + .../Recommend/Models/Personalization.cs | 150 + algoliasearch/Recommend/Models/Promote.cs | 288 + .../Recommend/Models/PromoteObjectID.cs | 149 + .../Recommend/Models/PromoteObjectIDs.cs | 150 + algoliasearch/Recommend/Models/QueryType.cs | 49 + algoliasearch/Recommend/Models/RankingInfo.cs | 311 + .../Recommend/Models/ReRankingApplyFilter.cs | 297 + .../Recommend/Models/RecommendHit.cs | 260 + .../Recommend/Models/RecommendHits.cs | 173 + .../Recommend/Models/RecommendModels.cs | 54 + .../Recommend/Models/RecommendationModels.cs | 43 + .../Recommend/Models/RecommendationsQuery.cs | 250 + .../Models/RecommendationsRequest.cs | 334 + .../Models/RecommendationsResponse.cs | 668 + algoliasearch/Recommend/Models/Redirect.cs | 124 + .../Models/RedirectRuleIndexMetadata.cs | 220 + .../Models/RedirectRuleIndexMetadataData.cs | 133 + .../Recommend/Models/RemoveStopWords.cs | 288 + .../Models/RemoveWordsIfNoResults.cs | 55 + .../Recommend/Models/RenderingContent.cs | 123 + .../Recommend/Models/RuleResponse.cs | 224 + .../Recommend/Models/RuleResponseMetadata.cs | 124 + .../Recommend/Models/SearchParamsObject.cs | 1512 +++ .../Recommend/Models/SearchParamsQuery.cs | 125 + .../Models/SearchRecommendRulesParams.cs | 231 + .../Models/SearchRecommendRulesResponse.cs | 180 + .../Recommend/Models/SemanticSearch.cs | 125 + .../Recommend/Models/SnippetResult.cs | 288 + .../Recommend/Models/SnippetResultOption.cs | 148 + .../Recommend/Models/SortRemainingBy.cs | 49 + algoliasearch/Recommend/Models/TagFilters.cs | 288 + algoliasearch/Recommend/Models/TaskStatus.cs | 43 + .../Recommend/Models/TrendingFacetsModel.cs | 37 + .../Recommend/Models/TrendingFacetsQuery.cs | 214 + .../Recommend/Models/TrendingItemsModel.cs | 37 + .../Recommend/Models/TrendingItemsQuery.cs | 264 + .../Recommend/Models/TypoTolerance.cs | 288 + .../Recommend/Models/TypoToleranceEnum.cs | 42 + algoliasearch/Recommend/Models/Value.cs | 139 + algoliasearch/Search/Api/SearchClient.cs | 10915 ++++++++++++++++ algoliasearch/Search/Client/ApiClient.cs | 736 ++ algoliasearch/Search/Client/ApiException.cs | 62 + algoliasearch/Search/Client/ApiResponse.cs | 160 + algoliasearch/Search/Client/ClientUtils.cs | 244 + algoliasearch/Search/Client/Configuration.cs | 645 + .../Search/Client/ExceptionFactory.cs | 16 + algoliasearch/Search/Client/FileParameter.cs | 74 + .../Search/Client/GlobalConfiguration.cs | 61 + .../Search/Client/IAsynchronousClient.cs | 94 + .../Search/Client/IReadableConfiguration.cs | 111 + .../Search/Client/ISynchronousClient.cs | 87 + algoliasearch/Search/Client/Multimap.cs | 289 + .../Search/Client/OpenAPIDateConverter.cs | 23 + algoliasearch/Search/Client/RequestOptions.cs | 68 + .../Search/Client/WebRequestPathBuilder.cs | 47 + .../Search/Models/AbstractOpenAPISchema.cs | 70 + algoliasearch/Search/Models/Acl.cs | 121 + algoliasearch/Search/Models/Action.cs | 73 + .../Search/Models/AddApiKeyResponse.cs | 158 + .../Search/Models/AdvancedSyntaxFeatures.cs | 42 + .../Search/Models/AlternativesAsExact.cs | 48 + algoliasearch/Search/Models/Anchoring.cs | 55 + algoliasearch/Search/Models/ApiKey.cs | 260 + .../Search/Models/AroundPrecision.cs | 288 + .../Models/AroundPrecisionFromValueInner.cs | 133 + algoliasearch/Search/Models/AroundRadius.cs | 288 + .../Search/Models/AroundRadiusAll.cs | 36 + .../Search/Models/AssignUserIdParams.cs | 134 + .../Search/Models/AttributeToUpdate.cs | 288 + .../Search/Models/AutomaticFacetFilter.cs | 164 + .../Search/Models/AutomaticFacetFilters.cs | 288 + .../Search/Models/BaseGetApiKeyResponse.cs | 144 + .../Search/Models/BaseIndexSettings.cs | 412 + .../Search/Models/BaseSearchParams.cs | 700 + .../Models/BaseSearchParamsWithoutQuery.cs | 680 + .../Search/Models/BaseSearchResponse.cs | 632 + .../Search/Models/BatchAssignUserIdsParams.cs | 159 + .../Models/BatchDictionaryEntriesParams.cs | 150 + .../Models/BatchDictionaryEntriesRequest.cs | 147 + algoliasearch/Search/Models/BatchParams.cs | 134 + algoliasearch/Search/Models/BatchRequest.cs | 148 + algoliasearch/Search/Models/BatchResponse.cs | 150 + .../Search/Models/BatchWriteParams.cs | 134 + algoliasearch/Search/Models/BrowseParams.cs | 288 + .../Search/Models/BrowseParamsObject.cs | 1531 +++ algoliasearch/Search/Models/BrowseResponse.cs | 696 + .../Search/Models/BuiltInOperation.cs | 148 + .../Search/Models/BuiltInOperationType.cs | 73 + algoliasearch/Search/Models/Condition.cs | 172 + algoliasearch/Search/Models/Consequence.cs | 197 + .../Search/Models/ConsequenceHide.cs | 134 + .../Search/Models/ConsequenceParams.cs | 1546 +++ .../Search/Models/ConsequenceQuery.cs | 288 + .../Search/Models/ConsequenceQueryObject.cs | 145 + .../Search/Models/CreatedAtResponse.cs | 134 + algoliasearch/Search/Models/Cursor.cs | 124 + .../Search/Models/DeleteApiKeyResponse.cs | 134 + algoliasearch/Search/Models/DeleteByParams.cs | 257 + .../Search/Models/DeleteSourceResponse.cs | 134 + .../Search/Models/DeletedAtResponse.cs | 149 + .../Search/Models/DictionaryAction.cs | 43 + .../Search/Models/DictionaryEntry.cs | 258 + .../Search/Models/DictionaryEntryState.cs | 43 + .../Search/Models/DictionaryLanguage.cs | 120 + .../Search/Models/DictionarySettingsParams.cs | 133 + algoliasearch/Search/Models/DictionaryType.cs | 48 + algoliasearch/Search/Models/Distinct.cs | 288 + algoliasearch/Search/Models/Edit.cs | 157 + algoliasearch/Search/Models/EditType.cs | 43 + algoliasearch/Search/Models/ErrorBase.cs | 147 + .../Search/Models/ExactOnSingleWordQuery.cs | 49 + algoliasearch/Search/Models/Exhaustive.cs | 180 + algoliasearch/Search/Models/FacetFilters.cs | 288 + algoliasearch/Search/Models/FacetHits.cs | 173 + algoliasearch/Search/Models/FacetOrdering.cs | 143 + algoliasearch/Search/Models/Facets.cs | 125 + algoliasearch/Search/Models/FacetsStats.cs | 165 + algoliasearch/Search/Models/FetchedIndex.cs | 311 + .../Search/Models/GetApiKeyResponse.cs | 294 + .../Models/GetDictionarySettingsResponse.cs | 133 + .../Search/Models/GetLogsResponse.cs | 134 + .../Search/Models/GetObjectsParams.cs | 134 + .../Search/Models/GetObjectsRequest.cs | 178 + .../Search/Models/GetObjectsResponse.cs | 135 + .../Search/Models/GetTaskResponse.cs | 124 + .../Search/Models/GetTopUserIdsResponse.cs | 135 + .../Models/HasPendingMappingsResponse.cs | 145 + .../Search/Models/HighlightResult.cs | 288 + .../Search/Models/HighlightResultOption.cs | 188 + algoliasearch/Search/Models/Hit.cs | 233 + algoliasearch/Search/Models/IgnorePlurals.cs | 288 + algoliasearch/Search/Models/IndexSettings.cs | 1224 ++ .../Models/IndexSettingsAsSearchParams.cs | 917 ++ algoliasearch/Search/Models/Languages.cs | 179 + .../Search/Models/ListApiKeysResponse.cs | 135 + .../Search/Models/ListClustersResponse.cs | 135 + .../Search/Models/ListIndicesResponse.cs | 150 + .../Search/Models/ListUserIdsResponse.cs | 135 + algoliasearch/Search/Models/Log.cs | 451 + algoliasearch/Search/Models/LogQuery.cs | 162 + algoliasearch/Search/Models/LogType.cs | 54 + algoliasearch/Search/Models/MatchLevel.cs | 49 + .../Search/Models/MatchedGeoLocation.cs | 150 + .../Search/Models/MixedSearchFilters.cs | 288 + algoliasearch/Search/Models/Mode.cs | 43 + .../Search/Models/MultipleBatchRequest.cs | 172 + .../Search/Models/MultipleBatchResponse.cs | 160 + algoliasearch/Search/Models/NumericFilters.cs | 288 + .../Search/Models/OperationIndexParams.cs | 168 + algoliasearch/Search/Models/OperationType.cs | 43 + .../Search/Models/OptionalFilters.cs | 288 + algoliasearch/Search/Models/Params.cs | 177 + .../Search/Models/Personalization.cs | 150 + algoliasearch/Search/Models/Promote.cs | 288 + .../Search/Models/PromoteObjectID.cs | 149 + .../Search/Models/PromoteObjectIDs.cs | 150 + algoliasearch/Search/Models/QueryType.cs | 49 + algoliasearch/Search/Models/RankingInfo.cs | 311 + .../Search/Models/ReRankingApplyFilter.cs | 297 + algoliasearch/Search/Models/Redirect.cs | 124 + .../Models/RedirectRuleIndexMetadata.cs | 220 + .../Models/RedirectRuleIndexMetadataData.cs | 133 + .../Search/Models/RemoveStopWords.cs | 288 + .../Search/Models/RemoveUserIdResponse.cs | 134 + .../Search/Models/RemoveWordsIfNoResults.cs | 55 + .../Search/Models/RenderingContent.cs | 123 + .../Search/Models/ReplaceSourceResponse.cs | 134 + algoliasearch/Search/Models/Rule.cs | 226 + .../Search/Models/SaveObjectResponse.cs | 168 + .../Search/Models/SaveSynonymResponse.cs | 173 + algoliasearch/Search/Models/ScopeType.cs | 48 + .../Models/SearchDictionaryEntriesParams.cs | 195 + .../Models/SearchForFacetValuesRequest.cs | 166 + .../Models/SearchForFacetValuesResponse.cs | 134 + .../Search/Models/SearchForFacets.cs | 1619 +++ .../Search/Models/SearchForFacetsOptions.cs | 213 + algoliasearch/Search/Models/SearchForHits.cs | 1575 +++ .../Search/Models/SearchForHitsOptions.cs | 148 + algoliasearch/Search/Models/SearchHits.cs | 209 + .../Search/Models/SearchMethodParams.cs | 148 + algoliasearch/Search/Models/SearchParams.cs | 288 + .../Search/Models/SearchParamsObject.cs | 1512 +++ .../Search/Models/SearchParamsQuery.cs | 125 + .../Search/Models/SearchParamsString.cs | 125 + algoliasearch/Search/Models/SearchQuery.cs | 288 + algoliasearch/Search/Models/SearchResponse.cs | 704 + .../Search/Models/SearchResponses.cs | 134 + algoliasearch/Search/Models/SearchResult.cs | 288 + .../Search/Models/SearchRulesParams.cs | 245 + .../Search/Models/SearchRulesResponse.cs | 180 + algoliasearch/Search/Models/SearchStrategy.cs | 43 + .../Search/Models/SearchSynonymsParams.cs | 125 + .../Search/Models/SearchSynonymsResponse.cs | 177 + .../Search/Models/SearchTypeDefault.cs | 37 + .../Search/Models/SearchTypeFacet.cs | 37 + .../Search/Models/SearchUserIdsParams.cs | 195 + .../Search/Models/SearchUserIdsResponse.cs | 216 + algoliasearch/Search/Models/SemanticSearch.cs | 125 + algoliasearch/Search/Models/SnippetResult.cs | 288 + .../Search/Models/SnippetResultOption.cs | 148 + .../Search/Models/SortRemainingBy.cs | 49 + algoliasearch/Search/Models/Source.cs | 153 + .../Search/Models/StandardEntries.cs | 165 + algoliasearch/Search/Models/SynonymHit.cs | 265 + algoliasearch/Search/Models/SynonymType.cs | 61 + algoliasearch/Search/Models/TagFilters.cs | 288 + algoliasearch/Search/Models/TaskStatus.cs | 43 + algoliasearch/Search/Models/TimeRange.cs | 140 + algoliasearch/Search/Models/TypoTolerance.cs | 288 + .../Search/Models/TypoToleranceEnum.cs | 42 + .../Search/Models/UpdateApiKeyResponse.cs | 158 + .../Search/Models/UpdatedAtResponse.cs | 149 + .../Models/UpdatedAtWithObjectIdResponse.cs | 158 + .../Search/Models/UpdatedRuleResponse.cs | 173 + .../Search/Models/UserHighlightResult.cs | 156 + algoliasearch/Search/Models/UserHit.cs | 245 + algoliasearch/Search/Models/UserId.cs | 198 + algoliasearch/Search/Models/Value.cs | 139 + 636 files changed, 155898 insertions(+) create mode 100644 .gitignore create mode 100644 Algolia.Search.sln create mode 100644 algoliasearch/Abtesting/Api/AbtestingClient.cs create mode 100644 algoliasearch/Abtesting/Client/ApiClient.cs create mode 100644 algoliasearch/Abtesting/Client/ApiException.cs create mode 100644 algoliasearch/Abtesting/Client/ApiResponse.cs create mode 100644 algoliasearch/Abtesting/Client/ClientUtils.cs create mode 100644 algoliasearch/Abtesting/Client/Configuration.cs create mode 100644 algoliasearch/Abtesting/Client/ExceptionFactory.cs create mode 100644 algoliasearch/Abtesting/Client/FileParameter.cs create mode 100644 algoliasearch/Abtesting/Client/GlobalConfiguration.cs create mode 100644 algoliasearch/Abtesting/Client/IAsynchronousClient.cs create mode 100644 algoliasearch/Abtesting/Client/IReadableConfiguration.cs create mode 100644 algoliasearch/Abtesting/Client/ISynchronousClient.cs create mode 100644 algoliasearch/Abtesting/Client/Multimap.cs create mode 100644 algoliasearch/Abtesting/Client/OpenAPIDateConverter.cs create mode 100644 algoliasearch/Abtesting/Client/RequestOptions.cs create mode 100644 algoliasearch/Abtesting/Client/WebRequestPathBuilder.cs create mode 100644 algoliasearch/Abtesting/Models/ABTest.cs create mode 100644 algoliasearch/Abtesting/Models/ABTestResponse.cs create mode 100644 algoliasearch/Abtesting/Models/AbTestsVariant.cs create mode 100644 algoliasearch/Abtesting/Models/AbTestsVariantSearchParams.cs create mode 100644 algoliasearch/Abtesting/Models/AbstractOpenAPISchema.cs create mode 100644 algoliasearch/Abtesting/Models/AddABTestsRequest.cs create mode 100644 algoliasearch/Abtesting/Models/AddABTestsVariant.cs create mode 100644 algoliasearch/Abtesting/Models/CurrenciesValue.cs create mode 100644 algoliasearch/Abtesting/Models/CustomSearchParams.cs create mode 100644 algoliasearch/Abtesting/Models/ErrorBase.cs create mode 100644 algoliasearch/Abtesting/Models/FilterEffects.cs create mode 100644 algoliasearch/Abtesting/Models/FilterEffectsEmptySearch.cs create mode 100644 algoliasearch/Abtesting/Models/FilterEffectsOutliers.cs create mode 100644 algoliasearch/Abtesting/Models/ListABTestsResponse.cs create mode 100644 algoliasearch/Abtesting/Models/Variant.cs create mode 100644 algoliasearch/Algolia.Search.csproj create mode 100644 algoliasearch/Analytics/Api/AnalyticsClient.cs create mode 100644 algoliasearch/Analytics/Client/ApiClient.cs create mode 100644 algoliasearch/Analytics/Client/ApiException.cs create mode 100644 algoliasearch/Analytics/Client/ApiResponse.cs create mode 100644 algoliasearch/Analytics/Client/ClientUtils.cs create mode 100644 algoliasearch/Analytics/Client/Configuration.cs create mode 100644 algoliasearch/Analytics/Client/ExceptionFactory.cs create mode 100644 algoliasearch/Analytics/Client/FileParameter.cs create mode 100644 algoliasearch/Analytics/Client/GlobalConfiguration.cs create mode 100644 algoliasearch/Analytics/Client/IAsynchronousClient.cs create mode 100644 algoliasearch/Analytics/Client/IReadableConfiguration.cs create mode 100644 algoliasearch/Analytics/Client/ISynchronousClient.cs create mode 100644 algoliasearch/Analytics/Client/Multimap.cs create mode 100644 algoliasearch/Analytics/Client/OpenAPIDateConverter.cs create mode 100644 algoliasearch/Analytics/Client/RequestOptions.cs create mode 100644 algoliasearch/Analytics/Client/WebRequestPathBuilder.cs create mode 100644 algoliasearch/Analytics/Models/AbstractOpenAPISchema.cs create mode 100644 algoliasearch/Analytics/Models/AverageClickEvent.cs create mode 100644 algoliasearch/Analytics/Models/ClickPosition.cs create mode 100644 algoliasearch/Analytics/Models/ClickThroughRateEvent.cs create mode 100644 algoliasearch/Analytics/Models/ConversionRateEvent.cs create mode 100644 algoliasearch/Analytics/Models/Direction.cs create mode 100644 algoliasearch/Analytics/Models/ErrorBase.cs create mode 100644 algoliasearch/Analytics/Models/GetAverageClickPositionResponse.cs create mode 100644 algoliasearch/Analytics/Models/GetClickPositionsResponse.cs create mode 100644 algoliasearch/Analytics/Models/GetClickThroughRateResponse.cs create mode 100644 algoliasearch/Analytics/Models/GetConversationRateResponse.cs create mode 100644 algoliasearch/Analytics/Models/GetNoClickRateResponse.cs create mode 100644 algoliasearch/Analytics/Models/GetNoResultsRateResponse.cs create mode 100644 algoliasearch/Analytics/Models/GetSearchesCountResponse.cs create mode 100644 algoliasearch/Analytics/Models/GetSearchesNoClicksResponse.cs create mode 100644 algoliasearch/Analytics/Models/GetSearchesNoResultsResponse.cs create mode 100644 algoliasearch/Analytics/Models/GetStatusResponse.cs create mode 100644 algoliasearch/Analytics/Models/GetTopCountriesResponse.cs create mode 100644 algoliasearch/Analytics/Models/GetTopFilterAttribute.cs create mode 100644 algoliasearch/Analytics/Models/GetTopFilterAttributesResponse.cs create mode 100644 algoliasearch/Analytics/Models/GetTopFilterForAttribute.cs create mode 100644 algoliasearch/Analytics/Models/GetTopFilterForAttributeResponse.cs create mode 100644 algoliasearch/Analytics/Models/GetTopFiltersNoResultsResponse.cs create mode 100644 algoliasearch/Analytics/Models/GetTopFiltersNoResultsValue.cs create mode 100644 algoliasearch/Analytics/Models/GetTopFiltersNoResultsValues.cs create mode 100644 algoliasearch/Analytics/Models/GetTopHitsResponse.cs create mode 100644 algoliasearch/Analytics/Models/GetTopSearchesResponse.cs create mode 100644 algoliasearch/Analytics/Models/GetUsersCountResponse.cs create mode 100644 algoliasearch/Analytics/Models/NoClickRateEvent.cs create mode 100644 algoliasearch/Analytics/Models/NoResultsRateEvent.cs create mode 100644 algoliasearch/Analytics/Models/OrderBy.cs create mode 100644 algoliasearch/Analytics/Models/SearchEvent.cs create mode 100644 algoliasearch/Analytics/Models/SearchNoClickEvent.cs create mode 100644 algoliasearch/Analytics/Models/SearchNoResultEvent.cs create mode 100644 algoliasearch/Analytics/Models/TopCountry.cs create mode 100644 algoliasearch/Analytics/Models/TopHit.cs create mode 100644 algoliasearch/Analytics/Models/TopHitWithAnalytics.cs create mode 100644 algoliasearch/Analytics/Models/TopHitsResponse.cs create mode 100644 algoliasearch/Analytics/Models/TopHitsResponseWithAnalytics.cs create mode 100644 algoliasearch/Analytics/Models/TopSearch.cs create mode 100644 algoliasearch/Analytics/Models/TopSearchWithAnalytics.cs create mode 100644 algoliasearch/Analytics/Models/TopSearchesResponse.cs create mode 100644 algoliasearch/Analytics/Models/TopSearchesResponseWithAnalytics.cs create mode 100644 algoliasearch/Analytics/Models/UserWithDate.cs create mode 100644 algoliasearch/Ingestion/Api/IngestionClient.cs create mode 100644 algoliasearch/Ingestion/Client/ApiClient.cs create mode 100644 algoliasearch/Ingestion/Client/ApiException.cs create mode 100644 algoliasearch/Ingestion/Client/ApiResponse.cs create mode 100644 algoliasearch/Ingestion/Client/ClientUtils.cs create mode 100644 algoliasearch/Ingestion/Client/Configuration.cs create mode 100644 algoliasearch/Ingestion/Client/ExceptionFactory.cs create mode 100644 algoliasearch/Ingestion/Client/FileParameter.cs create mode 100644 algoliasearch/Ingestion/Client/GlobalConfiguration.cs create mode 100644 algoliasearch/Ingestion/Client/IAsynchronousClient.cs create mode 100644 algoliasearch/Ingestion/Client/IReadableConfiguration.cs create mode 100644 algoliasearch/Ingestion/Client/ISynchronousClient.cs create mode 100644 algoliasearch/Ingestion/Client/Multimap.cs create mode 100644 algoliasearch/Ingestion/Client/OpenAPIDateConverter.cs create mode 100644 algoliasearch/Ingestion/Client/RequestOptions.cs create mode 100644 algoliasearch/Ingestion/Client/WebRequestPathBuilder.cs create mode 100644 algoliasearch/Ingestion/Models/AbstractOpenAPISchema.cs create mode 100644 algoliasearch/Ingestion/Models/ActionType.cs create mode 100644 algoliasearch/Ingestion/Models/AuthAPIKey.cs create mode 100644 algoliasearch/Ingestion/Models/AuthAPIKeyPartial.cs create mode 100644 algoliasearch/Ingestion/Models/AuthAlgolia.cs create mode 100644 algoliasearch/Ingestion/Models/AuthAlgoliaPartial.cs create mode 100644 algoliasearch/Ingestion/Models/AuthBasic.cs create mode 100644 algoliasearch/Ingestion/Models/AuthBasicPartial.cs create mode 100644 algoliasearch/Ingestion/Models/AuthGoogleServiceAccount.cs create mode 100644 algoliasearch/Ingestion/Models/AuthGoogleServiceAccountPartial.cs create mode 100644 algoliasearch/Ingestion/Models/AuthInput.cs create mode 100644 algoliasearch/Ingestion/Models/AuthInputPartial.cs create mode 100644 algoliasearch/Ingestion/Models/AuthOAuth.cs create mode 100644 algoliasearch/Ingestion/Models/AuthOAuthPartial.cs create mode 100644 algoliasearch/Ingestion/Models/Authentication.cs create mode 100644 algoliasearch/Ingestion/Models/AuthenticationCreate.cs create mode 100644 algoliasearch/Ingestion/Models/AuthenticationCreateResponse.cs create mode 100644 algoliasearch/Ingestion/Models/AuthenticationSearch.cs create mode 100644 algoliasearch/Ingestion/Models/AuthenticationSortKeys.cs create mode 100644 algoliasearch/Ingestion/Models/AuthenticationType.cs create mode 100644 algoliasearch/Ingestion/Models/AuthenticationUpdate.cs create mode 100644 algoliasearch/Ingestion/Models/AuthenticationUpdateResponse.cs create mode 100644 algoliasearch/Ingestion/Models/BigCommerceChannel.cs create mode 100644 algoliasearch/Ingestion/Models/BigCommerceMetafield.cs create mode 100644 algoliasearch/Ingestion/Models/BigQueryDataType.cs create mode 100644 algoliasearch/Ingestion/Models/DeleteResponse.cs create mode 100644 algoliasearch/Ingestion/Models/Destination.cs create mode 100644 algoliasearch/Ingestion/Models/DestinationCreate.cs create mode 100644 algoliasearch/Ingestion/Models/DestinationCreateResponse.cs create mode 100644 algoliasearch/Ingestion/Models/DestinationIndexName.cs create mode 100644 algoliasearch/Ingestion/Models/DestinationIndexPrefix.cs create mode 100644 algoliasearch/Ingestion/Models/DestinationInput.cs create mode 100644 algoliasearch/Ingestion/Models/DestinationSearch.cs create mode 100644 algoliasearch/Ingestion/Models/DestinationSortKeys.cs create mode 100644 algoliasearch/Ingestion/Models/DestinationType.cs create mode 100644 algoliasearch/Ingestion/Models/DestinationUpdate.cs create mode 100644 algoliasearch/Ingestion/Models/DestinationUpdateResponse.cs create mode 100644 algoliasearch/Ingestion/Models/DockerImageType.cs create mode 100644 algoliasearch/Ingestion/Models/DockerRegistry.cs create mode 100644 algoliasearch/Ingestion/Models/DockerSourceDiscover.cs create mode 100644 algoliasearch/Ingestion/Models/DockerSourceStreams.cs create mode 100644 algoliasearch/Ingestion/Models/ErrorBase.cs create mode 100644 algoliasearch/Ingestion/Models/Event.cs create mode 100644 algoliasearch/Ingestion/Models/EventSortKeys.cs create mode 100644 algoliasearch/Ingestion/Models/EventStatus.cs create mode 100644 algoliasearch/Ingestion/Models/EventType.cs create mode 100644 algoliasearch/Ingestion/Models/ListAuthenticationsResponse.cs create mode 100644 algoliasearch/Ingestion/Models/ListDestinationsResponse.cs create mode 100644 algoliasearch/Ingestion/Models/ListEventsResponse.cs create mode 100644 algoliasearch/Ingestion/Models/ListSourcesResponse.cs create mode 100644 algoliasearch/Ingestion/Models/ListTasksResponse.cs create mode 100644 algoliasearch/Ingestion/Models/MappingTypeCSV.cs create mode 100644 algoliasearch/Ingestion/Models/MethodType.cs create mode 100644 algoliasearch/Ingestion/Models/OnDemandDateUtilsInput.cs create mode 100644 algoliasearch/Ingestion/Models/OnDemandTrigger.cs create mode 100644 algoliasearch/Ingestion/Models/OnDemandTriggerInput.cs create mode 100644 algoliasearch/Ingestion/Models/OnDemandTriggerType.cs create mode 100644 algoliasearch/Ingestion/Models/OrderKeys.cs create mode 100644 algoliasearch/Ingestion/Models/Pagination.cs create mode 100644 algoliasearch/Ingestion/Models/Platform.cs create mode 100644 algoliasearch/Ingestion/Models/PlatformNone.cs create mode 100644 algoliasearch/Ingestion/Models/PlatformWithNone.cs create mode 100644 algoliasearch/Ingestion/Models/RecordType.cs create mode 100644 algoliasearch/Ingestion/Models/Run.cs create mode 100644 algoliasearch/Ingestion/Models/RunListResponse.cs create mode 100644 algoliasearch/Ingestion/Models/RunOutcome.cs create mode 100644 algoliasearch/Ingestion/Models/RunProgress.cs create mode 100644 algoliasearch/Ingestion/Models/RunReasonCode.cs create mode 100644 algoliasearch/Ingestion/Models/RunResponse.cs create mode 100644 algoliasearch/Ingestion/Models/RunSortKeys.cs create mode 100644 algoliasearch/Ingestion/Models/RunStatus.cs create mode 100644 algoliasearch/Ingestion/Models/RunType.cs create mode 100644 algoliasearch/Ingestion/Models/ScheduleDateUtilsInput.cs create mode 100644 algoliasearch/Ingestion/Models/ScheduleTrigger.cs create mode 100644 algoliasearch/Ingestion/Models/ScheduleTriggerInput.cs create mode 100644 algoliasearch/Ingestion/Models/ScheduleTriggerType.cs create mode 100644 algoliasearch/Ingestion/Models/Source.cs create mode 100644 algoliasearch/Ingestion/Models/SourceBigCommerce.cs create mode 100644 algoliasearch/Ingestion/Models/SourceBigQuery.cs create mode 100644 algoliasearch/Ingestion/Models/SourceCSV.cs create mode 100644 algoliasearch/Ingestion/Models/SourceCommercetools.cs create mode 100644 algoliasearch/Ingestion/Models/SourceCreate.cs create mode 100644 algoliasearch/Ingestion/Models/SourceCreateResponse.cs create mode 100644 algoliasearch/Ingestion/Models/SourceDocker.cs create mode 100644 algoliasearch/Ingestion/Models/SourceInput.cs create mode 100644 algoliasearch/Ingestion/Models/SourceJSON.cs create mode 100644 algoliasearch/Ingestion/Models/SourceSearch.cs create mode 100644 algoliasearch/Ingestion/Models/SourceSortKeys.cs create mode 100644 algoliasearch/Ingestion/Models/SourceType.cs create mode 100644 algoliasearch/Ingestion/Models/SourceUpdate.cs create mode 100644 algoliasearch/Ingestion/Models/SourceUpdateCommercetools.cs create mode 100644 algoliasearch/Ingestion/Models/SourceUpdateDocker.cs create mode 100644 algoliasearch/Ingestion/Models/SourceUpdateInput.cs create mode 100644 algoliasearch/Ingestion/Models/SourceUpdateResponse.cs create mode 100644 algoliasearch/Ingestion/Models/SubscriptionTrigger.cs create mode 100644 algoliasearch/Ingestion/Models/SubscriptionTriggerType.cs create mode 100644 algoliasearch/Ingestion/Models/Task.cs create mode 100644 algoliasearch/Ingestion/Models/TaskCreate.cs create mode 100644 algoliasearch/Ingestion/Models/TaskCreateResponse.cs create mode 100644 algoliasearch/Ingestion/Models/TaskCreateTrigger.cs create mode 100644 algoliasearch/Ingestion/Models/TaskInput.cs create mode 100644 algoliasearch/Ingestion/Models/TaskSearch.cs create mode 100644 algoliasearch/Ingestion/Models/TaskSortKeys.cs create mode 100644 algoliasearch/Ingestion/Models/TaskUpdate.cs create mode 100644 algoliasearch/Ingestion/Models/TaskUpdateResponse.cs create mode 100644 algoliasearch/Ingestion/Models/Trigger.cs create mode 100644 algoliasearch/Ingestion/Models/TriggerType.cs create mode 100644 algoliasearch/Ingestion/Models/TriggerUpdateInput.cs create mode 100644 algoliasearch/Ingestion/Models/Window.cs create mode 100644 algoliasearch/Insights/Api/InsightsClient.cs create mode 100644 algoliasearch/Insights/Client/ApiClient.cs create mode 100644 algoliasearch/Insights/Client/ApiException.cs create mode 100644 algoliasearch/Insights/Client/ApiResponse.cs create mode 100644 algoliasearch/Insights/Client/ClientUtils.cs create mode 100644 algoliasearch/Insights/Client/Configuration.cs create mode 100644 algoliasearch/Insights/Client/ExceptionFactory.cs create mode 100644 algoliasearch/Insights/Client/FileParameter.cs create mode 100644 algoliasearch/Insights/Client/GlobalConfiguration.cs create mode 100644 algoliasearch/Insights/Client/IAsynchronousClient.cs create mode 100644 algoliasearch/Insights/Client/IReadableConfiguration.cs create mode 100644 algoliasearch/Insights/Client/ISynchronousClient.cs create mode 100644 algoliasearch/Insights/Client/Multimap.cs create mode 100644 algoliasearch/Insights/Client/OpenAPIDateConverter.cs create mode 100644 algoliasearch/Insights/Client/RequestOptions.cs create mode 100644 algoliasearch/Insights/Client/WebRequestPathBuilder.cs create mode 100644 algoliasearch/Insights/Models/AbstractOpenAPISchema.cs create mode 100644 algoliasearch/Insights/Models/AddToCartEvent.cs create mode 100644 algoliasearch/Insights/Models/AddedToCartObjectIDs.cs create mode 100644 algoliasearch/Insights/Models/AddedToCartObjectIDsAfterSearch.cs create mode 100644 algoliasearch/Insights/Models/ClickEvent.cs create mode 100644 algoliasearch/Insights/Models/ClickedFilters.cs create mode 100644 algoliasearch/Insights/Models/ClickedObjectIDs.cs create mode 100644 algoliasearch/Insights/Models/ClickedObjectIDsAfterSearch.cs create mode 100644 algoliasearch/Insights/Models/ConversionEvent.cs create mode 100644 algoliasearch/Insights/Models/ConvertedFilters.cs create mode 100644 algoliasearch/Insights/Models/ConvertedObjectIDs.cs create mode 100644 algoliasearch/Insights/Models/ConvertedObjectIDsAfterSearch.cs create mode 100644 algoliasearch/Insights/Models/Discount.cs create mode 100644 algoliasearch/Insights/Models/ErrorBase.cs create mode 100644 algoliasearch/Insights/Models/EventsItems.cs create mode 100644 algoliasearch/Insights/Models/EventsResponse.cs create mode 100644 algoliasearch/Insights/Models/InsightsEvents.cs create mode 100644 algoliasearch/Insights/Models/ObjectData.cs create mode 100644 algoliasearch/Insights/Models/ObjectDataAfterSearch.cs create mode 100644 algoliasearch/Insights/Models/Price.cs create mode 100644 algoliasearch/Insights/Models/PurchaseEvent.cs create mode 100644 algoliasearch/Insights/Models/PurchasedObjectIDs.cs create mode 100644 algoliasearch/Insights/Models/PurchasedObjectIDsAfterSearch.cs create mode 100644 algoliasearch/Insights/Models/ViewEvent.cs create mode 100644 algoliasearch/Insights/Models/ViewedFilters.cs create mode 100644 algoliasearch/Insights/Models/ViewedObjectIDs.cs create mode 100644 algoliasearch/Monitoring/Api/MonitoringClient.cs create mode 100644 algoliasearch/Monitoring/Client/ApiClient.cs create mode 100644 algoliasearch/Monitoring/Client/ApiException.cs create mode 100644 algoliasearch/Monitoring/Client/ApiResponse.cs create mode 100644 algoliasearch/Monitoring/Client/ClientUtils.cs create mode 100644 algoliasearch/Monitoring/Client/Configuration.cs create mode 100644 algoliasearch/Monitoring/Client/ExceptionFactory.cs create mode 100644 algoliasearch/Monitoring/Client/FileParameter.cs create mode 100644 algoliasearch/Monitoring/Client/GlobalConfiguration.cs create mode 100644 algoliasearch/Monitoring/Client/IAsynchronousClient.cs create mode 100644 algoliasearch/Monitoring/Client/IReadableConfiguration.cs create mode 100644 algoliasearch/Monitoring/Client/ISynchronousClient.cs create mode 100644 algoliasearch/Monitoring/Client/Multimap.cs create mode 100644 algoliasearch/Monitoring/Client/OpenAPIDateConverter.cs create mode 100644 algoliasearch/Monitoring/Client/RequestOptions.cs create mode 100644 algoliasearch/Monitoring/Client/WebRequestPathBuilder.cs create mode 100644 algoliasearch/Monitoring/Models/AbstractOpenAPISchema.cs create mode 100644 algoliasearch/Monitoring/Models/ErrorBase.cs create mode 100644 algoliasearch/Monitoring/Models/GetInventory403Response.cs create mode 100644 algoliasearch/Monitoring/Models/Incident.cs create mode 100644 algoliasearch/Monitoring/Models/IncidentsInner.cs create mode 100644 algoliasearch/Monitoring/Models/IncidentsResponse.cs create mode 100644 algoliasearch/Monitoring/Models/IndexingTimeResponse.cs create mode 100644 algoliasearch/Monitoring/Models/IndexingTimeResponseMetrics.cs create mode 100644 algoliasearch/Monitoring/Models/InfrastructureResponse.cs create mode 100644 algoliasearch/Monitoring/Models/InfrastructureResponseMetrics.cs create mode 100644 algoliasearch/Monitoring/Models/InventoryResponse.cs create mode 100644 algoliasearch/Monitoring/Models/LatencyResponse.cs create mode 100644 algoliasearch/Monitoring/Models/LatencyResponseMetrics.cs create mode 100644 algoliasearch/Monitoring/Models/Metric.cs create mode 100644 algoliasearch/Monitoring/Models/Period.cs create mode 100644 algoliasearch/Monitoring/Models/ProbesMetric.cs create mode 100644 algoliasearch/Monitoring/Models/Region.cs create mode 100644 algoliasearch/Monitoring/Models/Server.cs create mode 100644 algoliasearch/Monitoring/Models/ServerStatus.cs create mode 100644 algoliasearch/Monitoring/Models/Status.cs create mode 100644 algoliasearch/Monitoring/Models/StatusResponse.cs create mode 100644 algoliasearch/Monitoring/Models/TimeInner.cs create mode 100644 algoliasearch/Monitoring/Models/Type.cs create mode 100644 algoliasearch/Personalization/Api/PersonalizationClient.cs create mode 100644 algoliasearch/Personalization/Client/ApiClient.cs create mode 100644 algoliasearch/Personalization/Client/ApiException.cs create mode 100644 algoliasearch/Personalization/Client/ApiResponse.cs create mode 100644 algoliasearch/Personalization/Client/ClientUtils.cs create mode 100644 algoliasearch/Personalization/Client/Configuration.cs create mode 100644 algoliasearch/Personalization/Client/ExceptionFactory.cs create mode 100644 algoliasearch/Personalization/Client/FileParameter.cs create mode 100644 algoliasearch/Personalization/Client/GlobalConfiguration.cs create mode 100644 algoliasearch/Personalization/Client/IAsynchronousClient.cs create mode 100644 algoliasearch/Personalization/Client/IReadableConfiguration.cs create mode 100644 algoliasearch/Personalization/Client/ISynchronousClient.cs create mode 100644 algoliasearch/Personalization/Client/Multimap.cs create mode 100644 algoliasearch/Personalization/Client/OpenAPIDateConverter.cs create mode 100644 algoliasearch/Personalization/Client/RequestOptions.cs create mode 100644 algoliasearch/Personalization/Client/WebRequestPathBuilder.cs create mode 100644 algoliasearch/Personalization/Models/AbstractOpenAPISchema.cs create mode 100644 algoliasearch/Personalization/Models/DeleteUserProfileResponse.cs create mode 100644 algoliasearch/Personalization/Models/ErrorBase.cs create mode 100644 algoliasearch/Personalization/Models/EventScoring.cs create mode 100644 algoliasearch/Personalization/Models/FacetScoring.cs create mode 100644 algoliasearch/Personalization/Models/GetUserTokenResponse.cs create mode 100644 algoliasearch/Personalization/Models/PersonalizationStrategyParams.cs create mode 100644 algoliasearch/Personalization/Models/SetPersonalizationStrategyResponse.cs create mode 100644 algoliasearch/QuerySuggestions/Api/QuerySuggestionsClient.cs create mode 100644 algoliasearch/QuerySuggestions/Client/ApiClient.cs create mode 100644 algoliasearch/QuerySuggestions/Client/ApiException.cs create mode 100644 algoliasearch/QuerySuggestions/Client/ApiResponse.cs create mode 100644 algoliasearch/QuerySuggestions/Client/ClientUtils.cs create mode 100644 algoliasearch/QuerySuggestions/Client/Configuration.cs create mode 100644 algoliasearch/QuerySuggestions/Client/ExceptionFactory.cs create mode 100644 algoliasearch/QuerySuggestions/Client/FileParameter.cs create mode 100644 algoliasearch/QuerySuggestions/Client/GlobalConfiguration.cs create mode 100644 algoliasearch/QuerySuggestions/Client/IAsynchronousClient.cs create mode 100644 algoliasearch/QuerySuggestions/Client/IReadableConfiguration.cs create mode 100644 algoliasearch/QuerySuggestions/Client/ISynchronousClient.cs create mode 100644 algoliasearch/QuerySuggestions/Client/Multimap.cs create mode 100644 algoliasearch/QuerySuggestions/Client/OpenAPIDateConverter.cs create mode 100644 algoliasearch/QuerySuggestions/Client/RequestOptions.cs create mode 100644 algoliasearch/QuerySuggestions/Client/WebRequestPathBuilder.cs create mode 100644 algoliasearch/QuerySuggestions/Models/AbstractOpenAPISchema.cs create mode 100644 algoliasearch/QuerySuggestions/Models/BaseQuerySuggestionsConfigurationResponse.cs create mode 100644 algoliasearch/QuerySuggestions/Models/BaseQuerySuggestionsConfigurationWithIndex.cs create mode 100644 algoliasearch/QuerySuggestions/Models/BaseResponse.cs create mode 100644 algoliasearch/QuerySuggestions/Models/ErrorBase.cs create mode 100644 algoliasearch/QuerySuggestions/Models/Facet.cs create mode 100644 algoliasearch/QuerySuggestions/Models/GetConfigStatus200Response.cs create mode 100644 algoliasearch/QuerySuggestions/Models/GetLogFile200Response.cs create mode 100644 algoliasearch/QuerySuggestions/Models/Languages.cs create mode 100644 algoliasearch/QuerySuggestions/Models/LogLevel.cs create mode 100644 algoliasearch/QuerySuggestions/Models/QuerySuggestionsConfiguration.cs create mode 100644 algoliasearch/QuerySuggestions/Models/QuerySuggestionsConfigurationResponse.cs create mode 100644 algoliasearch/QuerySuggestions/Models/QuerySuggestionsConfigurationWithIndex.cs create mode 100644 algoliasearch/QuerySuggestions/Models/SourceIndex.cs create mode 100644 algoliasearch/Recommend/Api/RecommendClient.cs create mode 100644 algoliasearch/Recommend/Client/ApiClient.cs create mode 100644 algoliasearch/Recommend/Client/ApiException.cs create mode 100644 algoliasearch/Recommend/Client/ApiResponse.cs create mode 100644 algoliasearch/Recommend/Client/ClientUtils.cs create mode 100644 algoliasearch/Recommend/Client/Configuration.cs create mode 100644 algoliasearch/Recommend/Client/ExceptionFactory.cs create mode 100644 algoliasearch/Recommend/Client/FileParameter.cs create mode 100644 algoliasearch/Recommend/Client/GlobalConfiguration.cs create mode 100644 algoliasearch/Recommend/Client/IAsynchronousClient.cs create mode 100644 algoliasearch/Recommend/Client/IReadableConfiguration.cs create mode 100644 algoliasearch/Recommend/Client/ISynchronousClient.cs create mode 100644 algoliasearch/Recommend/Client/Multimap.cs create mode 100644 algoliasearch/Recommend/Client/OpenAPIDateConverter.cs create mode 100644 algoliasearch/Recommend/Client/RequestOptions.cs create mode 100644 algoliasearch/Recommend/Client/WebRequestPathBuilder.cs create mode 100644 algoliasearch/Recommend/Models/AbstractOpenAPISchema.cs create mode 100644 algoliasearch/Recommend/Models/AdvancedSyntaxFeatures.cs create mode 100644 algoliasearch/Recommend/Models/AlternativesAsExact.cs create mode 100644 algoliasearch/Recommend/Models/Anchoring.cs create mode 100644 algoliasearch/Recommend/Models/AroundPrecision.cs create mode 100644 algoliasearch/Recommend/Models/AroundPrecisionFromValueInner.cs create mode 100644 algoliasearch/Recommend/Models/AroundRadius.cs create mode 100644 algoliasearch/Recommend/Models/AroundRadiusAll.cs create mode 100644 algoliasearch/Recommend/Models/AutomaticFacetFilter.cs create mode 100644 algoliasearch/Recommend/Models/AutomaticFacetFilters.cs create mode 100644 algoliasearch/Recommend/Models/BaseRecommendRequest.cs create mode 100644 algoliasearch/Recommend/Models/BaseRecommendationsQuery.cs create mode 100644 algoliasearch/Recommend/Models/BaseSearchParams.cs create mode 100644 algoliasearch/Recommend/Models/BaseSearchParamsWithoutQuery.cs create mode 100644 algoliasearch/Recommend/Models/BaseSearchResponse.cs create mode 100644 algoliasearch/Recommend/Models/BaseTrendingFacetsQuery.cs create mode 100644 algoliasearch/Recommend/Models/BaseTrendingItemsQuery.cs create mode 100644 algoliasearch/Recommend/Models/Condition.cs create mode 100644 algoliasearch/Recommend/Models/Consequence.cs create mode 100644 algoliasearch/Recommend/Models/ConsequenceHide.cs create mode 100644 algoliasearch/Recommend/Models/ConsequenceParams.cs create mode 100644 algoliasearch/Recommend/Models/ConsequenceQuery.cs create mode 100644 algoliasearch/Recommend/Models/ConsequenceQueryObject.cs create mode 100644 algoliasearch/Recommend/Models/DeletedAtResponse.cs create mode 100644 algoliasearch/Recommend/Models/Distinct.cs create mode 100644 algoliasearch/Recommend/Models/Edit.cs create mode 100644 algoliasearch/Recommend/Models/EditType.cs create mode 100644 algoliasearch/Recommend/Models/ErrorBase.cs create mode 100644 algoliasearch/Recommend/Models/ExactOnSingleWordQuery.cs create mode 100644 algoliasearch/Recommend/Models/Exhaustive.cs create mode 100644 algoliasearch/Recommend/Models/FacetFilters.cs create mode 100644 algoliasearch/Recommend/Models/FacetOrdering.cs create mode 100644 algoliasearch/Recommend/Models/Facets.cs create mode 100644 algoliasearch/Recommend/Models/FacetsStats.cs create mode 100644 algoliasearch/Recommend/Models/GetRecommendTaskResponse.cs create mode 100644 algoliasearch/Recommend/Models/GetRecommendationsParams.cs create mode 100644 algoliasearch/Recommend/Models/GetRecommendationsResponse.cs create mode 100644 algoliasearch/Recommend/Models/HighlightResult.cs create mode 100644 algoliasearch/Recommend/Models/HighlightResultOption.cs create mode 100644 algoliasearch/Recommend/Models/IgnorePlurals.cs create mode 100644 algoliasearch/Recommend/Models/IndexSettingsAsSearchParams.cs create mode 100644 algoliasearch/Recommend/Models/MatchLevel.cs create mode 100644 algoliasearch/Recommend/Models/MatchedGeoLocation.cs create mode 100644 algoliasearch/Recommend/Models/MixedSearchFilters.cs create mode 100644 algoliasearch/Recommend/Models/Mode.cs create mode 100644 algoliasearch/Recommend/Models/NumericFilters.cs create mode 100644 algoliasearch/Recommend/Models/OptionalFilters.cs create mode 100644 algoliasearch/Recommend/Models/Params.cs create mode 100644 algoliasearch/Recommend/Models/Personalization.cs create mode 100644 algoliasearch/Recommend/Models/Promote.cs create mode 100644 algoliasearch/Recommend/Models/PromoteObjectID.cs create mode 100644 algoliasearch/Recommend/Models/PromoteObjectIDs.cs create mode 100644 algoliasearch/Recommend/Models/QueryType.cs create mode 100644 algoliasearch/Recommend/Models/RankingInfo.cs create mode 100644 algoliasearch/Recommend/Models/ReRankingApplyFilter.cs create mode 100644 algoliasearch/Recommend/Models/RecommendHit.cs create mode 100644 algoliasearch/Recommend/Models/RecommendHits.cs create mode 100644 algoliasearch/Recommend/Models/RecommendModels.cs create mode 100644 algoliasearch/Recommend/Models/RecommendationModels.cs create mode 100644 algoliasearch/Recommend/Models/RecommendationsQuery.cs create mode 100644 algoliasearch/Recommend/Models/RecommendationsRequest.cs create mode 100644 algoliasearch/Recommend/Models/RecommendationsResponse.cs create mode 100644 algoliasearch/Recommend/Models/Redirect.cs create mode 100644 algoliasearch/Recommend/Models/RedirectRuleIndexMetadata.cs create mode 100644 algoliasearch/Recommend/Models/RedirectRuleIndexMetadataData.cs create mode 100644 algoliasearch/Recommend/Models/RemoveStopWords.cs create mode 100644 algoliasearch/Recommend/Models/RemoveWordsIfNoResults.cs create mode 100644 algoliasearch/Recommend/Models/RenderingContent.cs create mode 100644 algoliasearch/Recommend/Models/RuleResponse.cs create mode 100644 algoliasearch/Recommend/Models/RuleResponseMetadata.cs create mode 100644 algoliasearch/Recommend/Models/SearchParamsObject.cs create mode 100644 algoliasearch/Recommend/Models/SearchParamsQuery.cs create mode 100644 algoliasearch/Recommend/Models/SearchRecommendRulesParams.cs create mode 100644 algoliasearch/Recommend/Models/SearchRecommendRulesResponse.cs create mode 100644 algoliasearch/Recommend/Models/SemanticSearch.cs create mode 100644 algoliasearch/Recommend/Models/SnippetResult.cs create mode 100644 algoliasearch/Recommend/Models/SnippetResultOption.cs create mode 100644 algoliasearch/Recommend/Models/SortRemainingBy.cs create mode 100644 algoliasearch/Recommend/Models/TagFilters.cs create mode 100644 algoliasearch/Recommend/Models/TaskStatus.cs create mode 100644 algoliasearch/Recommend/Models/TrendingFacetsModel.cs create mode 100644 algoliasearch/Recommend/Models/TrendingFacetsQuery.cs create mode 100644 algoliasearch/Recommend/Models/TrendingItemsModel.cs create mode 100644 algoliasearch/Recommend/Models/TrendingItemsQuery.cs create mode 100644 algoliasearch/Recommend/Models/TypoTolerance.cs create mode 100644 algoliasearch/Recommend/Models/TypoToleranceEnum.cs create mode 100644 algoliasearch/Recommend/Models/Value.cs create mode 100644 algoliasearch/Search/Api/SearchClient.cs create mode 100644 algoliasearch/Search/Client/ApiClient.cs create mode 100644 algoliasearch/Search/Client/ApiException.cs create mode 100644 algoliasearch/Search/Client/ApiResponse.cs create mode 100644 algoliasearch/Search/Client/ClientUtils.cs create mode 100644 algoliasearch/Search/Client/Configuration.cs create mode 100644 algoliasearch/Search/Client/ExceptionFactory.cs create mode 100644 algoliasearch/Search/Client/FileParameter.cs create mode 100644 algoliasearch/Search/Client/GlobalConfiguration.cs create mode 100644 algoliasearch/Search/Client/IAsynchronousClient.cs create mode 100644 algoliasearch/Search/Client/IReadableConfiguration.cs create mode 100644 algoliasearch/Search/Client/ISynchronousClient.cs create mode 100644 algoliasearch/Search/Client/Multimap.cs create mode 100644 algoliasearch/Search/Client/OpenAPIDateConverter.cs create mode 100644 algoliasearch/Search/Client/RequestOptions.cs create mode 100644 algoliasearch/Search/Client/WebRequestPathBuilder.cs create mode 100644 algoliasearch/Search/Models/AbstractOpenAPISchema.cs create mode 100644 algoliasearch/Search/Models/Acl.cs create mode 100644 algoliasearch/Search/Models/Action.cs create mode 100644 algoliasearch/Search/Models/AddApiKeyResponse.cs create mode 100644 algoliasearch/Search/Models/AdvancedSyntaxFeatures.cs create mode 100644 algoliasearch/Search/Models/AlternativesAsExact.cs create mode 100644 algoliasearch/Search/Models/Anchoring.cs create mode 100644 algoliasearch/Search/Models/ApiKey.cs create mode 100644 algoliasearch/Search/Models/AroundPrecision.cs create mode 100644 algoliasearch/Search/Models/AroundPrecisionFromValueInner.cs create mode 100644 algoliasearch/Search/Models/AroundRadius.cs create mode 100644 algoliasearch/Search/Models/AroundRadiusAll.cs create mode 100644 algoliasearch/Search/Models/AssignUserIdParams.cs create mode 100644 algoliasearch/Search/Models/AttributeToUpdate.cs create mode 100644 algoliasearch/Search/Models/AutomaticFacetFilter.cs create mode 100644 algoliasearch/Search/Models/AutomaticFacetFilters.cs create mode 100644 algoliasearch/Search/Models/BaseGetApiKeyResponse.cs create mode 100644 algoliasearch/Search/Models/BaseIndexSettings.cs create mode 100644 algoliasearch/Search/Models/BaseSearchParams.cs create mode 100644 algoliasearch/Search/Models/BaseSearchParamsWithoutQuery.cs create mode 100644 algoliasearch/Search/Models/BaseSearchResponse.cs create mode 100644 algoliasearch/Search/Models/BatchAssignUserIdsParams.cs create mode 100644 algoliasearch/Search/Models/BatchDictionaryEntriesParams.cs create mode 100644 algoliasearch/Search/Models/BatchDictionaryEntriesRequest.cs create mode 100644 algoliasearch/Search/Models/BatchParams.cs create mode 100644 algoliasearch/Search/Models/BatchRequest.cs create mode 100644 algoliasearch/Search/Models/BatchResponse.cs create mode 100644 algoliasearch/Search/Models/BatchWriteParams.cs create mode 100644 algoliasearch/Search/Models/BrowseParams.cs create mode 100644 algoliasearch/Search/Models/BrowseParamsObject.cs create mode 100644 algoliasearch/Search/Models/BrowseResponse.cs create mode 100644 algoliasearch/Search/Models/BuiltInOperation.cs create mode 100644 algoliasearch/Search/Models/BuiltInOperationType.cs create mode 100644 algoliasearch/Search/Models/Condition.cs create mode 100644 algoliasearch/Search/Models/Consequence.cs create mode 100644 algoliasearch/Search/Models/ConsequenceHide.cs create mode 100644 algoliasearch/Search/Models/ConsequenceParams.cs create mode 100644 algoliasearch/Search/Models/ConsequenceQuery.cs create mode 100644 algoliasearch/Search/Models/ConsequenceQueryObject.cs create mode 100644 algoliasearch/Search/Models/CreatedAtResponse.cs create mode 100644 algoliasearch/Search/Models/Cursor.cs create mode 100644 algoliasearch/Search/Models/DeleteApiKeyResponse.cs create mode 100644 algoliasearch/Search/Models/DeleteByParams.cs create mode 100644 algoliasearch/Search/Models/DeleteSourceResponse.cs create mode 100644 algoliasearch/Search/Models/DeletedAtResponse.cs create mode 100644 algoliasearch/Search/Models/DictionaryAction.cs create mode 100644 algoliasearch/Search/Models/DictionaryEntry.cs create mode 100644 algoliasearch/Search/Models/DictionaryEntryState.cs create mode 100644 algoliasearch/Search/Models/DictionaryLanguage.cs create mode 100644 algoliasearch/Search/Models/DictionarySettingsParams.cs create mode 100644 algoliasearch/Search/Models/DictionaryType.cs create mode 100644 algoliasearch/Search/Models/Distinct.cs create mode 100644 algoliasearch/Search/Models/Edit.cs create mode 100644 algoliasearch/Search/Models/EditType.cs create mode 100644 algoliasearch/Search/Models/ErrorBase.cs create mode 100644 algoliasearch/Search/Models/ExactOnSingleWordQuery.cs create mode 100644 algoliasearch/Search/Models/Exhaustive.cs create mode 100644 algoliasearch/Search/Models/FacetFilters.cs create mode 100644 algoliasearch/Search/Models/FacetHits.cs create mode 100644 algoliasearch/Search/Models/FacetOrdering.cs create mode 100644 algoliasearch/Search/Models/Facets.cs create mode 100644 algoliasearch/Search/Models/FacetsStats.cs create mode 100644 algoliasearch/Search/Models/FetchedIndex.cs create mode 100644 algoliasearch/Search/Models/GetApiKeyResponse.cs create mode 100644 algoliasearch/Search/Models/GetDictionarySettingsResponse.cs create mode 100644 algoliasearch/Search/Models/GetLogsResponse.cs create mode 100644 algoliasearch/Search/Models/GetObjectsParams.cs create mode 100644 algoliasearch/Search/Models/GetObjectsRequest.cs create mode 100644 algoliasearch/Search/Models/GetObjectsResponse.cs create mode 100644 algoliasearch/Search/Models/GetTaskResponse.cs create mode 100644 algoliasearch/Search/Models/GetTopUserIdsResponse.cs create mode 100644 algoliasearch/Search/Models/HasPendingMappingsResponse.cs create mode 100644 algoliasearch/Search/Models/HighlightResult.cs create mode 100644 algoliasearch/Search/Models/HighlightResultOption.cs create mode 100644 algoliasearch/Search/Models/Hit.cs create mode 100644 algoliasearch/Search/Models/IgnorePlurals.cs create mode 100644 algoliasearch/Search/Models/IndexSettings.cs create mode 100644 algoliasearch/Search/Models/IndexSettingsAsSearchParams.cs create mode 100644 algoliasearch/Search/Models/Languages.cs create mode 100644 algoliasearch/Search/Models/ListApiKeysResponse.cs create mode 100644 algoliasearch/Search/Models/ListClustersResponse.cs create mode 100644 algoliasearch/Search/Models/ListIndicesResponse.cs create mode 100644 algoliasearch/Search/Models/ListUserIdsResponse.cs create mode 100644 algoliasearch/Search/Models/Log.cs create mode 100644 algoliasearch/Search/Models/LogQuery.cs create mode 100644 algoliasearch/Search/Models/LogType.cs create mode 100644 algoliasearch/Search/Models/MatchLevel.cs create mode 100644 algoliasearch/Search/Models/MatchedGeoLocation.cs create mode 100644 algoliasearch/Search/Models/MixedSearchFilters.cs create mode 100644 algoliasearch/Search/Models/Mode.cs create mode 100644 algoliasearch/Search/Models/MultipleBatchRequest.cs create mode 100644 algoliasearch/Search/Models/MultipleBatchResponse.cs create mode 100644 algoliasearch/Search/Models/NumericFilters.cs create mode 100644 algoliasearch/Search/Models/OperationIndexParams.cs create mode 100644 algoliasearch/Search/Models/OperationType.cs create mode 100644 algoliasearch/Search/Models/OptionalFilters.cs create mode 100644 algoliasearch/Search/Models/Params.cs create mode 100644 algoliasearch/Search/Models/Personalization.cs create mode 100644 algoliasearch/Search/Models/Promote.cs create mode 100644 algoliasearch/Search/Models/PromoteObjectID.cs create mode 100644 algoliasearch/Search/Models/PromoteObjectIDs.cs create mode 100644 algoliasearch/Search/Models/QueryType.cs create mode 100644 algoliasearch/Search/Models/RankingInfo.cs create mode 100644 algoliasearch/Search/Models/ReRankingApplyFilter.cs create mode 100644 algoliasearch/Search/Models/Redirect.cs create mode 100644 algoliasearch/Search/Models/RedirectRuleIndexMetadata.cs create mode 100644 algoliasearch/Search/Models/RedirectRuleIndexMetadataData.cs create mode 100644 algoliasearch/Search/Models/RemoveStopWords.cs create mode 100644 algoliasearch/Search/Models/RemoveUserIdResponse.cs create mode 100644 algoliasearch/Search/Models/RemoveWordsIfNoResults.cs create mode 100644 algoliasearch/Search/Models/RenderingContent.cs create mode 100644 algoliasearch/Search/Models/ReplaceSourceResponse.cs create mode 100644 algoliasearch/Search/Models/Rule.cs create mode 100644 algoliasearch/Search/Models/SaveObjectResponse.cs create mode 100644 algoliasearch/Search/Models/SaveSynonymResponse.cs create mode 100644 algoliasearch/Search/Models/ScopeType.cs create mode 100644 algoliasearch/Search/Models/SearchDictionaryEntriesParams.cs create mode 100644 algoliasearch/Search/Models/SearchForFacetValuesRequest.cs create mode 100644 algoliasearch/Search/Models/SearchForFacetValuesResponse.cs create mode 100644 algoliasearch/Search/Models/SearchForFacets.cs create mode 100644 algoliasearch/Search/Models/SearchForFacetsOptions.cs create mode 100644 algoliasearch/Search/Models/SearchForHits.cs create mode 100644 algoliasearch/Search/Models/SearchForHitsOptions.cs create mode 100644 algoliasearch/Search/Models/SearchHits.cs create mode 100644 algoliasearch/Search/Models/SearchMethodParams.cs create mode 100644 algoliasearch/Search/Models/SearchParams.cs create mode 100644 algoliasearch/Search/Models/SearchParamsObject.cs create mode 100644 algoliasearch/Search/Models/SearchParamsQuery.cs create mode 100644 algoliasearch/Search/Models/SearchParamsString.cs create mode 100644 algoliasearch/Search/Models/SearchQuery.cs create mode 100644 algoliasearch/Search/Models/SearchResponse.cs create mode 100644 algoliasearch/Search/Models/SearchResponses.cs create mode 100644 algoliasearch/Search/Models/SearchResult.cs create mode 100644 algoliasearch/Search/Models/SearchRulesParams.cs create mode 100644 algoliasearch/Search/Models/SearchRulesResponse.cs create mode 100644 algoliasearch/Search/Models/SearchStrategy.cs create mode 100644 algoliasearch/Search/Models/SearchSynonymsParams.cs create mode 100644 algoliasearch/Search/Models/SearchSynonymsResponse.cs create mode 100644 algoliasearch/Search/Models/SearchTypeDefault.cs create mode 100644 algoliasearch/Search/Models/SearchTypeFacet.cs create mode 100644 algoliasearch/Search/Models/SearchUserIdsParams.cs create mode 100644 algoliasearch/Search/Models/SearchUserIdsResponse.cs create mode 100644 algoliasearch/Search/Models/SemanticSearch.cs create mode 100644 algoliasearch/Search/Models/SnippetResult.cs create mode 100644 algoliasearch/Search/Models/SnippetResultOption.cs create mode 100644 algoliasearch/Search/Models/SortRemainingBy.cs create mode 100644 algoliasearch/Search/Models/Source.cs create mode 100644 algoliasearch/Search/Models/StandardEntries.cs create mode 100644 algoliasearch/Search/Models/SynonymHit.cs create mode 100644 algoliasearch/Search/Models/SynonymType.cs create mode 100644 algoliasearch/Search/Models/TagFilters.cs create mode 100644 algoliasearch/Search/Models/TaskStatus.cs create mode 100644 algoliasearch/Search/Models/TimeRange.cs create mode 100644 algoliasearch/Search/Models/TypoTolerance.cs create mode 100644 algoliasearch/Search/Models/TypoToleranceEnum.cs create mode 100644 algoliasearch/Search/Models/UpdateApiKeyResponse.cs create mode 100644 algoliasearch/Search/Models/UpdatedAtResponse.cs create mode 100644 algoliasearch/Search/Models/UpdatedAtWithObjectIdResponse.cs create mode 100644 algoliasearch/Search/Models/UpdatedRuleResponse.cs create mode 100644 algoliasearch/Search/Models/UserHighlightResult.cs create mode 100644 algoliasearch/Search/Models/UserHit.cs create mode 100644 algoliasearch/Search/Models/UserId.cs create mode 100644 algoliasearch/Search/Models/Value.cs diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..1ee53850b --- /dev/null +++ b/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/Algolia.Search.sln b/Algolia.Search.sln new file mode 100644 index 000000000..f63bb24ad --- /dev/null +++ b/Algolia.Search.sln @@ -0,0 +1,25 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Algolia.Search", "algoliasearch\Algolia.Search.csproj", "{65469A94-6FDA-4202-BEDE-7CA4DF2B2268}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {65469A94-6FDA-4202-BEDE-7CA4DF2B2268}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {65469A94-6FDA-4202-BEDE-7CA4DF2B2268}.Debug|Any CPU.Build.0 = Debug|Any CPU + {65469A94-6FDA-4202-BEDE-7CA4DF2B2268}.Release|Any CPU.ActiveCfg = Release|Any CPU + {65469A94-6FDA-4202-BEDE-7CA4DF2B2268}.Release|Any CPU.Build.0 = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/algoliasearch/Abtesting/Api/AbtestingClient.cs b/algoliasearch/Abtesting/Api/AbtestingClient.cs new file mode 100644 index 000000000..e704f64e4 --- /dev/null +++ b/algoliasearch/Abtesting/Api/AbtestingClient.cs @@ -0,0 +1,1781 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Mime; +using Algolia.Search.Abtesting.Client; +using Algolia.Search.Abtesting.Models; + +namespace Algolia.Search.Abtesting.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IAbtestingClient + { + /// + /// Create an A/B test. + /// + /// + /// Creates an A/B test. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ABTestResponse + System.Threading.Tasks.Task AddABTestsAsync(AddABTestsRequest addABTestsRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create an A/B test. + /// + /// + /// Creates an A/B test. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ABTestResponse) + System.Threading.Tasks.Task> AddABTestsWithHttpInfoAsync(AddABTestsRequest addABTestsRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete an A/B test. + /// + /// + /// Delete an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// Cancellation Token to cancel the request. + /// Task of ABTestResponse + System.Threading.Tasks.Task DeleteABTestAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete an A/B test. + /// + /// + /// Delete an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ABTestResponse) + System.Threading.Tasks.Task> DeleteABTestWithHttpInfoAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get A/B test details. + /// + /// + /// Get specific details for an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// Cancellation Token to cancel the request. + /// Task of ABTest + System.Threading.Tasks.Task GetABTestAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get A/B test details. + /// + /// + /// Get specific details for an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ABTest) + System.Threading.Tasks.Task> GetABTestWithHttpInfoAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// List all A/B tests. + /// + /// + /// List all A/B tests. + /// + /// Thrown when fails to make API call + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Number of records to return (page size). (optional, default to 10) + /// Only return A/B tests for indices starting with this prefix. (optional) + /// Only return A/B tests for indices ending with this suffix. (optional) + /// Cancellation Token to cancel the request. + /// Task of ListABTestsResponse + System.Threading.Tasks.Task ListABTestsAsync(int? offset = default(int?), int? limit = default(int?), string indexPrefix = default(string), string indexSuffix = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List all A/B tests. + /// + /// + /// List all A/B tests. + /// + /// Thrown when fails to make API call + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Number of records to return (page size). (optional, default to 10) + /// Only return A/B tests for indices starting with this prefix. (optional) + /// Only return A/B tests for indices ending with this suffix. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListABTestsResponse) + System.Threading.Tasks.Task> ListABTestsWithHttpInfoAsync(int? offset = default(int?), int? limit = default(int?), string indexPrefix = default(string), string indexSuffix = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Stop an A/B test. + /// + /// + /// If stopped, the test is over and can't be restarted. There is now only one index, receiving 100% of all search requests. The data gathered for stopped A/B tests is retained. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// Cancellation Token to cancel the request. + /// Task of ABTestResponse + System.Threading.Tasks.Task StopABTestAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Stop an A/B test. + /// + /// + /// If stopped, the test is over and can't be restarted. There is now only one index, receiving 100% of all search requests. The data gathered for stopped A/B tests is retained. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ABTestResponse) + System.Threading.Tasks.Task> StopABTestWithHttpInfoAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } + + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class AbtestingClient : IDisposable, IAbtestingClient + { + private Algolia.Search.Abtesting.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// + public AbtestingClient() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + /// + public AbtestingClient(string basePath) + { + this.Configuration = Algolia.Search.Abtesting.Client.Configuration.MergeConfigurations( + Algolia.Search.Abtesting.Client.GlobalConfiguration.Instance, + new Algolia.Search.Abtesting.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.Abtesting.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.Abtesting.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// An instance of Configuration. + /// + /// + public AbtestingClient(Algolia.Search.Abtesting.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Algolia.Search.Abtesting.Client.Configuration.MergeConfigurations( + Algolia.Search.Abtesting.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.Abtesting.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.Abtesting.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public AbtestingClient(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public AbtestingClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.Abtesting.Client.Configuration.MergeConfigurations( + Algolia.Search.Abtesting.Client.GlobalConfiguration.Instance, + new Algolia.Search.Abtesting.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.Abtesting.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.Abtesting.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// + /// An instance of HttpClient. + /// An instance of Configuration. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public AbtestingClient(HttpClient client, Algolia.Search.Abtesting.Client.Configuration configuration, HttpClientHandler handler = null) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.Abtesting.Client.Configuration.MergeConfigurations( + Algolia.Search.Abtesting.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.Abtesting.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.Abtesting.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + /// + public AbtestingClient(Algolia.Search.Abtesting.Client.ISynchronousClient client, Algolia.Search.Abtesting.Client.IAsynchronousClient asyncClient, Algolia.Search.Abtesting.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Algolia.Search.Abtesting.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + this.ApiClient?.Dispose(); + } + + /// + /// Holds the ApiClient if created + /// + public Algolia.Search.Abtesting.Client.ApiClient ApiClient { get; set; } = null; + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Algolia.Search.Abtesting.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Algolia.Search.Abtesting.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Algolia.Search.Abtesting.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Algolia.Search.Abtesting.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Create an A/B test. Creates an A/B test. + /// + /// Thrown when fails to make API call + /// + /// ABTestResponse + public ABTestResponse AddABTests(AddABTestsRequest addABTestsRequest) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = AddABTestsWithHttpInfo(addABTestsRequest); + return localVarResponse.Data; + } + + /// + /// Create an A/B test. Creates an A/B test. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of ABTestResponse + public Algolia.Search.Abtesting.Client.ApiResponse AddABTestsWithHttpInfo(AddABTestsRequest addABTestsRequest) + { + // verify the required parameter 'addABTestsRequest' is set + if (addABTestsRequest == null) + throw new Algolia.Search.Abtesting.Client.ApiException(400, "Missing required parameter 'addABTestsRequest' when calling AbtestingClient->AddABTests"); + + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = addABTestsRequest; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/2/abtests", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("AddABTests", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Create an A/B test. Creates an A/B test. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ABTestResponse + public async System.Threading.Tasks.Task AddABTestsAsync(AddABTestsRequest addABTestsRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = await AddABTestsWithHttpInfoAsync(addABTestsRequest, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Create an A/B test. Creates an A/B test. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ABTestResponse) + public async System.Threading.Tasks.Task> AddABTestsWithHttpInfoAsync(AddABTestsRequest addABTestsRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'addABTestsRequest' is set + if (addABTestsRequest == null) + throw new Algolia.Search.Abtesting.Client.ApiException(400, "Missing required parameter 'addABTestsRequest' when calling AbtestingClient->AddABTests"); + + + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = addABTestsRequest; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/2/abtests", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("AddABTests", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Del(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = DelWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.Abtesting.Client.ApiResponse DelWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Abtesting.Client.ApiException(400, "Missing required parameter 'path' when calling AbtestingClient->Del"); + + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Abtesting.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Abtesting.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = await DelWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Abtesting.Client.ApiException(400, "Missing required parameter 'path' when calling AbtestingClient->Del"); + + + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Abtesting.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Abtesting.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete an A/B test. Delete an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// ABTestResponse + public ABTestResponse DeleteABTest(int id) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = DeleteABTestWithHttpInfo(id); + return localVarResponse.Data; + } + + /// + /// Delete an A/B test. Delete an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// ApiResponse of ABTestResponse + public Algolia.Search.Abtesting.Client.ApiResponse DeleteABTestWithHttpInfo(int id) + { + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("id", Algolia.Search.Abtesting.Client.ClientUtils.ParameterToString(id)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/2/abtests/{id}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteABTest", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete an A/B test. Delete an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// Cancellation Token to cancel the request. + /// Task of ABTestResponse + public async System.Threading.Tasks.Task DeleteABTestAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = await DeleteABTestWithHttpInfoAsync(id, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete an A/B test. Delete an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ABTestResponse) + public async System.Threading.Tasks.Task> DeleteABTestWithHttpInfoAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("id", Algolia.Search.Abtesting.Client.ClientUtils.ParameterToString(id)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/2/abtests/{id}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteABTest", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Get(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = GetWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.Abtesting.Client.ApiResponse GetWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Abtesting.Client.ApiException(400, "Missing required parameter 'path' when calling AbtestingClient->Get"); + + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Abtesting.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Abtesting.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = await GetWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Abtesting.Client.ApiException(400, "Missing required parameter 'path' when calling AbtestingClient->Get"); + + + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Abtesting.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Abtesting.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get A/B test details. Get specific details for an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// ABTest + public ABTest GetABTest(int id) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = GetABTestWithHttpInfo(id); + return localVarResponse.Data; + } + + /// + /// Get A/B test details. Get specific details for an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// ApiResponse of ABTest + public Algolia.Search.Abtesting.Client.ApiResponse GetABTestWithHttpInfo(int id) + { + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("id", Algolia.Search.Abtesting.Client.ClientUtils.ParameterToString(id)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/abtests/{id}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetABTest", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get A/B test details. Get specific details for an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// Cancellation Token to cancel the request. + /// Task of ABTest + public async System.Threading.Tasks.Task GetABTestAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = await GetABTestWithHttpInfoAsync(id, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get A/B test details. Get specific details for an A/B test. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ABTest) + public async System.Threading.Tasks.Task> GetABTestWithHttpInfoAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("id", Algolia.Search.Abtesting.Client.ClientUtils.ParameterToString(id)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/abtests/{id}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetABTest", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List all A/B tests. List all A/B tests. + /// + /// Thrown when fails to make API call + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Number of records to return (page size). (optional, default to 10) + /// Only return A/B tests for indices starting with this prefix. (optional) + /// Only return A/B tests for indices ending with this suffix. (optional) + /// ListABTestsResponse + public ListABTestsResponse ListABTests(int? offset = default(int?), int? limit = default(int?), string indexPrefix = default(string), string indexSuffix = default(string)) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = ListABTestsWithHttpInfo(offset, limit, indexPrefix, indexSuffix); + return localVarResponse.Data; + } + + /// + /// List all A/B tests. List all A/B tests. + /// + /// Thrown when fails to make API call + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Number of records to return (page size). (optional, default to 10) + /// Only return A/B tests for indices starting with this prefix. (optional) + /// Only return A/B tests for indices ending with this suffix. (optional) + /// ApiResponse of ListABTestsResponse + public Algolia.Search.Abtesting.Client.ApiResponse ListABTestsWithHttpInfo(int? offset = default(int?), int? limit = default(int?), string indexPrefix = default(string), string indexSuffix = default(string)) + { + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Abtesting.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Abtesting.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (indexPrefix != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Abtesting.Client.ClientUtils.ParameterToMultiMap("", "indexPrefix", indexPrefix)); + } + if (indexSuffix != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Abtesting.Client.ClientUtils.ParameterToMultiMap("", "indexSuffix", indexSuffix)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/abtests", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ListABTests", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List all A/B tests. List all A/B tests. + /// + /// Thrown when fails to make API call + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Number of records to return (page size). (optional, default to 10) + /// Only return A/B tests for indices starting with this prefix. (optional) + /// Only return A/B tests for indices ending with this suffix. (optional) + /// Cancellation Token to cancel the request. + /// Task of ListABTestsResponse + public async System.Threading.Tasks.Task ListABTestsAsync(int? offset = default(int?), int? limit = default(int?), string indexPrefix = default(string), string indexSuffix = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = await ListABTestsWithHttpInfoAsync(offset, limit, indexPrefix, indexSuffix, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// List all A/B tests. List all A/B tests. + /// + /// Thrown when fails to make API call + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Number of records to return (page size). (optional, default to 10) + /// Only return A/B tests for indices starting with this prefix. (optional) + /// Only return A/B tests for indices ending with this suffix. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListABTestsResponse) + public async System.Threading.Tasks.Task> ListABTestsWithHttpInfoAsync(int? offset = default(int?), int? limit = default(int?), string indexPrefix = default(string), string indexSuffix = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Abtesting.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Abtesting.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (indexPrefix != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Abtesting.Client.ClientUtils.ParameterToMultiMap("", "indexPrefix", indexPrefix)); + } + if (indexSuffix != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Abtesting.Client.ClientUtils.ParameterToMultiMap("", "indexSuffix", indexSuffix)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/abtests", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ListABTests", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Post(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = PostWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.Abtesting.Client.ApiResponse PostWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Abtesting.Client.ApiException(400, "Missing required parameter 'path' when calling AbtestingClient->Post"); + + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Abtesting.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Abtesting.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = await PostWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Abtesting.Client.ApiException(400, "Missing required parameter 'path' when calling AbtestingClient->Post"); + + + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Abtesting.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Abtesting.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Put(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = PutWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.Abtesting.Client.ApiResponse PutWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Abtesting.Client.ApiException(400, "Missing required parameter 'path' when calling AbtestingClient->Put"); + + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Abtesting.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Abtesting.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = await PutWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Abtesting.Client.ApiException(400, "Missing required parameter 'path' when calling AbtestingClient->Put"); + + + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Abtesting.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Abtesting.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Stop an A/B test. If stopped, the test is over and can't be restarted. There is now only one index, receiving 100% of all search requests. The data gathered for stopped A/B tests is retained. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// ABTestResponse + public ABTestResponse StopABTest(int id) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = StopABTestWithHttpInfo(id); + return localVarResponse.Data; + } + + /// + /// Stop an A/B test. If stopped, the test is over and can't be restarted. There is now only one index, receiving 100% of all search requests. The data gathered for stopped A/B tests is retained. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// ApiResponse of ABTestResponse + public Algolia.Search.Abtesting.Client.ApiResponse StopABTestWithHttpInfo(int id) + { + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("id", Algolia.Search.Abtesting.Client.ClientUtils.ParameterToString(id)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/2/abtests/{id}/stop", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("StopABTest", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Stop an A/B test. If stopped, the test is over and can't be restarted. There is now only one index, receiving 100% of all search requests. The data gathered for stopped A/B tests is retained. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// Cancellation Token to cancel the request. + /// Task of ABTestResponse + public async System.Threading.Tasks.Task StopABTestAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Abtesting.Client.ApiResponse localVarResponse = await StopABTestWithHttpInfoAsync(id, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Stop an A/B test. If stopped, the test is over and can't be restarted. There is now only one index, receiving 100% of all search requests. The data gathered for stopped A/B tests is retained. To determine the `id` for an A/B test, use the [`listABTests` operation](#tag/abtest/operation/listABTests). + /// + /// Thrown when fails to make API call + /// Unique A/B test ID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ABTestResponse) + public async System.Threading.Tasks.Task> StopABTestWithHttpInfoAsync(int id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Abtesting.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Abtesting.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Abtesting.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("id", Algolia.Search.Abtesting.Client.ClientUtils.ParameterToString(id)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/2/abtests/{id}/stop", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("StopABTest", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + } +} diff --git a/algoliasearch/Abtesting/Client/ApiClient.cs b/algoliasearch/Abtesting/Client/ApiClient.cs new file mode 100644 index 000000000..846707d11 --- /dev/null +++ b/algoliasearch/Abtesting/Client/ApiClient.cs @@ -0,0 +1,736 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs; +using System.Net.Http; +using System.Net.Http.Headers; + +namespace Algolia.Search.Abtesting.Client +{ + /// + /// To Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec + { + private readonly IReadableConfiguration _configuration; + private static readonly string _contentType = "application/json"; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is Algolia.Search.Abtesting.Models.AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((Algolia.Search.Abtesting.Models.AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public async Task Deserialize(HttpResponseMessage response) + { + var result = (T)await Deserialize(response, typeof(T)).ConfigureAwait(false); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal async Task Deserialize(HttpResponseMessage response, Type type) + { + IList headers = response.Headers.Select(x => x.Key + "=" + x.Value).ToList(); + + if (type == typeof(byte[])) // return byte array + { + return await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + } + else if (type == typeof(FileParameter)) + { + return new FileParameter(await response.Content.ReadAsStreamAsync().ConfigureAwait(false)); + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + if (headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + File.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(await response.Content.ReadAsStringAsync().ConfigureAwait(false), null, System.Globalization.DateTimeStyles.RoundtripKind); + } + + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public string RootElement { get; set; } + public string Namespace { get; set; } + public string DateFormat { get; set; } + + public string ContentType + { + get { return _contentType; } + set { throw new InvalidOperationException("Not allowed to set content type."); } + } + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + /// + /// The Dispose method will manage the HttpClient lifecycle when not passed by constructor. + /// + public partial class ApiClient : IDisposable, ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + + private readonly HttpClientHandler _httpClientHandler; + private readonly HttpClient _httpClient; + private readonly bool _disposeClient; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + public ApiClient() : + this(Algolia.Search.Abtesting.Client.GlobalConfiguration.Instance.BasePath) + { + } + + /// + /// Initializes a new instance of the . + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = new HttpClientHandler(); + _httpClient = new HttpClient(_httpClientHandler, true); + _disposeClient = true; + _baseUrl = basePath; + } + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, HttpClientHandler handler = null) : + this(client, Algolia.Search.Abtesting.Client.GlobalConfiguration.Instance.BasePath, handler) + { + } + + /// + /// Initializes a new instance of the . + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client cannot be null"); + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = handler; + _httpClient = client; + _baseUrl = basePath; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + if (_disposeClient) + { + _httpClient.Dispose(); + } + } + + /// Prepares multipart/form-data content + HttpContent PrepareMultipartFormDataContent(RequestOptions options) + { + string boundary = "---------" + Guid.NewGuid().ToString().ToUpperInvariant(); + var multipartContent = new MultipartFormDataContent(boundary); + foreach (var formParameter in options.FormParameters) + { + multipartContent.Add(new StringContent(formParameter.Value), formParameter.Key); + } + + if (options.FileParameters != null && options.FileParameters.Count > 0) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var content = new StreamContent(file.Content); + content.Headers.ContentType = new MediaTypeHeaderValue(file.ContentType); + multipartContent.Add(content, fileParam.Key, file.Name); + } + } + } + return multipartContent; + } + + /// + /// Provides all logic for constructing a new HttpRequestMessage. + /// At this point, all information for querying the service is known. Here, it is simply + /// mapped into the a HttpRequestMessage. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// [private] A new HttpRequestMessage instance. + /// + private HttpRequestMessage NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + WebRequestPathBuilder builder = new WebRequestPathBuilder(_baseUrl, path); + + builder.AddPathParameters(options.PathParameters); + + builder.AddQueryParameters(options.QueryParameters); + + HttpRequestMessage request = new HttpRequestMessage(method, builder.GetFullUri()); + + if (configuration.UserAgent != null) + { + request.Headers.TryAddWithoutValidation("User-Agent", configuration.UserAgent); + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.Headers.Add(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + // Todo make content headers actually content headers + request.Headers.TryAddWithoutValidation(headerParam.Key, value); + } + } + } + + List> contentList = new List>(); + + string contentType = null; + if (options.HeaderParameters != null && options.HeaderParameters.ContainsKey("Content-Type")) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes.FirstOrDefault(); + } + + if (contentType == "multipart/form-data") + { + request.Content = PrepareMultipartFormDataContent(options); + } + else if (contentType == "application/x-www-form-urlencoded") + { + request.Content = new FormUrlEncodedContent(options.FormParameters); + } + else + { + if (options.Data != null) + { + if (options.Data is FileParameter fp) + { + contentType = contentType ?? "application/octet-stream"; + + var streamContent = new StreamContent(fp.Content); + streamContent.Headers.ContentType = new MediaTypeHeaderValue(contentType); + request.Content = streamContent; + } + else + { + var serializer = new CustomJsonCodec(SerializerSettings, configuration); + request.Content = new StringContent(serializer.Serialize(options.Data), new UTF8Encoding(), + "application/json"); + } + } + } + + + + // TODO provide an alternative that allows cookies per request instead of per API client + if (options.Cookies != null && options.Cookies.Count > 0) + { + request.Properties["CookieContainer"] = options.Cookies; + } + + return request; + } + + partial void InterceptRequest(HttpRequestMessage req); + partial void InterceptResponse(HttpRequestMessage req, HttpResponseMessage response); + + private async Task> ToApiResponse(HttpResponseMessage response, object responseData, Uri uri) + { + T result = (T)responseData; + string rawContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ReasonPhrase, + Cookies = new List() + }; + + // process response headers, e.g. Access-Control-Allow-Methods + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + // process response content headers, e.g. Content-Type + if (response.Content.Headers != null) + { + foreach (var responseHeader in response.Content.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (_httpClientHandler != null && response != null) + { + try + { + foreach (Cookie cookie in _httpClientHandler.CookieContainer.GetCookies(uri)) + { + transformed.Cookies.Add(cookie); + } + } + catch (PlatformNotSupportedException) { } + } + + return transformed; + } + + private ApiResponse Exec(HttpRequestMessage req, IReadableConfiguration configuration) + { + return ExecAsync(req, configuration).GetAwaiter().GetResult(); + } + + private async Task> ExecAsync(HttpRequestMessage req, + IReadableConfiguration configuration, + System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + CancellationTokenSource timeoutTokenSource = null; + CancellationTokenSource finalTokenSource = null; + var deserializer = new CustomJsonCodec(SerializerSettings, configuration); + var finalToken = cancellationToken; + + try + { + if (configuration.Timeout > 0) + { + timeoutTokenSource = new CancellationTokenSource(configuration.Timeout); + finalTokenSource = CancellationTokenSource.CreateLinkedTokenSource(finalToken, timeoutTokenSource.Token); + finalToken = finalTokenSource.Token; + } + + if (configuration.Proxy != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Configuration `Proxy` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + _httpClientHandler.Proxy = configuration.Proxy; + } + + var cookieContainer = req.Properties.ContainsKey("CookieContainer") ? req.Properties["CookieContainer"] as List : null; + + if (cookieContainer != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Request property `CookieContainer` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + foreach (var cookie in cookieContainer) + { + _httpClientHandler.CookieContainer.Add(cookie); + } + } + + InterceptRequest(req); + + HttpResponseMessage response; + response = await _httpClient.SendAsync(req, finalToken).ConfigureAwait(false); + + if (!response.IsSuccessStatusCode) + { + return await ToApiResponse(response, default(T), req.RequestUri).ConfigureAwait(false); + } + + object responseData = await deserializer.Deserialize(response).ConfigureAwait(false); + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(Algolia.Search.Abtesting.Models.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + responseData = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + else if (typeof(T).Name == "Stream") // for binary response + { + responseData = (T)(object)await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + } + + InterceptResponse(req, response); + + return await ToApiResponse(response, responseData, req.RequestUri).ConfigureAwait(false); + } + catch (OperationCanceledException original) + { + if (timeoutTokenSource != null && timeoutTokenSource.IsCancellationRequested) + { + throw new TaskCanceledException($"[{req.Method}] {req.RequestUri} was timeout.", + new TimeoutException(original.Message, original)); + } + throw; + } + finally + { + if (timeoutTokenSource != null) + { + timeoutTokenSource.Dispose(); + } + + if (finalTokenSource != null) + { + finalTokenSource.Dispose(); + } + } + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(new HttpMethod("PATCH"), path, options, config), config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(new HttpMethod("PATCH"), path, options, config), config); + } + #endregion ISynchronousClient + } +} diff --git a/algoliasearch/Abtesting/Client/ApiException.cs b/algoliasearch/Abtesting/Client/ApiException.cs new file mode 100644 index 000000000..9b9ee0159 --- /dev/null +++ b/algoliasearch/Abtesting/Client/ApiException.cs @@ -0,0 +1,62 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.Abtesting.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// Gets or sets the error code (HTTP status code) + /// + /// The error code (HTTP status code). + public int ErrorCode { get; set; } + + /// + /// Gets or sets the error content (body json object) + /// + /// The error content (Http response body). + public object ErrorContent { get; private set; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public ApiException() { } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + public ApiException(int errorCode, string message) : base(message) + { + this.ErrorCode = errorCode; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + /// Error content. + /// HTTP Headers. + public ApiException(int errorCode, string message, object errorContent = null, Multimap headers = null) : base(message) + { + this.ErrorCode = errorCode; + this.ErrorContent = errorContent; + this.Headers = headers; + } + } + +} diff --git a/algoliasearch/Abtesting/Client/ApiResponse.cs b/algoliasearch/Abtesting/Client/ApiResponse.cs new file mode 100644 index 000000000..5838c7e51 --- /dev/null +++ b/algoliasearch/Abtesting/Client/ApiResponse.cs @@ -0,0 +1,160 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; + +namespace Algolia.Search.Abtesting.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public interface IApiResponse + { + /// + /// The data type of + /// + Type ResponseType { get; } + + /// + /// The content of this response + /// + Object Content { get; } + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + Multimap Headers { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + List Cookies { get; set; } + + /// + /// The raw content of this response + /// + string RawContent { get; } + } + + /// + /// API Response + /// + public class ApiResponse : IApiResponse + { + #region Properties + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; } + + /// + /// Gets or sets the data (parsed HTTP body) + /// + /// The data. + public T Data { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + public string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + public List Cookies { get; set; } + + /// + /// The content of this response + /// + public Type ResponseType + { + get { return typeof(T); } + } + + /// + /// The data type of + /// + public object Content + { + get { return Data; } + } + + /// + /// The raw content + /// + public string RawContent { get; } + + #endregion Properties + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data, string rawContent) + { + StatusCode = statusCode; + Headers = headers; + Data = data; + RawContent = rawContent; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) : this(statusCode, headers, data, null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null) + { + } + + #endregion Constructors + } +} diff --git a/algoliasearch/Abtesting/Client/ClientUtils.cs b/algoliasearch/Abtesting/Client/ClientUtils.cs new file mode 100644 index 000000000..f54cb2b9e --- /dev/null +++ b/algoliasearch/Abtesting/Client/ClientUtils.cs @@ -0,0 +1,244 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; + +namespace Algolia.Search.Abtesting.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// Convert params to key/value pairs. + /// Use collectionFormat to properly format lists and collections. + /// + /// The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi + /// Key name. + /// Value object. + /// A multimap of keys with 1..n associated values. + public static Multimap ParameterToMultiMap(string collectionFormat, string name, object value) + { + var parameters = new Multimap(); + + if (value is ICollection collection && collectionFormat == "multi") + { + foreach (var item in collection) + { + parameters.Add(name, ParameterToString(item)); + } + } + else if (value is IDictionary dictionary) + { + if (collectionFormat == "deepObject") + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value)); + } + } + else + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value)); + } + } + } + else + { + parameters.Add(name, ParameterToString(value)); + } + + return parameters; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// An optional configuration instance, providing formatting options used in processing. + /// Formatted string. + public static string ParameterToString(object obj, IReadableConfiguration configuration = null) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is bool boolean) + return boolean ? "true" : "false"; + if (obj is ICollection collection) + { + List entries = new List(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry, configuration)); + return string.Join(",", entries); + } + if (obj is Enum && HasEnumMemberAttrValue(obj)) + return GetEnumMemberAttrValue(obj); + + return Convert.ToString(obj, CultureInfo.InvariantCulture); + } + + /// + /// Serializes the given object when not null. Otherwise return null. + /// + /// The object to serialize. + /// Serialized string. + public static string Serialize(object obj) + { + return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null; + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Is the Enum decorated with EnumMember Attribute + /// + /// + /// true if found + private static bool HasEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) return true; + return false; + } + + /// + /// Get the EnumMember value + /// + /// + /// EnumMember value as string otherwise null + private static string GetEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) + { + return attr.Value; + } + return null; + } + } +} diff --git a/algoliasearch/Abtesting/Client/Configuration.cs b/algoliasearch/Abtesting/Client/Configuration.cs new file mode 100644 index 000000000..531e402ef --- /dev/null +++ b/algoliasearch/Abtesting/Client/Configuration.cs @@ -0,0 +1,593 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Net.Http; +using System.Net.Security; + +namespace Algolia.Search.Abtesting.Client +{ + /// + /// Represents a set of configuration settings + /// + public class Configuration : IReadableConfiguration + { + #region Constants + + /// + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.RawContent), + response.RawContent, response.Headers); + } + return null; + }; + + #endregion Static Members + + #region Private Members + + /// + /// Defines the base path of the target API server. + /// Example: http://localhost:3000/v1/ + /// + private string _basePath; + + private bool _useDefaultCredentials = false; + + /// + /// Gets or sets the API key based on the authentication name. + /// This is the key and value comprising the "secret" for accessing an API. + /// + /// The API key. + private IDictionary _apiKey; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + /// + /// Gets or sets the servers defined in the OpenAPI spec. + /// + /// The servers + private IList> _servers; + + /// + /// Gets or sets the operation servers defined in the OpenAPI spec. + /// + /// The operation servers + private IReadOnlyDictionary>> _operationServers; + + #endregion Private Members + + #region Constructors + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration() + { + Proxy = null; + UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + BasePath = "https://analytics.us.algolia.com"; + DefaultHeaders = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + Servers = new List>() + { + { + new Dictionary { + {"url", "https://analytics.{region}.algolia.com"}, + {"description", "No description provided"}, + { + "variables", new Dictionary { + { + "region", new Dictionary { + {"description", "No description provided"}, + {"default_value", "us"}, + { + "enum_values", new List() { + "us", + "de" + } + } + } + } + } + } + } + }, + { + new Dictionary { + {"url", "https://analytics.algolia.com"}, + {"description", "No description provided"}, + } + } + }; + OperationServers = new Dictionary>>() + { + }; + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration( + IDictionary defaultHeaders, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "https://analytics.us.algolia.com") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeaders == null) + throw new ArgumentNullException("defaultHeaders"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeaders) + { + DefaultHeaders.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + #endregion Constructors + + #region Properties + + /// + /// Gets or sets the base path for API access. + /// + public virtual string BasePath + { + get { return _basePath; } + set { _basePath = value; } + } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + public virtual bool UseDefaultCredentials + { + get { return _useDefaultCredentials; } + set { _useDefaultCredentials = value; } + } + + /// + /// Gets or sets the default header. + /// + [Obsolete("Use DefaultHeaders instead.")] + public virtual IDictionary DefaultHeader + { + get + { + return DefaultHeaders; + } + set + { + DefaultHeaders = value; + } + } + + /// + /// Gets or sets the default headers. + /// + public virtual IDictionary DefaultHeaders { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { get; set; } + + /// + /// Gets or sets the proxy + /// + /// Proxy. + public virtual WebProxy Proxy { get; set; } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix(string apiKeyIdentifier) + { + string apiKeyValue; + ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue); + string apiKeyPrefix; + if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) + { + return apiKeyPrefix + " " + apiKeyValue; + } + + return apiKeyValue; + } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } + + set + { + if (string.IsNullOrEmpty(value)) + { + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } + } + } + + /// + /// Gets or sets the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// Whatever you set here will be prepended to the value defined in AddApiKey. + /// + /// An example invocation here might be: + /// + /// ApiKeyPrefix["Authorization"] = "Bearer"; + /// + /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// + /// + /// OAuth2 workflows should set tokens via AccessToken. + /// + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + /// + /// Gets or sets the servers. + /// + /// The servers. + public virtual IList> Servers + { + get { return _servers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Servers may not be null."); + } + _servers = value; + } + } + + /// + /// Gets or sets the operation servers. + /// + /// The operation servers. + public virtual IReadOnlyDictionary>> OperationServers + { + get { return _operationServers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Operation servers may not be null."); + } + _operationServers = value; + } + } + + /// + /// Returns URL based on server settings without providing values + /// for the variables + /// + /// Array index of the server settings. + /// The server URL. + public string GetServerUrl(int index) + { + return GetServerUrl(Servers, index, null); + } + + /// + /// Returns URL based on server settings. + /// + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + public string GetServerUrl(int index, Dictionary inputVariables) + { + return GetServerUrl(Servers, index, inputVariables); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index) + { + return GetOperationServerUrl(operation, index, null); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables) + { + if (operation != null && OperationServers.TryGetValue(operation, out var operationServer)) + { + return GetServerUrl(operationServer, index, inputVariables); + } + + return null; + } + + /// + /// Returns URL based on server settings. + /// + /// Dictionary of server settings. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + private string GetServerUrl(IList> servers, int index, Dictionary inputVariables) + { + if (index < 0 || index >= servers.Count) + { + throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}."); + } + + if (inputVariables == null) + { + inputVariables = new Dictionary(); + } + + IReadOnlyDictionary server = servers[index]; + string url = (string)server["url"]; + + if (server.ContainsKey("variables")) + { + // go through each variable and assign a value + foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"]) + { + + IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value); + + if (inputVariables.ContainsKey(variable.Key)) + { + if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + { + url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); + } + else + { + throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}"); + } + } + else + { + // use default value + url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]); + } + } + } + + return url; + } + + /// + /// Gets and Sets the RemoteCertificateValidationCallback + /// + public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; } + + #endregion Properties + + #region Methods + + /// + /// Returns a string with essential information for debugging. + /// + public static string ToDebugReport() + { + string report = "C# SDK (Algolia.Search.Abtesting) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: 1.0.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; + } + + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey(string key, string value) + { + ApiKey[key] = value; + } + + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix(string key, string value) + { + ApiKeyPrefix[key] = value; + } + + #endregion Methods + + #region Static Members + /// + /// Merge configurations. + /// + /// First configuration. + /// Second configuration. + /// Merged configuration. + public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) + { + if (second == null) return first ?? GlobalConfiguration.Instance; + + Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; + foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; + foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value; + + var config = new Configuration + { + ApiKey = apiKey, + ApiKeyPrefix = apiKeyPrefix, + DefaultHeaders = defaultHeaders, + BasePath = second.BasePath ?? first.BasePath, + Timeout = second.Timeout, + Proxy = second.Proxy ?? first.Proxy, + UserAgent = second.UserAgent ?? first.UserAgent, + TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, + DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat, + UseDefaultCredentials = second.UseDefaultCredentials, + RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback, + }; + return config; + } + #endregion Static Members + } +} diff --git a/algoliasearch/Abtesting/Client/ExceptionFactory.cs b/algoliasearch/Abtesting/Client/ExceptionFactory.cs new file mode 100644 index 000000000..ee505f741 --- /dev/null +++ b/algoliasearch/Abtesting/Client/ExceptionFactory.cs @@ -0,0 +1,16 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.Abtesting.Client +{ + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions + public delegate Exception ExceptionFactory(string methodName, IApiResponse response); +} diff --git a/algoliasearch/Abtesting/Client/FileParameter.cs b/algoliasearch/Abtesting/Client/FileParameter.cs new file mode 100644 index 000000000..7f8f20e41 --- /dev/null +++ b/algoliasearch/Abtesting/Client/FileParameter.cs @@ -0,0 +1,74 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.IO; + +namespace Algolia.Search.Abtesting.Client +{ + + /// + /// Represents a File passed to the API as a Parameter, allows using different backends for files + /// + public class FileParameter + { + /// + /// The filename + /// + public string Name { get; set; } = "no_name_provided"; + + /// + /// The content type of the file + /// + public string ContentType { get; set; } = "application/octet-stream"; + + /// + /// The content of the file + /// + public Stream Content { get; set; } + + /// + /// Construct a FileParameter just from the contents, will extract the filename from a filestream + /// + /// The file content + public FileParameter(Stream content) + { + if (content is FileStream fs) + { + Name = fs.Name; + } + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The file content + public FileParameter(string filename, Stream content) + { + Name = filename; + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The content type of the file + /// The file content + public FileParameter(string filename, string contentType, Stream content) + { + Name = filename; + ContentType = contentType; + Content = content; + } + + /// + /// Implicit conversion of stream to file parameter. Useful for backwards compatibility. + /// + /// Stream to convert + /// FileParameter + public static implicit operator FileParameter(Stream s) => new FileParameter(s); + } +} diff --git a/algoliasearch/Abtesting/Client/GlobalConfiguration.cs b/algoliasearch/Abtesting/Client/GlobalConfiguration.cs new file mode 100644 index 000000000..c40fa2557 --- /dev/null +++ b/algoliasearch/Abtesting/Client/GlobalConfiguration.cs @@ -0,0 +1,61 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.Collections.Generic; + +namespace Algolia.Search.Abtesting.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .openapi-generator-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + #region Private Members + + private static readonly object GlobalConfigSync = new { }; + private static IReadableConfiguration _globalConfiguration; + + #endregion Private Members + + #region Constructors + + /// + private GlobalConfiguration() + { + } + + /// + public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath) + { + } + + static GlobalConfiguration() + { + Instance = new GlobalConfiguration(); + } + + #endregion Constructors + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static IReadableConfiguration Instance + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + } +} diff --git a/algoliasearch/Abtesting/Client/IAsynchronousClient.cs b/algoliasearch/Abtesting/Client/IAsynchronousClient.cs new file mode 100644 index 000000000..5af4f867f --- /dev/null +++ b/algoliasearch/Abtesting/Client/IAsynchronousClient.cs @@ -0,0 +1,94 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Threading.Tasks; + +namespace Algolia.Search.Abtesting.Client +{ + /// + /// Contract for Asynchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface IAsynchronousClient + { + /// + /// Executes a non-blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } +} diff --git a/algoliasearch/Abtesting/Client/IReadableConfiguration.cs b/algoliasearch/Abtesting/Client/IReadableConfiguration.cs new file mode 100644 index 000000000..0104cfd55 --- /dev/null +++ b/algoliasearch/Abtesting/Client/IReadableConfiguration.cs @@ -0,0 +1,111 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; + +namespace Algolia.Search.Abtesting.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + /// + /// Gets the API key. + /// + /// API key. + IDictionary ApiKey { get; } + + /// + /// Gets the API key prefix. + /// + /// API key prefix. + IDictionary ApiKeyPrefix { get; } + + /// + /// Gets the base path. + /// + /// Base path. + string BasePath { get; } + + /// + /// Gets the date time format. + /// + /// Date time format. + string DateTimeFormat { get; } + + /// + /// Gets the default header. + /// + /// Default header. + [Obsolete("Use DefaultHeaders instead.")] + IDictionary DefaultHeader { get; } + + /// + /// Gets the default headers. + /// + /// Default headers. + IDictionary DefaultHeaders { get; } + + /// + /// Gets the temp folder path. + /// + /// Temp folder path. + string TempFolderPath { get; } + + /// + /// Gets the HTTP connection timeout (in milliseconds) + /// + /// HTTP connection timeout. + int Timeout { get; } + + /// + /// Gets the proxy. + /// + /// Proxy. + WebProxy Proxy { get; } + + /// + /// Gets the user agent. + /// + /// User agent. + string UserAgent { get; } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + bool UseDefaultCredentials { get; } + + /// + /// Get the servers associated with the operation. + /// + /// Operation servers. + IReadOnlyDictionary>> OperationServers { get; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + string GetApiKeyWithPrefix(string apiKeyIdentifier); + + /// + /// Gets the Operation server url at the provided index. + /// + /// Operation server name. + /// Index of the operation server settings. + /// + string GetOperationServerUrl(string operation, int index); + + /// + /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and + /// overriding certificate errors in the scope of a request. + /// + RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; } + } +} diff --git a/algoliasearch/Abtesting/Client/ISynchronousClient.cs b/algoliasearch/Abtesting/Client/ISynchronousClient.cs new file mode 100644 index 000000000..57d7d752c --- /dev/null +++ b/algoliasearch/Abtesting/Client/ISynchronousClient.cs @@ -0,0 +1,87 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.IO; + +namespace Algolia.Search.Abtesting.Client +{ + /// + /// Contract for Synchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface ISynchronousClient + { + /// + /// Executes a blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null); + } +} diff --git a/algoliasearch/Abtesting/Client/Multimap.cs b/algoliasearch/Abtesting/Client/Multimap.cs new file mode 100644 index 000000000..1046f262a --- /dev/null +++ b/algoliasearch/Abtesting/Client/Multimap.cs @@ -0,0 +1,289 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Algolia.Search.Abtesting.Client +{ + /// + /// A dictionary in which one key has many associated values. + /// + /// The type of the key + /// The type of the value associated with the key. + public class Multimap : IDictionary> + { + #region Private Fields + + private readonly Dictionary> _dictionary; + + #endregion Private Fields + + #region Constructors + + /// + /// Empty Constructor. + /// + public Multimap() + { + _dictionary = new Dictionary>(); + } + + /// + /// Constructor with comparer. + /// + /// + public Multimap(IEqualityComparer comparer) + { + _dictionary = new Dictionary>(comparer); + } + + #endregion Constructors + + #region Enumerators + + /// + /// To get the enumerator. + /// + /// Enumerator + public IEnumerator>> GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + /// + /// To get the enumerator. + /// + /// Enumerator + IEnumerator IEnumerable.GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + #endregion Enumerators + + #region Public Members + /// + /// Add values to Multimap + /// + /// Key value pair + public void Add(KeyValuePair> item) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + + /// + /// Add Multimap to Multimap + /// + /// Multimap + public void Add(Multimap multimap) + { + foreach (var item in multimap) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + + /// + /// Clear Multimap + /// + public void Clear() + { + _dictionary.Clear(); + } + + /// + /// Determines whether Multimap contains the specified item. + /// + /// Key value pair + /// Method needs to be implemented + /// true if the Multimap contains the item; otherwise, false. + public bool Contains(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Copy items of the Multimap to an array, + /// starting at a particular array index. + /// + /// The array that is the destination of the items copied + /// from Multimap. The array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + /// Method needs to be implemented + public void CopyTo(KeyValuePair>[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + /// + /// Removes the specified item from the Multimap. + /// + /// Key value pair + /// true if the item is successfully removed; otherwise, false. + /// Method needs to be implemented + public bool Remove(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Gets the number of items contained in the Multimap. + /// + public int Count => _dictionary.Count; + + /// + /// Gets a value indicating whether the Multimap is read-only. + /// + public bool IsReadOnly => false; + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add the value to Multimap. + public void Add(TKey key, IList value) + { + if (value != null && value.Count > 0) + { + if (_dictionary.TryGetValue(key, out var list)) + { + foreach (var k in value) list.Add(k); + } + else + { + list = new List(value); + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + } + + /// + /// Determines whether the Multimap contains an item with the specified key. + /// + /// The key to locate in the Multimap. + /// true if the Multimap contains an item with + /// the key; otherwise, false. + public bool ContainsKey(TKey key) + { + return _dictionary.ContainsKey(key); + } + + /// + /// Removes item with the specified key from the Multimap. + /// + /// The key to locate in the Multimap. + /// true if the item is successfully removed; otherwise, false. + public bool Remove(TKey key) + { + return TryRemove(key, out var _); + } + + /// + /// Gets the value associated with the specified key. + /// + /// The key whose value to get. + /// When this method returns, the value associated with the specified key, if the + /// key is found; otherwise, the default value for the type of the value parameter. + /// This parameter is passed uninitialized. + /// true if the object that implements Multimap contains + /// an item with the specified key; otherwise, false. + public bool TryGetValue(TKey key, out IList value) + { + return _dictionary.TryGetValue(key, out value); + } + + /// + /// Gets or sets the item with the specified key. + /// + /// The key of the item to get or set. + /// The value of the specified key. + public IList this[TKey key] + { + get => _dictionary[key]; + set => _dictionary[key] = value; + } + + /// + /// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap. + /// + public ICollection Keys => _dictionary.Keys; + + /// + /// Gets a System.Collections.Generic.ICollection containing the values of the Multimap. + /// + public ICollection> Values => _dictionary.Values; + + /// + /// Copy the items of the Multimap to an System.Array, + /// starting at a particular System.Array index. + /// + /// The one-dimensional System.Array that is the destination of the items copied + /// from Multimap. The System.Array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + public void CopyTo(Array array, int index) + { + ((ICollection)_dictionary).CopyTo(array, index); + } + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add value to Multimap. + public void Add(TKey key, TValue value) + { + if (value != null) + { + if (_dictionary.TryGetValue(key, out var list)) + { + list.Add(value); + } + else + { + list = new List { value }; + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add value to Multimap."); + } + } + } + + #endregion Public Members + + #region Private Members + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryRemove(TKey key, out IList value) + { + _dictionary.TryGetValue(key, out value); + return _dictionary.Remove(key); + } + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryAdd(TKey key, IList value) + { + try + { + _dictionary.Add(key, value); + } + catch (ArgumentException) + { + return false; + } + + return true; + } + #endregion Private Members + } +} diff --git a/algoliasearch/Abtesting/Client/OpenAPIDateConverter.cs b/algoliasearch/Abtesting/Client/OpenAPIDateConverter.cs new file mode 100644 index 000000000..077e586c5 --- /dev/null +++ b/algoliasearch/Abtesting/Client/OpenAPIDateConverter.cs @@ -0,0 +1,23 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using Newtonsoft.Json.Converters; + +namespace Algolia.Search.Abtesting.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class OpenAPIDateConverter : IsoDateTimeConverter + { + /// + /// Initializes a new instance of the class. + /// + public OpenAPIDateConverter() + { + // full-date = date-fullyear "-" date-month "-" date-mday + DateTimeFormat = "yyyy-MM-dd"; + } + } +} diff --git a/algoliasearch/Abtesting/Client/RequestOptions.cs b/algoliasearch/Abtesting/Client/RequestOptions.cs new file mode 100644 index 000000000..8984cbaa6 --- /dev/null +++ b/algoliasearch/Abtesting/Client/RequestOptions.cs @@ -0,0 +1,68 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; + +namespace Algolia.Search.Abtesting.Client +{ + /// + /// A container for generalized request inputs. This type allows consumers to extend the request functionality + /// by abstracting away from the default (built-in) request framework (e.g. RestSharp). + /// + public class RequestOptions + { + /// + /// Parameters to be bound to path parts of the Request's URL + /// + public Dictionary PathParameters { get; set; } + + /// + /// Query parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap QueryParameters { get; set; } + + /// + /// Header parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap HeaderParameters { get; set; } + + /// + /// Form parameters to be sent along with the request. + /// + public Dictionary FormParameters { get; set; } + + /// + /// File parameters to be sent along with the request. + /// + public Multimap FileParameters { get; set; } + + /// + /// Cookies to be sent along with the request. + /// + public List Cookies { get; set; } + + /// + /// Any data associated with a request body. + /// + public Object Data { get; set; } + + /// + /// Constructs a new instance of + /// + public RequestOptions() + { + PathParameters = new Dictionary(); + QueryParameters = new Multimap(); + HeaderParameters = new Multimap(); + FormParameters = new Dictionary(); + FileParameters = new Multimap(); + Cookies = new List(); + } + } +} diff --git a/algoliasearch/Abtesting/Client/WebRequestPathBuilder.cs b/algoliasearch/Abtesting/Client/WebRequestPathBuilder.cs new file mode 100644 index 000000000..b85262b27 --- /dev/null +++ b/algoliasearch/Abtesting/Client/WebRequestPathBuilder.cs @@ -0,0 +1,47 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using System; +using System.Collections.Generic; + +namespace Algolia.Search.Abtesting.Client +{ + /// + /// A URI builder + /// + class WebRequestPathBuilder + { + private string _baseUrl; + private string _path; + private string _query = "?"; + public WebRequestPathBuilder(string baseUrl, string path) + { + _baseUrl = baseUrl; + _path = path; + } + + public void AddPathParameters(Dictionary parameters) + { + foreach (var parameter in parameters) + { + _path = _path.Replace("{" + parameter.Key + "}", Uri.EscapeDataString(parameter.Value)); + } + } + + public void AddQueryParameters(Multimap parameters) + { + foreach (var parameter in parameters) + { + foreach (var value in parameter.Value) + { + _query = _query + parameter.Key + "=" + Uri.EscapeDataString(value) + "&"; + } + } + } + + public string GetFullUri() + { + return _baseUrl + _path + _query.Substring(0, _query.Length - 1); + } + } +} diff --git a/algoliasearch/Abtesting/Models/ABTest.cs b/algoliasearch/Abtesting/Models/ABTest.cs new file mode 100644 index 000000000..f1f3092db --- /dev/null +++ b/algoliasearch/Abtesting/Models/ABTest.cs @@ -0,0 +1,355 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Abtesting.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Abtesting.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Abtesting.Models +{ + /// + /// ABTest + /// + [DataContract(Name = "ABTest")] + public partial class ABTest : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ABTest() { } + /// + /// Initializes a new instance of the class. + /// + /// Unique A/B test ID. (required). + /// [A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on click data. A value of 0.95 or over is considered to be _significant_. (required). + /// [A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on conversion. A value of 0.95 or over is considered to be _significant_. (required). + /// [A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on add-to-cart data. A value of 0.95 or over is considered to be _significant_. (required). + /// [A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on purchase data. A value of 0.95 or over is considered to be _significant_. (required). + /// [A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on revenue data. A value of 0.95 or over is considered to be _significant_. (required). + /// Update date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + /// Creation date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + /// End date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + /// A/B test name. (required). + /// A/B test status. (required). + /// A/B test variants. (required). + public ABTest(int abTestID = default(int), double clickSignificance = default(double), double conversionSignificance = default(double), double addToCartSignificance = default(double), double purchaseSignificance = default(double), Dictionary revenueSignificance = default(Dictionary), string updatedAt = default(string), string createdAt = default(string), string endAt = default(string), string name = default(string), string status = default(string), List variants = default(List)) + { + this.AbTestID = abTestID; + this.ClickSignificance = clickSignificance; + this.ConversionSignificance = conversionSignificance; + this.AddToCartSignificance = addToCartSignificance; + this.PurchaseSignificance = purchaseSignificance; + // to ensure "revenueSignificance" is required (not null) + if (revenueSignificance == null) + { + throw new ArgumentNullException("revenueSignificance is a required property for ABTest and cannot be null"); + } + this.RevenueSignificance = revenueSignificance; + // to ensure "updatedAt" is required (not null) + if (updatedAt == null) + { + throw new ArgumentNullException("updatedAt is a required property for ABTest and cannot be null"); + } + this.UpdatedAt = updatedAt; + // to ensure "createdAt" is required (not null) + if (createdAt == null) + { + throw new ArgumentNullException("createdAt is a required property for ABTest and cannot be null"); + } + this.CreatedAt = createdAt; + // to ensure "endAt" is required (not null) + if (endAt == null) + { + throw new ArgumentNullException("endAt is a required property for ABTest and cannot be null"); + } + this.EndAt = endAt; + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for ABTest and cannot be null"); + } + this.Name = name; + // to ensure "status" is required (not null) + if (status == null) + { + throw new ArgumentNullException("status is a required property for ABTest and cannot be null"); + } + this.Status = status; + // to ensure "variants" is required (not null) + if (variants == null) + { + throw new ArgumentNullException("variants is a required property for ABTest and cannot be null"); + } + this.Variants = variants; + } + + /// + /// Unique A/B test ID. + /// + /// Unique A/B test ID. + [DataMember(Name = "abTestID", IsRequired = true, EmitDefaultValue = true)] + public int AbTestID { get; set; } + + /// + /// [A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on click data. A value of 0.95 or over is considered to be _significant_. + /// + /// [A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on click data. A value of 0.95 or over is considered to be _significant_. + [DataMember(Name = "clickSignificance", IsRequired = true, EmitDefaultValue = true)] + public double ClickSignificance { get; set; } + + /// + /// [A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on conversion. A value of 0.95 or over is considered to be _significant_. + /// + /// [A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on conversion. A value of 0.95 or over is considered to be _significant_. + [DataMember(Name = "conversionSignificance", IsRequired = true, EmitDefaultValue = true)] + public double ConversionSignificance { get; set; } + + /// + /// [A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on add-to-cart data. A value of 0.95 or over is considered to be _significant_. + /// + /// [A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on add-to-cart data. A value of 0.95 or over is considered to be _significant_. + [DataMember(Name = "addToCartSignificance", IsRequired = true, EmitDefaultValue = true)] + public double AddToCartSignificance { get; set; } + + /// + /// [A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on purchase data. A value of 0.95 or over is considered to be _significant_. + /// + /// [A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on purchase data. A value of 0.95 or over is considered to be _significant_. + [DataMember(Name = "purchaseSignificance", IsRequired = true, EmitDefaultValue = true)] + public double PurchaseSignificance { get; set; } + + /// + /// [A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on revenue data. A value of 0.95 or over is considered to be _significant_. + /// + /// [A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on revenue data. A value of 0.95 or over is considered to be _significant_. + [DataMember(Name = "revenueSignificance", IsRequired = true, EmitDefaultValue = true)] + public Dictionary RevenueSignificance { get; set; } + + /// + /// Update date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Update date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "updatedAt", IsRequired = true, EmitDefaultValue = true)] + public string UpdatedAt { get; set; } + + /// + /// Creation date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Creation date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public string CreatedAt { get; set; } + + /// + /// End date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// End date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "endAt", IsRequired = true, EmitDefaultValue = true)] + public string EndAt { get; set; } + + /// + /// A/B test name. + /// + /// A/B test name. + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// A/B test status. + /// + /// A/B test status. + [DataMember(Name = "status", IsRequired = true, EmitDefaultValue = true)] + public string Status { get; set; } + + /// + /// A/B test variants. + /// + /// A/B test variants. + [DataMember(Name = "variants", IsRequired = true, EmitDefaultValue = true)] + public List Variants { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ABTest {\n"); + sb.Append(" AbTestID: ").Append(AbTestID).Append("\n"); + sb.Append(" ClickSignificance: ").Append(ClickSignificance).Append("\n"); + sb.Append(" ConversionSignificance: ").Append(ConversionSignificance).Append("\n"); + sb.Append(" AddToCartSignificance: ").Append(AddToCartSignificance).Append("\n"); + sb.Append(" PurchaseSignificance: ").Append(PurchaseSignificance).Append("\n"); + sb.Append(" RevenueSignificance: ").Append(RevenueSignificance).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append(" EndAt: ").Append(EndAt).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Variants: ").Append(Variants).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ABTest); + } + + /// + /// Returns true if ABTest instances are equal + /// + /// Instance of ABTest to be compared + /// Boolean + public bool Equals(ABTest input) + { + if (input == null) + { + return false; + } + return + ( + this.AbTestID == input.AbTestID || + this.AbTestID.Equals(input.AbTestID) + ) && + ( + this.ClickSignificance == input.ClickSignificance || + this.ClickSignificance.Equals(input.ClickSignificance) + ) && + ( + this.ConversionSignificance == input.ConversionSignificance || + this.ConversionSignificance.Equals(input.ConversionSignificance) + ) && + ( + this.AddToCartSignificance == input.AddToCartSignificance || + this.AddToCartSignificance.Equals(input.AddToCartSignificance) + ) && + ( + this.PurchaseSignificance == input.PurchaseSignificance || + this.PurchaseSignificance.Equals(input.PurchaseSignificance) + ) && + ( + this.RevenueSignificance == input.RevenueSignificance || + this.RevenueSignificance != null && + input.RevenueSignificance != null && + this.RevenueSignificance.SequenceEqual(input.RevenueSignificance) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ) && + ( + this.CreatedAt == input.CreatedAt || + (this.CreatedAt != null && + this.CreatedAt.Equals(input.CreatedAt)) + ) && + ( + this.EndAt == input.EndAt || + (this.EndAt != null && + this.EndAt.Equals(input.EndAt)) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Status == input.Status || + (this.Status != null && + this.Status.Equals(input.Status)) + ) && + ( + this.Variants == input.Variants || + this.Variants != null && + input.Variants != null && + this.Variants.SequenceEqual(input.Variants) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.AbTestID.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickSignificance.GetHashCode(); + hashCode = (hashCode * 59) + this.ConversionSignificance.GetHashCode(); + hashCode = (hashCode * 59) + this.AddToCartSignificance.GetHashCode(); + hashCode = (hashCode * 59) + this.PurchaseSignificance.GetHashCode(); + if (this.RevenueSignificance != null) + { + hashCode = (hashCode * 59) + this.RevenueSignificance.GetHashCode(); + } + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + if (this.CreatedAt != null) + { + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + } + if (this.EndAt != null) + { + hashCode = (hashCode * 59) + this.EndAt.GetHashCode(); + } + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.Status != null) + { + hashCode = (hashCode * 59) + this.Status.GetHashCode(); + } + if (this.Variants != null) + { + hashCode = (hashCode * 59) + this.Variants.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Abtesting/Models/ABTestResponse.cs b/algoliasearch/Abtesting/Models/ABTestResponse.cs new file mode 100644 index 000000000..15408cf26 --- /dev/null +++ b/algoliasearch/Abtesting/Models/ABTestResponse.cs @@ -0,0 +1,164 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Abtesting.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Abtesting.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Abtesting.Models +{ + /// + /// ABTestResponse + /// + [DataContract(Name = "ABTestResponse")] + public partial class ABTestResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ABTestResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// A/B test index. (required). + /// Unique A/B test ID. (required). + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. (required). + public ABTestResponse(string index = default(string), int abTestID = default(int), long taskID = default(long)) + { + // to ensure "index" is required (not null) + if (index == null) + { + throw new ArgumentNullException("index is a required property for ABTestResponse and cannot be null"); + } + this.Index = index; + this.AbTestID = abTestID; + this.TaskID = taskID; + } + + /// + /// A/B test index. + /// + /// A/B test index. + [DataMember(Name = "index", IsRequired = true, EmitDefaultValue = true)] + public string Index { get; set; } + + /// + /// Unique A/B test ID. + /// + /// Unique A/B test ID. + [DataMember(Name = "abTestID", IsRequired = true, EmitDefaultValue = true)] + public int AbTestID { get; set; } + + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + [DataMember(Name = "taskID", IsRequired = true, EmitDefaultValue = true)] + public long TaskID { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ABTestResponse {\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" AbTestID: ").Append(AbTestID).Append("\n"); + sb.Append(" TaskID: ").Append(TaskID).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ABTestResponse); + } + + /// + /// Returns true if ABTestResponse instances are equal + /// + /// Instance of ABTestResponse to be compared + /// Boolean + public bool Equals(ABTestResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.AbTestID == input.AbTestID || + this.AbTestID.Equals(input.AbTestID) + ) && + ( + this.TaskID == input.TaskID || + this.TaskID.Equals(input.TaskID) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AbTestID.GetHashCode(); + hashCode = (hashCode * 59) + this.TaskID.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Abtesting/Models/AbTestsVariant.cs b/algoliasearch/Abtesting/Models/AbTestsVariant.cs new file mode 100644 index 000000000..21eaeddcb --- /dev/null +++ b/algoliasearch/Abtesting/Models/AbTestsVariant.cs @@ -0,0 +1,168 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Abtesting.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Abtesting.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Abtesting.Models +{ + /// + /// AbTestsVariant + /// + [DataContract(Name = "abTestsVariant")] + public partial class AbTestsVariant : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AbTestsVariant() { } + /// + /// Initializes a new instance of the class. + /// + /// A/B test index. (required). + /// A/B test traffic percentage. (required). + /// A/B test description.. + public AbTestsVariant(string index = default(string), int trafficPercentage = default(int), string description = default(string)) + { + // to ensure "index" is required (not null) + if (index == null) + { + throw new ArgumentNullException("index is a required property for AbTestsVariant and cannot be null"); + } + this.Index = index; + this.TrafficPercentage = trafficPercentage; + this.Description = description; + } + + /// + /// A/B test index. + /// + /// A/B test index. + [DataMember(Name = "index", IsRequired = true, EmitDefaultValue = true)] + public string Index { get; set; } + + /// + /// A/B test traffic percentage. + /// + /// A/B test traffic percentage. + [DataMember(Name = "trafficPercentage", IsRequired = true, EmitDefaultValue = true)] + public int TrafficPercentage { get; set; } + + /// + /// A/B test description. + /// + /// A/B test description. + [DataMember(Name = "description", EmitDefaultValue = false)] + public string Description { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AbTestsVariant {\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" TrafficPercentage: ").Append(TrafficPercentage).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AbTestsVariant); + } + + /// + /// Returns true if AbTestsVariant instances are equal + /// + /// Instance of AbTestsVariant to be compared + /// Boolean + public bool Equals(AbTestsVariant input) + { + if (input == null) + { + return false; + } + return + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.TrafficPercentage == input.TrafficPercentage || + this.TrafficPercentage.Equals(input.TrafficPercentage) + ) && + ( + this.Description == input.Description || + (this.Description != null && + this.Description.Equals(input.Description)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + hashCode = (hashCode * 59) + this.TrafficPercentage.GetHashCode(); + if (this.Description != null) + { + hashCode = (hashCode * 59) + this.Description.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Abtesting/Models/AbTestsVariantSearchParams.cs b/algoliasearch/Abtesting/Models/AbTestsVariantSearchParams.cs new file mode 100644 index 000000000..7c51ebf9b --- /dev/null +++ b/algoliasearch/Abtesting/Models/AbTestsVariantSearchParams.cs @@ -0,0 +1,191 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Abtesting.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Abtesting.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Abtesting.Models +{ + /// + /// AbTestsVariantSearchParams + /// + [DataContract(Name = "abTestsVariantSearchParams")] + public partial class AbTestsVariantSearchParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AbTestsVariantSearchParams() { } + /// + /// Initializes a new instance of the class. + /// + /// A/B test index. (required). + /// A/B test traffic percentage. (required). + /// A/B test description.. + /// customSearchParameters (required). + public AbTestsVariantSearchParams(string index = default(string), int trafficPercentage = default(int), string description = default(string), Object customSearchParameters = default(Object)) + { + // to ensure "index" is required (not null) + if (index == null) + { + throw new ArgumentNullException("index is a required property for AbTestsVariantSearchParams and cannot be null"); + } + this.Index = index; + this.TrafficPercentage = trafficPercentage; + // to ensure "customSearchParameters" is required (not null) + if (customSearchParameters == null) + { + throw new ArgumentNullException("customSearchParameters is a required property for AbTestsVariantSearchParams and cannot be null"); + } + this.CustomSearchParameters = customSearchParameters; + this.Description = description; + } + + /// + /// A/B test index. + /// + /// A/B test index. + [DataMember(Name = "index", IsRequired = true, EmitDefaultValue = true)] + public string Index { get; set; } + + /// + /// A/B test traffic percentage. + /// + /// A/B test traffic percentage. + [DataMember(Name = "trafficPercentage", IsRequired = true, EmitDefaultValue = true)] + public int TrafficPercentage { get; set; } + + /// + /// A/B test description. + /// + /// A/B test description. + [DataMember(Name = "description", EmitDefaultValue = false)] + public string Description { get; set; } + + /// + /// Gets or Sets CustomSearchParameters + /// + [DataMember(Name = "customSearchParameters", IsRequired = true, EmitDefaultValue = true)] + public Object CustomSearchParameters { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AbTestsVariantSearchParams {\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" TrafficPercentage: ").Append(TrafficPercentage).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append(" CustomSearchParameters: ").Append(CustomSearchParameters).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AbTestsVariantSearchParams); + } + + /// + /// Returns true if AbTestsVariantSearchParams instances are equal + /// + /// Instance of AbTestsVariantSearchParams to be compared + /// Boolean + public bool Equals(AbTestsVariantSearchParams input) + { + if (input == null) + { + return false; + } + return + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.TrafficPercentage == input.TrafficPercentage || + this.TrafficPercentage.Equals(input.TrafficPercentage) + ) && + ( + this.Description == input.Description || + (this.Description != null && + this.Description.Equals(input.Description)) + ) && + ( + this.CustomSearchParameters == input.CustomSearchParameters || + (this.CustomSearchParameters != null && + this.CustomSearchParameters.Equals(input.CustomSearchParameters)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + hashCode = (hashCode * 59) + this.TrafficPercentage.GetHashCode(); + if (this.Description != null) + { + hashCode = (hashCode * 59) + this.Description.GetHashCode(); + } + if (this.CustomSearchParameters != null) + { + hashCode = (hashCode * 59) + this.CustomSearchParameters.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Abtesting/Models/AbstractOpenAPISchema.cs b/algoliasearch/Abtesting/Models/AbstractOpenAPISchema.cs new file mode 100644 index 000000000..859402016 --- /dev/null +++ b/algoliasearch/Abtesting/Models/AbstractOpenAPISchema.cs @@ -0,0 +1,70 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace Algolia.Search.Abtesting.Models +{ + /// + /// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification + /// + public abstract partial class AbstractOpenAPISchema + { + /// + /// Custom JSON serializer + /// + static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Error, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Custom JSON serializer for objects with additional properties + /// + static public readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Ignore, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Gets or Sets the actual instance + /// + public abstract Object ActualInstance { get; set; } + + /// + /// Gets or Sets IsNullable to indicate whether the instance is nullable + /// + public bool IsNullable { get; protected set; } + + /// + /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf` + /// + public string SchemaType { get; protected set; } + + /// + /// Converts the instance into JSON string. + /// + public abstract string ToJson(); + } +} diff --git a/algoliasearch/Abtesting/Models/AddABTestsRequest.cs b/algoliasearch/Abtesting/Models/AddABTestsRequest.cs new file mode 100644 index 000000000..97f12a7b3 --- /dev/null +++ b/algoliasearch/Abtesting/Models/AddABTestsRequest.cs @@ -0,0 +1,183 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Abtesting.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Abtesting.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Abtesting.Models +{ + /// + /// AddABTestsRequest + /// + [DataContract(Name = "addABTestsRequest")] + public partial class AddABTestsRequest : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AddABTestsRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// A/B test name. (required). + /// A/B test variants. (required). + /// End date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + public AddABTestsRequest(string name = default(string), List variants = default(List), string endAt = default(string)) + { + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for AddABTestsRequest and cannot be null"); + } + this.Name = name; + // to ensure "variants" is required (not null) + if (variants == null) + { + throw new ArgumentNullException("variants is a required property for AddABTestsRequest and cannot be null"); + } + this.Variants = variants; + // to ensure "endAt" is required (not null) + if (endAt == null) + { + throw new ArgumentNullException("endAt is a required property for AddABTestsRequest and cannot be null"); + } + this.EndAt = endAt; + } + + /// + /// A/B test name. + /// + /// A/B test name. + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// A/B test variants. + /// + /// A/B test variants. + [DataMember(Name = "variants", IsRequired = true, EmitDefaultValue = true)] + public List Variants { get; set; } + + /// + /// End date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// End date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "endAt", IsRequired = true, EmitDefaultValue = true)] + public string EndAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AddABTestsRequest {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Variants: ").Append(Variants).Append("\n"); + sb.Append(" EndAt: ").Append(EndAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AddABTestsRequest); + } + + /// + /// Returns true if AddABTestsRequest instances are equal + /// + /// Instance of AddABTestsRequest to be compared + /// Boolean + public bool Equals(AddABTestsRequest input) + { + if (input == null) + { + return false; + } + return + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Variants == input.Variants || + this.Variants != null && + input.Variants != null && + this.Variants.SequenceEqual(input.Variants) + ) && + ( + this.EndAt == input.EndAt || + (this.EndAt != null && + this.EndAt.Equals(input.EndAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.Variants != null) + { + hashCode = (hashCode * 59) + this.Variants.GetHashCode(); + } + if (this.EndAt != null) + { + hashCode = (hashCode * 59) + this.EndAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Abtesting/Models/AddABTestsVariant.cs b/algoliasearch/Abtesting/Models/AddABTestsVariant.cs new file mode 100644 index 000000000..be902b41c --- /dev/null +++ b/algoliasearch/Abtesting/Models/AddABTestsVariant.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Abtesting.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Abtesting.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Abtesting.Models +{ + /// + /// AddABTestsVariant + /// + [JsonConverter(typeof(AddABTestsVariantJsonConverter))] + [DataContract(Name = "AddABTestsVariant")] + public partial class AddABTestsVariant : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of AbTestsVariant. + public AddABTestsVariant(AbTestsVariant actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of AbTestsVariantSearchParams. + public AddABTestsVariant(AbTestsVariantSearchParams actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(AbTestsVariant)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(AbTestsVariantSearchParams)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: AbTestsVariant, AbTestsVariantSearchParams"); + } + } + } + + /// + /// Get the actual instance of `AbTestsVariant`. If the actual instance is not `AbTestsVariant`, + /// the InvalidClassException will be thrown + /// + /// An instance of AbTestsVariant + public AbTestsVariant GetterAbTestsVariant() + { + return (AbTestsVariant)this.ActualInstance; + } + + /// + /// Get the actual instance of `AbTestsVariantSearchParams`. If the actual instance is not `AbTestsVariantSearchParams`, + /// the InvalidClassException will be thrown + /// + /// An instance of AbTestsVariantSearchParams + public AbTestsVariantSearchParams GetterAbTestsVariantSearchParams() + { + return (AbTestsVariantSearchParams)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class AddABTestsVariant {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, AddABTestsVariant.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of AddABTestsVariant + /// + /// JSON string + /// An instance of AddABTestsVariant + public static AddABTestsVariant FromJson(string jsonString) + { + AddABTestsVariant newAddABTestsVariant = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newAddABTestsVariant; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(AbTestsVariant).GetProperty("AdditionalProperties") == null) + { + newAddABTestsVariant = new AddABTestsVariant(JsonConvert.DeserializeObject(jsonString, AddABTestsVariant.SerializerSettings)); + } + else + { + newAddABTestsVariant = new AddABTestsVariant(JsonConvert.DeserializeObject(jsonString, AddABTestsVariant.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("AbTestsVariant"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into AbTestsVariant: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(AbTestsVariantSearchParams).GetProperty("AdditionalProperties") == null) + { + newAddABTestsVariant = new AddABTestsVariant(JsonConvert.DeserializeObject(jsonString, AddABTestsVariant.SerializerSettings)); + } + else + { + newAddABTestsVariant = new AddABTestsVariant(JsonConvert.DeserializeObject(jsonString, AddABTestsVariant.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("AbTestsVariantSearchParams"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into AbTestsVariantSearchParams: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newAddABTestsVariant; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AddABTestsVariant); + } + + /// + /// Returns true if AddABTestsVariant instances are equal + /// + /// Instance of AddABTestsVariant to be compared + /// Boolean + public bool Equals(AddABTestsVariant input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for AddABTestsVariant + /// + public class AddABTestsVariantJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(AddABTestsVariant).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return AddABTestsVariant.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Abtesting/Models/CurrenciesValue.cs b/algoliasearch/Abtesting/Models/CurrenciesValue.cs new file mode 100644 index 000000000..b23e2eda2 --- /dev/null +++ b/algoliasearch/Abtesting/Models/CurrenciesValue.cs @@ -0,0 +1,169 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Abtesting.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Abtesting.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Abtesting.Models +{ + /// + /// CurrenciesValue + /// + [DataContract(Name = "currencies_value")] + public partial class CurrenciesValue : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Currency code.. + /// Revenue for this currency.. + /// Mean for this currency.. + /// Standard deviation for this currency.. + public CurrenciesValue(string currency = default(string), double revenue = default(double), double mean = default(double), double standardDeviation = default(double)) + { + this.Currency = currency; + this.Revenue = revenue; + this.Mean = mean; + this.StandardDeviation = standardDeviation; + } + + /// + /// Currency code. + /// + /// Currency code. + [DataMember(Name = "currency", EmitDefaultValue = false)] + public string Currency { get; set; } + + /// + /// Revenue for this currency. + /// + /// Revenue for this currency. + [DataMember(Name = "revenue", EmitDefaultValue = false)] + public double Revenue { get; set; } + + /// + /// Mean for this currency. + /// + /// Mean for this currency. + [DataMember(Name = "mean", EmitDefaultValue = false)] + public double Mean { get; set; } + + /// + /// Standard deviation for this currency. + /// + /// Standard deviation for this currency. + [DataMember(Name = "standardDeviation", EmitDefaultValue = false)] + public double StandardDeviation { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class CurrenciesValue {\n"); + sb.Append(" Currency: ").Append(Currency).Append("\n"); + sb.Append(" Revenue: ").Append(Revenue).Append("\n"); + sb.Append(" Mean: ").Append(Mean).Append("\n"); + sb.Append(" StandardDeviation: ").Append(StandardDeviation).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as CurrenciesValue); + } + + /// + /// Returns true if CurrenciesValue instances are equal + /// + /// Instance of CurrenciesValue to be compared + /// Boolean + public bool Equals(CurrenciesValue input) + { + if (input == null) + { + return false; + } + return + ( + this.Currency == input.Currency || + (this.Currency != null && + this.Currency.Equals(input.Currency)) + ) && + ( + this.Revenue == input.Revenue || + this.Revenue.Equals(input.Revenue) + ) && + ( + this.Mean == input.Mean || + this.Mean.Equals(input.Mean) + ) && + ( + this.StandardDeviation == input.StandardDeviation || + this.StandardDeviation.Equals(input.StandardDeviation) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Currency != null) + { + hashCode = (hashCode * 59) + this.Currency.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Revenue.GetHashCode(); + hashCode = (hashCode * 59) + this.Mean.GetHashCode(); + hashCode = (hashCode * 59) + this.StandardDeviation.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Abtesting/Models/CustomSearchParams.cs b/algoliasearch/Abtesting/Models/CustomSearchParams.cs new file mode 100644 index 000000000..7ae91cb90 --- /dev/null +++ b/algoliasearch/Abtesting/Models/CustomSearchParams.cs @@ -0,0 +1,133 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Abtesting.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Abtesting.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Abtesting.Models +{ + /// + /// Applies search parameters from [a restricted set of options](https://www.algolia.com/doc/api-reference/api-methods/add-ab-test/#method-param-customsearchparameters). Only use this parameter if the two variants use the same index. + /// + [DataContract(Name = "customSearchParams")] + public partial class CustomSearchParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected CustomSearchParams() { } + /// + /// Initializes a new instance of the class. + /// + /// customSearchParameters (required). + public CustomSearchParams(Object customSearchParameters = default(Object)) + { + // to ensure "customSearchParameters" is required (not null) + if (customSearchParameters == null) + { + throw new ArgumentNullException("customSearchParameters is a required property for CustomSearchParams and cannot be null"); + } + this.CustomSearchParameters = customSearchParameters; + } + + /// + /// Gets or Sets CustomSearchParameters + /// + [DataMember(Name = "customSearchParameters", IsRequired = true, EmitDefaultValue = true)] + public Object CustomSearchParameters { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class CustomSearchParams {\n"); + sb.Append(" CustomSearchParameters: ").Append(CustomSearchParameters).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as CustomSearchParams); + } + + /// + /// Returns true if CustomSearchParams instances are equal + /// + /// Instance of CustomSearchParams to be compared + /// Boolean + public bool Equals(CustomSearchParams input) + { + if (input == null) + { + return false; + } + return + ( + this.CustomSearchParameters == input.CustomSearchParameters || + (this.CustomSearchParameters != null && + this.CustomSearchParameters.Equals(input.CustomSearchParameters)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.CustomSearchParameters != null) + { + hashCode = (hashCode * 59) + this.CustomSearchParameters.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Abtesting/Models/ErrorBase.cs b/algoliasearch/Abtesting/Models/ErrorBase.cs new file mode 100644 index 000000000..47b95c193 --- /dev/null +++ b/algoliasearch/Abtesting/Models/ErrorBase.cs @@ -0,0 +1,147 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Abtesting.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Abtesting.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Abtesting.Models +{ + /// + /// Error. + /// + [DataContract(Name = "ErrorBase")] + public partial class ErrorBase : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// message. + public ErrorBase(string message = default(string)) : base() + { + this.Message = message; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Message + /// + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ErrorBase {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ErrorBase); + } + + /// + /// Returns true if ErrorBase instances are equal + /// + /// Instance of ErrorBase to be compared + /// Boolean + public bool Equals(ErrorBase input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Abtesting/Models/FilterEffects.cs b/algoliasearch/Abtesting/Models/FilterEffects.cs new file mode 100644 index 000000000..6a407cfbd --- /dev/null +++ b/algoliasearch/Abtesting/Models/FilterEffects.cs @@ -0,0 +1,141 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Abtesting.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Abtesting.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Abtesting.Models +{ + /// + /// A/B test filter effects resulting from configuration settings. + /// + [DataContract(Name = "filterEffects")] + public partial class FilterEffects : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// outliers. + /// emptySearch. + public FilterEffects(FilterEffectsOutliers outliers = default(FilterEffectsOutliers), FilterEffectsEmptySearch emptySearch = default(FilterEffectsEmptySearch)) + { + this.Outliers = outliers; + this.EmptySearch = emptySearch; + } + + /// + /// Gets or Sets Outliers + /// + [DataMember(Name = "outliers", EmitDefaultValue = false)] + public FilterEffectsOutliers Outliers { get; set; } + + /// + /// Gets or Sets EmptySearch + /// + [DataMember(Name = "emptySearch", EmitDefaultValue = false)] + public FilterEffectsEmptySearch EmptySearch { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FilterEffects {\n"); + sb.Append(" Outliers: ").Append(Outliers).Append("\n"); + sb.Append(" EmptySearch: ").Append(EmptySearch).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FilterEffects); + } + + /// + /// Returns true if FilterEffects instances are equal + /// + /// Instance of FilterEffects to be compared + /// Boolean + public bool Equals(FilterEffects input) + { + if (input == null) + { + return false; + } + return + ( + this.Outliers == input.Outliers || + (this.Outliers != null && + this.Outliers.Equals(input.Outliers)) + ) && + ( + this.EmptySearch == input.EmptySearch || + (this.EmptySearch != null && + this.EmptySearch.Equals(input.EmptySearch)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Outliers != null) + { + hashCode = (hashCode * 59) + this.Outliers.GetHashCode(); + } + if (this.EmptySearch != null) + { + hashCode = (hashCode * 59) + this.EmptySearch.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Abtesting/Models/FilterEffectsEmptySearch.cs b/algoliasearch/Abtesting/Models/FilterEffectsEmptySearch.cs new file mode 100644 index 000000000..3fa080a2a --- /dev/null +++ b/algoliasearch/Abtesting/Models/FilterEffectsEmptySearch.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Abtesting.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Abtesting.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Abtesting.Models +{ + /// + /// Empty searches removed from the A/B test as a result of configuration settings. + /// + [DataContract(Name = "filterEffects_emptySearch")] + public partial class FilterEffectsEmptySearch : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Number of users removed from the A/B test.. + /// Number of tracked searches removed from the A/B test.. + public FilterEffectsEmptySearch(int usersCount = default(int), int trackedSearchesCount = default(int)) + { + this.UsersCount = usersCount; + this.TrackedSearchesCount = trackedSearchesCount; + } + + /// + /// Number of users removed from the A/B test. + /// + /// Number of users removed from the A/B test. + [DataMember(Name = "usersCount", EmitDefaultValue = false)] + public int UsersCount { get; set; } + + /// + /// Number of tracked searches removed from the A/B test. + /// + /// Number of tracked searches removed from the A/B test. + [DataMember(Name = "trackedSearchesCount", EmitDefaultValue = false)] + public int TrackedSearchesCount { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FilterEffectsEmptySearch {\n"); + sb.Append(" UsersCount: ").Append(UsersCount).Append("\n"); + sb.Append(" TrackedSearchesCount: ").Append(TrackedSearchesCount).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FilterEffectsEmptySearch); + } + + /// + /// Returns true if FilterEffectsEmptySearch instances are equal + /// + /// Instance of FilterEffectsEmptySearch to be compared + /// Boolean + public bool Equals(FilterEffectsEmptySearch input) + { + if (input == null) + { + return false; + } + return + ( + this.UsersCount == input.UsersCount || + this.UsersCount.Equals(input.UsersCount) + ) && + ( + this.TrackedSearchesCount == input.TrackedSearchesCount || + this.TrackedSearchesCount.Equals(input.TrackedSearchesCount) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.UsersCount.GetHashCode(); + hashCode = (hashCode * 59) + this.TrackedSearchesCount.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Abtesting/Models/FilterEffectsOutliers.cs b/algoliasearch/Abtesting/Models/FilterEffectsOutliers.cs new file mode 100644 index 000000000..0c8c6f0e4 --- /dev/null +++ b/algoliasearch/Abtesting/Models/FilterEffectsOutliers.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Abtesting.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Abtesting.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Abtesting.Models +{ + /// + /// Outliers removed from the A/B test as a result of configuration settings. + /// + [DataContract(Name = "filterEffects_outliers")] + public partial class FilterEffectsOutliers : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Number of users removed from the A/B test.. + /// Number of tracked searches removed from the A/B test.. + public FilterEffectsOutliers(int usersCount = default(int), int trackedSearchesCount = default(int)) + { + this.UsersCount = usersCount; + this.TrackedSearchesCount = trackedSearchesCount; + } + + /// + /// Number of users removed from the A/B test. + /// + /// Number of users removed from the A/B test. + [DataMember(Name = "usersCount", EmitDefaultValue = false)] + public int UsersCount { get; set; } + + /// + /// Number of tracked searches removed from the A/B test. + /// + /// Number of tracked searches removed from the A/B test. + [DataMember(Name = "trackedSearchesCount", EmitDefaultValue = false)] + public int TrackedSearchesCount { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FilterEffectsOutliers {\n"); + sb.Append(" UsersCount: ").Append(UsersCount).Append("\n"); + sb.Append(" TrackedSearchesCount: ").Append(TrackedSearchesCount).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FilterEffectsOutliers); + } + + /// + /// Returns true if FilterEffectsOutliers instances are equal + /// + /// Instance of FilterEffectsOutliers to be compared + /// Boolean + public bool Equals(FilterEffectsOutliers input) + { + if (input == null) + { + return false; + } + return + ( + this.UsersCount == input.UsersCount || + this.UsersCount.Equals(input.UsersCount) + ) && + ( + this.TrackedSearchesCount == input.TrackedSearchesCount || + this.TrackedSearchesCount.Equals(input.TrackedSearchesCount) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.UsersCount.GetHashCode(); + hashCode = (hashCode * 59) + this.TrackedSearchesCount.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Abtesting/Models/ListABTestsResponse.cs b/algoliasearch/Abtesting/Models/ListABTestsResponse.cs new file mode 100644 index 000000000..98abff44b --- /dev/null +++ b/algoliasearch/Abtesting/Models/ListABTestsResponse.cs @@ -0,0 +1,165 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Abtesting.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Abtesting.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Abtesting.Models +{ + /// + /// ListABTestsResponse + /// + [DataContract(Name = "listABTestsResponse")] + public partial class ListABTestsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ListABTestsResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// A/B tests. (required). + /// Number of A/B tests implemented. (required). + /// Number of retrievable A/B tests. (required). + public ListABTestsResponse(List abtests = default(List), int count = default(int), int total = default(int)) + { + // to ensure "abtests" is required (not null) + if (abtests == null) + { + throw new ArgumentNullException("abtests is a required property for ListABTestsResponse and cannot be null"); + } + this.Abtests = abtests; + this.Count = count; + this.Total = total; + } + + /// + /// A/B tests. + /// + /// A/B tests. + [DataMember(Name = "abtests", IsRequired = true, EmitDefaultValue = true)] + public List Abtests { get; set; } + + /// + /// Number of A/B tests implemented. + /// + /// Number of A/B tests implemented. + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Number of retrievable A/B tests. + /// + /// Number of retrievable A/B tests. + [DataMember(Name = "total", IsRequired = true, EmitDefaultValue = true)] + public int Total { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ListABTestsResponse {\n"); + sb.Append(" Abtests: ").Append(Abtests).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" Total: ").Append(Total).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ListABTestsResponse); + } + + /// + /// Returns true if ListABTestsResponse instances are equal + /// + /// Instance of ListABTestsResponse to be compared + /// Boolean + public bool Equals(ListABTestsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Abtests == input.Abtests || + this.Abtests != null && + input.Abtests != null && + this.Abtests.SequenceEqual(input.Abtests) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ) && + ( + this.Total == input.Total || + this.Total.Equals(input.Total) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Abtests != null) + { + hashCode = (hashCode * 59) + this.Abtests.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + hashCode = (hashCode * 59) + this.Total.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Abtesting/Models/Variant.cs b/algoliasearch/Abtesting/Models/Variant.cs new file mode 100644 index 000000000..9b0cf67e3 --- /dev/null +++ b/algoliasearch/Abtesting/Models/Variant.cs @@ -0,0 +1,411 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Abtesting.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Abtesting.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Abtesting.Models +{ + /// + /// Variant + /// + [DataContract(Name = "variant")] + public partial class Variant : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Variant() { } + /// + /// Initializes a new instance of the class. + /// + /// Number of add-to-cart events for this variant. (required). + /// Variant's [add-to-cart rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#add-to-cart-rate). (required). + /// Variant's [average click position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position). (required). + /// Number of click events for this variant. (required). + /// Variant's [click-through rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). (required). + /// Number of click events for this variant. (required). + /// Variant's [conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). (required). + /// A/B test currencies. (required). + /// A/B test description. (required). + /// filterEffects. + /// A/B test index. (required). + /// Number of [searches without results](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#searches-without-results) for that variant. (required). + /// Number of purchase events for this variant. (required). + /// Variant's [purchase rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#purchase-rate). (required). + /// Number of searches carried out during the A/B test. (required). + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. (required). + /// A/B test traffic percentage. (required). + /// Number of users during the A/B test. (required). + public Variant(int addToCartCount = default(int), double addToCartRate = default(double), int averageClickPosition = default(int), int clickCount = default(int), double clickThroughRate = default(double), int conversionCount = default(int), double conversionRate = default(double), Dictionary currencies = default(Dictionary), string description = default(string), FilterEffects filterEffects = default(FilterEffects), string index = default(string), int noResultCount = default(int), int purchaseCount = default(int), double purchaseRate = default(double), int searchCount = default(int), int trackedSearchCount = default(int), int trafficPercentage = default(int), int userCount = default(int)) + { + this.AddToCartCount = addToCartCount; + this.AddToCartRate = addToCartRate; + this.AverageClickPosition = averageClickPosition; + this.ClickCount = clickCount; + this.ClickThroughRate = clickThroughRate; + this.ConversionCount = conversionCount; + this.ConversionRate = conversionRate; + // to ensure "currencies" is required (not null) + if (currencies == null) + { + throw new ArgumentNullException("currencies is a required property for Variant and cannot be null"); + } + this.Currencies = currencies; + // to ensure "description" is required (not null) + if (description == null) + { + throw new ArgumentNullException("description is a required property for Variant and cannot be null"); + } + this.Description = description; + // to ensure "index" is required (not null) + if (index == null) + { + throw new ArgumentNullException("index is a required property for Variant and cannot be null"); + } + this.Index = index; + this.NoResultCount = noResultCount; + this.PurchaseCount = purchaseCount; + this.PurchaseRate = purchaseRate; + this.SearchCount = searchCount; + this.TrackedSearchCount = trackedSearchCount; + this.TrafficPercentage = trafficPercentage; + this.UserCount = userCount; + this.FilterEffects = filterEffects; + } + + /// + /// Number of add-to-cart events for this variant. + /// + /// Number of add-to-cart events for this variant. + [DataMember(Name = "addToCartCount", IsRequired = true, EmitDefaultValue = true)] + public int AddToCartCount { get; set; } + + /// + /// Variant's [add-to-cart rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#add-to-cart-rate). + /// + /// Variant's [add-to-cart rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#add-to-cart-rate). + [DataMember(Name = "addToCartRate", IsRequired = true, EmitDefaultValue = true)] + public double AddToCartRate { get; set; } + + /// + /// Variant's [average click position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position). + /// + /// Variant's [average click position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position). + [DataMember(Name = "averageClickPosition", IsRequired = true, EmitDefaultValue = true)] + public int AverageClickPosition { get; set; } + + /// + /// Number of click events for this variant. + /// + /// Number of click events for this variant. + [DataMember(Name = "clickCount", IsRequired = true, EmitDefaultValue = true)] + public int ClickCount { get; set; } + + /// + /// Variant's [click-through rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// Variant's [click-through rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + [DataMember(Name = "clickThroughRate", IsRequired = true, EmitDefaultValue = true)] + public double ClickThroughRate { get; set; } + + /// + /// Number of click events for this variant. + /// + /// Number of click events for this variant. + [DataMember(Name = "conversionCount", IsRequired = true, EmitDefaultValue = true)] + public int ConversionCount { get; set; } + + /// + /// Variant's [conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). + /// + /// Variant's [conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). + [DataMember(Name = "conversionRate", IsRequired = true, EmitDefaultValue = true)] + public double ConversionRate { get; set; } + + /// + /// A/B test currencies. + /// + /// A/B test currencies. + [DataMember(Name = "currencies", IsRequired = true, EmitDefaultValue = true)] + public Dictionary Currencies { get; set; } + + /// + /// A/B test description. + /// + /// A/B test description. + [DataMember(Name = "description", IsRequired = true, EmitDefaultValue = true)] + public string Description { get; set; } + + /// + /// Gets or Sets FilterEffects + /// + [DataMember(Name = "filterEffects", EmitDefaultValue = false)] + public FilterEffects FilterEffects { get; set; } + + /// + /// A/B test index. + /// + /// A/B test index. + [DataMember(Name = "index", IsRequired = true, EmitDefaultValue = true)] + public string Index { get; set; } + + /// + /// Number of [searches without results](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#searches-without-results) for that variant. + /// + /// Number of [searches without results](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#searches-without-results) for that variant. + [DataMember(Name = "noResultCount", IsRequired = true, EmitDefaultValue = true)] + public int NoResultCount { get; set; } + + /// + /// Number of purchase events for this variant. + /// + /// Number of purchase events for this variant. + [DataMember(Name = "purchaseCount", IsRequired = true, EmitDefaultValue = true)] + public int PurchaseCount { get; set; } + + /// + /// Variant's [purchase rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#purchase-rate). + /// + /// Variant's [purchase rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#purchase-rate). + [DataMember(Name = "purchaseRate", IsRequired = true, EmitDefaultValue = true)] + public double PurchaseRate { get; set; } + + /// + /// Number of searches carried out during the A/B test. + /// + /// Number of searches carried out during the A/B test. + [DataMember(Name = "searchCount", IsRequired = true, EmitDefaultValue = true)] + public int SearchCount { get; set; } + + /// + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. + /// + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. + [DataMember(Name = "trackedSearchCount", IsRequired = true, EmitDefaultValue = true)] + public int TrackedSearchCount { get; set; } + + /// + /// A/B test traffic percentage. + /// + /// A/B test traffic percentage. + [DataMember(Name = "trafficPercentage", IsRequired = true, EmitDefaultValue = true)] + public int TrafficPercentage { get; set; } + + /// + /// Number of users during the A/B test. + /// + /// Number of users during the A/B test. + [DataMember(Name = "userCount", IsRequired = true, EmitDefaultValue = true)] + public int UserCount { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Variant {\n"); + sb.Append(" AddToCartCount: ").Append(AddToCartCount).Append("\n"); + sb.Append(" AddToCartRate: ").Append(AddToCartRate).Append("\n"); + sb.Append(" AverageClickPosition: ").Append(AverageClickPosition).Append("\n"); + sb.Append(" ClickCount: ").Append(ClickCount).Append("\n"); + sb.Append(" ClickThroughRate: ").Append(ClickThroughRate).Append("\n"); + sb.Append(" ConversionCount: ").Append(ConversionCount).Append("\n"); + sb.Append(" ConversionRate: ").Append(ConversionRate).Append("\n"); + sb.Append(" Currencies: ").Append(Currencies).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append(" FilterEffects: ").Append(FilterEffects).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" NoResultCount: ").Append(NoResultCount).Append("\n"); + sb.Append(" PurchaseCount: ").Append(PurchaseCount).Append("\n"); + sb.Append(" PurchaseRate: ").Append(PurchaseRate).Append("\n"); + sb.Append(" SearchCount: ").Append(SearchCount).Append("\n"); + sb.Append(" TrackedSearchCount: ").Append(TrackedSearchCount).Append("\n"); + sb.Append(" TrafficPercentage: ").Append(TrafficPercentage).Append("\n"); + sb.Append(" UserCount: ").Append(UserCount).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Variant); + } + + /// + /// Returns true if Variant instances are equal + /// + /// Instance of Variant to be compared + /// Boolean + public bool Equals(Variant input) + { + if (input == null) + { + return false; + } + return + ( + this.AddToCartCount == input.AddToCartCount || + this.AddToCartCount.Equals(input.AddToCartCount) + ) && + ( + this.AddToCartRate == input.AddToCartRate || + this.AddToCartRate.Equals(input.AddToCartRate) + ) && + ( + this.AverageClickPosition == input.AverageClickPosition || + this.AverageClickPosition.Equals(input.AverageClickPosition) + ) && + ( + this.ClickCount == input.ClickCount || + this.ClickCount.Equals(input.ClickCount) + ) && + ( + this.ClickThroughRate == input.ClickThroughRate || + this.ClickThroughRate.Equals(input.ClickThroughRate) + ) && + ( + this.ConversionCount == input.ConversionCount || + this.ConversionCount.Equals(input.ConversionCount) + ) && + ( + this.ConversionRate == input.ConversionRate || + this.ConversionRate.Equals(input.ConversionRate) + ) && + ( + this.Currencies == input.Currencies || + this.Currencies != null && + input.Currencies != null && + this.Currencies.SequenceEqual(input.Currencies) + ) && + ( + this.Description == input.Description || + (this.Description != null && + this.Description.Equals(input.Description)) + ) && + ( + this.FilterEffects == input.FilterEffects || + (this.FilterEffects != null && + this.FilterEffects.Equals(input.FilterEffects)) + ) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.NoResultCount == input.NoResultCount || + this.NoResultCount.Equals(input.NoResultCount) + ) && + ( + this.PurchaseCount == input.PurchaseCount || + this.PurchaseCount.Equals(input.PurchaseCount) + ) && + ( + this.PurchaseRate == input.PurchaseRate || + this.PurchaseRate.Equals(input.PurchaseRate) + ) && + ( + this.SearchCount == input.SearchCount || + this.SearchCount.Equals(input.SearchCount) + ) && + ( + this.TrackedSearchCount == input.TrackedSearchCount || + this.TrackedSearchCount.Equals(input.TrackedSearchCount) + ) && + ( + this.TrafficPercentage == input.TrafficPercentage || + this.TrafficPercentage.Equals(input.TrafficPercentage) + ) && + ( + this.UserCount == input.UserCount || + this.UserCount.Equals(input.UserCount) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.AddToCartCount.GetHashCode(); + hashCode = (hashCode * 59) + this.AddToCartRate.GetHashCode(); + hashCode = (hashCode * 59) + this.AverageClickPosition.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickCount.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickThroughRate.GetHashCode(); + hashCode = (hashCode * 59) + this.ConversionCount.GetHashCode(); + hashCode = (hashCode * 59) + this.ConversionRate.GetHashCode(); + if (this.Currencies != null) + { + hashCode = (hashCode * 59) + this.Currencies.GetHashCode(); + } + if (this.Description != null) + { + hashCode = (hashCode * 59) + this.Description.GetHashCode(); + } + if (this.FilterEffects != null) + { + hashCode = (hashCode * 59) + this.FilterEffects.GetHashCode(); + } + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NoResultCount.GetHashCode(); + hashCode = (hashCode * 59) + this.PurchaseCount.GetHashCode(); + hashCode = (hashCode * 59) + this.PurchaseRate.GetHashCode(); + hashCode = (hashCode * 59) + this.SearchCount.GetHashCode(); + hashCode = (hashCode * 59) + this.TrackedSearchCount.GetHashCode(); + hashCode = (hashCode * 59) + this.TrafficPercentage.GetHashCode(); + hashCode = (hashCode * 59) + this.UserCount.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Algolia.Search.csproj b/algoliasearch/Algolia.Search.csproj new file mode 100644 index 000000000..33a38fccc --- /dev/null +++ b/algoliasearch/Algolia.Search.csproj @@ -0,0 +1,34 @@ + + + + false + netstandard2.0 + Algolia.Search + Algolia.Search + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Algolia.Search + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Algolia.Search.xml + https://github.com/algolia/algoliasearch-client-csharp.git + git + Minor update + + + + + + + + + + + + + + + diff --git a/algoliasearch/Analytics/Api/AnalyticsClient.cs b/algoliasearch/Analytics/Api/AnalyticsClient.cs new file mode 100644 index 000000000..c9c330a1f --- /dev/null +++ b/algoliasearch/Analytics/Api/AnalyticsClient.cs @@ -0,0 +1,4731 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Mime; +using Algolia.Search.Analytics.Client; +using Algolia.Search.Analytics.Models; + +namespace Algolia.Search.Analytics.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IAnalyticsClient + { + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get average click position. + /// + /// + /// Return the average click position for the complete time range and for individual days. > **Note**: If all `positions` have a `clickCount` of `0` or `null`, it means Algolia didn't receive any click events for tracked searches. A _tracked_ search is a search request where the `clickAnalytics` parameter is `true`. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetAverageClickPositionResponse + System.Threading.Tasks.Task GetAverageClickPositionAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get average click position. + /// + /// + /// Return the average click position for the complete time range and for individual days. > **Note**: If all `positions` have a `clickCount` of `0` or `null`, it means Algolia didn't receive any click events for tracked searches. A _tracked_ search is a search request where the `clickAnalytics` parameter is `true`. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetAverageClickPositionResponse) + System.Threading.Tasks.Task> GetAverageClickPositionWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get click positions. + /// + /// + /// Show the number of clicks events and their associated position in the search results. > **Note**: If all `positions` have a `clickCount` of `0` or `null`, it means Algolia didn't receive any click events for tracked searches. A _tracked_ search is a search request where the `clickAnalytics` parameter is `true`. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetClickPositionsResponse + System.Threading.Tasks.Task GetClickPositionsAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get click positions. + /// + /// + /// Show the number of clicks events and their associated position in the search results. > **Note**: If all `positions` have a `clickCount` of `0` or `null`, it means Algolia didn't receive any click events for tracked searches. A _tracked_ search is a search request where the `clickAnalytics` parameter is `true`. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetClickPositionsResponse) + System.Threading.Tasks.Task> GetClickPositionsWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get click-through rate (CTR). + /// + /// + /// Returns a [click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetClickThroughRateResponse + System.Threading.Tasks.Task GetClickThroughRateAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get click-through rate (CTR). + /// + /// + /// Returns a [click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetClickThroughRateResponse) + System.Threading.Tasks.Task> GetClickThroughRateWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get conversion rate (CR). + /// + /// + /// Return a [conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetConversationRateResponse + System.Threading.Tasks.Task GetConversationRateAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get conversion rate (CR). + /// + /// + /// Return a [conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetConversationRateResponse) + System.Threading.Tasks.Task> GetConversationRateWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get no click rate. + /// + /// + /// Returns the rate at which searches don't lead to any clicks. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without clicks. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetNoClickRateResponse + System.Threading.Tasks.Task GetNoClickRateAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get no click rate. + /// + /// + /// Returns the rate at which searches don't lead to any clicks. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without clicks. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetNoClickRateResponse) + System.Threading.Tasks.Task> GetNoClickRateWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get no results rate. + /// + /// + /// Returns the rate at which searches didn't return any results. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetNoResultsRateResponse + System.Threading.Tasks.Task GetNoResultsRateAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get no results rate. + /// + /// + /// Returns the rate at which searches didn't return any results. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetNoResultsRateResponse) + System.Threading.Tasks.Task> GetNoResultsRateWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get number of searches. + /// + /// + /// Returns the number of searches within a time range. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetSearchesCountResponse + System.Threading.Tasks.Task GetSearchesCountAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get number of searches. + /// + /// + /// Returns the number of searches within a time range. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetSearchesCountResponse) + System.Threading.Tasks.Task> GetSearchesCountWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get top searches with no clicks. + /// + /// + /// Return the most popular of the last 1,000 searches that didn't lead to any clicks. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetSearchesNoClicksResponse + System.Threading.Tasks.Task GetSearchesNoClicksAsync(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get top searches with no clicks. + /// + /// + /// Return the most popular of the last 1,000 searches that didn't lead to any clicks. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetSearchesNoClicksResponse) + System.Threading.Tasks.Task> GetSearchesNoClicksWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get top searches with no results. + /// + /// + /// Returns the most popular of the latest 1,000 searches that didn't return any results. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetSearchesNoResultsResponse + System.Threading.Tasks.Task GetSearchesNoResultsAsync(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get top searches with no results. + /// + /// + /// Returns the most popular of the latest 1,000 searches that didn't return any results. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetSearchesNoResultsResponse) + System.Threading.Tasks.Task> GetSearchesNoResultsWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get Analytics API status. + /// + /// + /// Return the latest update time of the Analytics API for an index. If the index has been recently created or no search has been performed yet, `updatedAt` will be `null`. > **Note**: The Analytics API is updated every 5&nbsp;minutes. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Cancellation Token to cancel the request. + /// Task of GetStatusResponse + System.Threading.Tasks.Task GetStatusAsync(string index, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get Analytics API status. + /// + /// + /// Return the latest update time of the Analytics API for an index. If the index has been recently created or no search has been performed yet, `updatedAt` will be `null`. > **Note**: The Analytics API is updated every 5&nbsp;minutes. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetStatusResponse) + System.Threading.Tasks.Task> GetStatusWithHttpInfoAsync(string index, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get top countries. + /// + /// + /// Returns top countries. Limited to the 1,000 most frequent ones. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetTopCountriesResponse + System.Threading.Tasks.Task GetTopCountriesAsync(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get top countries. + /// + /// + /// Returns top countries. Limited to the 1,000 most frequent ones. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetTopCountriesResponse) + System.Threading.Tasks.Task> GetTopCountriesWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get top filterable attributes. + /// + /// + /// Return the most popular [filterable attributes](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) in the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetTopFilterAttributesResponse + System.Threading.Tasks.Task GetTopFilterAttributesAsync(string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get top filterable attributes. + /// + /// + /// Return the most popular [filterable attributes](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) in the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetTopFilterAttributesResponse) + System.Threading.Tasks.Task> GetTopFilterAttributesWithHttpInfoAsync(string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get top filter values for an attribute. + /// + /// + /// Returns the most popular filter values for an attribute in the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Attribute name. + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetTopFilterForAttributeResponse + System.Threading.Tasks.Task GetTopFilterForAttributeAsync(string attribute, string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get top filter values for an attribute. + /// + /// + /// Returns the most popular filter values for an attribute in the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Attribute name. + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetTopFilterForAttributeResponse) + System.Threading.Tasks.Task> GetTopFilterForAttributeWithHttpInfoAsync(string attribute, string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get top filters for a no result search. + /// + /// + /// Returns top filters for filter-enabled searches that don't return results. Limited to the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetTopFiltersNoResultsResponse + System.Threading.Tasks.Task GetTopFiltersNoResultsAsync(string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get top filters for a no result search. + /// + /// + /// Returns top filters for filter-enabled searches that don't return results. Limited to the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetTopFiltersNoResultsResponse) + System.Threading.Tasks.Task> GetTopFiltersNoResultsWithHttpInfoAsync(string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get top hits. + /// + /// + /// Return the most popular clicked results in the last 1,000 searches. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Whether to include [click and conversion](https://www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search. (optional, default to false) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetTopHitsResponse + System.Threading.Tasks.Task GetTopHitsAsync(string index, string search = default(string), bool? clickAnalytics = default(bool?), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get top hits. + /// + /// + /// Return the most popular clicked results in the last 1,000 searches. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Whether to include [click and conversion](https://www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search. (optional, default to false) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetTopHitsResponse) + System.Threading.Tasks.Task> GetTopHitsWithHttpInfoAsync(string index, string search = default(string), bool? clickAnalytics = default(bool?), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get top searches. + /// + /// + /// Returns the most popular of the latest 1,000 searches. For each search, also returns the number of hits. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Whether to include [click and conversion](https://www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search. (optional, default to false) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Reorder the results. (optional) + /// Sorting direction of the results: ascending or descending. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetTopSearchesResponse + System.Threading.Tasks.Task GetTopSearchesAsync(string index, bool? clickAnalytics = default(bool?), string startDate = default(string), string endDate = default(string), OrderBy orderBy = default(OrderBy), Direction direction = default(Direction), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get top searches. + /// + /// + /// Returns the most popular of the latest 1,000 searches. For each search, also returns the number of hits. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Whether to include [click and conversion](https://www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search. (optional, default to false) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Reorder the results. (optional) + /// Sorting direction of the results: ascending or descending. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetTopSearchesResponse) + System.Threading.Tasks.Task> GetTopSearchesWithHttpInfoAsync(string index, bool? clickAnalytics = default(bool?), string startDate = default(string), string endDate = default(string), OrderBy orderBy = default(OrderBy), Direction direction = default(Direction), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get user count. + /// + /// + /// Return the count of unique users. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetUsersCountResponse + System.Threading.Tasks.Task GetUsersCountAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get user count. + /// + /// + /// Return the count of unique users. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetUsersCountResponse) + System.Threading.Tasks.Task> GetUsersCountWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } + + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class AnalyticsClient : IDisposable, IAnalyticsClient + { + private Algolia.Search.Analytics.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// + public AnalyticsClient() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + /// + public AnalyticsClient(string basePath) + { + this.Configuration = Algolia.Search.Analytics.Client.Configuration.MergeConfigurations( + Algolia.Search.Analytics.Client.GlobalConfiguration.Instance, + new Algolia.Search.Analytics.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.Analytics.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.Analytics.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// An instance of Configuration. + /// + /// + public AnalyticsClient(Algolia.Search.Analytics.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Algolia.Search.Analytics.Client.Configuration.MergeConfigurations( + Algolia.Search.Analytics.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.Analytics.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.Analytics.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public AnalyticsClient(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public AnalyticsClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.Analytics.Client.Configuration.MergeConfigurations( + Algolia.Search.Analytics.Client.GlobalConfiguration.Instance, + new Algolia.Search.Analytics.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.Analytics.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.Analytics.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// + /// An instance of HttpClient. + /// An instance of Configuration. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public AnalyticsClient(HttpClient client, Algolia.Search.Analytics.Client.Configuration configuration, HttpClientHandler handler = null) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.Analytics.Client.Configuration.MergeConfigurations( + Algolia.Search.Analytics.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.Analytics.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.Analytics.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + /// + public AnalyticsClient(Algolia.Search.Analytics.Client.ISynchronousClient client, Algolia.Search.Analytics.Client.IAsynchronousClient asyncClient, Algolia.Search.Analytics.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Algolia.Search.Analytics.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + this.ApiClient?.Dispose(); + } + + /// + /// Holds the ApiClient if created + /// + public Algolia.Search.Analytics.Client.ApiClient ApiClient { get; set; } = null; + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Algolia.Search.Analytics.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Algolia.Search.Analytics.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Algolia.Search.Analytics.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Algolia.Search.Analytics.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Del(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = DelWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.Analytics.Client.ApiResponse DelWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'path' when calling AnalyticsClient->Del"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Analytics.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await DelWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'path' when calling AnalyticsClient->Del"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Analytics.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Get(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.Analytics.Client.ApiResponse GetWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'path' when calling AnalyticsClient->Get"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Analytics.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'path' when calling AnalyticsClient->Get"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Analytics.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get average click position. Return the average click position for the complete time range and for individual days. > **Note**: If all `positions` have a `clickCount` of `0` or `null`, it means Algolia didn't receive any click events for tracked searches. A _tracked_ search is a search request where the `clickAnalytics` parameter is `true`. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// GetAverageClickPositionResponse + public GetAverageClickPositionResponse GetAverageClickPosition(string index, string startDate = default(string), string endDate = default(string), string tags = default(string)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetAverageClickPositionWithHttpInfo(index, startDate, endDate, tags); + return localVarResponse.Data; + } + + /// + /// Get average click position. Return the average click position for the complete time range and for individual days. > **Note**: If all `positions` have a `clickCount` of `0` or `null`, it means Algolia didn't receive any click events for tracked searches. A _tracked_ search is a search request where the `clickAnalytics` parameter is `true`. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// ApiResponse of GetAverageClickPositionResponse + public Algolia.Search.Analytics.Client.ApiResponse GetAverageClickPositionWithHttpInfo(string index, string startDate = default(string), string endDate = default(string), string tags = default(string)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetAverageClickPosition"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/clicks/averageClickPosition", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetAverageClickPosition", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get average click position. Return the average click position for the complete time range and for individual days. > **Note**: If all `positions` have a `clickCount` of `0` or `null`, it means Algolia didn't receive any click events for tracked searches. A _tracked_ search is a search request where the `clickAnalytics` parameter is `true`. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetAverageClickPositionResponse + public async System.Threading.Tasks.Task GetAverageClickPositionAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetAverageClickPositionWithHttpInfoAsync(index, startDate, endDate, tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get average click position. Return the average click position for the complete time range and for individual days. > **Note**: If all `positions` have a `clickCount` of `0` or `null`, it means Algolia didn't receive any click events for tracked searches. A _tracked_ search is a search request where the `clickAnalytics` parameter is `true`. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetAverageClickPositionResponse) + public async System.Threading.Tasks.Task> GetAverageClickPositionWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetAverageClickPosition"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/clicks/averageClickPosition", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetAverageClickPosition", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get click positions. Show the number of clicks events and their associated position in the search results. > **Note**: If all `positions` have a `clickCount` of `0` or `null`, it means Algolia didn't receive any click events for tracked searches. A _tracked_ search is a search request where the `clickAnalytics` parameter is `true`. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// GetClickPositionsResponse + public GetClickPositionsResponse GetClickPositions(string index, string startDate = default(string), string endDate = default(string), string tags = default(string)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetClickPositionsWithHttpInfo(index, startDate, endDate, tags); + return localVarResponse.Data; + } + + /// + /// Get click positions. Show the number of clicks events and their associated position in the search results. > **Note**: If all `positions` have a `clickCount` of `0` or `null`, it means Algolia didn't receive any click events for tracked searches. A _tracked_ search is a search request where the `clickAnalytics` parameter is `true`. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// ApiResponse of GetClickPositionsResponse + public Algolia.Search.Analytics.Client.ApiResponse GetClickPositionsWithHttpInfo(string index, string startDate = default(string), string endDate = default(string), string tags = default(string)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetClickPositions"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/clicks/positions", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetClickPositions", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get click positions. Show the number of clicks events and their associated position in the search results. > **Note**: If all `positions` have a `clickCount` of `0` or `null`, it means Algolia didn't receive any click events for tracked searches. A _tracked_ search is a search request where the `clickAnalytics` parameter is `true`. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetClickPositionsResponse + public async System.Threading.Tasks.Task GetClickPositionsAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetClickPositionsWithHttpInfoAsync(index, startDate, endDate, tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get click positions. Show the number of clicks events and their associated position in the search results. > **Note**: If all `positions` have a `clickCount` of `0` or `null`, it means Algolia didn't receive any click events for tracked searches. A _tracked_ search is a search request where the `clickAnalytics` parameter is `true`. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetClickPositionsResponse) + public async System.Threading.Tasks.Task> GetClickPositionsWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetClickPositions"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/clicks/positions", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetClickPositions", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get click-through rate (CTR). Returns a [click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// GetClickThroughRateResponse + public GetClickThroughRateResponse GetClickThroughRate(string index, string startDate = default(string), string endDate = default(string), string tags = default(string)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetClickThroughRateWithHttpInfo(index, startDate, endDate, tags); + return localVarResponse.Data; + } + + /// + /// Get click-through rate (CTR). Returns a [click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// ApiResponse of GetClickThroughRateResponse + public Algolia.Search.Analytics.Client.ApiResponse GetClickThroughRateWithHttpInfo(string index, string startDate = default(string), string endDate = default(string), string tags = default(string)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetClickThroughRate"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/clicks/clickThroughRate", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetClickThroughRate", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get click-through rate (CTR). Returns a [click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetClickThroughRateResponse + public async System.Threading.Tasks.Task GetClickThroughRateAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetClickThroughRateWithHttpInfoAsync(index, startDate, endDate, tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get click-through rate (CTR). Returns a [click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetClickThroughRateResponse) + public async System.Threading.Tasks.Task> GetClickThroughRateWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetClickThroughRate"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/clicks/clickThroughRate", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetClickThroughRate", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get conversion rate (CR). Return a [conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// GetConversationRateResponse + public GetConversationRateResponse GetConversationRate(string index, string startDate = default(string), string endDate = default(string), string tags = default(string)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetConversationRateWithHttpInfo(index, startDate, endDate, tags); + return localVarResponse.Data; + } + + /// + /// Get conversion rate (CR). Return a [conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// ApiResponse of GetConversationRateResponse + public Algolia.Search.Analytics.Client.ApiResponse GetConversationRateWithHttpInfo(string index, string startDate = default(string), string endDate = default(string), string tags = default(string)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetConversationRate"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/conversions/conversionRate", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetConversationRate", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get conversion rate (CR). Return a [conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetConversationRateResponse + public async System.Threading.Tasks.Task GetConversationRateAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetConversationRateWithHttpInfoAsync(index, startDate, endDate, tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get conversion rate (CR). Return a [conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetConversationRateResponse) + public async System.Threading.Tasks.Task> GetConversationRateWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetConversationRate"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/conversions/conversionRate", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetConversationRate", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get no click rate. Returns the rate at which searches don't lead to any clicks. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without clicks. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// GetNoClickRateResponse + public GetNoClickRateResponse GetNoClickRate(string index, string startDate = default(string), string endDate = default(string), string tags = default(string)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetNoClickRateWithHttpInfo(index, startDate, endDate, tags); + return localVarResponse.Data; + } + + /// + /// Get no click rate. Returns the rate at which searches don't lead to any clicks. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without clicks. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// ApiResponse of GetNoClickRateResponse + public Algolia.Search.Analytics.Client.ApiResponse GetNoClickRateWithHttpInfo(string index, string startDate = default(string), string endDate = default(string), string tags = default(string)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetNoClickRate"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/searches/noClickRate", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetNoClickRate", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get no click rate. Returns the rate at which searches don't lead to any clicks. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without clicks. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetNoClickRateResponse + public async System.Threading.Tasks.Task GetNoClickRateAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetNoClickRateWithHttpInfoAsync(index, startDate, endDate, tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get no click rate. Returns the rate at which searches don't lead to any clicks. The endpoint returns a value for the complete given time range, as well as a value per day. It also returns the count of searches and searches without clicks. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetNoClickRateResponse) + public async System.Threading.Tasks.Task> GetNoClickRateWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetNoClickRate"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/searches/noClickRate", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetNoClickRate", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get no results rate. Returns the rate at which searches didn't return any results. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// GetNoResultsRateResponse + public GetNoResultsRateResponse GetNoResultsRate(string index, string startDate = default(string), string endDate = default(string), string tags = default(string)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetNoResultsRateWithHttpInfo(index, startDate, endDate, tags); + return localVarResponse.Data; + } + + /// + /// Get no results rate. Returns the rate at which searches didn't return any results. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// ApiResponse of GetNoResultsRateResponse + public Algolia.Search.Analytics.Client.ApiResponse GetNoResultsRateWithHttpInfo(string index, string startDate = default(string), string endDate = default(string), string tags = default(string)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetNoResultsRate"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/searches/noResultRate", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetNoResultsRate", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get no results rate. Returns the rate at which searches didn't return any results. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetNoResultsRateResponse + public async System.Threading.Tasks.Task GetNoResultsRateAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetNoResultsRateWithHttpInfoAsync(index, startDate, endDate, tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get no results rate. Returns the rate at which searches didn't return any results. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetNoResultsRateResponse) + public async System.Threading.Tasks.Task> GetNoResultsRateWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetNoResultsRate"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/searches/noResultRate", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetNoResultsRate", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get number of searches. Returns the number of searches within a time range. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// GetSearchesCountResponse + public GetSearchesCountResponse GetSearchesCount(string index, string startDate = default(string), string endDate = default(string), string tags = default(string)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetSearchesCountWithHttpInfo(index, startDate, endDate, tags); + return localVarResponse.Data; + } + + /// + /// Get number of searches. Returns the number of searches within a time range. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// ApiResponse of GetSearchesCountResponse + public Algolia.Search.Analytics.Client.ApiResponse GetSearchesCountWithHttpInfo(string index, string startDate = default(string), string endDate = default(string), string tags = default(string)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetSearchesCount"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/searches/count", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetSearchesCount", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get number of searches. Returns the number of searches within a time range. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetSearchesCountResponse + public async System.Threading.Tasks.Task GetSearchesCountAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetSearchesCountWithHttpInfoAsync(index, startDate, endDate, tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get number of searches. Returns the number of searches within a time range. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetSearchesCountResponse) + public async System.Threading.Tasks.Task> GetSearchesCountWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetSearchesCount"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/searches/count", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetSearchesCount", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top searches with no clicks. Return the most popular of the last 1,000 searches that didn't lead to any clicks. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// GetSearchesNoClicksResponse + public GetSearchesNoClicksResponse GetSearchesNoClicks(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetSearchesNoClicksWithHttpInfo(index, startDate, endDate, limit, offset, tags); + return localVarResponse.Data; + } + + /// + /// Get top searches with no clicks. Return the most popular of the last 1,000 searches that didn't lead to any clicks. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// ApiResponse of GetSearchesNoClicksResponse + public Algolia.Search.Analytics.Client.ApiResponse GetSearchesNoClicksWithHttpInfo(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetSearchesNoClicks"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/searches/noClicks", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetSearchesNoClicks", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top searches with no clicks. Return the most popular of the last 1,000 searches that didn't lead to any clicks. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetSearchesNoClicksResponse + public async System.Threading.Tasks.Task GetSearchesNoClicksAsync(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetSearchesNoClicksWithHttpInfoAsync(index, startDate, endDate, limit, offset, tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get top searches with no clicks. Return the most popular of the last 1,000 searches that didn't lead to any clicks. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetSearchesNoClicksResponse) + public async System.Threading.Tasks.Task> GetSearchesNoClicksWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetSearchesNoClicks"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/searches/noClicks", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetSearchesNoClicks", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top searches with no results. Returns the most popular of the latest 1,000 searches that didn't return any results. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// GetSearchesNoResultsResponse + public GetSearchesNoResultsResponse GetSearchesNoResults(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetSearchesNoResultsWithHttpInfo(index, startDate, endDate, limit, offset, tags); + return localVarResponse.Data; + } + + /// + /// Get top searches with no results. Returns the most popular of the latest 1,000 searches that didn't return any results. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// ApiResponse of GetSearchesNoResultsResponse + public Algolia.Search.Analytics.Client.ApiResponse GetSearchesNoResultsWithHttpInfo(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetSearchesNoResults"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/searches/noResults", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetSearchesNoResults", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top searches with no results. Returns the most popular of the latest 1,000 searches that didn't return any results. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetSearchesNoResultsResponse + public async System.Threading.Tasks.Task GetSearchesNoResultsAsync(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetSearchesNoResultsWithHttpInfoAsync(index, startDate, endDate, limit, offset, tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get top searches with no results. Returns the most popular of the latest 1,000 searches that didn't return any results. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetSearchesNoResultsResponse) + public async System.Threading.Tasks.Task> GetSearchesNoResultsWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetSearchesNoResults"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/searches/noResults", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetSearchesNoResults", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get Analytics API status. Return the latest update time of the Analytics API for an index. If the index has been recently created or no search has been performed yet, `updatedAt` will be `null`. > **Note**: The Analytics API is updated every 5&nbsp;minutes. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// GetStatusResponse + public GetStatusResponse GetStatus(string index) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetStatusWithHttpInfo(index); + return localVarResponse.Data; + } + + /// + /// Get Analytics API status. Return the latest update time of the Analytics API for an index. If the index has been recently created or no search has been performed yet, `updatedAt` will be `null`. > **Note**: The Analytics API is updated every 5&nbsp;minutes. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// ApiResponse of GetStatusResponse + public Algolia.Search.Analytics.Client.ApiResponse GetStatusWithHttpInfo(string index) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetStatus"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/status", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetStatus", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get Analytics API status. Return the latest update time of the Analytics API for an index. If the index has been recently created or no search has been performed yet, `updatedAt` will be `null`. > **Note**: The Analytics API is updated every 5&nbsp;minutes. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Cancellation Token to cancel the request. + /// Task of GetStatusResponse + public async System.Threading.Tasks.Task GetStatusAsync(string index, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetStatusWithHttpInfoAsync(index, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get Analytics API status. Return the latest update time of the Analytics API for an index. If the index has been recently created or no search has been performed yet, `updatedAt` will be `null`. > **Note**: The Analytics API is updated every 5&nbsp;minutes. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetStatusResponse) + public async System.Threading.Tasks.Task> GetStatusWithHttpInfoAsync(string index, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetStatus"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/status", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetStatus", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top countries. Returns top countries. Limited to the 1,000 most frequent ones. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// GetTopCountriesResponse + public GetTopCountriesResponse GetTopCountries(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetTopCountriesWithHttpInfo(index, startDate, endDate, limit, offset, tags); + return localVarResponse.Data; + } + + /// + /// Get top countries. Returns top countries. Limited to the 1,000 most frequent ones. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// ApiResponse of GetTopCountriesResponse + public Algolia.Search.Analytics.Client.ApiResponse GetTopCountriesWithHttpInfo(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetTopCountries"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/countries", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTopCountries", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top countries. Returns top countries. Limited to the 1,000 most frequent ones. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetTopCountriesResponse + public async System.Threading.Tasks.Task GetTopCountriesAsync(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetTopCountriesWithHttpInfoAsync(index, startDate, endDate, limit, offset, tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get top countries. Returns top countries. Limited to the 1,000 most frequent ones. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetTopCountriesResponse) + public async System.Threading.Tasks.Task> GetTopCountriesWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetTopCountries"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/countries", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTopCountries", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top filterable attributes. Return the most popular [filterable attributes](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) in the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// GetTopFilterAttributesResponse + public GetTopFilterAttributesResponse GetTopFilterAttributes(string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetTopFilterAttributesWithHttpInfo(index, search, startDate, endDate, limit, offset, tags); + return localVarResponse.Data; + } + + /// + /// Get top filterable attributes. Return the most popular [filterable attributes](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) in the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// ApiResponse of GetTopFilterAttributesResponse + public Algolia.Search.Analytics.Client.ApiResponse GetTopFilterAttributesWithHttpInfo(string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetTopFilterAttributes"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (search != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "search", search)); + } + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/filters", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTopFilterAttributes", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top filterable attributes. Return the most popular [filterable attributes](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) in the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetTopFilterAttributesResponse + public async System.Threading.Tasks.Task GetTopFilterAttributesAsync(string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetTopFilterAttributesWithHttpInfoAsync(index, search, startDate, endDate, limit, offset, tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get top filterable attributes. Return the most popular [filterable attributes](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) in the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetTopFilterAttributesResponse) + public async System.Threading.Tasks.Task> GetTopFilterAttributesWithHttpInfoAsync(string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetTopFilterAttributes"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (search != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "search", search)); + } + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/filters", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTopFilterAttributes", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top filter values for an attribute. Returns the most popular filter values for an attribute in the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Attribute name. + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// GetTopFilterForAttributeResponse + public GetTopFilterForAttributeResponse GetTopFilterForAttribute(string attribute, string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetTopFilterForAttributeWithHttpInfo(attribute, index, search, startDate, endDate, limit, offset, tags); + return localVarResponse.Data; + } + + /// + /// Get top filter values for an attribute. Returns the most popular filter values for an attribute in the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Attribute name. + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// ApiResponse of GetTopFilterForAttributeResponse + public Algolia.Search.Analytics.Client.ApiResponse GetTopFilterForAttributeWithHttpInfo(string attribute, string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string)) + { + // verify the required parameter 'attribute' is set + if (attribute == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'attribute' when calling AnalyticsClient->GetTopFilterForAttribute"); + + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetTopFilterForAttribute"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("attribute", Algolia.Search.Analytics.Client.ClientUtils.ParameterToString(attribute)); // path parameter + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (search != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "search", search)); + } + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/filters/{attribute}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTopFilterForAttribute", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top filter values for an attribute. Returns the most popular filter values for an attribute in the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Attribute name. + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetTopFilterForAttributeResponse + public async System.Threading.Tasks.Task GetTopFilterForAttributeAsync(string attribute, string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetTopFilterForAttributeWithHttpInfoAsync(attribute, index, search, startDate, endDate, limit, offset, tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get top filter values for an attribute. Returns the most popular filter values for an attribute in the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Attribute name. + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetTopFilterForAttributeResponse) + public async System.Threading.Tasks.Task> GetTopFilterForAttributeWithHttpInfoAsync(string attribute, string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'attribute' is set + if (attribute == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'attribute' when calling AnalyticsClient->GetTopFilterForAttribute"); + + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetTopFilterForAttribute"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("attribute", Algolia.Search.Analytics.Client.ClientUtils.ParameterToString(attribute)); // path parameter + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (search != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "search", search)); + } + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/filters/{attribute}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTopFilterForAttribute", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top filters for a no result search. Returns top filters for filter-enabled searches that don't return results. Limited to the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// GetTopFiltersNoResultsResponse + public GetTopFiltersNoResultsResponse GetTopFiltersNoResults(string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetTopFiltersNoResultsWithHttpInfo(index, search, startDate, endDate, limit, offset, tags); + return localVarResponse.Data; + } + + /// + /// Get top filters for a no result search. Returns top filters for filter-enabled searches that don't return results. Limited to the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// ApiResponse of GetTopFiltersNoResultsResponse + public Algolia.Search.Analytics.Client.ApiResponse GetTopFiltersNoResultsWithHttpInfo(string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetTopFiltersNoResults"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (search != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "search", search)); + } + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/filters/noResults", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTopFiltersNoResults", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top filters for a no result search. Returns top filters for filter-enabled searches that don't return results. Limited to the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetTopFiltersNoResultsResponse + public async System.Threading.Tasks.Task GetTopFiltersNoResultsAsync(string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetTopFiltersNoResultsWithHttpInfoAsync(index, search, startDate, endDate, limit, offset, tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get top filters for a no result search. Returns top filters for filter-enabled searches that don't return results. Limited to the 1,000 most recently used filters. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetTopFiltersNoResultsResponse) + public async System.Threading.Tasks.Task> GetTopFiltersNoResultsWithHttpInfoAsync(string index, string search = default(string), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetTopFiltersNoResults"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (search != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "search", search)); + } + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/filters/noResults", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTopFiltersNoResults", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top hits. Return the most popular clicked results in the last 1,000 searches. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Whether to include [click and conversion](https://www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search. (optional, default to false) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// GetTopHitsResponse + public GetTopHitsResponse GetTopHits(string index, string search = default(string), bool? clickAnalytics = default(bool?), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetTopHitsWithHttpInfo(index, search, clickAnalytics, startDate, endDate, limit, offset, tags); + return localVarResponse.Data; + } + + /// + /// Get top hits. Return the most popular clicked results in the last 1,000 searches. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Whether to include [click and conversion](https://www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search. (optional, default to false) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// ApiResponse of GetTopHitsResponse + public Algolia.Search.Analytics.Client.ApiResponse GetTopHitsWithHttpInfo(string index, string search = default(string), bool? clickAnalytics = default(bool?), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetTopHits"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (search != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "search", search)); + } + if (clickAnalytics != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "clickAnalytics", clickAnalytics)); + } + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/hits", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTopHits", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top hits. Return the most popular clicked results in the last 1,000 searches. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Whether to include [click and conversion](https://www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search. (optional, default to false) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetTopHitsResponse + public async System.Threading.Tasks.Task GetTopHitsAsync(string index, string search = default(string), bool? clickAnalytics = default(bool?), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetTopHitsWithHttpInfoAsync(index, search, clickAnalytics, startDate, endDate, limit, offset, tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get top hits. Return the most popular clicked results in the last 1,000 searches. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// User query. (optional) + /// Whether to include [click and conversion](https://www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search. (optional, default to false) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetTopHitsResponse) + public async System.Threading.Tasks.Task> GetTopHitsWithHttpInfoAsync(string index, string search = default(string), bool? clickAnalytics = default(bool?), string startDate = default(string), string endDate = default(string), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetTopHits"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (search != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "search", search)); + } + if (clickAnalytics != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "clickAnalytics", clickAnalytics)); + } + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/hits", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTopHits", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top searches. Returns the most popular of the latest 1,000 searches. For each search, also returns the number of hits. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Whether to include [click and conversion](https://www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search. (optional, default to false) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Reorder the results. (optional) + /// Sorting direction of the results: ascending or descending. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// GetTopSearchesResponse + public GetTopSearchesResponse GetTopSearches(string index, bool? clickAnalytics = default(bool?), string startDate = default(string), string endDate = default(string), OrderBy orderBy = default(OrderBy), Direction direction = default(Direction), int? limit = default(int?), int? offset = default(int?), string tags = default(string)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetTopSearchesWithHttpInfo(index, clickAnalytics, startDate, endDate, orderBy, direction, limit, offset, tags); + return localVarResponse.Data; + } + + /// + /// Get top searches. Returns the most popular of the latest 1,000 searches. For each search, also returns the number of hits. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Whether to include [click and conversion](https://www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search. (optional, default to false) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Reorder the results. (optional) + /// Sorting direction of the results: ascending or descending. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// ApiResponse of GetTopSearchesResponse + public Algolia.Search.Analytics.Client.ApiResponse GetTopSearchesWithHttpInfo(string index, bool? clickAnalytics = default(bool?), string startDate = default(string), string endDate = default(string), OrderBy orderBy = default(OrderBy), Direction direction = default(Direction), int? limit = default(int?), int? offset = default(int?), string tags = default(string)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetTopSearches"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (clickAnalytics != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "clickAnalytics", clickAnalytics)); + } + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (orderBy != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "orderBy", orderBy)); + } + if (direction != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "direction", direction)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/searches", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTopSearches", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top searches. Returns the most popular of the latest 1,000 searches. For each search, also returns the number of hits. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Whether to include [click and conversion](https://www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search. (optional, default to false) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Reorder the results. (optional) + /// Sorting direction of the results: ascending or descending. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetTopSearchesResponse + public async System.Threading.Tasks.Task GetTopSearchesAsync(string index, bool? clickAnalytics = default(bool?), string startDate = default(string), string endDate = default(string), OrderBy orderBy = default(OrderBy), Direction direction = default(Direction), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetTopSearchesWithHttpInfoAsync(index, clickAnalytics, startDate, endDate, orderBy, direction, limit, offset, tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get top searches. Returns the most popular of the latest 1,000 searches. For each search, also returns the number of hits. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Whether to include [click and conversion](https://www.algolia.com/doc/guides/sending-events/getting-started/) rates for a search. (optional, default to false) + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Reorder the results. (optional) + /// Sorting direction of the results: ascending or descending. (optional) + /// Number of records to return (page size). (optional, default to 10) + /// Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetTopSearchesResponse) + public async System.Threading.Tasks.Task> GetTopSearchesWithHttpInfoAsync(string index, bool? clickAnalytics = default(bool?), string startDate = default(string), string endDate = default(string), OrderBy orderBy = default(OrderBy), Direction direction = default(Direction), int? limit = default(int?), int? offset = default(int?), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetTopSearches"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (clickAnalytics != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "clickAnalytics", clickAnalytics)); + } + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (orderBy != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "orderBy", orderBy)); + } + if (direction != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "direction", direction)); + } + if (limit != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "limit", limit)); + } + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/searches", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTopSearches", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get user count. Return the count of unique users. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// GetUsersCountResponse + public GetUsersCountResponse GetUsersCount(string index, string startDate = default(string), string endDate = default(string), string tags = default(string)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = GetUsersCountWithHttpInfo(index, startDate, endDate, tags); + return localVarResponse.Data; + } + + /// + /// Get user count. Return the count of unique users. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// ApiResponse of GetUsersCountResponse + public Algolia.Search.Analytics.Client.ApiResponse GetUsersCountWithHttpInfo(string index, string startDate = default(string), string endDate = default(string), string tags = default(string)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetUsersCount"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/2/users/count", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetUsersCount", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get user count. Return the count of unique users. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetUsersCountResponse + public async System.Threading.Tasks.Task GetUsersCountAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await GetUsersCountWithHttpInfoAsync(index, startDate, endDate, tags, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get user count. Return the count of unique users. + /// + /// Thrown when fails to make API call + /// Index name to target. + /// Start date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// End date (a string in the format `YYYY-MM-DD`) of the period to analyze. (optional) + /// Filter analytics on the [`analyticsTags`](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it must be URL-encoded. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetUsersCountResponse) + public async System.Threading.Tasks.Task> GetUsersCountWithHttpInfoAsync(string index, string startDate = default(string), string endDate = default(string), string tags = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'index' is set + if (index == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'index' when calling AnalyticsClient->GetUsersCount"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "index", index)); + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + if (tags != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "tags", tags)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/2/users/count", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetUsersCount", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Post(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = PostWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.Analytics.Client.ApiResponse PostWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'path' when calling AnalyticsClient->Post"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Analytics.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await PostWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'path' when calling AnalyticsClient->Post"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Analytics.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Put(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = PutWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.Analytics.Client.ApiResponse PutWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'path' when calling AnalyticsClient->Put"); + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Analytics.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Analytics.Client.ApiResponse localVarResponse = await PutWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Analytics.Client.ApiException(400, "Missing required parameter 'path' when calling AnalyticsClient->Put"); + + + Algolia.Search.Analytics.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Analytics.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Analytics.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Analytics.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Analytics.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + } +} diff --git a/algoliasearch/Analytics/Client/ApiClient.cs b/algoliasearch/Analytics/Client/ApiClient.cs new file mode 100644 index 000000000..a8bcbe0f0 --- /dev/null +++ b/algoliasearch/Analytics/Client/ApiClient.cs @@ -0,0 +1,736 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs; +using System.Net.Http; +using System.Net.Http.Headers; + +namespace Algolia.Search.Analytics.Client +{ + /// + /// To Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec + { + private readonly IReadableConfiguration _configuration; + private static readonly string _contentType = "application/json"; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is Algolia.Search.Analytics.Models.AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((Algolia.Search.Analytics.Models.AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public async Task Deserialize(HttpResponseMessage response) + { + var result = (T)await Deserialize(response, typeof(T)).ConfigureAwait(false); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal async Task Deserialize(HttpResponseMessage response, Type type) + { + IList headers = response.Headers.Select(x => x.Key + "=" + x.Value).ToList(); + + if (type == typeof(byte[])) // return byte array + { + return await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + } + else if (type == typeof(FileParameter)) + { + return new FileParameter(await response.Content.ReadAsStreamAsync().ConfigureAwait(false)); + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + if (headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + File.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(await response.Content.ReadAsStringAsync().ConfigureAwait(false), null, System.Globalization.DateTimeStyles.RoundtripKind); + } + + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public string RootElement { get; set; } + public string Namespace { get; set; } + public string DateFormat { get; set; } + + public string ContentType + { + get { return _contentType; } + set { throw new InvalidOperationException("Not allowed to set content type."); } + } + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + /// + /// The Dispose method will manage the HttpClient lifecycle when not passed by constructor. + /// + public partial class ApiClient : IDisposable, ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + + private readonly HttpClientHandler _httpClientHandler; + private readonly HttpClient _httpClient; + private readonly bool _disposeClient; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + public ApiClient() : + this(Algolia.Search.Analytics.Client.GlobalConfiguration.Instance.BasePath) + { + } + + /// + /// Initializes a new instance of the . + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = new HttpClientHandler(); + _httpClient = new HttpClient(_httpClientHandler, true); + _disposeClient = true; + _baseUrl = basePath; + } + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, HttpClientHandler handler = null) : + this(client, Algolia.Search.Analytics.Client.GlobalConfiguration.Instance.BasePath, handler) + { + } + + /// + /// Initializes a new instance of the . + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client cannot be null"); + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = handler; + _httpClient = client; + _baseUrl = basePath; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + if (_disposeClient) + { + _httpClient.Dispose(); + } + } + + /// Prepares multipart/form-data content + HttpContent PrepareMultipartFormDataContent(RequestOptions options) + { + string boundary = "---------" + Guid.NewGuid().ToString().ToUpperInvariant(); + var multipartContent = new MultipartFormDataContent(boundary); + foreach (var formParameter in options.FormParameters) + { + multipartContent.Add(new StringContent(formParameter.Value), formParameter.Key); + } + + if (options.FileParameters != null && options.FileParameters.Count > 0) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var content = new StreamContent(file.Content); + content.Headers.ContentType = new MediaTypeHeaderValue(file.ContentType); + multipartContent.Add(content, fileParam.Key, file.Name); + } + } + } + return multipartContent; + } + + /// + /// Provides all logic for constructing a new HttpRequestMessage. + /// At this point, all information for querying the service is known. Here, it is simply + /// mapped into the a HttpRequestMessage. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// [private] A new HttpRequestMessage instance. + /// + private HttpRequestMessage NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + WebRequestPathBuilder builder = new WebRequestPathBuilder(_baseUrl, path); + + builder.AddPathParameters(options.PathParameters); + + builder.AddQueryParameters(options.QueryParameters); + + HttpRequestMessage request = new HttpRequestMessage(method, builder.GetFullUri()); + + if (configuration.UserAgent != null) + { + request.Headers.TryAddWithoutValidation("User-Agent", configuration.UserAgent); + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.Headers.Add(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + // Todo make content headers actually content headers + request.Headers.TryAddWithoutValidation(headerParam.Key, value); + } + } + } + + List> contentList = new List>(); + + string contentType = null; + if (options.HeaderParameters != null && options.HeaderParameters.ContainsKey("Content-Type")) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes.FirstOrDefault(); + } + + if (contentType == "multipart/form-data") + { + request.Content = PrepareMultipartFormDataContent(options); + } + else if (contentType == "application/x-www-form-urlencoded") + { + request.Content = new FormUrlEncodedContent(options.FormParameters); + } + else + { + if (options.Data != null) + { + if (options.Data is FileParameter fp) + { + contentType = contentType ?? "application/octet-stream"; + + var streamContent = new StreamContent(fp.Content); + streamContent.Headers.ContentType = new MediaTypeHeaderValue(contentType); + request.Content = streamContent; + } + else + { + var serializer = new CustomJsonCodec(SerializerSettings, configuration); + request.Content = new StringContent(serializer.Serialize(options.Data), new UTF8Encoding(), + "application/json"); + } + } + } + + + + // TODO provide an alternative that allows cookies per request instead of per API client + if (options.Cookies != null && options.Cookies.Count > 0) + { + request.Properties["CookieContainer"] = options.Cookies; + } + + return request; + } + + partial void InterceptRequest(HttpRequestMessage req); + partial void InterceptResponse(HttpRequestMessage req, HttpResponseMessage response); + + private async Task> ToApiResponse(HttpResponseMessage response, object responseData, Uri uri) + { + T result = (T)responseData; + string rawContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ReasonPhrase, + Cookies = new List() + }; + + // process response headers, e.g. Access-Control-Allow-Methods + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + // process response content headers, e.g. Content-Type + if (response.Content.Headers != null) + { + foreach (var responseHeader in response.Content.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (_httpClientHandler != null && response != null) + { + try + { + foreach (Cookie cookie in _httpClientHandler.CookieContainer.GetCookies(uri)) + { + transformed.Cookies.Add(cookie); + } + } + catch (PlatformNotSupportedException) { } + } + + return transformed; + } + + private ApiResponse Exec(HttpRequestMessage req, IReadableConfiguration configuration) + { + return ExecAsync(req, configuration).GetAwaiter().GetResult(); + } + + private async Task> ExecAsync(HttpRequestMessage req, + IReadableConfiguration configuration, + System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + CancellationTokenSource timeoutTokenSource = null; + CancellationTokenSource finalTokenSource = null; + var deserializer = new CustomJsonCodec(SerializerSettings, configuration); + var finalToken = cancellationToken; + + try + { + if (configuration.Timeout > 0) + { + timeoutTokenSource = new CancellationTokenSource(configuration.Timeout); + finalTokenSource = CancellationTokenSource.CreateLinkedTokenSource(finalToken, timeoutTokenSource.Token); + finalToken = finalTokenSource.Token; + } + + if (configuration.Proxy != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Configuration `Proxy` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + _httpClientHandler.Proxy = configuration.Proxy; + } + + var cookieContainer = req.Properties.ContainsKey("CookieContainer") ? req.Properties["CookieContainer"] as List : null; + + if (cookieContainer != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Request property `CookieContainer` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + foreach (var cookie in cookieContainer) + { + _httpClientHandler.CookieContainer.Add(cookie); + } + } + + InterceptRequest(req); + + HttpResponseMessage response; + response = await _httpClient.SendAsync(req, finalToken).ConfigureAwait(false); + + if (!response.IsSuccessStatusCode) + { + return await ToApiResponse(response, default(T), req.RequestUri).ConfigureAwait(false); + } + + object responseData = await deserializer.Deserialize(response).ConfigureAwait(false); + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(Algolia.Search.Analytics.Models.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + responseData = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + else if (typeof(T).Name == "Stream") // for binary response + { + responseData = (T)(object)await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + } + + InterceptResponse(req, response); + + return await ToApiResponse(response, responseData, req.RequestUri).ConfigureAwait(false); + } + catch (OperationCanceledException original) + { + if (timeoutTokenSource != null && timeoutTokenSource.IsCancellationRequested) + { + throw new TaskCanceledException($"[{req.Method}] {req.RequestUri} was timeout.", + new TimeoutException(original.Message, original)); + } + throw; + } + finally + { + if (timeoutTokenSource != null) + { + timeoutTokenSource.Dispose(); + } + + if (finalTokenSource != null) + { + finalTokenSource.Dispose(); + } + } + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(new HttpMethod("PATCH"), path, options, config), config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(new HttpMethod("PATCH"), path, options, config), config); + } + #endregion ISynchronousClient + } +} diff --git a/algoliasearch/Analytics/Client/ApiException.cs b/algoliasearch/Analytics/Client/ApiException.cs new file mode 100644 index 000000000..822df3b23 --- /dev/null +++ b/algoliasearch/Analytics/Client/ApiException.cs @@ -0,0 +1,62 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.Analytics.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// Gets or sets the error code (HTTP status code) + /// + /// The error code (HTTP status code). + public int ErrorCode { get; set; } + + /// + /// Gets or sets the error content (body json object) + /// + /// The error content (Http response body). + public object ErrorContent { get; private set; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public ApiException() { } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + public ApiException(int errorCode, string message) : base(message) + { + this.ErrorCode = errorCode; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + /// Error content. + /// HTTP Headers. + public ApiException(int errorCode, string message, object errorContent = null, Multimap headers = null) : base(message) + { + this.ErrorCode = errorCode; + this.ErrorContent = errorContent; + this.Headers = headers; + } + } + +} diff --git a/algoliasearch/Analytics/Client/ApiResponse.cs b/algoliasearch/Analytics/Client/ApiResponse.cs new file mode 100644 index 000000000..20048c32a --- /dev/null +++ b/algoliasearch/Analytics/Client/ApiResponse.cs @@ -0,0 +1,160 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; + +namespace Algolia.Search.Analytics.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public interface IApiResponse + { + /// + /// The data type of + /// + Type ResponseType { get; } + + /// + /// The content of this response + /// + Object Content { get; } + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + Multimap Headers { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + List Cookies { get; set; } + + /// + /// The raw content of this response + /// + string RawContent { get; } + } + + /// + /// API Response + /// + public class ApiResponse : IApiResponse + { + #region Properties + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; } + + /// + /// Gets or sets the data (parsed HTTP body) + /// + /// The data. + public T Data { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + public string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + public List Cookies { get; set; } + + /// + /// The content of this response + /// + public Type ResponseType + { + get { return typeof(T); } + } + + /// + /// The data type of + /// + public object Content + { + get { return Data; } + } + + /// + /// The raw content + /// + public string RawContent { get; } + + #endregion Properties + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data, string rawContent) + { + StatusCode = statusCode; + Headers = headers; + Data = data; + RawContent = rawContent; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) : this(statusCode, headers, data, null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null) + { + } + + #endregion Constructors + } +} diff --git a/algoliasearch/Analytics/Client/ClientUtils.cs b/algoliasearch/Analytics/Client/ClientUtils.cs new file mode 100644 index 000000000..39b03e6e3 --- /dev/null +++ b/algoliasearch/Analytics/Client/ClientUtils.cs @@ -0,0 +1,244 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; + +namespace Algolia.Search.Analytics.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// Convert params to key/value pairs. + /// Use collectionFormat to properly format lists and collections. + /// + /// The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi + /// Key name. + /// Value object. + /// A multimap of keys with 1..n associated values. + public static Multimap ParameterToMultiMap(string collectionFormat, string name, object value) + { + var parameters = new Multimap(); + + if (value is ICollection collection && collectionFormat == "multi") + { + foreach (var item in collection) + { + parameters.Add(name, ParameterToString(item)); + } + } + else if (value is IDictionary dictionary) + { + if (collectionFormat == "deepObject") + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value)); + } + } + else + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value)); + } + } + } + else + { + parameters.Add(name, ParameterToString(value)); + } + + return parameters; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// An optional configuration instance, providing formatting options used in processing. + /// Formatted string. + public static string ParameterToString(object obj, IReadableConfiguration configuration = null) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is bool boolean) + return boolean ? "true" : "false"; + if (obj is ICollection collection) + { + List entries = new List(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry, configuration)); + return string.Join(",", entries); + } + if (obj is Enum && HasEnumMemberAttrValue(obj)) + return GetEnumMemberAttrValue(obj); + + return Convert.ToString(obj, CultureInfo.InvariantCulture); + } + + /// + /// Serializes the given object when not null. Otherwise return null. + /// + /// The object to serialize. + /// Serialized string. + public static string Serialize(object obj) + { + return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null; + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Is the Enum decorated with EnumMember Attribute + /// + /// + /// true if found + private static bool HasEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) return true; + return false; + } + + /// + /// Get the EnumMember value + /// + /// + /// EnumMember value as string otherwise null + private static string GetEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) + { + return attr.Value; + } + return null; + } + } +} diff --git a/algoliasearch/Analytics/Client/Configuration.cs b/algoliasearch/Analytics/Client/Configuration.cs new file mode 100644 index 000000000..aa75ed439 --- /dev/null +++ b/algoliasearch/Analytics/Client/Configuration.cs @@ -0,0 +1,593 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Net.Http; +using System.Net.Security; + +namespace Algolia.Search.Analytics.Client +{ + /// + /// Represents a set of configuration settings + /// + public class Configuration : IReadableConfiguration + { + #region Constants + + /// + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.RawContent), + response.RawContent, response.Headers); + } + return null; + }; + + #endregion Static Members + + #region Private Members + + /// + /// Defines the base path of the target API server. + /// Example: http://localhost:3000/v1/ + /// + private string _basePath; + + private bool _useDefaultCredentials = false; + + /// + /// Gets or sets the API key based on the authentication name. + /// This is the key and value comprising the "secret" for accessing an API. + /// + /// The API key. + private IDictionary _apiKey; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + /// + /// Gets or sets the servers defined in the OpenAPI spec. + /// + /// The servers + private IList> _servers; + + /// + /// Gets or sets the operation servers defined in the OpenAPI spec. + /// + /// The operation servers + private IReadOnlyDictionary>> _operationServers; + + #endregion Private Members + + #region Constructors + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration() + { + Proxy = null; + UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + BasePath = "https://analytics.us.algolia.com"; + DefaultHeaders = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + Servers = new List>() + { + { + new Dictionary { + {"url", "https://analytics.{region}.algolia.com"}, + {"description", "No description provided"}, + { + "variables", new Dictionary { + { + "region", new Dictionary { + {"description", "No description provided"}, + {"default_value", "us"}, + { + "enum_values", new List() { + "us", + "de" + } + } + } + } + } + } + } + }, + { + new Dictionary { + {"url", "https://analytics.algolia.com"}, + {"description", "No description provided"}, + } + } + }; + OperationServers = new Dictionary>>() + { + }; + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration( + IDictionary defaultHeaders, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "https://analytics.us.algolia.com") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeaders == null) + throw new ArgumentNullException("defaultHeaders"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeaders) + { + DefaultHeaders.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + #endregion Constructors + + #region Properties + + /// + /// Gets or sets the base path for API access. + /// + public virtual string BasePath + { + get { return _basePath; } + set { _basePath = value; } + } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + public virtual bool UseDefaultCredentials + { + get { return _useDefaultCredentials; } + set { _useDefaultCredentials = value; } + } + + /// + /// Gets or sets the default header. + /// + [Obsolete("Use DefaultHeaders instead.")] + public virtual IDictionary DefaultHeader + { + get + { + return DefaultHeaders; + } + set + { + DefaultHeaders = value; + } + } + + /// + /// Gets or sets the default headers. + /// + public virtual IDictionary DefaultHeaders { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { get; set; } + + /// + /// Gets or sets the proxy + /// + /// Proxy. + public virtual WebProxy Proxy { get; set; } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix(string apiKeyIdentifier) + { + string apiKeyValue; + ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue); + string apiKeyPrefix; + if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) + { + return apiKeyPrefix + " " + apiKeyValue; + } + + return apiKeyValue; + } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } + + set + { + if (string.IsNullOrEmpty(value)) + { + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } + } + } + + /// + /// Gets or sets the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// Whatever you set here will be prepended to the value defined in AddApiKey. + /// + /// An example invocation here might be: + /// + /// ApiKeyPrefix["Authorization"] = "Bearer"; + /// + /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// + /// + /// OAuth2 workflows should set tokens via AccessToken. + /// + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + /// + /// Gets or sets the servers. + /// + /// The servers. + public virtual IList> Servers + { + get { return _servers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Servers may not be null."); + } + _servers = value; + } + } + + /// + /// Gets or sets the operation servers. + /// + /// The operation servers. + public virtual IReadOnlyDictionary>> OperationServers + { + get { return _operationServers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Operation servers may not be null."); + } + _operationServers = value; + } + } + + /// + /// Returns URL based on server settings without providing values + /// for the variables + /// + /// Array index of the server settings. + /// The server URL. + public string GetServerUrl(int index) + { + return GetServerUrl(Servers, index, null); + } + + /// + /// Returns URL based on server settings. + /// + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + public string GetServerUrl(int index, Dictionary inputVariables) + { + return GetServerUrl(Servers, index, inputVariables); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index) + { + return GetOperationServerUrl(operation, index, null); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables) + { + if (operation != null && OperationServers.TryGetValue(operation, out var operationServer)) + { + return GetServerUrl(operationServer, index, inputVariables); + } + + return null; + } + + /// + /// Returns URL based on server settings. + /// + /// Dictionary of server settings. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + private string GetServerUrl(IList> servers, int index, Dictionary inputVariables) + { + if (index < 0 || index >= servers.Count) + { + throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}."); + } + + if (inputVariables == null) + { + inputVariables = new Dictionary(); + } + + IReadOnlyDictionary server = servers[index]; + string url = (string)server["url"]; + + if (server.ContainsKey("variables")) + { + // go through each variable and assign a value + foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"]) + { + + IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value); + + if (inputVariables.ContainsKey(variable.Key)) + { + if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + { + url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); + } + else + { + throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}"); + } + } + else + { + // use default value + url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]); + } + } + } + + return url; + } + + /// + /// Gets and Sets the RemoteCertificateValidationCallback + /// + public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; } + + #endregion Properties + + #region Methods + + /// + /// Returns a string with essential information for debugging. + /// + public static string ToDebugReport() + { + string report = "C# SDK (Algolia.Search.Analytics) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: 1.0.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; + } + + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey(string key, string value) + { + ApiKey[key] = value; + } + + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix(string key, string value) + { + ApiKeyPrefix[key] = value; + } + + #endregion Methods + + #region Static Members + /// + /// Merge configurations. + /// + /// First configuration. + /// Second configuration. + /// Merged configuration. + public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) + { + if (second == null) return first ?? GlobalConfiguration.Instance; + + Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; + foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; + foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value; + + var config = new Configuration + { + ApiKey = apiKey, + ApiKeyPrefix = apiKeyPrefix, + DefaultHeaders = defaultHeaders, + BasePath = second.BasePath ?? first.BasePath, + Timeout = second.Timeout, + Proxy = second.Proxy ?? first.Proxy, + UserAgent = second.UserAgent ?? first.UserAgent, + TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, + DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat, + UseDefaultCredentials = second.UseDefaultCredentials, + RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback, + }; + return config; + } + #endregion Static Members + } +} diff --git a/algoliasearch/Analytics/Client/ExceptionFactory.cs b/algoliasearch/Analytics/Client/ExceptionFactory.cs new file mode 100644 index 000000000..68991bb87 --- /dev/null +++ b/algoliasearch/Analytics/Client/ExceptionFactory.cs @@ -0,0 +1,16 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.Analytics.Client +{ + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions + public delegate Exception ExceptionFactory(string methodName, IApiResponse response); +} diff --git a/algoliasearch/Analytics/Client/FileParameter.cs b/algoliasearch/Analytics/Client/FileParameter.cs new file mode 100644 index 000000000..46fdb39e0 --- /dev/null +++ b/algoliasearch/Analytics/Client/FileParameter.cs @@ -0,0 +1,74 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.IO; + +namespace Algolia.Search.Analytics.Client +{ + + /// + /// Represents a File passed to the API as a Parameter, allows using different backends for files + /// + public class FileParameter + { + /// + /// The filename + /// + public string Name { get; set; } = "no_name_provided"; + + /// + /// The content type of the file + /// + public string ContentType { get; set; } = "application/octet-stream"; + + /// + /// The content of the file + /// + public Stream Content { get; set; } + + /// + /// Construct a FileParameter just from the contents, will extract the filename from a filestream + /// + /// The file content + public FileParameter(Stream content) + { + if (content is FileStream fs) + { + Name = fs.Name; + } + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The file content + public FileParameter(string filename, Stream content) + { + Name = filename; + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The content type of the file + /// The file content + public FileParameter(string filename, string contentType, Stream content) + { + Name = filename; + ContentType = contentType; + Content = content; + } + + /// + /// Implicit conversion of stream to file parameter. Useful for backwards compatibility. + /// + /// Stream to convert + /// FileParameter + public static implicit operator FileParameter(Stream s) => new FileParameter(s); + } +} diff --git a/algoliasearch/Analytics/Client/GlobalConfiguration.cs b/algoliasearch/Analytics/Client/GlobalConfiguration.cs new file mode 100644 index 000000000..e22b2311d --- /dev/null +++ b/algoliasearch/Analytics/Client/GlobalConfiguration.cs @@ -0,0 +1,61 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.Collections.Generic; + +namespace Algolia.Search.Analytics.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .openapi-generator-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + #region Private Members + + private static readonly object GlobalConfigSync = new { }; + private static IReadableConfiguration _globalConfiguration; + + #endregion Private Members + + #region Constructors + + /// + private GlobalConfiguration() + { + } + + /// + public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath) + { + } + + static GlobalConfiguration() + { + Instance = new GlobalConfiguration(); + } + + #endregion Constructors + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static IReadableConfiguration Instance + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + } +} diff --git a/algoliasearch/Analytics/Client/IAsynchronousClient.cs b/algoliasearch/Analytics/Client/IAsynchronousClient.cs new file mode 100644 index 000000000..1536575ff --- /dev/null +++ b/algoliasearch/Analytics/Client/IAsynchronousClient.cs @@ -0,0 +1,94 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Threading.Tasks; + +namespace Algolia.Search.Analytics.Client +{ + /// + /// Contract for Asynchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface IAsynchronousClient + { + /// + /// Executes a non-blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } +} diff --git a/algoliasearch/Analytics/Client/IReadableConfiguration.cs b/algoliasearch/Analytics/Client/IReadableConfiguration.cs new file mode 100644 index 000000000..2155b1acb --- /dev/null +++ b/algoliasearch/Analytics/Client/IReadableConfiguration.cs @@ -0,0 +1,111 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; + +namespace Algolia.Search.Analytics.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + /// + /// Gets the API key. + /// + /// API key. + IDictionary ApiKey { get; } + + /// + /// Gets the API key prefix. + /// + /// API key prefix. + IDictionary ApiKeyPrefix { get; } + + /// + /// Gets the base path. + /// + /// Base path. + string BasePath { get; } + + /// + /// Gets the date time format. + /// + /// Date time format. + string DateTimeFormat { get; } + + /// + /// Gets the default header. + /// + /// Default header. + [Obsolete("Use DefaultHeaders instead.")] + IDictionary DefaultHeader { get; } + + /// + /// Gets the default headers. + /// + /// Default headers. + IDictionary DefaultHeaders { get; } + + /// + /// Gets the temp folder path. + /// + /// Temp folder path. + string TempFolderPath { get; } + + /// + /// Gets the HTTP connection timeout (in milliseconds) + /// + /// HTTP connection timeout. + int Timeout { get; } + + /// + /// Gets the proxy. + /// + /// Proxy. + WebProxy Proxy { get; } + + /// + /// Gets the user agent. + /// + /// User agent. + string UserAgent { get; } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + bool UseDefaultCredentials { get; } + + /// + /// Get the servers associated with the operation. + /// + /// Operation servers. + IReadOnlyDictionary>> OperationServers { get; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + string GetApiKeyWithPrefix(string apiKeyIdentifier); + + /// + /// Gets the Operation server url at the provided index. + /// + /// Operation server name. + /// Index of the operation server settings. + /// + string GetOperationServerUrl(string operation, int index); + + /// + /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and + /// overriding certificate errors in the scope of a request. + /// + RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; } + } +} diff --git a/algoliasearch/Analytics/Client/ISynchronousClient.cs b/algoliasearch/Analytics/Client/ISynchronousClient.cs new file mode 100644 index 000000000..9f552514c --- /dev/null +++ b/algoliasearch/Analytics/Client/ISynchronousClient.cs @@ -0,0 +1,87 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.IO; + +namespace Algolia.Search.Analytics.Client +{ + /// + /// Contract for Synchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface ISynchronousClient + { + /// + /// Executes a blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null); + } +} diff --git a/algoliasearch/Analytics/Client/Multimap.cs b/algoliasearch/Analytics/Client/Multimap.cs new file mode 100644 index 000000000..46109e9c0 --- /dev/null +++ b/algoliasearch/Analytics/Client/Multimap.cs @@ -0,0 +1,289 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Algolia.Search.Analytics.Client +{ + /// + /// A dictionary in which one key has many associated values. + /// + /// The type of the key + /// The type of the value associated with the key. + public class Multimap : IDictionary> + { + #region Private Fields + + private readonly Dictionary> _dictionary; + + #endregion Private Fields + + #region Constructors + + /// + /// Empty Constructor. + /// + public Multimap() + { + _dictionary = new Dictionary>(); + } + + /// + /// Constructor with comparer. + /// + /// + public Multimap(IEqualityComparer comparer) + { + _dictionary = new Dictionary>(comparer); + } + + #endregion Constructors + + #region Enumerators + + /// + /// To get the enumerator. + /// + /// Enumerator + public IEnumerator>> GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + /// + /// To get the enumerator. + /// + /// Enumerator + IEnumerator IEnumerable.GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + #endregion Enumerators + + #region Public Members + /// + /// Add values to Multimap + /// + /// Key value pair + public void Add(KeyValuePair> item) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + + /// + /// Add Multimap to Multimap + /// + /// Multimap + public void Add(Multimap multimap) + { + foreach (var item in multimap) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + + /// + /// Clear Multimap + /// + public void Clear() + { + _dictionary.Clear(); + } + + /// + /// Determines whether Multimap contains the specified item. + /// + /// Key value pair + /// Method needs to be implemented + /// true if the Multimap contains the item; otherwise, false. + public bool Contains(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Copy items of the Multimap to an array, + /// starting at a particular array index. + /// + /// The array that is the destination of the items copied + /// from Multimap. The array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + /// Method needs to be implemented + public void CopyTo(KeyValuePair>[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + /// + /// Removes the specified item from the Multimap. + /// + /// Key value pair + /// true if the item is successfully removed; otherwise, false. + /// Method needs to be implemented + public bool Remove(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Gets the number of items contained in the Multimap. + /// + public int Count => _dictionary.Count; + + /// + /// Gets a value indicating whether the Multimap is read-only. + /// + public bool IsReadOnly => false; + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add the value to Multimap. + public void Add(TKey key, IList value) + { + if (value != null && value.Count > 0) + { + if (_dictionary.TryGetValue(key, out var list)) + { + foreach (var k in value) list.Add(k); + } + else + { + list = new List(value); + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + } + + /// + /// Determines whether the Multimap contains an item with the specified key. + /// + /// The key to locate in the Multimap. + /// true if the Multimap contains an item with + /// the key; otherwise, false. + public bool ContainsKey(TKey key) + { + return _dictionary.ContainsKey(key); + } + + /// + /// Removes item with the specified key from the Multimap. + /// + /// The key to locate in the Multimap. + /// true if the item is successfully removed; otherwise, false. + public bool Remove(TKey key) + { + return TryRemove(key, out var _); + } + + /// + /// Gets the value associated with the specified key. + /// + /// The key whose value to get. + /// When this method returns, the value associated with the specified key, if the + /// key is found; otherwise, the default value for the type of the value parameter. + /// This parameter is passed uninitialized. + /// true if the object that implements Multimap contains + /// an item with the specified key; otherwise, false. + public bool TryGetValue(TKey key, out IList value) + { + return _dictionary.TryGetValue(key, out value); + } + + /// + /// Gets or sets the item with the specified key. + /// + /// The key of the item to get or set. + /// The value of the specified key. + public IList this[TKey key] + { + get => _dictionary[key]; + set => _dictionary[key] = value; + } + + /// + /// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap. + /// + public ICollection Keys => _dictionary.Keys; + + /// + /// Gets a System.Collections.Generic.ICollection containing the values of the Multimap. + /// + public ICollection> Values => _dictionary.Values; + + /// + /// Copy the items of the Multimap to an System.Array, + /// starting at a particular System.Array index. + /// + /// The one-dimensional System.Array that is the destination of the items copied + /// from Multimap. The System.Array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + public void CopyTo(Array array, int index) + { + ((ICollection)_dictionary).CopyTo(array, index); + } + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add value to Multimap. + public void Add(TKey key, TValue value) + { + if (value != null) + { + if (_dictionary.TryGetValue(key, out var list)) + { + list.Add(value); + } + else + { + list = new List { value }; + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add value to Multimap."); + } + } + } + + #endregion Public Members + + #region Private Members + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryRemove(TKey key, out IList value) + { + _dictionary.TryGetValue(key, out value); + return _dictionary.Remove(key); + } + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryAdd(TKey key, IList value) + { + try + { + _dictionary.Add(key, value); + } + catch (ArgumentException) + { + return false; + } + + return true; + } + #endregion Private Members + } +} diff --git a/algoliasearch/Analytics/Client/OpenAPIDateConverter.cs b/algoliasearch/Analytics/Client/OpenAPIDateConverter.cs new file mode 100644 index 000000000..b1261ae9c --- /dev/null +++ b/algoliasearch/Analytics/Client/OpenAPIDateConverter.cs @@ -0,0 +1,23 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using Newtonsoft.Json.Converters; + +namespace Algolia.Search.Analytics.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class OpenAPIDateConverter : IsoDateTimeConverter + { + /// + /// Initializes a new instance of the class. + /// + public OpenAPIDateConverter() + { + // full-date = date-fullyear "-" date-month "-" date-mday + DateTimeFormat = "yyyy-MM-dd"; + } + } +} diff --git a/algoliasearch/Analytics/Client/RequestOptions.cs b/algoliasearch/Analytics/Client/RequestOptions.cs new file mode 100644 index 000000000..a183ca7c1 --- /dev/null +++ b/algoliasearch/Analytics/Client/RequestOptions.cs @@ -0,0 +1,68 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; + +namespace Algolia.Search.Analytics.Client +{ + /// + /// A container for generalized request inputs. This type allows consumers to extend the request functionality + /// by abstracting away from the default (built-in) request framework (e.g. RestSharp). + /// + public class RequestOptions + { + /// + /// Parameters to be bound to path parts of the Request's URL + /// + public Dictionary PathParameters { get; set; } + + /// + /// Query parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap QueryParameters { get; set; } + + /// + /// Header parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap HeaderParameters { get; set; } + + /// + /// Form parameters to be sent along with the request. + /// + public Dictionary FormParameters { get; set; } + + /// + /// File parameters to be sent along with the request. + /// + public Multimap FileParameters { get; set; } + + /// + /// Cookies to be sent along with the request. + /// + public List Cookies { get; set; } + + /// + /// Any data associated with a request body. + /// + public Object Data { get; set; } + + /// + /// Constructs a new instance of + /// + public RequestOptions() + { + PathParameters = new Dictionary(); + QueryParameters = new Multimap(); + HeaderParameters = new Multimap(); + FormParameters = new Dictionary(); + FileParameters = new Multimap(); + Cookies = new List(); + } + } +} diff --git a/algoliasearch/Analytics/Client/WebRequestPathBuilder.cs b/algoliasearch/Analytics/Client/WebRequestPathBuilder.cs new file mode 100644 index 000000000..eb9711f08 --- /dev/null +++ b/algoliasearch/Analytics/Client/WebRequestPathBuilder.cs @@ -0,0 +1,47 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using System; +using System.Collections.Generic; + +namespace Algolia.Search.Analytics.Client +{ + /// + /// A URI builder + /// + class WebRequestPathBuilder + { + private string _baseUrl; + private string _path; + private string _query = "?"; + public WebRequestPathBuilder(string baseUrl, string path) + { + _baseUrl = baseUrl; + _path = path; + } + + public void AddPathParameters(Dictionary parameters) + { + foreach (var parameter in parameters) + { + _path = _path.Replace("{" + parameter.Key + "}", Uri.EscapeDataString(parameter.Value)); + } + } + + public void AddQueryParameters(Multimap parameters) + { + foreach (var parameter in parameters) + { + foreach (var value in parameter.Value) + { + _query = _query + parameter.Key + "=" + Uri.EscapeDataString(value) + "&"; + } + } + } + + public string GetFullUri() + { + return _baseUrl + _path + _query.Substring(0, _query.Length - 1); + } + } +} diff --git a/algoliasearch/Analytics/Models/AbstractOpenAPISchema.cs b/algoliasearch/Analytics/Models/AbstractOpenAPISchema.cs new file mode 100644 index 000000000..f7060660d --- /dev/null +++ b/algoliasearch/Analytics/Models/AbstractOpenAPISchema.cs @@ -0,0 +1,70 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification + /// + public abstract partial class AbstractOpenAPISchema + { + /// + /// Custom JSON serializer + /// + static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Error, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Custom JSON serializer for objects with additional properties + /// + static public readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Ignore, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Gets or Sets the actual instance + /// + public abstract Object ActualInstance { get; set; } + + /// + /// Gets or Sets IsNullable to indicate whether the instance is nullable + /// + public bool IsNullable { get; protected set; } + + /// + /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf` + /// + public string SchemaType { get; protected set; } + + /// + /// Converts the instance into JSON string. + /// + public abstract string ToJson(); + } +} diff --git a/algoliasearch/Analytics/Models/AverageClickEvent.cs b/algoliasearch/Analytics/Models/AverageClickEvent.cs new file mode 100644 index 000000000..8eef09bec --- /dev/null +++ b/algoliasearch/Analytics/Models/AverageClickEvent.cs @@ -0,0 +1,164 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// AverageClickEvent + /// + [DataContract(Name = "averageClickEvent")] + public partial class AverageClickEvent : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AverageClickEvent() { } + /// + /// Initializes a new instance of the class. + /// + /// Average count of all click events. (required). + /// Number of click events. (required). + /// Date of the event in the format YYYY-MM-DD. (required). + public AverageClickEvent(double average = default(double), int clickCount = default(int), string date = default(string)) + { + this.Average = average; + this.ClickCount = clickCount; + // to ensure "date" is required (not null) + if (date == null) + { + throw new ArgumentNullException("date is a required property for AverageClickEvent and cannot be null"); + } + this.Date = date; + } + + /// + /// Average count of all click events. + /// + /// Average count of all click events. + [DataMember(Name = "average", IsRequired = true, EmitDefaultValue = true)] + public double Average { get; set; } + + /// + /// Number of click events. + /// + /// Number of click events. + [DataMember(Name = "clickCount", IsRequired = true, EmitDefaultValue = true)] + public int ClickCount { get; set; } + + /// + /// Date of the event in the format YYYY-MM-DD. + /// + /// Date of the event in the format YYYY-MM-DD. + [DataMember(Name = "date", IsRequired = true, EmitDefaultValue = true)] + public string Date { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AverageClickEvent {\n"); + sb.Append(" Average: ").Append(Average).Append("\n"); + sb.Append(" ClickCount: ").Append(ClickCount).Append("\n"); + sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AverageClickEvent); + } + + /// + /// Returns true if AverageClickEvent instances are equal + /// + /// Instance of AverageClickEvent to be compared + /// Boolean + public bool Equals(AverageClickEvent input) + { + if (input == null) + { + return false; + } + return + ( + this.Average == input.Average || + this.Average.Equals(input.Average) + ) && + ( + this.ClickCount == input.ClickCount || + this.ClickCount.Equals(input.ClickCount) + ) && + ( + this.Date == input.Date || + (this.Date != null && + this.Date.Equals(input.Date)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Average.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickCount.GetHashCode(); + if (this.Date != null) + { + hashCode = (hashCode * 59) + this.Date.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/ClickPosition.cs b/algoliasearch/Analytics/Models/ClickPosition.cs new file mode 100644 index 000000000..5b3faab58 --- /dev/null +++ b/algoliasearch/Analytics/Models/ClickPosition.cs @@ -0,0 +1,150 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// ClickPosition + /// + [DataContract(Name = "clickPosition")] + public partial class ClickPosition : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ClickPosition() { } + /// + /// Initializes a new instance of the class. + /// + /// Range of positions with the following pattern: - For positions 1 to 10, the number of click events are shown for each position - For positions 11 to 20, all click events are grouped - For positions 21 and up, all click events are grouped. (required). + /// Number of click events. (required). + public ClickPosition(List position = default(List), int clickCount = default(int)) + { + // to ensure "position" is required (not null) + if (position == null) + { + throw new ArgumentNullException("position is a required property for ClickPosition and cannot be null"); + } + this.Position = position; + this.ClickCount = clickCount; + } + + /// + /// Range of positions with the following pattern: - For positions 1 to 10, the number of click events are shown for each position - For positions 11 to 20, all click events are grouped - For positions 21 and up, all click events are grouped. + /// + /// Range of positions with the following pattern: - For positions 1 to 10, the number of click events are shown for each position - For positions 11 to 20, all click events are grouped - For positions 21 and up, all click events are grouped. + [DataMember(Name = "position", IsRequired = true, EmitDefaultValue = true)] + public List Position { get; set; } + + /// + /// Number of click events. + /// + /// Number of click events. + [DataMember(Name = "clickCount", IsRequired = true, EmitDefaultValue = true)] + public int ClickCount { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ClickPosition {\n"); + sb.Append(" Position: ").Append(Position).Append("\n"); + sb.Append(" ClickCount: ").Append(ClickCount).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ClickPosition); + } + + /// + /// Returns true if ClickPosition instances are equal + /// + /// Instance of ClickPosition to be compared + /// Boolean + public bool Equals(ClickPosition input) + { + if (input == null) + { + return false; + } + return + ( + this.Position == input.Position || + this.Position != null && + input.Position != null && + this.Position.SequenceEqual(input.Position) + ) && + ( + this.ClickCount == input.ClickCount || + this.ClickCount.Equals(input.ClickCount) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Position != null) + { + hashCode = (hashCode * 59) + this.Position.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ClickCount.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/ClickThroughRateEvent.cs b/algoliasearch/Analytics/Models/ClickThroughRateEvent.cs new file mode 100644 index 000000000..9e7e4a200 --- /dev/null +++ b/algoliasearch/Analytics/Models/ClickThroughRateEvent.cs @@ -0,0 +1,191 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// ClickThroughRateEvent + /// + [DataContract(Name = "clickThroughRateEvent")] + public partial class ClickThroughRateEvent : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ClickThroughRateEvent() { } + /// + /// Initializes a new instance of the class. + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). (required). + /// Number of click events. (required). + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. (required). + /// Date of the event in the format YYYY-MM-DD. (required). + public ClickThroughRateEvent(double rate = default(double), int clickCount = default(int), int trackedSearchCount = default(int), string date = default(string)) + { + this.Rate = rate; + this.ClickCount = clickCount; + this.TrackedSearchCount = trackedSearchCount; + // to ensure "date" is required (not null) + if (date == null) + { + throw new ArgumentNullException("date is a required property for ClickThroughRateEvent and cannot be null"); + } + this.Date = date; + } + + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + [DataMember(Name = "rate", IsRequired = true, EmitDefaultValue = true)] + public double Rate { get; set; } + + /// + /// Number of click events. + /// + /// Number of click events. + [DataMember(Name = "clickCount", IsRequired = true, EmitDefaultValue = true)] + public int ClickCount { get; set; } + + /// + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. + /// + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. + [DataMember(Name = "trackedSearchCount", IsRequired = true, EmitDefaultValue = true)] + public int TrackedSearchCount { get; set; } + + /// + /// Date of the event in the format YYYY-MM-DD. + /// + /// Date of the event in the format YYYY-MM-DD. + [DataMember(Name = "date", IsRequired = true, EmitDefaultValue = true)] + public string Date { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ClickThroughRateEvent {\n"); + sb.Append(" Rate: ").Append(Rate).Append("\n"); + sb.Append(" ClickCount: ").Append(ClickCount).Append("\n"); + sb.Append(" TrackedSearchCount: ").Append(TrackedSearchCount).Append("\n"); + sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ClickThroughRateEvent); + } + + /// + /// Returns true if ClickThroughRateEvent instances are equal + /// + /// Instance of ClickThroughRateEvent to be compared + /// Boolean + public bool Equals(ClickThroughRateEvent input) + { + if (input == null) + { + return false; + } + return + ( + this.Rate == input.Rate || + this.Rate.Equals(input.Rate) + ) && + ( + this.ClickCount == input.ClickCount || + this.ClickCount.Equals(input.ClickCount) + ) && + ( + this.TrackedSearchCount == input.TrackedSearchCount || + this.TrackedSearchCount.Equals(input.TrackedSearchCount) + ) && + ( + this.Date == input.Date || + (this.Date != null && + this.Date.Equals(input.Date)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Rate.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickCount.GetHashCode(); + hashCode = (hashCode * 59) + this.TrackedSearchCount.GetHashCode(); + if (this.Date != null) + { + hashCode = (hashCode * 59) + this.Date.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Rate (double) maximum + if (this.Rate > (double)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Rate, must be a value less than or equal to 1.", new[] { "Rate" }); + } + + // Rate (double) minimum + if (this.Rate < (double)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Rate, must be a value greater than or equal to 0.", new[] { "Rate" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/ConversionRateEvent.cs b/algoliasearch/Analytics/Models/ConversionRateEvent.cs new file mode 100644 index 000000000..21b6b9f90 --- /dev/null +++ b/algoliasearch/Analytics/Models/ConversionRateEvent.cs @@ -0,0 +1,191 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// ConversionRateEvent + /// + [DataContract(Name = "conversionRateEvent")] + public partial class ConversionRateEvent : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ConversionRateEvent() { } + /// + /// Initializes a new instance of the class. + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). (required). + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. (required). + /// Number of converted clicks. (required). + /// Date of the event in the format YYYY-MM-DD. (required). + public ConversionRateEvent(double rate = default(double), int trackedSearchCount = default(int), int conversionCount = default(int), string date = default(string)) + { + this.Rate = rate; + this.TrackedSearchCount = trackedSearchCount; + this.ConversionCount = conversionCount; + // to ensure "date" is required (not null) + if (date == null) + { + throw new ArgumentNullException("date is a required property for ConversionRateEvent and cannot be null"); + } + this.Date = date; + } + + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + [DataMember(Name = "rate", IsRequired = true, EmitDefaultValue = true)] + public double Rate { get; set; } + + /// + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. + /// + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. + [DataMember(Name = "trackedSearchCount", IsRequired = true, EmitDefaultValue = true)] + public int TrackedSearchCount { get; set; } + + /// + /// Number of converted clicks. + /// + /// Number of converted clicks. + [DataMember(Name = "conversionCount", IsRequired = true, EmitDefaultValue = true)] + public int ConversionCount { get; set; } + + /// + /// Date of the event in the format YYYY-MM-DD. + /// + /// Date of the event in the format YYYY-MM-DD. + [DataMember(Name = "date", IsRequired = true, EmitDefaultValue = true)] + public string Date { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ConversionRateEvent {\n"); + sb.Append(" Rate: ").Append(Rate).Append("\n"); + sb.Append(" TrackedSearchCount: ").Append(TrackedSearchCount).Append("\n"); + sb.Append(" ConversionCount: ").Append(ConversionCount).Append("\n"); + sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ConversionRateEvent); + } + + /// + /// Returns true if ConversionRateEvent instances are equal + /// + /// Instance of ConversionRateEvent to be compared + /// Boolean + public bool Equals(ConversionRateEvent input) + { + if (input == null) + { + return false; + } + return + ( + this.Rate == input.Rate || + this.Rate.Equals(input.Rate) + ) && + ( + this.TrackedSearchCount == input.TrackedSearchCount || + this.TrackedSearchCount.Equals(input.TrackedSearchCount) + ) && + ( + this.ConversionCount == input.ConversionCount || + this.ConversionCount.Equals(input.ConversionCount) + ) && + ( + this.Date == input.Date || + (this.Date != null && + this.Date.Equals(input.Date)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Rate.GetHashCode(); + hashCode = (hashCode * 59) + this.TrackedSearchCount.GetHashCode(); + hashCode = (hashCode * 59) + this.ConversionCount.GetHashCode(); + if (this.Date != null) + { + hashCode = (hashCode * 59) + this.Date.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Rate (double) maximum + if (this.Rate > (double)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Rate, must be a value less than or equal to 1.", new[] { "Rate" }); + } + + // Rate (double) minimum + if (this.Rate < (double)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Rate, must be a value greater than or equal to 0.", new[] { "Rate" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/Direction.cs b/algoliasearch/Analytics/Models/Direction.cs new file mode 100644 index 000000000..f1c609f72 --- /dev/null +++ b/algoliasearch/Analytics/Models/Direction.cs @@ -0,0 +1,42 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// Defines direction + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum Direction + { + /// + /// Enum Asc for value: asc + /// + [EnumMember(Value = "asc")] + Asc = 1, + + /// + /// Enum Desc for value: desc + /// + [EnumMember(Value = "desc")] + Desc = 2 + } + +} diff --git a/algoliasearch/Analytics/Models/ErrorBase.cs b/algoliasearch/Analytics/Models/ErrorBase.cs new file mode 100644 index 000000000..2b637f863 --- /dev/null +++ b/algoliasearch/Analytics/Models/ErrorBase.cs @@ -0,0 +1,147 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// Error. + /// + [DataContract(Name = "ErrorBase")] + public partial class ErrorBase : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// message. + public ErrorBase(string message = default(string)) : base() + { + this.Message = message; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Message + /// + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ErrorBase {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ErrorBase); + } + + /// + /// Returns true if ErrorBase instances are equal + /// + /// Instance of ErrorBase to be compared + /// Boolean + public bool Equals(ErrorBase input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetAverageClickPositionResponse.cs b/algoliasearch/Analytics/Models/GetAverageClickPositionResponse.cs new file mode 100644 index 000000000..2707bb1d9 --- /dev/null +++ b/algoliasearch/Analytics/Models/GetAverageClickPositionResponse.cs @@ -0,0 +1,165 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetAverageClickPositionResponse + /// + [DataContract(Name = "getAverageClickPositionResponse")] + public partial class GetAverageClickPositionResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetAverageClickPositionResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Average count of all click events. (required). + /// Number of click events. (required). + /// Average click positions. (required). + public GetAverageClickPositionResponse(double average = default(double), int clickCount = default(int), List dates = default(List)) + { + this.Average = average; + this.ClickCount = clickCount; + // to ensure "dates" is required (not null) + if (dates == null) + { + throw new ArgumentNullException("dates is a required property for GetAverageClickPositionResponse and cannot be null"); + } + this.Dates = dates; + } + + /// + /// Average count of all click events. + /// + /// Average count of all click events. + [DataMember(Name = "average", IsRequired = true, EmitDefaultValue = true)] + public double Average { get; set; } + + /// + /// Number of click events. + /// + /// Number of click events. + [DataMember(Name = "clickCount", IsRequired = true, EmitDefaultValue = true)] + public int ClickCount { get; set; } + + /// + /// Average click positions. + /// + /// Average click positions. + [DataMember(Name = "dates", IsRequired = true, EmitDefaultValue = true)] + public List Dates { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetAverageClickPositionResponse {\n"); + sb.Append(" Average: ").Append(Average).Append("\n"); + sb.Append(" ClickCount: ").Append(ClickCount).Append("\n"); + sb.Append(" Dates: ").Append(Dates).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetAverageClickPositionResponse); + } + + /// + /// Returns true if GetAverageClickPositionResponse instances are equal + /// + /// Instance of GetAverageClickPositionResponse to be compared + /// Boolean + public bool Equals(GetAverageClickPositionResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Average == input.Average || + this.Average.Equals(input.Average) + ) && + ( + this.ClickCount == input.ClickCount || + this.ClickCount.Equals(input.ClickCount) + ) && + ( + this.Dates == input.Dates || + this.Dates != null && + input.Dates != null && + this.Dates.SequenceEqual(input.Dates) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Average.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickCount.GetHashCode(); + if (this.Dates != null) + { + hashCode = (hashCode * 59) + this.Dates.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetClickPositionsResponse.cs b/algoliasearch/Analytics/Models/GetClickPositionsResponse.cs new file mode 100644 index 000000000..5d81e3030 --- /dev/null +++ b/algoliasearch/Analytics/Models/GetClickPositionsResponse.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetClickPositionsResponse + /// + [DataContract(Name = "getClickPositionsResponse")] + public partial class GetClickPositionsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetClickPositionsResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Click positions. (required). + public GetClickPositionsResponse(List positions = default(List)) + { + // to ensure "positions" is required (not null) + if (positions == null) + { + throw new ArgumentNullException("positions is a required property for GetClickPositionsResponse and cannot be null"); + } + this.Positions = positions; + } + + /// + /// Click positions. + /// + /// Click positions. + [DataMember(Name = "positions", IsRequired = true, EmitDefaultValue = true)] + public List Positions { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetClickPositionsResponse {\n"); + sb.Append(" Positions: ").Append(Positions).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetClickPositionsResponse); + } + + /// + /// Returns true if GetClickPositionsResponse instances are equal + /// + /// Instance of GetClickPositionsResponse to be compared + /// Boolean + public bool Equals(GetClickPositionsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Positions == input.Positions || + this.Positions != null && + input.Positions != null && + this.Positions.SequenceEqual(input.Positions) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Positions != null) + { + hashCode = (hashCode * 59) + this.Positions.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetClickThroughRateResponse.cs b/algoliasearch/Analytics/Models/GetClickThroughRateResponse.cs new file mode 100644 index 000000000..3b62e2fee --- /dev/null +++ b/algoliasearch/Analytics/Models/GetClickThroughRateResponse.cs @@ -0,0 +1,192 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetClickThroughRateResponse + /// + [DataContract(Name = "getClickThroughRateResponse")] + public partial class GetClickThroughRateResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetClickThroughRateResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). (required). + /// Number of click events. (required). + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. (required). + /// Click-through rate events. (required). + public GetClickThroughRateResponse(double rate = default(double), int clickCount = default(int), int trackedSearchCount = default(int), List dates = default(List)) + { + this.Rate = rate; + this.ClickCount = clickCount; + this.TrackedSearchCount = trackedSearchCount; + // to ensure "dates" is required (not null) + if (dates == null) + { + throw new ArgumentNullException("dates is a required property for GetClickThroughRateResponse and cannot be null"); + } + this.Dates = dates; + } + + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + [DataMember(Name = "rate", IsRequired = true, EmitDefaultValue = true)] + public double Rate { get; set; } + + /// + /// Number of click events. + /// + /// Number of click events. + [DataMember(Name = "clickCount", IsRequired = true, EmitDefaultValue = true)] + public int ClickCount { get; set; } + + /// + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. + /// + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. + [DataMember(Name = "trackedSearchCount", IsRequired = true, EmitDefaultValue = true)] + public int TrackedSearchCount { get; set; } + + /// + /// Click-through rate events. + /// + /// Click-through rate events. + [DataMember(Name = "dates", IsRequired = true, EmitDefaultValue = true)] + public List Dates { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetClickThroughRateResponse {\n"); + sb.Append(" Rate: ").Append(Rate).Append("\n"); + sb.Append(" ClickCount: ").Append(ClickCount).Append("\n"); + sb.Append(" TrackedSearchCount: ").Append(TrackedSearchCount).Append("\n"); + sb.Append(" Dates: ").Append(Dates).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetClickThroughRateResponse); + } + + /// + /// Returns true if GetClickThroughRateResponse instances are equal + /// + /// Instance of GetClickThroughRateResponse to be compared + /// Boolean + public bool Equals(GetClickThroughRateResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Rate == input.Rate || + this.Rate.Equals(input.Rate) + ) && + ( + this.ClickCount == input.ClickCount || + this.ClickCount.Equals(input.ClickCount) + ) && + ( + this.TrackedSearchCount == input.TrackedSearchCount || + this.TrackedSearchCount.Equals(input.TrackedSearchCount) + ) && + ( + this.Dates == input.Dates || + this.Dates != null && + input.Dates != null && + this.Dates.SequenceEqual(input.Dates) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Rate.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickCount.GetHashCode(); + hashCode = (hashCode * 59) + this.TrackedSearchCount.GetHashCode(); + if (this.Dates != null) + { + hashCode = (hashCode * 59) + this.Dates.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Rate (double) maximum + if (this.Rate > (double)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Rate, must be a value less than or equal to 1.", new[] { "Rate" }); + } + + // Rate (double) minimum + if (this.Rate < (double)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Rate, must be a value greater than or equal to 0.", new[] { "Rate" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetConversationRateResponse.cs b/algoliasearch/Analytics/Models/GetConversationRateResponse.cs new file mode 100644 index 000000000..972c46ed6 --- /dev/null +++ b/algoliasearch/Analytics/Models/GetConversationRateResponse.cs @@ -0,0 +1,192 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetConversationRateResponse + /// + [DataContract(Name = "getConversationRateResponse")] + public partial class GetConversationRateResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetConversationRateResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). (required). + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. (required). + /// Number of converted clicks. (required). + /// Conversion events. (required). + public GetConversationRateResponse(double rate = default(double), int trackedSearchCount = default(int), int conversionCount = default(int), List dates = default(List)) + { + this.Rate = rate; + this.TrackedSearchCount = trackedSearchCount; + this.ConversionCount = conversionCount; + // to ensure "dates" is required (not null) + if (dates == null) + { + throw new ArgumentNullException("dates is a required property for GetConversationRateResponse and cannot be null"); + } + this.Dates = dates; + } + + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + [DataMember(Name = "rate", IsRequired = true, EmitDefaultValue = true)] + public double Rate { get; set; } + + /// + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. + /// + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. + [DataMember(Name = "trackedSearchCount", IsRequired = true, EmitDefaultValue = true)] + public int TrackedSearchCount { get; set; } + + /// + /// Number of converted clicks. + /// + /// Number of converted clicks. + [DataMember(Name = "conversionCount", IsRequired = true, EmitDefaultValue = true)] + public int ConversionCount { get; set; } + + /// + /// Conversion events. + /// + /// Conversion events. + [DataMember(Name = "dates", IsRequired = true, EmitDefaultValue = true)] + public List Dates { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetConversationRateResponse {\n"); + sb.Append(" Rate: ").Append(Rate).Append("\n"); + sb.Append(" TrackedSearchCount: ").Append(TrackedSearchCount).Append("\n"); + sb.Append(" ConversionCount: ").Append(ConversionCount).Append("\n"); + sb.Append(" Dates: ").Append(Dates).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetConversationRateResponse); + } + + /// + /// Returns true if GetConversationRateResponse instances are equal + /// + /// Instance of GetConversationRateResponse to be compared + /// Boolean + public bool Equals(GetConversationRateResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Rate == input.Rate || + this.Rate.Equals(input.Rate) + ) && + ( + this.TrackedSearchCount == input.TrackedSearchCount || + this.TrackedSearchCount.Equals(input.TrackedSearchCount) + ) && + ( + this.ConversionCount == input.ConversionCount || + this.ConversionCount.Equals(input.ConversionCount) + ) && + ( + this.Dates == input.Dates || + this.Dates != null && + input.Dates != null && + this.Dates.SequenceEqual(input.Dates) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Rate.GetHashCode(); + hashCode = (hashCode * 59) + this.TrackedSearchCount.GetHashCode(); + hashCode = (hashCode * 59) + this.ConversionCount.GetHashCode(); + if (this.Dates != null) + { + hashCode = (hashCode * 59) + this.Dates.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Rate (double) maximum + if (this.Rate > (double)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Rate, must be a value less than or equal to 1.", new[] { "Rate" }); + } + + // Rate (double) minimum + if (this.Rate < (double)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Rate, must be a value greater than or equal to 0.", new[] { "Rate" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetNoClickRateResponse.cs b/algoliasearch/Analytics/Models/GetNoClickRateResponse.cs new file mode 100644 index 000000000..1cab20720 --- /dev/null +++ b/algoliasearch/Analytics/Models/GetNoClickRateResponse.cs @@ -0,0 +1,192 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetNoClickRateResponse + /// + [DataContract(Name = "getNoClickRateResponse")] + public partial class GetNoClickRateResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetNoClickRateResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). (required). + /// Number of click events. (required). + /// Number of click events. (required). + /// Overall count of searches without clicks plus a daily breakdown. (required). + public GetNoClickRateResponse(double rate = default(double), int count = default(int), int noClickCount = default(int), List dates = default(List)) + { + this.Rate = rate; + this.Count = count; + this.NoClickCount = noClickCount; + // to ensure "dates" is required (not null) + if (dates == null) + { + throw new ArgumentNullException("dates is a required property for GetNoClickRateResponse and cannot be null"); + } + this.Dates = dates; + } + + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + [DataMember(Name = "rate", IsRequired = true, EmitDefaultValue = true)] + public double Rate { get; set; } + + /// + /// Number of click events. + /// + /// Number of click events. + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Number of click events. + /// + /// Number of click events. + [DataMember(Name = "noClickCount", IsRequired = true, EmitDefaultValue = true)] + public int NoClickCount { get; set; } + + /// + /// Overall count of searches without clicks plus a daily breakdown. + /// + /// Overall count of searches without clicks plus a daily breakdown. + [DataMember(Name = "dates", IsRequired = true, EmitDefaultValue = true)] + public List Dates { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetNoClickRateResponse {\n"); + sb.Append(" Rate: ").Append(Rate).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" NoClickCount: ").Append(NoClickCount).Append("\n"); + sb.Append(" Dates: ").Append(Dates).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetNoClickRateResponse); + } + + /// + /// Returns true if GetNoClickRateResponse instances are equal + /// + /// Instance of GetNoClickRateResponse to be compared + /// Boolean + public bool Equals(GetNoClickRateResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Rate == input.Rate || + this.Rate.Equals(input.Rate) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ) && + ( + this.NoClickCount == input.NoClickCount || + this.NoClickCount.Equals(input.NoClickCount) + ) && + ( + this.Dates == input.Dates || + this.Dates != null && + input.Dates != null && + this.Dates.SequenceEqual(input.Dates) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Rate.GetHashCode(); + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + hashCode = (hashCode * 59) + this.NoClickCount.GetHashCode(); + if (this.Dates != null) + { + hashCode = (hashCode * 59) + this.Dates.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Rate (double) maximum + if (this.Rate > (double)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Rate, must be a value less than or equal to 1.", new[] { "Rate" }); + } + + // Rate (double) minimum + if (this.Rate < (double)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Rate, must be a value greater than or equal to 0.", new[] { "Rate" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetNoResultsRateResponse.cs b/algoliasearch/Analytics/Models/GetNoResultsRateResponse.cs new file mode 100644 index 000000000..6f5b283db --- /dev/null +++ b/algoliasearch/Analytics/Models/GetNoResultsRateResponse.cs @@ -0,0 +1,192 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetNoResultsRateResponse + /// + [DataContract(Name = "getNoResultsRateResponse")] + public partial class GetNoResultsRateResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetNoResultsRateResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). (required). + /// Number of occurrences. (required). + /// Number of occurrences. (required). + /// Overall count of searches without results plus a daily breakdown. (required). + public GetNoResultsRateResponse(double rate = default(double), int count = default(int), int noResultCount = default(int), List dates = default(List)) + { + this.Rate = rate; + this.Count = count; + this.NoResultCount = noResultCount; + // to ensure "dates" is required (not null) + if (dates == null) + { + throw new ArgumentNullException("dates is a required property for GetNoResultsRateResponse and cannot be null"); + } + this.Dates = dates; + } + + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + [DataMember(Name = "rate", IsRequired = true, EmitDefaultValue = true)] + public double Rate { get; set; } + + /// + /// Number of occurrences. + /// + /// Number of occurrences. + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Number of occurrences. + /// + /// Number of occurrences. + [DataMember(Name = "noResultCount", IsRequired = true, EmitDefaultValue = true)] + public int NoResultCount { get; set; } + + /// + /// Overall count of searches without results plus a daily breakdown. + /// + /// Overall count of searches without results plus a daily breakdown. + [DataMember(Name = "dates", IsRequired = true, EmitDefaultValue = true)] + public List Dates { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetNoResultsRateResponse {\n"); + sb.Append(" Rate: ").Append(Rate).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" NoResultCount: ").Append(NoResultCount).Append("\n"); + sb.Append(" Dates: ").Append(Dates).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetNoResultsRateResponse); + } + + /// + /// Returns true if GetNoResultsRateResponse instances are equal + /// + /// Instance of GetNoResultsRateResponse to be compared + /// Boolean + public bool Equals(GetNoResultsRateResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Rate == input.Rate || + this.Rate.Equals(input.Rate) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ) && + ( + this.NoResultCount == input.NoResultCount || + this.NoResultCount.Equals(input.NoResultCount) + ) && + ( + this.Dates == input.Dates || + this.Dates != null && + input.Dates != null && + this.Dates.SequenceEqual(input.Dates) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Rate.GetHashCode(); + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + hashCode = (hashCode * 59) + this.NoResultCount.GetHashCode(); + if (this.Dates != null) + { + hashCode = (hashCode * 59) + this.Dates.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Rate (double) maximum + if (this.Rate > (double)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Rate, must be a value less than or equal to 1.", new[] { "Rate" }); + } + + // Rate (double) minimum + if (this.Rate < (double)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Rate, must be a value greater than or equal to 0.", new[] { "Rate" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetSearchesCountResponse.cs b/algoliasearch/Analytics/Models/GetSearchesCountResponse.cs new file mode 100644 index 000000000..985f5f2ed --- /dev/null +++ b/algoliasearch/Analytics/Models/GetSearchesCountResponse.cs @@ -0,0 +1,150 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetSearchesCountResponse + /// + [DataContract(Name = "getSearchesCountResponse")] + public partial class GetSearchesCountResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetSearchesCountResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Number of occurrences. (required). + /// Search events with their associated dates and hit counts. (required). + public GetSearchesCountResponse(int count = default(int), List dates = default(List)) + { + this.Count = count; + // to ensure "dates" is required (not null) + if (dates == null) + { + throw new ArgumentNullException("dates is a required property for GetSearchesCountResponse and cannot be null"); + } + this.Dates = dates; + } + + /// + /// Number of occurrences. + /// + /// Number of occurrences. + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Search events with their associated dates and hit counts. + /// + /// Search events with their associated dates and hit counts. + [DataMember(Name = "dates", IsRequired = true, EmitDefaultValue = true)] + public List Dates { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetSearchesCountResponse {\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" Dates: ").Append(Dates).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetSearchesCountResponse); + } + + /// + /// Returns true if GetSearchesCountResponse instances are equal + /// + /// Instance of GetSearchesCountResponse to be compared + /// Boolean + public bool Equals(GetSearchesCountResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ) && + ( + this.Dates == input.Dates || + this.Dates != null && + input.Dates != null && + this.Dates.SequenceEqual(input.Dates) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + if (this.Dates != null) + { + hashCode = (hashCode * 59) + this.Dates.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetSearchesNoClicksResponse.cs b/algoliasearch/Analytics/Models/GetSearchesNoClicksResponse.cs new file mode 100644 index 000000000..9387e67b6 --- /dev/null +++ b/algoliasearch/Analytics/Models/GetSearchesNoClicksResponse.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetSearchesNoClicksResponse + /// + [DataContract(Name = "getSearchesNoClicksResponse")] + public partial class GetSearchesNoClicksResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetSearchesNoClicksResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Searches with no clicks. (required). + public GetSearchesNoClicksResponse(List searches = default(List)) + { + // to ensure "searches" is required (not null) + if (searches == null) + { + throw new ArgumentNullException("searches is a required property for GetSearchesNoClicksResponse and cannot be null"); + } + this.Searches = searches; + } + + /// + /// Searches with no clicks. + /// + /// Searches with no clicks. + [DataMember(Name = "searches", IsRequired = true, EmitDefaultValue = true)] + public List Searches { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetSearchesNoClicksResponse {\n"); + sb.Append(" Searches: ").Append(Searches).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetSearchesNoClicksResponse); + } + + /// + /// Returns true if GetSearchesNoClicksResponse instances are equal + /// + /// Instance of GetSearchesNoClicksResponse to be compared + /// Boolean + public bool Equals(GetSearchesNoClicksResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Searches == input.Searches || + this.Searches != null && + input.Searches != null && + this.Searches.SequenceEqual(input.Searches) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Searches != null) + { + hashCode = (hashCode * 59) + this.Searches.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetSearchesNoResultsResponse.cs b/algoliasearch/Analytics/Models/GetSearchesNoResultsResponse.cs new file mode 100644 index 000000000..62cb150ce --- /dev/null +++ b/algoliasearch/Analytics/Models/GetSearchesNoResultsResponse.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetSearchesNoResultsResponse + /// + [DataContract(Name = "getSearchesNoResultsResponse")] + public partial class GetSearchesNoResultsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetSearchesNoResultsResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Searches with no results. (required). + public GetSearchesNoResultsResponse(List searches = default(List)) + { + // to ensure "searches" is required (not null) + if (searches == null) + { + throw new ArgumentNullException("searches is a required property for GetSearchesNoResultsResponse and cannot be null"); + } + this.Searches = searches; + } + + /// + /// Searches with no results. + /// + /// Searches with no results. + [DataMember(Name = "searches", IsRequired = true, EmitDefaultValue = true)] + public List Searches { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetSearchesNoResultsResponse {\n"); + sb.Append(" Searches: ").Append(Searches).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetSearchesNoResultsResponse); + } + + /// + /// Returns true if GetSearchesNoResultsResponse instances are equal + /// + /// Instance of GetSearchesNoResultsResponse to be compared + /// Boolean + public bool Equals(GetSearchesNoResultsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Searches == input.Searches || + this.Searches != null && + input.Searches != null && + this.Searches.SequenceEqual(input.Searches) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Searches != null) + { + hashCode = (hashCode * 59) + this.Searches.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetStatusResponse.cs b/algoliasearch/Analytics/Models/GetStatusResponse.cs new file mode 100644 index 000000000..9f74395e9 --- /dev/null +++ b/algoliasearch/Analytics/Models/GetStatusResponse.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetStatusResponse + /// + [DataContract(Name = "getStatusResponse")] + public partial class GetStatusResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetStatusResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + public GetStatusResponse(string updatedAt = default(string)) + { + // to ensure "updatedAt" is required (not null) + if (updatedAt == null) + { + throw new ArgumentNullException("updatedAt is a required property for GetStatusResponse and cannot be null"); + } + this.UpdatedAt = updatedAt; + } + + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "updatedAt", IsRequired = true, EmitDefaultValue = true)] + public string UpdatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetStatusResponse {\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetStatusResponse); + } + + /// + /// Returns true if GetStatusResponse instances are equal + /// + /// Instance of GetStatusResponse to be compared + /// Boolean + public bool Equals(GetStatusResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetTopCountriesResponse.cs b/algoliasearch/Analytics/Models/GetTopCountriesResponse.cs new file mode 100644 index 000000000..f1e191fc0 --- /dev/null +++ b/algoliasearch/Analytics/Models/GetTopCountriesResponse.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetTopCountriesResponse + /// + [DataContract(Name = "getTopCountriesResponse")] + public partial class GetTopCountriesResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetTopCountriesResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Countries (required). + public GetTopCountriesResponse(List countries = default(List)) + { + // to ensure "countries" is required (not null) + if (countries == null) + { + throw new ArgumentNullException("countries is a required property for GetTopCountriesResponse and cannot be null"); + } + this.Countries = countries; + } + + /// + /// Countries + /// + /// Countries + [DataMember(Name = "countries", IsRequired = true, EmitDefaultValue = true)] + public List Countries { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetTopCountriesResponse {\n"); + sb.Append(" Countries: ").Append(Countries).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetTopCountriesResponse); + } + + /// + /// Returns true if GetTopCountriesResponse instances are equal + /// + /// Instance of GetTopCountriesResponse to be compared + /// Boolean + public bool Equals(GetTopCountriesResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Countries == input.Countries || + this.Countries != null && + input.Countries != null && + this.Countries.SequenceEqual(input.Countries) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Countries != null) + { + hashCode = (hashCode * 59) + this.Countries.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetTopFilterAttribute.cs b/algoliasearch/Analytics/Models/GetTopFilterAttribute.cs new file mode 100644 index 000000000..4889a31b9 --- /dev/null +++ b/algoliasearch/Analytics/Models/GetTopFilterAttribute.cs @@ -0,0 +1,149 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetTopFilterAttribute + /// + [DataContract(Name = "getTopFilterAttribute")] + public partial class GetTopFilterAttribute : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetTopFilterAttribute() { } + /// + /// Initializes a new instance of the class. + /// + /// Attribute name. (required). + /// Number of occurrences. (required). + public GetTopFilterAttribute(string attribute = default(string), int count = default(int)) + { + // to ensure "attribute" is required (not null) + if (attribute == null) + { + throw new ArgumentNullException("attribute is a required property for GetTopFilterAttribute and cannot be null"); + } + this.Attribute = attribute; + this.Count = count; + } + + /// + /// Attribute name. + /// + /// Attribute name. + [DataMember(Name = "attribute", IsRequired = true, EmitDefaultValue = true)] + public string Attribute { get; set; } + + /// + /// Number of occurrences. + /// + /// Number of occurrences. + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetTopFilterAttribute {\n"); + sb.Append(" Attribute: ").Append(Attribute).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetTopFilterAttribute); + } + + /// + /// Returns true if GetTopFilterAttribute instances are equal + /// + /// Instance of GetTopFilterAttribute to be compared + /// Boolean + public bool Equals(GetTopFilterAttribute input) + { + if (input == null) + { + return false; + } + return + ( + this.Attribute == input.Attribute || + (this.Attribute != null && + this.Attribute.Equals(input.Attribute)) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Attribute != null) + { + hashCode = (hashCode * 59) + this.Attribute.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetTopFilterAttributesResponse.cs b/algoliasearch/Analytics/Models/GetTopFilterAttributesResponse.cs new file mode 100644 index 000000000..14bde9cbb --- /dev/null +++ b/algoliasearch/Analytics/Models/GetTopFilterAttributesResponse.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetTopFilterAttributesResponse + /// + [DataContract(Name = "getTopFilterAttributesResponse")] + public partial class GetTopFilterAttributesResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetTopFilterAttributesResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Filterable attributes. (required). + public GetTopFilterAttributesResponse(List attributes = default(List)) + { + // to ensure "attributes" is required (not null) + if (attributes == null) + { + throw new ArgumentNullException("attributes is a required property for GetTopFilterAttributesResponse and cannot be null"); + } + this.Attributes = attributes; + } + + /// + /// Filterable attributes. + /// + /// Filterable attributes. + [DataMember(Name = "attributes", IsRequired = true, EmitDefaultValue = true)] + public List Attributes { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetTopFilterAttributesResponse {\n"); + sb.Append(" Attributes: ").Append(Attributes).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetTopFilterAttributesResponse); + } + + /// + /// Returns true if GetTopFilterAttributesResponse instances are equal + /// + /// Instance of GetTopFilterAttributesResponse to be compared + /// Boolean + public bool Equals(GetTopFilterAttributesResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Attributes == input.Attributes || + this.Attributes != null && + input.Attributes != null && + this.Attributes.SequenceEqual(input.Attributes) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Attributes != null) + { + hashCode = (hashCode * 59) + this.Attributes.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetTopFilterForAttribute.cs b/algoliasearch/Analytics/Models/GetTopFilterForAttribute.cs new file mode 100644 index 000000000..6d434dad3 --- /dev/null +++ b/algoliasearch/Analytics/Models/GetTopFilterForAttribute.cs @@ -0,0 +1,197 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetTopFilterForAttribute + /// + [DataContract(Name = "getTopFilterForAttribute")] + public partial class GetTopFilterForAttribute : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetTopFilterForAttribute() { } + /// + /// Initializes a new instance of the class. + /// + /// Attribute name. (required). + /// Operator. (required). + /// Attribute value. (required). + /// Number of occurrences. (required). + public GetTopFilterForAttribute(string attribute = default(string), string varOperator = default(string), string value = default(string), int count = default(int)) + { + // to ensure "attribute" is required (not null) + if (attribute == null) + { + throw new ArgumentNullException("attribute is a required property for GetTopFilterForAttribute and cannot be null"); + } + this.Attribute = attribute; + // to ensure "varOperator" is required (not null) + if (varOperator == null) + { + throw new ArgumentNullException("varOperator is a required property for GetTopFilterForAttribute and cannot be null"); + } + this.VarOperator = varOperator; + // to ensure "value" is required (not null) + if (value == null) + { + throw new ArgumentNullException("value is a required property for GetTopFilterForAttribute and cannot be null"); + } + this.Value = value; + this.Count = count; + } + + /// + /// Attribute name. + /// + /// Attribute name. + [DataMember(Name = "attribute", IsRequired = true, EmitDefaultValue = true)] + public string Attribute { get; set; } + + /// + /// Operator. + /// + /// Operator. + [DataMember(Name = "operator", IsRequired = true, EmitDefaultValue = true)] + public string VarOperator { get; set; } + + /// + /// Attribute value. + /// + /// Attribute value. + [DataMember(Name = "value", IsRequired = true, EmitDefaultValue = true)] + public string Value { get; set; } + + /// + /// Number of occurrences. + /// + /// Number of occurrences. + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetTopFilterForAttribute {\n"); + sb.Append(" Attribute: ").Append(Attribute).Append("\n"); + sb.Append(" VarOperator: ").Append(VarOperator).Append("\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetTopFilterForAttribute); + } + + /// + /// Returns true if GetTopFilterForAttribute instances are equal + /// + /// Instance of GetTopFilterForAttribute to be compared + /// Boolean + public bool Equals(GetTopFilterForAttribute input) + { + if (input == null) + { + return false; + } + return + ( + this.Attribute == input.Attribute || + (this.Attribute != null && + this.Attribute.Equals(input.Attribute)) + ) && + ( + this.VarOperator == input.VarOperator || + (this.VarOperator != null && + this.VarOperator.Equals(input.VarOperator)) + ) && + ( + this.Value == input.Value || + (this.Value != null && + this.Value.Equals(input.Value)) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Attribute != null) + { + hashCode = (hashCode * 59) + this.Attribute.GetHashCode(); + } + if (this.VarOperator != null) + { + hashCode = (hashCode * 59) + this.VarOperator.GetHashCode(); + } + if (this.Value != null) + { + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetTopFilterForAttributeResponse.cs b/algoliasearch/Analytics/Models/GetTopFilterForAttributeResponse.cs new file mode 100644 index 000000000..77966f655 --- /dev/null +++ b/algoliasearch/Analytics/Models/GetTopFilterForAttributeResponse.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetTopFilterForAttributeResponse + /// + [DataContract(Name = "getTopFilterForAttributeResponse")] + public partial class GetTopFilterForAttributeResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetTopFilterForAttributeResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Filter values for an attribute. (required). + public GetTopFilterForAttributeResponse(List values = default(List)) + { + // to ensure "values" is required (not null) + if (values == null) + { + throw new ArgumentNullException("values is a required property for GetTopFilterForAttributeResponse and cannot be null"); + } + this.Values = values; + } + + /// + /// Filter values for an attribute. + /// + /// Filter values for an attribute. + [DataMember(Name = "values", IsRequired = true, EmitDefaultValue = true)] + public List Values { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetTopFilterForAttributeResponse {\n"); + sb.Append(" Values: ").Append(Values).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetTopFilterForAttributeResponse); + } + + /// + /// Returns true if GetTopFilterForAttributeResponse instances are equal + /// + /// Instance of GetTopFilterForAttributeResponse to be compared + /// Boolean + public bool Equals(GetTopFilterForAttributeResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Values == input.Values || + this.Values != null && + input.Values != null && + this.Values.SequenceEqual(input.Values) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Values != null) + { + hashCode = (hashCode * 59) + this.Values.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetTopFiltersNoResultsResponse.cs b/algoliasearch/Analytics/Models/GetTopFiltersNoResultsResponse.cs new file mode 100644 index 000000000..011685f24 --- /dev/null +++ b/algoliasearch/Analytics/Models/GetTopFiltersNoResultsResponse.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetTopFiltersNoResultsResponse + /// + [DataContract(Name = "getTopFiltersNoResultsResponse")] + public partial class GetTopFiltersNoResultsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetTopFiltersNoResultsResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Filters with no results. (required). + public GetTopFiltersNoResultsResponse(List values = default(List)) + { + // to ensure "values" is required (not null) + if (values == null) + { + throw new ArgumentNullException("values is a required property for GetTopFiltersNoResultsResponse and cannot be null"); + } + this.Values = values; + } + + /// + /// Filters with no results. + /// + /// Filters with no results. + [DataMember(Name = "values", IsRequired = true, EmitDefaultValue = true)] + public List Values { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetTopFiltersNoResultsResponse {\n"); + sb.Append(" Values: ").Append(Values).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetTopFiltersNoResultsResponse); + } + + /// + /// Returns true if GetTopFiltersNoResultsResponse instances are equal + /// + /// Instance of GetTopFiltersNoResultsResponse to be compared + /// Boolean + public bool Equals(GetTopFiltersNoResultsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Values == input.Values || + this.Values != null && + input.Values != null && + this.Values.SequenceEqual(input.Values) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Values != null) + { + hashCode = (hashCode * 59) + this.Values.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetTopFiltersNoResultsValue.cs b/algoliasearch/Analytics/Models/GetTopFiltersNoResultsValue.cs new file mode 100644 index 000000000..f4c6b3a53 --- /dev/null +++ b/algoliasearch/Analytics/Models/GetTopFiltersNoResultsValue.cs @@ -0,0 +1,182 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetTopFiltersNoResultsValue + /// + [DataContract(Name = "getTopFiltersNoResultsValue")] + public partial class GetTopFiltersNoResultsValue : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetTopFiltersNoResultsValue() { } + /// + /// Initializes a new instance of the class. + /// + /// Attribute name. (required). + /// Operator. (required). + /// Attribute value. (required). + public GetTopFiltersNoResultsValue(string attribute = default(string), string varOperator = default(string), string value = default(string)) + { + // to ensure "attribute" is required (not null) + if (attribute == null) + { + throw new ArgumentNullException("attribute is a required property for GetTopFiltersNoResultsValue and cannot be null"); + } + this.Attribute = attribute; + // to ensure "varOperator" is required (not null) + if (varOperator == null) + { + throw new ArgumentNullException("varOperator is a required property for GetTopFiltersNoResultsValue and cannot be null"); + } + this.VarOperator = varOperator; + // to ensure "value" is required (not null) + if (value == null) + { + throw new ArgumentNullException("value is a required property for GetTopFiltersNoResultsValue and cannot be null"); + } + this.Value = value; + } + + /// + /// Attribute name. + /// + /// Attribute name. + [DataMember(Name = "attribute", IsRequired = true, EmitDefaultValue = true)] + public string Attribute { get; set; } + + /// + /// Operator. + /// + /// Operator. + [DataMember(Name = "operator", IsRequired = true, EmitDefaultValue = true)] + public string VarOperator { get; set; } + + /// + /// Attribute value. + /// + /// Attribute value. + [DataMember(Name = "value", IsRequired = true, EmitDefaultValue = true)] + public string Value { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetTopFiltersNoResultsValue {\n"); + sb.Append(" Attribute: ").Append(Attribute).Append("\n"); + sb.Append(" VarOperator: ").Append(VarOperator).Append("\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetTopFiltersNoResultsValue); + } + + /// + /// Returns true if GetTopFiltersNoResultsValue instances are equal + /// + /// Instance of GetTopFiltersNoResultsValue to be compared + /// Boolean + public bool Equals(GetTopFiltersNoResultsValue input) + { + if (input == null) + { + return false; + } + return + ( + this.Attribute == input.Attribute || + (this.Attribute != null && + this.Attribute.Equals(input.Attribute)) + ) && + ( + this.VarOperator == input.VarOperator || + (this.VarOperator != null && + this.VarOperator.Equals(input.VarOperator)) + ) && + ( + this.Value == input.Value || + (this.Value != null && + this.Value.Equals(input.Value)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Attribute != null) + { + hashCode = (hashCode * 59) + this.Attribute.GetHashCode(); + } + if (this.VarOperator != null) + { + hashCode = (hashCode * 59) + this.VarOperator.GetHashCode(); + } + if (this.Value != null) + { + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetTopFiltersNoResultsValues.cs b/algoliasearch/Analytics/Models/GetTopFiltersNoResultsValues.cs new file mode 100644 index 000000000..01617982d --- /dev/null +++ b/algoliasearch/Analytics/Models/GetTopFiltersNoResultsValues.cs @@ -0,0 +1,150 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetTopFiltersNoResultsValues + /// + [DataContract(Name = "getTopFiltersNoResultsValues")] + public partial class GetTopFiltersNoResultsValues : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetTopFiltersNoResultsValues() { } + /// + /// Initializes a new instance of the class. + /// + /// Number of occurrences. (required). + /// Filters with no results. (required). + public GetTopFiltersNoResultsValues(int count = default(int), List values = default(List)) + { + this.Count = count; + // to ensure "values" is required (not null) + if (values == null) + { + throw new ArgumentNullException("values is a required property for GetTopFiltersNoResultsValues and cannot be null"); + } + this.Values = values; + } + + /// + /// Number of occurrences. + /// + /// Number of occurrences. + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Filters with no results. + /// + /// Filters with no results. + [DataMember(Name = "values", IsRequired = true, EmitDefaultValue = true)] + public List Values { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetTopFiltersNoResultsValues {\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" Values: ").Append(Values).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetTopFiltersNoResultsValues); + } + + /// + /// Returns true if GetTopFiltersNoResultsValues instances are equal + /// + /// Instance of GetTopFiltersNoResultsValues to be compared + /// Boolean + public bool Equals(GetTopFiltersNoResultsValues input) + { + if (input == null) + { + return false; + } + return + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ) && + ( + this.Values == input.Values || + this.Values != null && + input.Values != null && + this.Values.SequenceEqual(input.Values) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + if (this.Values != null) + { + hashCode = (hashCode * 59) + this.Values.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetTopHitsResponse.cs b/algoliasearch/Analytics/Models/GetTopHitsResponse.cs new file mode 100644 index 000000000..705c05c75 --- /dev/null +++ b/algoliasearch/Analytics/Models/GetTopHitsResponse.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetTopHitsResponse + /// + [JsonConverter(typeof(GetTopHitsResponseJsonConverter))] + [DataContract(Name = "getTopHitsResponse")] + public partial class GetTopHitsResponse : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of TopHitsResponse. + public GetTopHitsResponse(TopHitsResponse actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of TopHitsResponseWithAnalytics. + public GetTopHitsResponse(TopHitsResponseWithAnalytics actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(TopHitsResponse)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(TopHitsResponseWithAnalytics)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: TopHitsResponse, TopHitsResponseWithAnalytics"); + } + } + } + + /// + /// Get the actual instance of `TopHitsResponse`. If the actual instance is not `TopHitsResponse`, + /// the InvalidClassException will be thrown + /// + /// An instance of TopHitsResponse + public TopHitsResponse GetterTopHitsResponse() + { + return (TopHitsResponse)this.ActualInstance; + } + + /// + /// Get the actual instance of `TopHitsResponseWithAnalytics`. If the actual instance is not `TopHitsResponseWithAnalytics`, + /// the InvalidClassException will be thrown + /// + /// An instance of TopHitsResponseWithAnalytics + public TopHitsResponseWithAnalytics GetterTopHitsResponseWithAnalytics() + { + return (TopHitsResponseWithAnalytics)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class GetTopHitsResponse {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, GetTopHitsResponse.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of GetTopHitsResponse + /// + /// JSON string + /// An instance of GetTopHitsResponse + public static GetTopHitsResponse FromJson(string jsonString) + { + GetTopHitsResponse newGetTopHitsResponse = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newGetTopHitsResponse; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(TopHitsResponse).GetProperty("AdditionalProperties") == null) + { + newGetTopHitsResponse = new GetTopHitsResponse(JsonConvert.DeserializeObject(jsonString, GetTopHitsResponse.SerializerSettings)); + } + else + { + newGetTopHitsResponse = new GetTopHitsResponse(JsonConvert.DeserializeObject(jsonString, GetTopHitsResponse.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("TopHitsResponse"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into TopHitsResponse: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(TopHitsResponseWithAnalytics).GetProperty("AdditionalProperties") == null) + { + newGetTopHitsResponse = new GetTopHitsResponse(JsonConvert.DeserializeObject(jsonString, GetTopHitsResponse.SerializerSettings)); + } + else + { + newGetTopHitsResponse = new GetTopHitsResponse(JsonConvert.DeserializeObject(jsonString, GetTopHitsResponse.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("TopHitsResponseWithAnalytics"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into TopHitsResponseWithAnalytics: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newGetTopHitsResponse; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetTopHitsResponse); + } + + /// + /// Returns true if GetTopHitsResponse instances are equal + /// + /// Instance of GetTopHitsResponse to be compared + /// Boolean + public bool Equals(GetTopHitsResponse input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for GetTopHitsResponse + /// + public class GetTopHitsResponseJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(GetTopHitsResponse).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return GetTopHitsResponse.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetTopSearchesResponse.cs b/algoliasearch/Analytics/Models/GetTopSearchesResponse.cs new file mode 100644 index 000000000..3248a5e3d --- /dev/null +++ b/algoliasearch/Analytics/Models/GetTopSearchesResponse.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetTopSearchesResponse + /// + [JsonConverter(typeof(GetTopSearchesResponseJsonConverter))] + [DataContract(Name = "getTopSearchesResponse")] + public partial class GetTopSearchesResponse : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of TopSearchesResponse. + public GetTopSearchesResponse(TopSearchesResponse actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of TopSearchesResponseWithAnalytics. + public GetTopSearchesResponse(TopSearchesResponseWithAnalytics actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(TopSearchesResponse)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(TopSearchesResponseWithAnalytics)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: TopSearchesResponse, TopSearchesResponseWithAnalytics"); + } + } + } + + /// + /// Get the actual instance of `TopSearchesResponse`. If the actual instance is not `TopSearchesResponse`, + /// the InvalidClassException will be thrown + /// + /// An instance of TopSearchesResponse + public TopSearchesResponse GetterTopSearchesResponse() + { + return (TopSearchesResponse)this.ActualInstance; + } + + /// + /// Get the actual instance of `TopSearchesResponseWithAnalytics`. If the actual instance is not `TopSearchesResponseWithAnalytics`, + /// the InvalidClassException will be thrown + /// + /// An instance of TopSearchesResponseWithAnalytics + public TopSearchesResponseWithAnalytics GetterTopSearchesResponseWithAnalytics() + { + return (TopSearchesResponseWithAnalytics)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class GetTopSearchesResponse {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, GetTopSearchesResponse.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of GetTopSearchesResponse + /// + /// JSON string + /// An instance of GetTopSearchesResponse + public static GetTopSearchesResponse FromJson(string jsonString) + { + GetTopSearchesResponse newGetTopSearchesResponse = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newGetTopSearchesResponse; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(TopSearchesResponse).GetProperty("AdditionalProperties") == null) + { + newGetTopSearchesResponse = new GetTopSearchesResponse(JsonConvert.DeserializeObject(jsonString, GetTopSearchesResponse.SerializerSettings)); + } + else + { + newGetTopSearchesResponse = new GetTopSearchesResponse(JsonConvert.DeserializeObject(jsonString, GetTopSearchesResponse.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("TopSearchesResponse"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into TopSearchesResponse: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(TopSearchesResponseWithAnalytics).GetProperty("AdditionalProperties") == null) + { + newGetTopSearchesResponse = new GetTopSearchesResponse(JsonConvert.DeserializeObject(jsonString, GetTopSearchesResponse.SerializerSettings)); + } + else + { + newGetTopSearchesResponse = new GetTopSearchesResponse(JsonConvert.DeserializeObject(jsonString, GetTopSearchesResponse.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("TopSearchesResponseWithAnalytics"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into TopSearchesResponseWithAnalytics: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newGetTopSearchesResponse; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetTopSearchesResponse); + } + + /// + /// Returns true if GetTopSearchesResponse instances are equal + /// + /// Instance of GetTopSearchesResponse to be compared + /// Boolean + public bool Equals(GetTopSearchesResponse input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for GetTopSearchesResponse + /// + public class GetTopSearchesResponseJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(GetTopSearchesResponse).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return GetTopSearchesResponse.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Analytics/Models/GetUsersCountResponse.cs b/algoliasearch/Analytics/Models/GetUsersCountResponse.cs new file mode 100644 index 000000000..98f7c82eb --- /dev/null +++ b/algoliasearch/Analytics/Models/GetUsersCountResponse.cs @@ -0,0 +1,150 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// GetUsersCountResponse + /// + [DataContract(Name = "getUsersCountResponse")] + public partial class GetUsersCountResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetUsersCountResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Number of occurrences. (required). + /// User count. (required). + public GetUsersCountResponse(int count = default(int), List dates = default(List)) + { + this.Count = count; + // to ensure "dates" is required (not null) + if (dates == null) + { + throw new ArgumentNullException("dates is a required property for GetUsersCountResponse and cannot be null"); + } + this.Dates = dates; + } + + /// + /// Number of occurrences. + /// + /// Number of occurrences. + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// User count. + /// + /// User count. + [DataMember(Name = "dates", IsRequired = true, EmitDefaultValue = true)] + public List Dates { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetUsersCountResponse {\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" Dates: ").Append(Dates).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetUsersCountResponse); + } + + /// + /// Returns true if GetUsersCountResponse instances are equal + /// + /// Instance of GetUsersCountResponse to be compared + /// Boolean + public bool Equals(GetUsersCountResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ) && + ( + this.Dates == input.Dates || + this.Dates != null && + input.Dates != null && + this.Dates.SequenceEqual(input.Dates) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + if (this.Dates != null) + { + hashCode = (hashCode * 59) + this.Dates.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/NoClickRateEvent.cs b/algoliasearch/Analytics/Models/NoClickRateEvent.cs new file mode 100644 index 000000000..3f5fa2a77 --- /dev/null +++ b/algoliasearch/Analytics/Models/NoClickRateEvent.cs @@ -0,0 +1,191 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// NoClickRateEvent + /// + [DataContract(Name = "noClickRateEvent")] + public partial class NoClickRateEvent : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected NoClickRateEvent() { } + /// + /// Initializes a new instance of the class. + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). (required). + /// Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`). (required). + /// Number of click events. (required). + /// Date of the event in the format YYYY-MM-DD. (required). + public NoClickRateEvent(double rate = default(double), int count = default(int), int noClickCount = default(int), string date = default(string)) + { + this.Rate = rate; + this.Count = count; + this.NoClickCount = noClickCount; + // to ensure "date" is required (not null) + if (date == null) + { + throw new ArgumentNullException("date is a required property for NoClickRateEvent and cannot be null"); + } + this.Date = date; + } + + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + [DataMember(Name = "rate", IsRequired = true, EmitDefaultValue = true)] + public double Rate { get; set; } + + /// + /// Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`). + /// + /// Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`). + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Number of click events. + /// + /// Number of click events. + [DataMember(Name = "noClickCount", IsRequired = true, EmitDefaultValue = true)] + public int NoClickCount { get; set; } + + /// + /// Date of the event in the format YYYY-MM-DD. + /// + /// Date of the event in the format YYYY-MM-DD. + [DataMember(Name = "date", IsRequired = true, EmitDefaultValue = true)] + public string Date { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NoClickRateEvent {\n"); + sb.Append(" Rate: ").Append(Rate).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" NoClickCount: ").Append(NoClickCount).Append("\n"); + sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as NoClickRateEvent); + } + + /// + /// Returns true if NoClickRateEvent instances are equal + /// + /// Instance of NoClickRateEvent to be compared + /// Boolean + public bool Equals(NoClickRateEvent input) + { + if (input == null) + { + return false; + } + return + ( + this.Rate == input.Rate || + this.Rate.Equals(input.Rate) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ) && + ( + this.NoClickCount == input.NoClickCount || + this.NoClickCount.Equals(input.NoClickCount) + ) && + ( + this.Date == input.Date || + (this.Date != null && + this.Date.Equals(input.Date)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Rate.GetHashCode(); + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + hashCode = (hashCode * 59) + this.NoClickCount.GetHashCode(); + if (this.Date != null) + { + hashCode = (hashCode * 59) + this.Date.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Rate (double) maximum + if (this.Rate > (double)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Rate, must be a value less than or equal to 1.", new[] { "Rate" }); + } + + // Rate (double) minimum + if (this.Rate < (double)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Rate, must be a value greater than or equal to 0.", new[] { "Rate" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/NoResultsRateEvent.cs b/algoliasearch/Analytics/Models/NoResultsRateEvent.cs new file mode 100644 index 000000000..1bde7c149 --- /dev/null +++ b/algoliasearch/Analytics/Models/NoResultsRateEvent.cs @@ -0,0 +1,191 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// NoResultsRateEvent + /// + [DataContract(Name = "noResultsRateEvent")] + public partial class NoResultsRateEvent : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected NoResultsRateEvent() { } + /// + /// Initializes a new instance of the class. + /// + /// Date of the event in the format YYYY-MM-DD. (required). + /// Number of occurences. (required). + /// Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`). (required). + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). (required). + public NoResultsRateEvent(string date = default(string), int noResultCount = default(int), int count = default(int), double rate = default(double)) + { + // to ensure "date" is required (not null) + if (date == null) + { + throw new ArgumentNullException("date is a required property for NoResultsRateEvent and cannot be null"); + } + this.Date = date; + this.NoResultCount = noResultCount; + this.Count = count; + this.Rate = rate; + } + + /// + /// Date of the event in the format YYYY-MM-DD. + /// + /// Date of the event in the format YYYY-MM-DD. + [DataMember(Name = "date", IsRequired = true, EmitDefaultValue = true)] + public string Date { get; set; } + + /// + /// Number of occurences. + /// + /// Number of occurences. + [DataMember(Name = "noResultCount", IsRequired = true, EmitDefaultValue = true)] + public int NoResultCount { get; set; } + + /// + /// Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`). + /// + /// Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`). + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + [DataMember(Name = "rate", IsRequired = true, EmitDefaultValue = true)] + public double Rate { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NoResultsRateEvent {\n"); + sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" NoResultCount: ").Append(NoResultCount).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" Rate: ").Append(Rate).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as NoResultsRateEvent); + } + + /// + /// Returns true if NoResultsRateEvent instances are equal + /// + /// Instance of NoResultsRateEvent to be compared + /// Boolean + public bool Equals(NoResultsRateEvent input) + { + if (input == null) + { + return false; + } + return + ( + this.Date == input.Date || + (this.Date != null && + this.Date.Equals(input.Date)) + ) && + ( + this.NoResultCount == input.NoResultCount || + this.NoResultCount.Equals(input.NoResultCount) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ) && + ( + this.Rate == input.Rate || + this.Rate.Equals(input.Rate) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Date != null) + { + hashCode = (hashCode * 59) + this.Date.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NoResultCount.GetHashCode(); + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + hashCode = (hashCode * 59) + this.Rate.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Rate (double) maximum + if (this.Rate > (double)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Rate, must be a value less than or equal to 1.", new[] { "Rate" }); + } + + // Rate (double) minimum + if (this.Rate < (double)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Rate, must be a value greater than or equal to 0.", new[] { "Rate" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/OrderBy.cs b/algoliasearch/Analytics/Models/OrderBy.cs new file mode 100644 index 000000000..9daf64b58 --- /dev/null +++ b/algoliasearch/Analytics/Models/OrderBy.cs @@ -0,0 +1,55 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// Method for ordering results. `clickThroughRate`, `conversionRate` and `averageClickPosition` are only available if the `clickAnalytics` parameter is `true`. + /// + /// Method for ordering results. `clickThroughRate`, `conversionRate` and `averageClickPosition` are only available if the `clickAnalytics` parameter is `true`. + [JsonConverter(typeof(StringEnumConverter))] + public enum OrderBy + { + /// + /// Enum SearchCount for value: searchCount + /// + [EnumMember(Value = "searchCount")] + SearchCount = 1, + + /// + /// Enum ClickThroughRate for value: clickThroughRate + /// + [EnumMember(Value = "clickThroughRate")] + ClickThroughRate = 2, + + /// + /// Enum ConversionRate for value: conversionRate + /// + [EnumMember(Value = "conversionRate")] + ConversionRate = 3, + + /// + /// Enum AverageClickPosition for value: averageClickPosition + /// + [EnumMember(Value = "averageClickPosition")] + AverageClickPosition = 4 + } + +} diff --git a/algoliasearch/Analytics/Models/SearchEvent.cs b/algoliasearch/Analytics/Models/SearchEvent.cs new file mode 100644 index 000000000..65eef67e9 --- /dev/null +++ b/algoliasearch/Analytics/Models/SearchEvent.cs @@ -0,0 +1,149 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// SearchEvent + /// + [DataContract(Name = "searchEvent")] + public partial class SearchEvent : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchEvent() { } + /// + /// Initializes a new instance of the class. + /// + /// Date of the event in the format YYYY-MM-DD. (required). + /// Number of occurrences. (required). + public SearchEvent(string date = default(string), int count = default(int)) + { + // to ensure "date" is required (not null) + if (date == null) + { + throw new ArgumentNullException("date is a required property for SearchEvent and cannot be null"); + } + this.Date = date; + this.Count = count; + } + + /// + /// Date of the event in the format YYYY-MM-DD. + /// + /// Date of the event in the format YYYY-MM-DD. + [DataMember(Name = "date", IsRequired = true, EmitDefaultValue = true)] + public string Date { get; set; } + + /// + /// Number of occurrences. + /// + /// Number of occurrences. + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchEvent {\n"); + sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchEvent); + } + + /// + /// Returns true if SearchEvent instances are equal + /// + /// Instance of SearchEvent to be compared + /// Boolean + public bool Equals(SearchEvent input) + { + if (input == null) + { + return false; + } + return + ( + this.Date == input.Date || + (this.Date != null && + this.Date.Equals(input.Date)) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Date != null) + { + hashCode = (hashCode * 59) + this.Date.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/SearchNoClickEvent.cs b/algoliasearch/Analytics/Models/SearchNoClickEvent.cs new file mode 100644 index 000000000..77d9a9096 --- /dev/null +++ b/algoliasearch/Analytics/Models/SearchNoClickEvent.cs @@ -0,0 +1,164 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// SearchNoClickEvent + /// + [DataContract(Name = "searchNoClickEvent")] + public partial class SearchNoClickEvent : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchNoClickEvent() { } + /// + /// Initializes a new instance of the class. + /// + /// User query. (required). + /// Number of occurrences. (required). + /// Number of occurrences. (required). + public SearchNoClickEvent(string search = default(string), int count = default(int), int withFilterCount = default(int)) + { + // to ensure "search" is required (not null) + if (search == null) + { + throw new ArgumentNullException("search is a required property for SearchNoClickEvent and cannot be null"); + } + this.Search = search; + this.Count = count; + this.WithFilterCount = withFilterCount; + } + + /// + /// User query. + /// + /// User query. + [DataMember(Name = "search", IsRequired = true, EmitDefaultValue = true)] + public string Search { get; set; } + + /// + /// Number of occurrences. + /// + /// Number of occurrences. + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Number of occurrences. + /// + /// Number of occurrences. + [DataMember(Name = "withFilterCount", IsRequired = true, EmitDefaultValue = true)] + public int WithFilterCount { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchNoClickEvent {\n"); + sb.Append(" Search: ").Append(Search).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" WithFilterCount: ").Append(WithFilterCount).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchNoClickEvent); + } + + /// + /// Returns true if SearchNoClickEvent instances are equal + /// + /// Instance of SearchNoClickEvent to be compared + /// Boolean + public bool Equals(SearchNoClickEvent input) + { + if (input == null) + { + return false; + } + return + ( + this.Search == input.Search || + (this.Search != null && + this.Search.Equals(input.Search)) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ) && + ( + this.WithFilterCount == input.WithFilterCount || + this.WithFilterCount.Equals(input.WithFilterCount) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Search != null) + { + hashCode = (hashCode * 59) + this.Search.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + hashCode = (hashCode * 59) + this.WithFilterCount.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/SearchNoResultEvent.cs b/algoliasearch/Analytics/Models/SearchNoResultEvent.cs new file mode 100644 index 000000000..e36d1e39a --- /dev/null +++ b/algoliasearch/Analytics/Models/SearchNoResultEvent.cs @@ -0,0 +1,164 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// SearchNoResultEvent + /// + [DataContract(Name = "searchNoResultEvent")] + public partial class SearchNoResultEvent : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchNoResultEvent() { } + /// + /// Initializes a new instance of the class. + /// + /// User query. (required). + /// Number of occurrences. (required). + /// Number of hits the search query matched. (required). + public SearchNoResultEvent(string search = default(string), int count = default(int), int nbHits = default(int)) + { + // to ensure "search" is required (not null) + if (search == null) + { + throw new ArgumentNullException("search is a required property for SearchNoResultEvent and cannot be null"); + } + this.Search = search; + this.Count = count; + this.NbHits = nbHits; + } + + /// + /// User query. + /// + /// User query. + [DataMember(Name = "search", IsRequired = true, EmitDefaultValue = true)] + public string Search { get; set; } + + /// + /// Number of occurrences. + /// + /// Number of occurrences. + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Number of hits the search query matched. + /// + /// Number of hits the search query matched. + [DataMember(Name = "nbHits", IsRequired = true, EmitDefaultValue = true)] + public int NbHits { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchNoResultEvent {\n"); + sb.Append(" Search: ").Append(Search).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchNoResultEvent); + } + + /// + /// Returns true if SearchNoResultEvent instances are equal + /// + /// Instance of SearchNoResultEvent to be compared + /// Boolean + public bool Equals(SearchNoResultEvent input) + { + if (input == null) + { + return false; + } + return + ( + this.Search == input.Search || + (this.Search != null && + this.Search.Equals(input.Search)) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ) && + ( + this.NbHits == input.NbHits || + this.NbHits.Equals(input.NbHits) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Search != null) + { + hashCode = (hashCode * 59) + this.Search.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + hashCode = (hashCode * 59) + this.NbHits.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/TopCountry.cs b/algoliasearch/Analytics/Models/TopCountry.cs new file mode 100644 index 000000000..563e0764e --- /dev/null +++ b/algoliasearch/Analytics/Models/TopCountry.cs @@ -0,0 +1,149 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// TopCountry + /// + [DataContract(Name = "topCountry")] + public partial class TopCountry : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TopCountry() { } + /// + /// Initializes a new instance of the class. + /// + /// Country. (required). + /// Number of occurrences. (required). + public TopCountry(string country = default(string), int count = default(int)) + { + // to ensure "country" is required (not null) + if (country == null) + { + throw new ArgumentNullException("country is a required property for TopCountry and cannot be null"); + } + this.Country = country; + this.Count = count; + } + + /// + /// Country. + /// + /// Country. + [DataMember(Name = "country", IsRequired = true, EmitDefaultValue = true)] + public string Country { get; set; } + + /// + /// Number of occurrences. + /// + /// Number of occurrences. + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TopCountry {\n"); + sb.Append(" Country: ").Append(Country).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TopCountry); + } + + /// + /// Returns true if TopCountry instances are equal + /// + /// Instance of TopCountry to be compared + /// Boolean + public bool Equals(TopCountry input) + { + if (input == null) + { + return false; + } + return + ( + this.Country == input.Country || + (this.Country != null && + this.Country.Equals(input.Country)) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Country != null) + { + hashCode = (hashCode * 59) + this.Country.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/TopHit.cs b/algoliasearch/Analytics/Models/TopHit.cs new file mode 100644 index 000000000..faba5790d --- /dev/null +++ b/algoliasearch/Analytics/Models/TopHit.cs @@ -0,0 +1,149 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// TopHit + /// + [DataContract(Name = "topHit")] + public partial class TopHit : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TopHit() { } + /// + /// Initializes a new instance of the class. + /// + /// Hit. (required). + /// Number of occurrences. (required). + public TopHit(string hit = default(string), int count = default(int)) + { + // to ensure "hit" is required (not null) + if (hit == null) + { + throw new ArgumentNullException("hit is a required property for TopHit and cannot be null"); + } + this.Hit = hit; + this.Count = count; + } + + /// + /// Hit. + /// + /// Hit. + [DataMember(Name = "hit", IsRequired = true, EmitDefaultValue = true)] + public string Hit { get; set; } + + /// + /// Number of occurrences. + /// + /// Number of occurrences. + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TopHit {\n"); + sb.Append(" Hit: ").Append(Hit).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TopHit); + } + + /// + /// Returns true if TopHit instances are equal + /// + /// Instance of TopHit to be compared + /// Boolean + public bool Equals(TopHit input) + { + if (input == null) + { + return false; + } + return + ( + this.Hit == input.Hit || + (this.Hit != null && + this.Hit.Equals(input.Hit)) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Hit != null) + { + hashCode = (hashCode * 59) + this.Hit.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/TopHitWithAnalytics.cs b/algoliasearch/Analytics/Models/TopHitWithAnalytics.cs new file mode 100644 index 000000000..7a415a478 --- /dev/null +++ b/algoliasearch/Analytics/Models/TopHitWithAnalytics.cs @@ -0,0 +1,236 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// TopHitWithAnalytics + /// + [DataContract(Name = "topHitWithAnalytics")] + public partial class TopHitWithAnalytics : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TopHitWithAnalytics() { } + /// + /// Initializes a new instance of the class. + /// + /// Hit. (required). + /// Number of occurrences. (required). + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). (required). + /// [Conversion rate (CR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). (required). + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. (required). + /// Number of click events. (required). + /// Number of converted clicks. (required). + public TopHitWithAnalytics(string hit = default(string), int count = default(int), double clickThroughRate = default(double), double conversionRate = default(double), int trackedSearchCount = default(int), int clickCount = default(int), int conversionCount = default(int)) + { + // to ensure "hit" is required (not null) + if (hit == null) + { + throw new ArgumentNullException("hit is a required property for TopHitWithAnalytics and cannot be null"); + } + this.Hit = hit; + this.Count = count; + this.ClickThroughRate = clickThroughRate; + this.ConversionRate = conversionRate; + this.TrackedSearchCount = trackedSearchCount; + this.ClickCount = clickCount; + this.ConversionCount = conversionCount; + } + + /// + /// Hit. + /// + /// Hit. + [DataMember(Name = "hit", IsRequired = true, EmitDefaultValue = true)] + public string Hit { get; set; } + + /// + /// Number of occurrences. + /// + /// Number of occurrences. + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + [DataMember(Name = "clickThroughRate", IsRequired = true, EmitDefaultValue = true)] + public double ClickThroughRate { get; set; } + + /// + /// [Conversion rate (CR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). + /// + /// [Conversion rate (CR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). + [DataMember(Name = "conversionRate", IsRequired = true, EmitDefaultValue = true)] + public double ConversionRate { get; set; } + + /// + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. + /// + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. + [DataMember(Name = "trackedSearchCount", IsRequired = true, EmitDefaultValue = true)] + public int TrackedSearchCount { get; set; } + + /// + /// Number of click events. + /// + /// Number of click events. + [DataMember(Name = "clickCount", IsRequired = true, EmitDefaultValue = true)] + public int ClickCount { get; set; } + + /// + /// Number of converted clicks. + /// + /// Number of converted clicks. + [DataMember(Name = "conversionCount", IsRequired = true, EmitDefaultValue = true)] + public int ConversionCount { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TopHitWithAnalytics {\n"); + sb.Append(" Hit: ").Append(Hit).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" ClickThroughRate: ").Append(ClickThroughRate).Append("\n"); + sb.Append(" ConversionRate: ").Append(ConversionRate).Append("\n"); + sb.Append(" TrackedSearchCount: ").Append(TrackedSearchCount).Append("\n"); + sb.Append(" ClickCount: ").Append(ClickCount).Append("\n"); + sb.Append(" ConversionCount: ").Append(ConversionCount).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TopHitWithAnalytics); + } + + /// + /// Returns true if TopHitWithAnalytics instances are equal + /// + /// Instance of TopHitWithAnalytics to be compared + /// Boolean + public bool Equals(TopHitWithAnalytics input) + { + if (input == null) + { + return false; + } + return + ( + this.Hit == input.Hit || + (this.Hit != null && + this.Hit.Equals(input.Hit)) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ) && + ( + this.ClickThroughRate == input.ClickThroughRate || + this.ClickThroughRate.Equals(input.ClickThroughRate) + ) && + ( + this.ConversionRate == input.ConversionRate || + this.ConversionRate.Equals(input.ConversionRate) + ) && + ( + this.TrackedSearchCount == input.TrackedSearchCount || + this.TrackedSearchCount.Equals(input.TrackedSearchCount) + ) && + ( + this.ClickCount == input.ClickCount || + this.ClickCount.Equals(input.ClickCount) + ) && + ( + this.ConversionCount == input.ConversionCount || + this.ConversionCount.Equals(input.ConversionCount) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Hit != null) + { + hashCode = (hashCode * 59) + this.Hit.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickThroughRate.GetHashCode(); + hashCode = (hashCode * 59) + this.ConversionRate.GetHashCode(); + hashCode = (hashCode * 59) + this.TrackedSearchCount.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickCount.GetHashCode(); + hashCode = (hashCode * 59) + this.ConversionCount.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // ClickThroughRate (double) maximum + if (this.ClickThroughRate > (double)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ClickThroughRate, must be a value less than or equal to 1.", new[] { "ClickThroughRate" }); + } + + // ClickThroughRate (double) minimum + if (this.ClickThroughRate < (double)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ClickThroughRate, must be a value greater than or equal to 0.", new[] { "ClickThroughRate" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/TopHitsResponse.cs b/algoliasearch/Analytics/Models/TopHitsResponse.cs new file mode 100644 index 000000000..df93aca27 --- /dev/null +++ b/algoliasearch/Analytics/Models/TopHitsResponse.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// TopHitsResponse + /// + [DataContract(Name = "topHitsResponse")] + public partial class TopHitsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TopHitsResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Top hits. (required). + public TopHitsResponse(List hits = default(List)) + { + // to ensure "hits" is required (not null) + if (hits == null) + { + throw new ArgumentNullException("hits is a required property for TopHitsResponse and cannot be null"); + } + this.Hits = hits; + } + + /// + /// Top hits. + /// + /// Top hits. + [DataMember(Name = "hits", IsRequired = true, EmitDefaultValue = true)] + public List Hits { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TopHitsResponse {\n"); + sb.Append(" Hits: ").Append(Hits).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TopHitsResponse); + } + + /// + /// Returns true if TopHitsResponse instances are equal + /// + /// Instance of TopHitsResponse to be compared + /// Boolean + public bool Equals(TopHitsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Hits == input.Hits || + this.Hits != null && + input.Hits != null && + this.Hits.SequenceEqual(input.Hits) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Hits != null) + { + hashCode = (hashCode * 59) + this.Hits.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/TopHitsResponseWithAnalytics.cs b/algoliasearch/Analytics/Models/TopHitsResponseWithAnalytics.cs new file mode 100644 index 000000000..8c64358df --- /dev/null +++ b/algoliasearch/Analytics/Models/TopHitsResponseWithAnalytics.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// TopHitsResponseWithAnalytics + /// + [DataContract(Name = "topHitsResponseWithAnalytics")] + public partial class TopHitsResponseWithAnalytics : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TopHitsResponseWithAnalytics() { } + /// + /// Initializes a new instance of the class. + /// + /// Top hits. (required). + public TopHitsResponseWithAnalytics(List hits = default(List)) + { + // to ensure "hits" is required (not null) + if (hits == null) + { + throw new ArgumentNullException("hits is a required property for TopHitsResponseWithAnalytics and cannot be null"); + } + this.Hits = hits; + } + + /// + /// Top hits. + /// + /// Top hits. + [DataMember(Name = "hits", IsRequired = true, EmitDefaultValue = true)] + public List Hits { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TopHitsResponseWithAnalytics {\n"); + sb.Append(" Hits: ").Append(Hits).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TopHitsResponseWithAnalytics); + } + + /// + /// Returns true if TopHitsResponseWithAnalytics instances are equal + /// + /// Instance of TopHitsResponseWithAnalytics to be compared + /// Boolean + public bool Equals(TopHitsResponseWithAnalytics input) + { + if (input == null) + { + return false; + } + return + ( + this.Hits == input.Hits || + this.Hits != null && + input.Hits != null && + this.Hits.SequenceEqual(input.Hits) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Hits != null) + { + hashCode = (hashCode * 59) + this.Hits.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/TopSearch.cs b/algoliasearch/Analytics/Models/TopSearch.cs new file mode 100644 index 000000000..7bfde4432 --- /dev/null +++ b/algoliasearch/Analytics/Models/TopSearch.cs @@ -0,0 +1,164 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// TopSearch + /// + [DataContract(Name = "topSearch")] + public partial class TopSearch : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TopSearch() { } + /// + /// Initializes a new instance of the class. + /// + /// User query. (required). + /// Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`). (required). + /// Number of hits the search query matched. (required). + public TopSearch(string search = default(string), int count = default(int), int nbHits = default(int)) + { + // to ensure "search" is required (not null) + if (search == null) + { + throw new ArgumentNullException("search is a required property for TopSearch and cannot be null"); + } + this.Search = search; + this.Count = count; + this.NbHits = nbHits; + } + + /// + /// User query. + /// + /// User query. + [DataMember(Name = "search", IsRequired = true, EmitDefaultValue = true)] + public string Search { get; set; } + + /// + /// Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`). + /// + /// Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`). + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Number of hits the search query matched. + /// + /// Number of hits the search query matched. + [DataMember(Name = "nbHits", IsRequired = true, EmitDefaultValue = true)] + public int NbHits { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TopSearch {\n"); + sb.Append(" Search: ").Append(Search).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TopSearch); + } + + /// + /// Returns true if TopSearch instances are equal + /// + /// Instance of TopSearch to be compared + /// Boolean + public bool Equals(TopSearch input) + { + if (input == null) + { + return false; + } + return + ( + this.Search == input.Search || + (this.Search != null && + this.Search.Equals(input.Search)) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ) && + ( + this.NbHits == input.NbHits || + this.NbHits.Equals(input.NbHits) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Search != null) + { + hashCode = (hashCode * 59) + this.Search.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + hashCode = (hashCode * 59) + this.NbHits.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/TopSearchWithAnalytics.cs b/algoliasearch/Analytics/Models/TopSearchWithAnalytics.cs new file mode 100644 index 000000000..583a867da --- /dev/null +++ b/algoliasearch/Analytics/Models/TopSearchWithAnalytics.cs @@ -0,0 +1,266 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// TopSearchWithAnalytics + /// + [DataContract(Name = "topSearchWithAnalytics")] + public partial class TopSearchWithAnalytics : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TopSearchWithAnalytics() { } + /// + /// Initializes a new instance of the class. + /// + /// User query. (required). + /// Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`). (required). + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). (required). + /// Average [position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position) of clicked search result. (required). + /// [Conversion rate (CR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). (required). + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. (required). + /// Number of click events. (required). + /// Number of converted clicks. (required). + /// Number of hits the search query matched. (required). + public TopSearchWithAnalytics(string search = default(string), int count = default(int), double clickThroughRate = default(double), int averageClickPosition = default(int), double conversionRate = default(double), int trackedSearchCount = default(int), int clickCount = default(int), int conversionCount = default(int), int nbHits = default(int)) + { + // to ensure "search" is required (not null) + if (search == null) + { + throw new ArgumentNullException("search is a required property for TopSearchWithAnalytics and cannot be null"); + } + this.Search = search; + this.Count = count; + this.ClickThroughRate = clickThroughRate; + this.AverageClickPosition = averageClickPosition; + this.ConversionRate = conversionRate; + this.TrackedSearchCount = trackedSearchCount; + this.ClickCount = clickCount; + this.ConversionCount = conversionCount; + this.NbHits = nbHits; + } + + /// + /// User query. + /// + /// User query. + [DataMember(Name = "search", IsRequired = true, EmitDefaultValue = true)] + public string Search { get; set; } + + /// + /// Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`). + /// + /// Number of tracked _and_ untracked searches (where the `clickAnalytics` parameter isn't `true`). + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + /// + /// [Click-through rate (CTR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate). + [DataMember(Name = "clickThroughRate", IsRequired = true, EmitDefaultValue = true)] + public double ClickThroughRate { get; set; } + + /// + /// Average [position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position) of clicked search result. + /// + /// Average [position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position) of clicked search result. + [DataMember(Name = "averageClickPosition", IsRequired = true, EmitDefaultValue = true)] + public int AverageClickPosition { get; set; } + + /// + /// [Conversion rate (CR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). + /// + /// [Conversion rate (CR)](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate). + [DataMember(Name = "conversionRate", IsRequired = true, EmitDefaultValue = true)] + public double ConversionRate { get; set; } + + /// + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. + /// + /// Number of tracked searches. This is the number of search requests where the `clickAnalytics` parameter is `true`. + [DataMember(Name = "trackedSearchCount", IsRequired = true, EmitDefaultValue = true)] + public int TrackedSearchCount { get; set; } + + /// + /// Number of click events. + /// + /// Number of click events. + [DataMember(Name = "clickCount", IsRequired = true, EmitDefaultValue = true)] + public int ClickCount { get; set; } + + /// + /// Number of converted clicks. + /// + /// Number of converted clicks. + [DataMember(Name = "conversionCount", IsRequired = true, EmitDefaultValue = true)] + public int ConversionCount { get; set; } + + /// + /// Number of hits the search query matched. + /// + /// Number of hits the search query matched. + [DataMember(Name = "nbHits", IsRequired = true, EmitDefaultValue = true)] + public int NbHits { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TopSearchWithAnalytics {\n"); + sb.Append(" Search: ").Append(Search).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" ClickThroughRate: ").Append(ClickThroughRate).Append("\n"); + sb.Append(" AverageClickPosition: ").Append(AverageClickPosition).Append("\n"); + sb.Append(" ConversionRate: ").Append(ConversionRate).Append("\n"); + sb.Append(" TrackedSearchCount: ").Append(TrackedSearchCount).Append("\n"); + sb.Append(" ClickCount: ").Append(ClickCount).Append("\n"); + sb.Append(" ConversionCount: ").Append(ConversionCount).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TopSearchWithAnalytics); + } + + /// + /// Returns true if TopSearchWithAnalytics instances are equal + /// + /// Instance of TopSearchWithAnalytics to be compared + /// Boolean + public bool Equals(TopSearchWithAnalytics input) + { + if (input == null) + { + return false; + } + return + ( + this.Search == input.Search || + (this.Search != null && + this.Search.Equals(input.Search)) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ) && + ( + this.ClickThroughRate == input.ClickThroughRate || + this.ClickThroughRate.Equals(input.ClickThroughRate) + ) && + ( + this.AverageClickPosition == input.AverageClickPosition || + this.AverageClickPosition.Equals(input.AverageClickPosition) + ) && + ( + this.ConversionRate == input.ConversionRate || + this.ConversionRate.Equals(input.ConversionRate) + ) && + ( + this.TrackedSearchCount == input.TrackedSearchCount || + this.TrackedSearchCount.Equals(input.TrackedSearchCount) + ) && + ( + this.ClickCount == input.ClickCount || + this.ClickCount.Equals(input.ClickCount) + ) && + ( + this.ConversionCount == input.ConversionCount || + this.ConversionCount.Equals(input.ConversionCount) + ) && + ( + this.NbHits == input.NbHits || + this.NbHits.Equals(input.NbHits) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Search != null) + { + hashCode = (hashCode * 59) + this.Search.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickThroughRate.GetHashCode(); + hashCode = (hashCode * 59) + this.AverageClickPosition.GetHashCode(); + hashCode = (hashCode * 59) + this.ConversionRate.GetHashCode(); + hashCode = (hashCode * 59) + this.TrackedSearchCount.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickCount.GetHashCode(); + hashCode = (hashCode * 59) + this.ConversionCount.GetHashCode(); + hashCode = (hashCode * 59) + this.NbHits.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // ClickThroughRate (double) maximum + if (this.ClickThroughRate > (double)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ClickThroughRate, must be a value less than or equal to 1.", new[] { "ClickThroughRate" }); + } + + // ClickThroughRate (double) minimum + if (this.ClickThroughRate < (double)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ClickThroughRate, must be a value greater than or equal to 0.", new[] { "ClickThroughRate" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/TopSearchesResponse.cs b/algoliasearch/Analytics/Models/TopSearchesResponse.cs new file mode 100644 index 000000000..82e52f929 --- /dev/null +++ b/algoliasearch/Analytics/Models/TopSearchesResponse.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// TopSearchesResponse + /// + [DataContract(Name = "topSearchesResponse")] + public partial class TopSearchesResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TopSearchesResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Top searches with their hits count. (required). + public TopSearchesResponse(List searches = default(List)) + { + // to ensure "searches" is required (not null) + if (searches == null) + { + throw new ArgumentNullException("searches is a required property for TopSearchesResponse and cannot be null"); + } + this.Searches = searches; + } + + /// + /// Top searches with their hits count. + /// + /// Top searches with their hits count. + [DataMember(Name = "searches", IsRequired = true, EmitDefaultValue = true)] + public List Searches { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TopSearchesResponse {\n"); + sb.Append(" Searches: ").Append(Searches).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TopSearchesResponse); + } + + /// + /// Returns true if TopSearchesResponse instances are equal + /// + /// Instance of TopSearchesResponse to be compared + /// Boolean + public bool Equals(TopSearchesResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Searches == input.Searches || + this.Searches != null && + input.Searches != null && + this.Searches.SequenceEqual(input.Searches) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Searches != null) + { + hashCode = (hashCode * 59) + this.Searches.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/TopSearchesResponseWithAnalytics.cs b/algoliasearch/Analytics/Models/TopSearchesResponseWithAnalytics.cs new file mode 100644 index 000000000..2ac06ab20 --- /dev/null +++ b/algoliasearch/Analytics/Models/TopSearchesResponseWithAnalytics.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// TopSearchesResponseWithAnalytics + /// + [DataContract(Name = "topSearchesResponseWithAnalytics")] + public partial class TopSearchesResponseWithAnalytics : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TopSearchesResponseWithAnalytics() { } + /// + /// Initializes a new instance of the class. + /// + /// Top searches with their hits count and analytics. (required). + public TopSearchesResponseWithAnalytics(List searches = default(List)) + { + // to ensure "searches" is required (not null) + if (searches == null) + { + throw new ArgumentNullException("searches is a required property for TopSearchesResponseWithAnalytics and cannot be null"); + } + this.Searches = searches; + } + + /// + /// Top searches with their hits count and analytics. + /// + /// Top searches with their hits count and analytics. + [DataMember(Name = "searches", IsRequired = true, EmitDefaultValue = true)] + public List Searches { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TopSearchesResponseWithAnalytics {\n"); + sb.Append(" Searches: ").Append(Searches).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TopSearchesResponseWithAnalytics); + } + + /// + /// Returns true if TopSearchesResponseWithAnalytics instances are equal + /// + /// Instance of TopSearchesResponseWithAnalytics to be compared + /// Boolean + public bool Equals(TopSearchesResponseWithAnalytics input) + { + if (input == null) + { + return false; + } + return + ( + this.Searches == input.Searches || + this.Searches != null && + input.Searches != null && + this.Searches.SequenceEqual(input.Searches) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Searches != null) + { + hashCode = (hashCode * 59) + this.Searches.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Analytics/Models/UserWithDate.cs b/algoliasearch/Analytics/Models/UserWithDate.cs new file mode 100644 index 000000000..0a7cbcea1 --- /dev/null +++ b/algoliasearch/Analytics/Models/UserWithDate.cs @@ -0,0 +1,149 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Analytics.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Analytics.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Analytics.Models +{ + /// + /// UserWithDate + /// + [DataContract(Name = "userWithDate")] + public partial class UserWithDate : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected UserWithDate() { } + /// + /// Initializes a new instance of the class. + /// + /// Date of the event in the format YYYY-MM-DD. (required). + /// Number of occurrences. (required). + public UserWithDate(string date = default(string), int count = default(int)) + { + // to ensure "date" is required (not null) + if (date == null) + { + throw new ArgumentNullException("date is a required property for UserWithDate and cannot be null"); + } + this.Date = date; + this.Count = count; + } + + /// + /// Date of the event in the format YYYY-MM-DD. + /// + /// Date of the event in the format YYYY-MM-DD. + [DataMember(Name = "date", IsRequired = true, EmitDefaultValue = true)] + public string Date { get; set; } + + /// + /// Number of occurrences. + /// + /// Number of occurrences. + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class UserWithDate {\n"); + sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as UserWithDate); + } + + /// + /// Returns true if UserWithDate instances are equal + /// + /// Instance of UserWithDate to be compared + /// Boolean + public bool Equals(UserWithDate input) + { + if (input == null) + { + return false; + } + return + ( + this.Date == input.Date || + (this.Date != null && + this.Date.Equals(input.Date)) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Date != null) + { + hashCode = (hashCode * 59) + this.Date.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Api/IngestionClient.cs b/algoliasearch/Ingestion/Api/IngestionClient.cs new file mode 100644 index 000000000..2f732ba2d --- /dev/null +++ b/algoliasearch/Ingestion/Api/IngestionClient.cs @@ -0,0 +1,6925 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Mime; +using Algolia.Search.Ingestion.Client; +using Algolia.Search.Ingestion.Models; + +namespace Algolia.Search.Ingestion.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IIngestionClient + { + /// + /// Create a authentication. + /// + /// + /// Create a authentication. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of AuthenticationCreateResponse + System.Threading.Tasks.Task CreateAuthenticationAsync(AuthenticationCreate authenticationCreate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create a authentication. + /// + /// + /// Create a authentication. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (AuthenticationCreateResponse) + System.Threading.Tasks.Task> CreateAuthenticationWithHttpInfoAsync(AuthenticationCreate authenticationCreate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Create a destination. + /// + /// + /// Create a destination. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of DestinationCreateResponse + System.Threading.Tasks.Task CreateDestinationAsync(DestinationCreate destinationCreate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create a destination. + /// + /// + /// Create a destination. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DestinationCreateResponse) + System.Threading.Tasks.Task> CreateDestinationWithHttpInfoAsync(DestinationCreate destinationCreate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Create a source. + /// + /// + /// Create a source. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of SourceCreateResponse + System.Threading.Tasks.Task CreateSourceAsync(SourceCreate sourceCreate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create a source. + /// + /// + /// Create a source. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SourceCreateResponse) + System.Threading.Tasks.Task> CreateSourceWithHttpInfoAsync(SourceCreate sourceCreate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Create a task. + /// + /// + /// Create a task. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of TaskCreateResponse + System.Threading.Tasks.Task CreateTaskAsync(TaskCreate taskCreate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create a task. + /// + /// + /// Create a task. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (TaskCreateResponse) + System.Threading.Tasks.Task> CreateTaskWithHttpInfoAsync(TaskCreate taskCreate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete a authentication. + /// + /// + /// Soft delete the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// Cancellation Token to cancel the request. + /// Task of DeleteResponse + System.Threading.Tasks.Task DeleteAuthenticationAsync(string authenticationID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete a authentication. + /// + /// + /// Soft delete the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeleteResponse) + System.Threading.Tasks.Task> DeleteAuthenticationWithHttpInfoAsync(string authenticationID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete a destination. + /// + /// + /// Soft delete the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// Cancellation Token to cancel the request. + /// Task of DeleteResponse + System.Threading.Tasks.Task DeleteDestinationAsync(string destinationID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete a destination. + /// + /// + /// Soft delete the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeleteResponse) + System.Threading.Tasks.Task> DeleteDestinationWithHttpInfoAsync(string destinationID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete a source. + /// + /// + /// Soft delete the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Cancellation Token to cancel the request. + /// Task of DeleteResponse + System.Threading.Tasks.Task DeleteSourceAsync(string sourceID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete a source. + /// + /// + /// Soft delete the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeleteResponse) + System.Threading.Tasks.Task> DeleteSourceWithHttpInfoAsync(string sourceID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete a task. + /// + /// + /// Soft delete the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of DeleteResponse + System.Threading.Tasks.Task DeleteTaskAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete a task. + /// + /// + /// Soft delete the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeleteResponse) + System.Threading.Tasks.Task> DeleteTaskWithHttpInfoAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Disable a task. + /// + /// + /// Disable the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of TaskUpdateResponse + System.Threading.Tasks.Task DisableTaskAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Disable a task. + /// + /// + /// Disable the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (TaskUpdateResponse) + System.Threading.Tasks.Task> DisableTaskWithHttpInfoAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Enable a task. + /// + /// + /// Enable the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of TaskUpdateResponse + System.Threading.Tasks.Task EnableTaskAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Enable a task. + /// + /// + /// Enable the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (TaskUpdateResponse) + System.Threading.Tasks.Task> EnableTaskWithHttpInfoAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a authentication. + /// + /// + /// Get the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// Cancellation Token to cancel the request. + /// Task of Authentication + System.Threading.Tasks.Task GetAuthenticationAsync(string authenticationID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a authentication. + /// + /// + /// Get the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Authentication) + System.Threading.Tasks.Task> GetAuthenticationWithHttpInfoAsync(string authenticationID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a list of authentications. + /// + /// + /// Get a list of authentications for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the authentications to retrieve. (optional) + /// The platform of the authentications to retrieve. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// Cancellation Token to cancel the request. + /// Task of ListAuthenticationsResponse + System.Threading.Tasks.Task GetAuthenticationsAsync(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List platform = default(List), AuthenticationSortKeys sort = default(AuthenticationSortKeys), OrderKeys order = default(OrderKeys), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a list of authentications. + /// + /// + /// Get a list of authentications for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the authentications to retrieve. (optional) + /// The platform of the authentications to retrieve. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListAuthenticationsResponse) + System.Threading.Tasks.Task> GetAuthenticationsWithHttpInfoAsync(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List platform = default(List), AuthenticationSortKeys sort = default(AuthenticationSortKeys), OrderKeys order = default(OrderKeys), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a destination. + /// + /// + /// Get the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// Cancellation Token to cancel the request. + /// Task of Destination + System.Threading.Tasks.Task GetDestinationAsync(string destinationID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a destination. + /// + /// + /// Get the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Destination) + System.Threading.Tasks.Task> GetDestinationWithHttpInfoAsync(string destinationID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a list of destinations. + /// + /// + /// Get a list of destinations for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the destinations to retrive. (optional) + /// The authenticationIDs of the destinations to retrive. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// Cancellation Token to cancel the request. + /// Task of ListDestinationsResponse + System.Threading.Tasks.Task GetDestinationsAsync(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List authenticationID = default(List), DestinationSortKeys sort = default(DestinationSortKeys), OrderKeys order = default(OrderKeys), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a list of destinations. + /// + /// + /// Get a list of destinations for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the destinations to retrive. (optional) + /// The authenticationIDs of the destinations to retrive. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListDestinationsResponse) + System.Threading.Tasks.Task> GetDestinationsWithHttpInfoAsync(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List authenticationID = default(List), DestinationSortKeys sort = default(DestinationSortKeys), OrderKeys order = default(OrderKeys), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Retrieve a stream listing. + /// + /// + /// Retrieve a stream listing for a given Singer specification compatible docker type source ID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Cancellation Token to cancel the request. + /// Task of DockerSourceStreams + System.Threading.Tasks.Task GetDockerSourceStreamsAsync(string sourceID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Retrieve a stream listing. + /// + /// + /// Retrieve a stream listing for a given Singer specification compatible docker type source ID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DockerSourceStreams) + System.Threading.Tasks.Task> GetDockerSourceStreamsWithHttpInfoAsync(string sourceID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get an event. + /// + /// + /// Get a single event for a specific runID. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// The event UUID. + /// Cancellation Token to cancel the request. + /// Task of Event + System.Threading.Tasks.Task GetEventAsync(string runID, string eventID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get an event. + /// + /// + /// Get a single event for a specific runID. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// The event UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Event) + System.Threading.Tasks.Task> GetEventWithHttpInfoAsync(string runID, string eventID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a list of events. + /// + /// + /// Get a list of events associated to the given runID, for the given query parameters. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// Filter the status of the events. (optional) + /// Filter the type of the events. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// The start date (in RFC3339 format) of the events fetching window. Defaults to 'now'-3 hours if omitted. (optional) + /// The end date (in RFC3339 format) of the events fetching window. Defaults to 'now' days if omitted. (optional) + /// Cancellation Token to cancel the request. + /// Task of ListEventsResponse + System.Threading.Tasks.Task GetEventsAsync(string runID, int? itemsPerPage = default(int?), int? page = default(int?), List status = default(List), List type = default(List), EventSortKeys sort = default(EventSortKeys), OrderKeys order = default(OrderKeys), string startDate = default(string), string endDate = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a list of events. + /// + /// + /// Get a list of events associated to the given runID, for the given query parameters. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// Filter the status of the events. (optional) + /// Filter the type of the events. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// The start date (in RFC3339 format) of the events fetching window. Defaults to 'now'-3 hours if omitted. (optional) + /// The end date (in RFC3339 format) of the events fetching window. Defaults to 'now' days if omitted. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListEventsResponse) + System.Threading.Tasks.Task> GetEventsWithHttpInfoAsync(string runID, int? itemsPerPage = default(int?), int? page = default(int?), List status = default(List), List type = default(List), EventSortKeys sort = default(EventSortKeys), OrderKeys order = default(OrderKeys), string startDate = default(string), string endDate = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a run. + /// + /// + /// Get a single run for the given ID. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// Cancellation Token to cancel the request. + /// Task of Run + System.Threading.Tasks.Task GetRunAsync(string runID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a run. + /// + /// + /// Get a single run for the given ID. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Run) + System.Threading.Tasks.Task> GetRunWithHttpInfoAsync(string runID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a list of runs. + /// + /// + /// Get a list of runs for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// Filter the status of the runs. (optional) + /// Filter by taskID. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// The start date (in RFC3339 format) of the runs fetching window. Defaults to 'now'-7 days if omitted. (optional) + /// The end date (in RFC3339 format) of the runs fetching window. Defaults to 'now' days if omitted. (optional) + /// Cancellation Token to cancel the request. + /// Task of RunListResponse + System.Threading.Tasks.Task GetRunsAsync(int? itemsPerPage = default(int?), int? page = default(int?), List status = default(List), string taskID = default(string), RunSortKeys sort = default(RunSortKeys), OrderKeys order = default(OrderKeys), string startDate = default(string), string endDate = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a list of runs. + /// + /// + /// Get a list of runs for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// Filter the status of the runs. (optional) + /// Filter by taskID. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// The start date (in RFC3339 format) of the runs fetching window. Defaults to 'now'-7 days if omitted. (optional) + /// The end date (in RFC3339 format) of the runs fetching window. Defaults to 'now' days if omitted. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (RunListResponse) + System.Threading.Tasks.Task> GetRunsWithHttpInfoAsync(int? itemsPerPage = default(int?), int? page = default(int?), List status = default(List), string taskID = default(string), RunSortKeys sort = default(RunSortKeys), OrderKeys order = default(OrderKeys), string startDate = default(string), string endDate = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a source. + /// + /// + /// Get the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Cancellation Token to cancel the request. + /// Task of Source + System.Threading.Tasks.Task GetSourceAsync(string sourceID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a source. + /// + /// + /// Get the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Source) + System.Threading.Tasks.Task> GetSourceWithHttpInfoAsync(string sourceID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a list of sources. + /// + /// + /// Get a list of sources for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the sources to retrieve. (optional) + /// The authenticationIDs of the sources to retrieve. 'none' returns sources that doesn't have an authentication. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// Cancellation Token to cancel the request. + /// Task of ListSourcesResponse + System.Threading.Tasks.Task GetSourcesAsync(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List authenticationID = default(List), SourceSortKeys sort = default(SourceSortKeys), OrderKeys order = default(OrderKeys), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a list of sources. + /// + /// + /// Get a list of sources for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the sources to retrieve. (optional) + /// The authenticationIDs of the sources to retrieve. 'none' returns sources that doesn't have an authentication. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListSourcesResponse) + System.Threading.Tasks.Task> GetSourcesWithHttpInfoAsync(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List authenticationID = default(List), SourceSortKeys sort = default(SourceSortKeys), OrderKeys order = default(OrderKeys), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a task. + /// + /// + /// Get the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of Task + System.Threading.Tasks.Task GetTaskAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a task. + /// + /// + /// Get the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Task) + System.Threading.Tasks.Task> GetTaskWithHttpInfoAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a list of tasks. + /// + /// + /// Get a list of tasks for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The action of the tasks to retrieve. (optional) + /// Whether the task is enabled or not. (optional) + /// The sourceIDs of the tasks to retrive. (optional) + /// The destinationIDs of the tasks to retrive. (optional) + /// The trigger type of the task. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// Cancellation Token to cancel the request. + /// Task of ListTasksResponse + System.Threading.Tasks.Task GetTasksAsync(int? itemsPerPage = default(int?), int? page = default(int?), List action = default(List), bool? enabled = default(bool?), List sourceID = default(List), List destinationID = default(List), List triggerType = default(List), TaskSortKeys sort = default(TaskSortKeys), OrderKeys order = default(OrderKeys), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a list of tasks. + /// + /// + /// Get a list of tasks for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The action of the tasks to retrieve. (optional) + /// Whether the task is enabled or not. (optional) + /// The sourceIDs of the tasks to retrive. (optional) + /// The destinationIDs of the tasks to retrive. (optional) + /// The trigger type of the task. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListTasksResponse) + System.Threading.Tasks.Task> GetTasksWithHttpInfoAsync(int? itemsPerPage = default(int?), int? page = default(int?), List action = default(List), bool? enabled = default(bool?), List sourceID = default(List), List destinationID = default(List), List triggerType = default(List), TaskSortKeys sort = default(TaskSortKeys), OrderKeys order = default(OrderKeys), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Run a task. + /// + /// + /// Run the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of RunResponse + System.Threading.Tasks.Task RunTaskAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Run a task. + /// + /// + /// Run the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (RunResponse) + System.Threading.Tasks.Task> RunTaskWithHttpInfoAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Search among authentications. + /// + /// + /// Search among authentications with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of List<Authentication> + System.Threading.Tasks.Task> SearchAuthenticationsAsync(AuthenticationSearch authenticationSearch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Search among authentications. + /// + /// + /// Search among authentications with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Authentication>) + System.Threading.Tasks.Task>> SearchAuthenticationsWithHttpInfoAsync(AuthenticationSearch authenticationSearch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Search among destinations. + /// + /// + /// Search among destinations with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of List<Destination> + System.Threading.Tasks.Task> SearchDestinationsAsync(DestinationSearch destinationSearch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Search among destinations. + /// + /// + /// Search among destinations with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Destination>) + System.Threading.Tasks.Task>> SearchDestinationsWithHttpInfoAsync(DestinationSearch destinationSearch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Search among sources. + /// + /// + /// Search among sources with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of List<Source> + System.Threading.Tasks.Task> SearchSourcesAsync(SourceSearch sourceSearch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Search among sources. + /// + /// + /// Search among sources with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Source>) + System.Threading.Tasks.Task>> SearchSourcesWithHttpInfoAsync(SourceSearch sourceSearch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Search among tasks. + /// + /// + /// Search among tasks with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of List<Task> + System.Threading.Tasks.Task> SearchTasksAsync(TaskSearch taskSearch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Search among tasks. + /// + /// + /// Search among tasks with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Task>) + System.Threading.Tasks.Task>> SearchTasksWithHttpInfoAsync(TaskSearch taskSearch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Trigger a stream listing request. + /// + /// + /// Trigger a stream listing request for a Singer specification compatible docker type source. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Cancellation Token to cancel the request. + /// Task of DockerSourceDiscover + System.Threading.Tasks.Task TriggerDockerSourceDiscoverAsync(string sourceID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Trigger a stream listing request. + /// + /// + /// Trigger a stream listing request for a Singer specification compatible docker type source. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DockerSourceDiscover) + System.Threading.Tasks.Task> TriggerDockerSourceDiscoverWithHttpInfoAsync(string sourceID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Update a authentication. + /// + /// + /// Update the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// + /// Cancellation Token to cancel the request. + /// Task of AuthenticationUpdateResponse + System.Threading.Tasks.Task UpdateAuthenticationAsync(string authenticationID, AuthenticationUpdate authenticationUpdate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Update a authentication. + /// + /// + /// Update the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (AuthenticationUpdateResponse) + System.Threading.Tasks.Task> UpdateAuthenticationWithHttpInfoAsync(string authenticationID, AuthenticationUpdate authenticationUpdate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Update a destination. + /// + /// + /// Update the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// + /// Cancellation Token to cancel the request. + /// Task of DestinationUpdateResponse + System.Threading.Tasks.Task UpdateDestinationAsync(string destinationID, DestinationUpdate destinationUpdate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Update a destination. + /// + /// + /// Update the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DestinationUpdateResponse) + System.Threading.Tasks.Task> UpdateDestinationWithHttpInfoAsync(string destinationID, DestinationUpdate destinationUpdate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Update a source. + /// + /// + /// Update the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// + /// Cancellation Token to cancel the request. + /// Task of SourceUpdateResponse + System.Threading.Tasks.Task UpdateSourceAsync(string sourceID, SourceUpdate sourceUpdate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Update a source. + /// + /// + /// Update the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SourceUpdateResponse) + System.Threading.Tasks.Task> UpdateSourceWithHttpInfoAsync(string sourceID, SourceUpdate sourceUpdate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Update a task. + /// + /// + /// Update the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// + /// Cancellation Token to cancel the request. + /// Task of TaskUpdateResponse + System.Threading.Tasks.Task UpdateTaskAsync(string taskID, TaskUpdate taskUpdate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Update a task. + /// + /// + /// Update the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (TaskUpdateResponse) + System.Threading.Tasks.Task> UpdateTaskWithHttpInfoAsync(string taskID, TaskUpdate taskUpdate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } + + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class IngestionClient : IDisposable, IIngestionClient + { + private Algolia.Search.Ingestion.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// + public IngestionClient() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + /// + public IngestionClient(string basePath) + { + this.Configuration = Algolia.Search.Ingestion.Client.Configuration.MergeConfigurations( + Algolia.Search.Ingestion.Client.GlobalConfiguration.Instance, + new Algolia.Search.Ingestion.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.Ingestion.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.Ingestion.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// An instance of Configuration. + /// + /// + public IngestionClient(Algolia.Search.Ingestion.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Algolia.Search.Ingestion.Client.Configuration.MergeConfigurations( + Algolia.Search.Ingestion.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.Ingestion.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.Ingestion.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public IngestionClient(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public IngestionClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.Ingestion.Client.Configuration.MergeConfigurations( + Algolia.Search.Ingestion.Client.GlobalConfiguration.Instance, + new Algolia.Search.Ingestion.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.Ingestion.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.Ingestion.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// + /// An instance of HttpClient. + /// An instance of Configuration. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public IngestionClient(HttpClient client, Algolia.Search.Ingestion.Client.Configuration configuration, HttpClientHandler handler = null) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.Ingestion.Client.Configuration.MergeConfigurations( + Algolia.Search.Ingestion.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.Ingestion.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.Ingestion.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + /// + public IngestionClient(Algolia.Search.Ingestion.Client.ISynchronousClient client, Algolia.Search.Ingestion.Client.IAsynchronousClient asyncClient, Algolia.Search.Ingestion.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Algolia.Search.Ingestion.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + this.ApiClient?.Dispose(); + } + + /// + /// Holds the ApiClient if created + /// + public Algolia.Search.Ingestion.Client.ApiClient ApiClient { get; set; } = null; + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Algolia.Search.Ingestion.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Algolia.Search.Ingestion.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Algolia.Search.Ingestion.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Algolia.Search.Ingestion.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Create a authentication. Create a authentication. + /// + /// Thrown when fails to make API call + /// + /// AuthenticationCreateResponse + public AuthenticationCreateResponse CreateAuthentication(AuthenticationCreate authenticationCreate) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = CreateAuthenticationWithHttpInfo(authenticationCreate); + return localVarResponse.Data; + } + + /// + /// Create a authentication. Create a authentication. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of AuthenticationCreateResponse + public Algolia.Search.Ingestion.Client.ApiResponse CreateAuthenticationWithHttpInfo(AuthenticationCreate authenticationCreate) + { + // verify the required parameter 'authenticationCreate' is set + if (authenticationCreate == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'authenticationCreate' when calling IngestionClient->CreateAuthentication"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = authenticationCreate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/authentications", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateAuthentication", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Create a authentication. Create a authentication. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of AuthenticationCreateResponse + public async System.Threading.Tasks.Task CreateAuthenticationAsync(AuthenticationCreate authenticationCreate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await CreateAuthenticationWithHttpInfoAsync(authenticationCreate, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Create a authentication. Create a authentication. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (AuthenticationCreateResponse) + public async System.Threading.Tasks.Task> CreateAuthenticationWithHttpInfoAsync(AuthenticationCreate authenticationCreate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'authenticationCreate' is set + if (authenticationCreate == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'authenticationCreate' when calling IngestionClient->CreateAuthentication"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = authenticationCreate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/authentications", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateAuthentication", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Create a destination. Create a destination. + /// + /// Thrown when fails to make API call + /// + /// DestinationCreateResponse + public DestinationCreateResponse CreateDestination(DestinationCreate destinationCreate) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = CreateDestinationWithHttpInfo(destinationCreate); + return localVarResponse.Data; + } + + /// + /// Create a destination. Create a destination. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of DestinationCreateResponse + public Algolia.Search.Ingestion.Client.ApiResponse CreateDestinationWithHttpInfo(DestinationCreate destinationCreate) + { + // verify the required parameter 'destinationCreate' is set + if (destinationCreate == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'destinationCreate' when calling IngestionClient->CreateDestination"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = destinationCreate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/destinations", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateDestination", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Create a destination. Create a destination. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of DestinationCreateResponse + public async System.Threading.Tasks.Task CreateDestinationAsync(DestinationCreate destinationCreate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await CreateDestinationWithHttpInfoAsync(destinationCreate, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Create a destination. Create a destination. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DestinationCreateResponse) + public async System.Threading.Tasks.Task> CreateDestinationWithHttpInfoAsync(DestinationCreate destinationCreate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'destinationCreate' is set + if (destinationCreate == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'destinationCreate' when calling IngestionClient->CreateDestination"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = destinationCreate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/destinations", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateDestination", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Create a source. Create a source. + /// + /// Thrown when fails to make API call + /// + /// SourceCreateResponse + public SourceCreateResponse CreateSource(SourceCreate sourceCreate) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = CreateSourceWithHttpInfo(sourceCreate); + return localVarResponse.Data; + } + + /// + /// Create a source. Create a source. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of SourceCreateResponse + public Algolia.Search.Ingestion.Client.ApiResponse CreateSourceWithHttpInfo(SourceCreate sourceCreate) + { + // verify the required parameter 'sourceCreate' is set + if (sourceCreate == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'sourceCreate' when calling IngestionClient->CreateSource"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = sourceCreate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/sources", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateSource", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Create a source. Create a source. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of SourceCreateResponse + public async System.Threading.Tasks.Task CreateSourceAsync(SourceCreate sourceCreate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await CreateSourceWithHttpInfoAsync(sourceCreate, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Create a source. Create a source. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SourceCreateResponse) + public async System.Threading.Tasks.Task> CreateSourceWithHttpInfoAsync(SourceCreate sourceCreate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'sourceCreate' is set + if (sourceCreate == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'sourceCreate' when calling IngestionClient->CreateSource"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = sourceCreate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/sources", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateSource", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Create a task. Create a task. + /// + /// Thrown when fails to make API call + /// + /// TaskCreateResponse + public TaskCreateResponse CreateTask(TaskCreate taskCreate) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = CreateTaskWithHttpInfo(taskCreate); + return localVarResponse.Data; + } + + /// + /// Create a task. Create a task. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of TaskCreateResponse + public Algolia.Search.Ingestion.Client.ApiResponse CreateTaskWithHttpInfo(TaskCreate taskCreate) + { + // verify the required parameter 'taskCreate' is set + if (taskCreate == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskCreate' when calling IngestionClient->CreateTask"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = taskCreate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/tasks", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateTask", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Create a task. Create a task. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of TaskCreateResponse + public async System.Threading.Tasks.Task CreateTaskAsync(TaskCreate taskCreate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await CreateTaskWithHttpInfoAsync(taskCreate, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Create a task. Create a task. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (TaskCreateResponse) + public async System.Threading.Tasks.Task> CreateTaskWithHttpInfoAsync(TaskCreate taskCreate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'taskCreate' is set + if (taskCreate == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskCreate' when calling IngestionClient->CreateTask"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = taskCreate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/tasks", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateTask", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Del(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = DelWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.Ingestion.Client.ApiResponse DelWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'path' when calling IngestionClient->Del"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await DelWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'path' when calling IngestionClient->Del"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a authentication. Soft delete the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// DeleteResponse + public DeleteResponse DeleteAuthentication(string authenticationID) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = DeleteAuthenticationWithHttpInfo(authenticationID); + return localVarResponse.Data; + } + + /// + /// Delete a authentication. Soft delete the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// ApiResponse of DeleteResponse + public Algolia.Search.Ingestion.Client.ApiResponse DeleteAuthenticationWithHttpInfo(string authenticationID) + { + // verify the required parameter 'authenticationID' is set + if (authenticationID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'authenticationID' when calling IngestionClient->DeleteAuthentication"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("authenticationID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(authenticationID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1/authentications/{authenticationID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteAuthentication", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a authentication. Soft delete the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// Cancellation Token to cancel the request. + /// Task of DeleteResponse + public async System.Threading.Tasks.Task DeleteAuthenticationAsync(string authenticationID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await DeleteAuthenticationWithHttpInfoAsync(authenticationID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete a authentication. Soft delete the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeleteResponse) + public async System.Threading.Tasks.Task> DeleteAuthenticationWithHttpInfoAsync(string authenticationID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'authenticationID' is set + if (authenticationID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'authenticationID' when calling IngestionClient->DeleteAuthentication"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("authenticationID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(authenticationID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1/authentications/{authenticationID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteAuthentication", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a destination. Soft delete the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// DeleteResponse + public DeleteResponse DeleteDestination(string destinationID) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = DeleteDestinationWithHttpInfo(destinationID); + return localVarResponse.Data; + } + + /// + /// Delete a destination. Soft delete the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// ApiResponse of DeleteResponse + public Algolia.Search.Ingestion.Client.ApiResponse DeleteDestinationWithHttpInfo(string destinationID) + { + // verify the required parameter 'destinationID' is set + if (destinationID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'destinationID' when calling IngestionClient->DeleteDestination"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("destinationID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(destinationID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1/destinations/{destinationID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteDestination", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a destination. Soft delete the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// Cancellation Token to cancel the request. + /// Task of DeleteResponse + public async System.Threading.Tasks.Task DeleteDestinationAsync(string destinationID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await DeleteDestinationWithHttpInfoAsync(destinationID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete a destination. Soft delete the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeleteResponse) + public async System.Threading.Tasks.Task> DeleteDestinationWithHttpInfoAsync(string destinationID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'destinationID' is set + if (destinationID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'destinationID' when calling IngestionClient->DeleteDestination"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("destinationID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(destinationID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1/destinations/{destinationID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteDestination", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a source. Soft delete the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// DeleteResponse + public DeleteResponse DeleteSource(string sourceID) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = DeleteSourceWithHttpInfo(sourceID); + return localVarResponse.Data; + } + + /// + /// Delete a source. Soft delete the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// ApiResponse of DeleteResponse + public Algolia.Search.Ingestion.Client.ApiResponse DeleteSourceWithHttpInfo(string sourceID) + { + // verify the required parameter 'sourceID' is set + if (sourceID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'sourceID' when calling IngestionClient->DeleteSource"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("sourceID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(sourceID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1/sources/{sourceID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteSource", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a source. Soft delete the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Cancellation Token to cancel the request. + /// Task of DeleteResponse + public async System.Threading.Tasks.Task DeleteSourceAsync(string sourceID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await DeleteSourceWithHttpInfoAsync(sourceID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete a source. Soft delete the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeleteResponse) + public async System.Threading.Tasks.Task> DeleteSourceWithHttpInfoAsync(string sourceID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'sourceID' is set + if (sourceID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'sourceID' when calling IngestionClient->DeleteSource"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("sourceID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(sourceID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1/sources/{sourceID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteSource", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a task. Soft delete the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// DeleteResponse + public DeleteResponse DeleteTask(string taskID) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = DeleteTaskWithHttpInfo(taskID); + return localVarResponse.Data; + } + + /// + /// Delete a task. Soft delete the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// ApiResponse of DeleteResponse + public Algolia.Search.Ingestion.Client.ApiResponse DeleteTaskWithHttpInfo(string taskID) + { + // verify the required parameter 'taskID' is set + if (taskID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskID' when calling IngestionClient->DeleteTask"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("taskID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(taskID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1/tasks/{taskID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteTask", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a task. Soft delete the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of DeleteResponse + public async System.Threading.Tasks.Task DeleteTaskAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await DeleteTaskWithHttpInfoAsync(taskID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete a task. Soft delete the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeleteResponse) + public async System.Threading.Tasks.Task> DeleteTaskWithHttpInfoAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'taskID' is set + if (taskID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskID' when calling IngestionClient->DeleteTask"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("taskID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(taskID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1/tasks/{taskID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteTask", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Disable a task. Disable the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// TaskUpdateResponse + public TaskUpdateResponse DisableTask(string taskID) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = DisableTaskWithHttpInfo(taskID); + return localVarResponse.Data; + } + + /// + /// Disable a task. Disable the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// ApiResponse of TaskUpdateResponse + public Algolia.Search.Ingestion.Client.ApiResponse DisableTaskWithHttpInfo(string taskID) + { + // verify the required parameter 'taskID' is set + if (taskID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskID' when calling IngestionClient->DisableTask"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("taskID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(taskID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1/tasks/{taskID}/disable", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DisableTask", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Disable a task. Disable the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of TaskUpdateResponse + public async System.Threading.Tasks.Task DisableTaskAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await DisableTaskWithHttpInfoAsync(taskID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Disable a task. Disable the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (TaskUpdateResponse) + public async System.Threading.Tasks.Task> DisableTaskWithHttpInfoAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'taskID' is set + if (taskID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskID' when calling IngestionClient->DisableTask"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("taskID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(taskID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1/tasks/{taskID}/disable", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DisableTask", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Enable a task. Enable the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// TaskUpdateResponse + public TaskUpdateResponse EnableTask(string taskID) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = EnableTaskWithHttpInfo(taskID); + return localVarResponse.Data; + } + + /// + /// Enable a task. Enable the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// ApiResponse of TaskUpdateResponse + public Algolia.Search.Ingestion.Client.ApiResponse EnableTaskWithHttpInfo(string taskID) + { + // verify the required parameter 'taskID' is set + if (taskID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskID' when calling IngestionClient->EnableTask"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("taskID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(taskID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1/tasks/{taskID}/enable", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("EnableTask", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Enable a task. Enable the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of TaskUpdateResponse + public async System.Threading.Tasks.Task EnableTaskAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await EnableTaskWithHttpInfoAsync(taskID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Enable a task. Enable the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (TaskUpdateResponse) + public async System.Threading.Tasks.Task> EnableTaskWithHttpInfoAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'taskID' is set + if (taskID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskID' when calling IngestionClient->EnableTask"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("taskID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(taskID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1/tasks/{taskID}/enable", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("EnableTask", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Get(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = GetWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.Ingestion.Client.ApiResponse GetWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'path' when calling IngestionClient->Get"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await GetWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'path' when calling IngestionClient->Get"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a authentication. Get the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// Authentication + public Authentication GetAuthentication(string authenticationID) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = GetAuthenticationWithHttpInfo(authenticationID); + return localVarResponse.Data; + } + + /// + /// Get a authentication. Get the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// ApiResponse of Authentication + public Algolia.Search.Ingestion.Client.ApiResponse GetAuthenticationWithHttpInfo(string authenticationID) + { + // verify the required parameter 'authenticationID' is set + if (authenticationID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'authenticationID' when calling IngestionClient->GetAuthentication"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("authenticationID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(authenticationID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/authentications/{authenticationID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetAuthentication", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a authentication. Get the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// Cancellation Token to cancel the request. + /// Task of Authentication + public async System.Threading.Tasks.Task GetAuthenticationAsync(string authenticationID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await GetAuthenticationWithHttpInfoAsync(authenticationID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a authentication. Get the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Authentication) + public async System.Threading.Tasks.Task> GetAuthenticationWithHttpInfoAsync(string authenticationID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'authenticationID' is set + if (authenticationID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'authenticationID' when calling IngestionClient->GetAuthentication"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("authenticationID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(authenticationID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/authentications/{authenticationID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetAuthentication", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a list of authentications. Get a list of authentications for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the authentications to retrieve. (optional) + /// The platform of the authentications to retrieve. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// ListAuthenticationsResponse + public ListAuthenticationsResponse GetAuthentications(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List platform = default(List), AuthenticationSortKeys sort = default(AuthenticationSortKeys), OrderKeys order = default(OrderKeys)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = GetAuthenticationsWithHttpInfo(itemsPerPage, page, type, platform, sort, order); + return localVarResponse.Data; + } + + /// + /// Get a list of authentications. Get a list of authentications for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the authentications to retrieve. (optional) + /// The platform of the authentications to retrieve. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// ApiResponse of ListAuthenticationsResponse + public Algolia.Search.Ingestion.Client.ApiResponse GetAuthenticationsWithHttpInfo(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List platform = default(List), AuthenticationSortKeys sort = default(AuthenticationSortKeys), OrderKeys order = default(OrderKeys)) + { + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (itemsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "itemsPerPage", itemsPerPage)); + } + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (type != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "type", type)); + } + if (platform != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "platform", platform)); + } + if (sort != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "sort", sort)); + } + if (order != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "order", order)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/authentications", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetAuthentications", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a list of authentications. Get a list of authentications for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the authentications to retrieve. (optional) + /// The platform of the authentications to retrieve. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// Cancellation Token to cancel the request. + /// Task of ListAuthenticationsResponse + public async System.Threading.Tasks.Task GetAuthenticationsAsync(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List platform = default(List), AuthenticationSortKeys sort = default(AuthenticationSortKeys), OrderKeys order = default(OrderKeys), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await GetAuthenticationsWithHttpInfoAsync(itemsPerPage, page, type, platform, sort, order, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a list of authentications. Get a list of authentications for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the authentications to retrieve. (optional) + /// The platform of the authentications to retrieve. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListAuthenticationsResponse) + public async System.Threading.Tasks.Task> GetAuthenticationsWithHttpInfoAsync(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List platform = default(List), AuthenticationSortKeys sort = default(AuthenticationSortKeys), OrderKeys order = default(OrderKeys), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (itemsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "itemsPerPage", itemsPerPage)); + } + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (type != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "type", type)); + } + if (platform != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "platform", platform)); + } + if (sort != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "sort", sort)); + } + if (order != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "order", order)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/authentications", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetAuthentications", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a destination. Get the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// Destination + public Destination GetDestination(string destinationID) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = GetDestinationWithHttpInfo(destinationID); + return localVarResponse.Data; + } + + /// + /// Get a destination. Get the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// ApiResponse of Destination + public Algolia.Search.Ingestion.Client.ApiResponse GetDestinationWithHttpInfo(string destinationID) + { + // verify the required parameter 'destinationID' is set + if (destinationID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'destinationID' when calling IngestionClient->GetDestination"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("destinationID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(destinationID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/destinations/{destinationID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetDestination", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a destination. Get the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// Cancellation Token to cancel the request. + /// Task of Destination + public async System.Threading.Tasks.Task GetDestinationAsync(string destinationID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await GetDestinationWithHttpInfoAsync(destinationID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a destination. Get the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Destination) + public async System.Threading.Tasks.Task> GetDestinationWithHttpInfoAsync(string destinationID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'destinationID' is set + if (destinationID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'destinationID' when calling IngestionClient->GetDestination"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("destinationID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(destinationID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/destinations/{destinationID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetDestination", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a list of destinations. Get a list of destinations for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the destinations to retrive. (optional) + /// The authenticationIDs of the destinations to retrive. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// ListDestinationsResponse + public ListDestinationsResponse GetDestinations(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List authenticationID = default(List), DestinationSortKeys sort = default(DestinationSortKeys), OrderKeys order = default(OrderKeys)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = GetDestinationsWithHttpInfo(itemsPerPage, page, type, authenticationID, sort, order); + return localVarResponse.Data; + } + + /// + /// Get a list of destinations. Get a list of destinations for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the destinations to retrive. (optional) + /// The authenticationIDs of the destinations to retrive. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// ApiResponse of ListDestinationsResponse + public Algolia.Search.Ingestion.Client.ApiResponse GetDestinationsWithHttpInfo(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List authenticationID = default(List), DestinationSortKeys sort = default(DestinationSortKeys), OrderKeys order = default(OrderKeys)) + { + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (itemsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "itemsPerPage", itemsPerPage)); + } + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (type != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "type", type)); + } + if (authenticationID != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "authenticationID", authenticationID)); + } + if (sort != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "sort", sort)); + } + if (order != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "order", order)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/destinations", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetDestinations", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a list of destinations. Get a list of destinations for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the destinations to retrive. (optional) + /// The authenticationIDs of the destinations to retrive. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// Cancellation Token to cancel the request. + /// Task of ListDestinationsResponse + public async System.Threading.Tasks.Task GetDestinationsAsync(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List authenticationID = default(List), DestinationSortKeys sort = default(DestinationSortKeys), OrderKeys order = default(OrderKeys), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await GetDestinationsWithHttpInfoAsync(itemsPerPage, page, type, authenticationID, sort, order, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a list of destinations. Get a list of destinations for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the destinations to retrive. (optional) + /// The authenticationIDs of the destinations to retrive. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListDestinationsResponse) + public async System.Threading.Tasks.Task> GetDestinationsWithHttpInfoAsync(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List authenticationID = default(List), DestinationSortKeys sort = default(DestinationSortKeys), OrderKeys order = default(OrderKeys), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (itemsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "itemsPerPage", itemsPerPage)); + } + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (type != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "type", type)); + } + if (authenticationID != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "authenticationID", authenticationID)); + } + if (sort != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "sort", sort)); + } + if (order != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "order", order)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/destinations", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetDestinations", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Retrieve a stream listing. Retrieve a stream listing for a given Singer specification compatible docker type source ID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// DockerSourceStreams + public DockerSourceStreams GetDockerSourceStreams(string sourceID) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = GetDockerSourceStreamsWithHttpInfo(sourceID); + return localVarResponse.Data; + } + + /// + /// Retrieve a stream listing. Retrieve a stream listing for a given Singer specification compatible docker type source ID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// ApiResponse of DockerSourceStreams + public Algolia.Search.Ingestion.Client.ApiResponse GetDockerSourceStreamsWithHttpInfo(string sourceID) + { + // verify the required parameter 'sourceID' is set + if (sourceID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'sourceID' when calling IngestionClient->GetDockerSourceStreams"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("sourceID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(sourceID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/sources/{sourceID}/discover", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetDockerSourceStreams", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Retrieve a stream listing. Retrieve a stream listing for a given Singer specification compatible docker type source ID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Cancellation Token to cancel the request. + /// Task of DockerSourceStreams + public async System.Threading.Tasks.Task GetDockerSourceStreamsAsync(string sourceID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await GetDockerSourceStreamsWithHttpInfoAsync(sourceID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Retrieve a stream listing. Retrieve a stream listing for a given Singer specification compatible docker type source ID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DockerSourceStreams) + public async System.Threading.Tasks.Task> GetDockerSourceStreamsWithHttpInfoAsync(string sourceID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'sourceID' is set + if (sourceID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'sourceID' when calling IngestionClient->GetDockerSourceStreams"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("sourceID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(sourceID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/sources/{sourceID}/discover", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetDockerSourceStreams", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get an event. Get a single event for a specific runID. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// The event UUID. + /// Event + public Event GetEvent(string runID, string eventID) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = GetEventWithHttpInfo(runID, eventID); + return localVarResponse.Data; + } + + /// + /// Get an event. Get a single event for a specific runID. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// The event UUID. + /// ApiResponse of Event + public Algolia.Search.Ingestion.Client.ApiResponse GetEventWithHttpInfo(string runID, string eventID) + { + // verify the required parameter 'runID' is set + if (runID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'runID' when calling IngestionClient->GetEvent"); + + // verify the required parameter 'eventID' is set + if (eventID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'eventID' when calling IngestionClient->GetEvent"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("runID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(runID)); // path parameter + localVarRequestOptions.PathParameters.Add("eventID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(eventID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/runs/{runID}/events/{eventID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetEvent", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get an event. Get a single event for a specific runID. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// The event UUID. + /// Cancellation Token to cancel the request. + /// Task of Event + public async System.Threading.Tasks.Task GetEventAsync(string runID, string eventID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await GetEventWithHttpInfoAsync(runID, eventID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get an event. Get a single event for a specific runID. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// The event UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Event) + public async System.Threading.Tasks.Task> GetEventWithHttpInfoAsync(string runID, string eventID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'runID' is set + if (runID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'runID' when calling IngestionClient->GetEvent"); + + // verify the required parameter 'eventID' is set + if (eventID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'eventID' when calling IngestionClient->GetEvent"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("runID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(runID)); // path parameter + localVarRequestOptions.PathParameters.Add("eventID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(eventID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/runs/{runID}/events/{eventID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetEvent", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a list of events. Get a list of events associated to the given runID, for the given query parameters. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// Filter the status of the events. (optional) + /// Filter the type of the events. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// The start date (in RFC3339 format) of the events fetching window. Defaults to 'now'-3 hours if omitted. (optional) + /// The end date (in RFC3339 format) of the events fetching window. Defaults to 'now' days if omitted. (optional) + /// ListEventsResponse + public ListEventsResponse GetEvents(string runID, int? itemsPerPage = default(int?), int? page = default(int?), List status = default(List), List type = default(List), EventSortKeys sort = default(EventSortKeys), OrderKeys order = default(OrderKeys), string startDate = default(string), string endDate = default(string)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = GetEventsWithHttpInfo(runID, itemsPerPage, page, status, type, sort, order, startDate, endDate); + return localVarResponse.Data; + } + + /// + /// Get a list of events. Get a list of events associated to the given runID, for the given query parameters. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// Filter the status of the events. (optional) + /// Filter the type of the events. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// The start date (in RFC3339 format) of the events fetching window. Defaults to 'now'-3 hours if omitted. (optional) + /// The end date (in RFC3339 format) of the events fetching window. Defaults to 'now' days if omitted. (optional) + /// ApiResponse of ListEventsResponse + public Algolia.Search.Ingestion.Client.ApiResponse GetEventsWithHttpInfo(string runID, int? itemsPerPage = default(int?), int? page = default(int?), List status = default(List), List type = default(List), EventSortKeys sort = default(EventSortKeys), OrderKeys order = default(OrderKeys), string startDate = default(string), string endDate = default(string)) + { + // verify the required parameter 'runID' is set + if (runID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'runID' when calling IngestionClient->GetEvents"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("runID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(runID)); // path parameter + if (itemsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "itemsPerPage", itemsPerPage)); + } + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (status != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("multi", "status", status)); + } + if (type != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("multi", "type", type)); + } + if (sort != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "sort", sort)); + } + if (order != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "order", order)); + } + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/runs/{runID}/events", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetEvents", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a list of events. Get a list of events associated to the given runID, for the given query parameters. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// Filter the status of the events. (optional) + /// Filter the type of the events. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// The start date (in RFC3339 format) of the events fetching window. Defaults to 'now'-3 hours if omitted. (optional) + /// The end date (in RFC3339 format) of the events fetching window. Defaults to 'now' days if omitted. (optional) + /// Cancellation Token to cancel the request. + /// Task of ListEventsResponse + public async System.Threading.Tasks.Task GetEventsAsync(string runID, int? itemsPerPage = default(int?), int? page = default(int?), List status = default(List), List type = default(List), EventSortKeys sort = default(EventSortKeys), OrderKeys order = default(OrderKeys), string startDate = default(string), string endDate = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await GetEventsWithHttpInfoAsync(runID, itemsPerPage, page, status, type, sort, order, startDate, endDate, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a list of events. Get a list of events associated to the given runID, for the given query parameters. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// Filter the status of the events. (optional) + /// Filter the type of the events. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// The start date (in RFC3339 format) of the events fetching window. Defaults to 'now'-3 hours if omitted. (optional) + /// The end date (in RFC3339 format) of the events fetching window. Defaults to 'now' days if omitted. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListEventsResponse) + public async System.Threading.Tasks.Task> GetEventsWithHttpInfoAsync(string runID, int? itemsPerPage = default(int?), int? page = default(int?), List status = default(List), List type = default(List), EventSortKeys sort = default(EventSortKeys), OrderKeys order = default(OrderKeys), string startDate = default(string), string endDate = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'runID' is set + if (runID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'runID' when calling IngestionClient->GetEvents"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("runID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(runID)); // path parameter + if (itemsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "itemsPerPage", itemsPerPage)); + } + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (status != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("multi", "status", status)); + } + if (type != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("multi", "type", type)); + } + if (sort != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "sort", sort)); + } + if (order != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "order", order)); + } + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/runs/{runID}/events", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetEvents", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a run. Get a single run for the given ID. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// Run + public Run GetRun(string runID) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = GetRunWithHttpInfo(runID); + return localVarResponse.Data; + } + + /// + /// Get a run. Get a single run for the given ID. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// ApiResponse of Run + public Algolia.Search.Ingestion.Client.ApiResponse GetRunWithHttpInfo(string runID) + { + // verify the required parameter 'runID' is set + if (runID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'runID' when calling IngestionClient->GetRun"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("runID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(runID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/runs/{runID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetRun", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a run. Get a single run for the given ID. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// Cancellation Token to cancel the request. + /// Task of Run + public async System.Threading.Tasks.Task GetRunAsync(string runID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await GetRunWithHttpInfoAsync(runID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a run. Get a single run for the given ID. + /// + /// Thrown when fails to make API call + /// The run UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Run) + public async System.Threading.Tasks.Task> GetRunWithHttpInfoAsync(string runID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'runID' is set + if (runID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'runID' when calling IngestionClient->GetRun"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("runID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(runID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/runs/{runID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetRun", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a list of runs. Get a list of runs for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// Filter the status of the runs. (optional) + /// Filter by taskID. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// The start date (in RFC3339 format) of the runs fetching window. Defaults to 'now'-7 days if omitted. (optional) + /// The end date (in RFC3339 format) of the runs fetching window. Defaults to 'now' days if omitted. (optional) + /// RunListResponse + public RunListResponse GetRuns(int? itemsPerPage = default(int?), int? page = default(int?), List status = default(List), string taskID = default(string), RunSortKeys sort = default(RunSortKeys), OrderKeys order = default(OrderKeys), string startDate = default(string), string endDate = default(string)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = GetRunsWithHttpInfo(itemsPerPage, page, status, taskID, sort, order, startDate, endDate); + return localVarResponse.Data; + } + + /// + /// Get a list of runs. Get a list of runs for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// Filter the status of the runs. (optional) + /// Filter by taskID. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// The start date (in RFC3339 format) of the runs fetching window. Defaults to 'now'-7 days if omitted. (optional) + /// The end date (in RFC3339 format) of the runs fetching window. Defaults to 'now' days if omitted. (optional) + /// ApiResponse of RunListResponse + public Algolia.Search.Ingestion.Client.ApiResponse GetRunsWithHttpInfo(int? itemsPerPage = default(int?), int? page = default(int?), List status = default(List), string taskID = default(string), RunSortKeys sort = default(RunSortKeys), OrderKeys order = default(OrderKeys), string startDate = default(string), string endDate = default(string)) + { + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (itemsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "itemsPerPage", itemsPerPage)); + } + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (status != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("multi", "status", status)); + } + if (taskID != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "taskID", taskID)); + } + if (sort != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "sort", sort)); + } + if (order != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "order", order)); + } + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/runs", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetRuns", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a list of runs. Get a list of runs for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// Filter the status of the runs. (optional) + /// Filter by taskID. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// The start date (in RFC3339 format) of the runs fetching window. Defaults to 'now'-7 days if omitted. (optional) + /// The end date (in RFC3339 format) of the runs fetching window. Defaults to 'now' days if omitted. (optional) + /// Cancellation Token to cancel the request. + /// Task of RunListResponse + public async System.Threading.Tasks.Task GetRunsAsync(int? itemsPerPage = default(int?), int? page = default(int?), List status = default(List), string taskID = default(string), RunSortKeys sort = default(RunSortKeys), OrderKeys order = default(OrderKeys), string startDate = default(string), string endDate = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await GetRunsWithHttpInfoAsync(itemsPerPage, page, status, taskID, sort, order, startDate, endDate, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a list of runs. Get a list of runs for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// Filter the status of the runs. (optional) + /// Filter by taskID. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// The start date (in RFC3339 format) of the runs fetching window. Defaults to 'now'-7 days if omitted. (optional) + /// The end date (in RFC3339 format) of the runs fetching window. Defaults to 'now' days if omitted. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (RunListResponse) + public async System.Threading.Tasks.Task> GetRunsWithHttpInfoAsync(int? itemsPerPage = default(int?), int? page = default(int?), List status = default(List), string taskID = default(string), RunSortKeys sort = default(RunSortKeys), OrderKeys order = default(OrderKeys), string startDate = default(string), string endDate = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (itemsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "itemsPerPage", itemsPerPage)); + } + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (status != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("multi", "status", status)); + } + if (taskID != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "taskID", taskID)); + } + if (sort != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "sort", sort)); + } + if (order != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "order", order)); + } + if (startDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "startDate", startDate)); + } + if (endDate != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "endDate", endDate)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/runs", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetRuns", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a source. Get the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Source + public Source GetSource(string sourceID) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = GetSourceWithHttpInfo(sourceID); + return localVarResponse.Data; + } + + /// + /// Get a source. Get the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// ApiResponse of Source + public Algolia.Search.Ingestion.Client.ApiResponse GetSourceWithHttpInfo(string sourceID) + { + // verify the required parameter 'sourceID' is set + if (sourceID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'sourceID' when calling IngestionClient->GetSource"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("sourceID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(sourceID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/sources/{sourceID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetSource", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a source. Get the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Cancellation Token to cancel the request. + /// Task of Source + public async System.Threading.Tasks.Task GetSourceAsync(string sourceID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await GetSourceWithHttpInfoAsync(sourceID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a source. Get the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Source) + public async System.Threading.Tasks.Task> GetSourceWithHttpInfoAsync(string sourceID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'sourceID' is set + if (sourceID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'sourceID' when calling IngestionClient->GetSource"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("sourceID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(sourceID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/sources/{sourceID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetSource", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a list of sources. Get a list of sources for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the sources to retrieve. (optional) + /// The authenticationIDs of the sources to retrieve. 'none' returns sources that doesn't have an authentication. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// ListSourcesResponse + public ListSourcesResponse GetSources(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List authenticationID = default(List), SourceSortKeys sort = default(SourceSortKeys), OrderKeys order = default(OrderKeys)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = GetSourcesWithHttpInfo(itemsPerPage, page, type, authenticationID, sort, order); + return localVarResponse.Data; + } + + /// + /// Get a list of sources. Get a list of sources for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the sources to retrieve. (optional) + /// The authenticationIDs of the sources to retrieve. 'none' returns sources that doesn't have an authentication. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// ApiResponse of ListSourcesResponse + public Algolia.Search.Ingestion.Client.ApiResponse GetSourcesWithHttpInfo(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List authenticationID = default(List), SourceSortKeys sort = default(SourceSortKeys), OrderKeys order = default(OrderKeys)) + { + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (itemsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "itemsPerPage", itemsPerPage)); + } + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (type != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "type", type)); + } + if (authenticationID != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "authenticationID", authenticationID)); + } + if (sort != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "sort", sort)); + } + if (order != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "order", order)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/sources", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetSources", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a list of sources. Get a list of sources for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the sources to retrieve. (optional) + /// The authenticationIDs of the sources to retrieve. 'none' returns sources that doesn't have an authentication. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// Cancellation Token to cancel the request. + /// Task of ListSourcesResponse + public async System.Threading.Tasks.Task GetSourcesAsync(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List authenticationID = default(List), SourceSortKeys sort = default(SourceSortKeys), OrderKeys order = default(OrderKeys), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await GetSourcesWithHttpInfoAsync(itemsPerPage, page, type, authenticationID, sort, order, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a list of sources. Get a list of sources for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The type of the sources to retrieve. (optional) + /// The authenticationIDs of the sources to retrieve. 'none' returns sources that doesn't have an authentication. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListSourcesResponse) + public async System.Threading.Tasks.Task> GetSourcesWithHttpInfoAsync(int? itemsPerPage = default(int?), int? page = default(int?), List type = default(List), List authenticationID = default(List), SourceSortKeys sort = default(SourceSortKeys), OrderKeys order = default(OrderKeys), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (itemsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "itemsPerPage", itemsPerPage)); + } + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (type != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "type", type)); + } + if (authenticationID != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "authenticationID", authenticationID)); + } + if (sort != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "sort", sort)); + } + if (order != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "order", order)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/sources", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetSources", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a task. Get the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Task + public Task GetTask(string taskID) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = GetTaskWithHttpInfo(taskID); + return localVarResponse.Data; + } + + /// + /// Get a task. Get the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// ApiResponse of Task + public Algolia.Search.Ingestion.Client.ApiResponse GetTaskWithHttpInfo(string taskID) + { + // verify the required parameter 'taskID' is set + if (taskID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskID' when calling IngestionClient->GetTask"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("taskID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(taskID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/tasks/{taskID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTask", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a task. Get the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of Task + public async System.Threading.Tasks.Task GetTaskAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await GetTaskWithHttpInfoAsync(taskID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a task. Get the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Task) + public async System.Threading.Tasks.Task> GetTaskWithHttpInfoAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'taskID' is set + if (taskID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskID' when calling IngestionClient->GetTask"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("taskID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(taskID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/tasks/{taskID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTask", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a list of tasks. Get a list of tasks for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The action of the tasks to retrieve. (optional) + /// Whether the task is enabled or not. (optional) + /// The sourceIDs of the tasks to retrive. (optional) + /// The destinationIDs of the tasks to retrive. (optional) + /// The trigger type of the task. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// ListTasksResponse + public ListTasksResponse GetTasks(int? itemsPerPage = default(int?), int? page = default(int?), List action = default(List), bool? enabled = default(bool?), List sourceID = default(List), List destinationID = default(List), List triggerType = default(List), TaskSortKeys sort = default(TaskSortKeys), OrderKeys order = default(OrderKeys)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = GetTasksWithHttpInfo(itemsPerPage, page, action, enabled, sourceID, destinationID, triggerType, sort, order); + return localVarResponse.Data; + } + + /// + /// Get a list of tasks. Get a list of tasks for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The action of the tasks to retrieve. (optional) + /// Whether the task is enabled or not. (optional) + /// The sourceIDs of the tasks to retrive. (optional) + /// The destinationIDs of the tasks to retrive. (optional) + /// The trigger type of the task. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// ApiResponse of ListTasksResponse + public Algolia.Search.Ingestion.Client.ApiResponse GetTasksWithHttpInfo(int? itemsPerPage = default(int?), int? page = default(int?), List action = default(List), bool? enabled = default(bool?), List sourceID = default(List), List destinationID = default(List), List triggerType = default(List), TaskSortKeys sort = default(TaskSortKeys), OrderKeys order = default(OrderKeys)) + { + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (itemsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "itemsPerPage", itemsPerPage)); + } + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (action != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "action", action)); + } + if (enabled != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "enabled", enabled)); + } + if (sourceID != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "sourceID", sourceID)); + } + if (destinationID != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "destinationID", destinationID)); + } + if (triggerType != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "triggerType", triggerType)); + } + if (sort != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "sort", sort)); + } + if (order != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "order", order)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/tasks", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTasks", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a list of tasks. Get a list of tasks for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The action of the tasks to retrieve. (optional) + /// Whether the task is enabled or not. (optional) + /// The sourceIDs of the tasks to retrive. (optional) + /// The destinationIDs of the tasks to retrive. (optional) + /// The trigger type of the task. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// Cancellation Token to cancel the request. + /// Task of ListTasksResponse + public async System.Threading.Tasks.Task GetTasksAsync(int? itemsPerPage = default(int?), int? page = default(int?), List action = default(List), bool? enabled = default(bool?), List sourceID = default(List), List destinationID = default(List), List triggerType = default(List), TaskSortKeys sort = default(TaskSortKeys), OrderKeys order = default(OrderKeys), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await GetTasksWithHttpInfoAsync(itemsPerPage, page, action, enabled, sourceID, destinationID, triggerType, sort, order, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a list of tasks. Get a list of tasks for the given query parameters, with pagination details. + /// + /// Thrown when fails to make API call + /// The number of items per page to return. (optional) + /// The page number to fetch, starting at 1. (optional) + /// The action of the tasks to retrieve. (optional) + /// Whether the task is enabled or not. (optional) + /// The sourceIDs of the tasks to retrive. (optional) + /// The destinationIDs of the tasks to retrive. (optional) + /// The trigger type of the task. (optional) + /// The key by which the list should be sorted. (optional) + /// The order of the returned list. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListTasksResponse) + public async System.Threading.Tasks.Task> GetTasksWithHttpInfoAsync(int? itemsPerPage = default(int?), int? page = default(int?), List action = default(List), bool? enabled = default(bool?), List sourceID = default(List), List destinationID = default(List), List triggerType = default(List), TaskSortKeys sort = default(TaskSortKeys), OrderKeys order = default(OrderKeys), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (itemsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "itemsPerPage", itemsPerPage)); + } + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (action != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "action", action)); + } + if (enabled != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "enabled", enabled)); + } + if (sourceID != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "sourceID", sourceID)); + } + if (destinationID != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "destinationID", destinationID)); + } + if (triggerType != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("csv", "triggerType", triggerType)); + } + if (sort != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "sort", sort)); + } + if (order != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "order", order)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/tasks", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTasks", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Post(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = PostWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.Ingestion.Client.ApiResponse PostWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'path' when calling IngestionClient->Post"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await PostWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'path' when calling IngestionClient->Post"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Put(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = PutWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.Ingestion.Client.ApiResponse PutWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'path' when calling IngestionClient->Put"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await PutWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'path' when calling IngestionClient->Put"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Ingestion.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Run a task. Run the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// RunResponse + public RunResponse RunTask(string taskID) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = RunTaskWithHttpInfo(taskID); + return localVarResponse.Data; + } + + /// + /// Run a task. Run the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// ApiResponse of RunResponse + public Algolia.Search.Ingestion.Client.ApiResponse RunTaskWithHttpInfo(string taskID) + { + // verify the required parameter 'taskID' is set + if (taskID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskID' when calling IngestionClient->RunTask"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("taskID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(taskID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/tasks/{taskID}/run", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("RunTask", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Run a task. Run the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of RunResponse + public async System.Threading.Tasks.Task RunTaskAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await RunTaskWithHttpInfoAsync(taskID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Run a task. Run the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (RunResponse) + public async System.Threading.Tasks.Task> RunTaskWithHttpInfoAsync(string taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'taskID' is set + if (taskID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskID' when calling IngestionClient->RunTask"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("taskID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(taskID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/tasks/{taskID}/run", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("RunTask", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search among authentications. Search among authentications with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// List<Authentication> + public List SearchAuthentications(AuthenticationSearch authenticationSearch) + { + Algolia.Search.Ingestion.Client.ApiResponse> localVarResponse = SearchAuthenticationsWithHttpInfo(authenticationSearch); + return localVarResponse.Data; + } + + /// + /// Search among authentications. Search among authentications with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of List<Authentication> + public Algolia.Search.Ingestion.Client.ApiResponse> SearchAuthenticationsWithHttpInfo(AuthenticationSearch authenticationSearch) + { + // verify the required parameter 'authenticationSearch' is set + if (authenticationSearch == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'authenticationSearch' when calling IngestionClient->SearchAuthentications"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = authenticationSearch; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post>("/1/authentications/search", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchAuthentications", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search among authentications. Search among authentications with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of List<Authentication> + public async System.Threading.Tasks.Task> SearchAuthenticationsAsync(AuthenticationSearch authenticationSearch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse> localVarResponse = await SearchAuthenticationsWithHttpInfoAsync(authenticationSearch, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Search among authentications. Search among authentications with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Authentication>) + public async System.Threading.Tasks.Task>> SearchAuthenticationsWithHttpInfoAsync(AuthenticationSearch authenticationSearch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'authenticationSearch' is set + if (authenticationSearch == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'authenticationSearch' when calling IngestionClient->SearchAuthentications"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = authenticationSearch; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync>("/1/authentications/search", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchAuthentications", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search among destinations. Search among destinations with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// List<Destination> + public List SearchDestinations(DestinationSearch destinationSearch) + { + Algolia.Search.Ingestion.Client.ApiResponse> localVarResponse = SearchDestinationsWithHttpInfo(destinationSearch); + return localVarResponse.Data; + } + + /// + /// Search among destinations. Search among destinations with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of List<Destination> + public Algolia.Search.Ingestion.Client.ApiResponse> SearchDestinationsWithHttpInfo(DestinationSearch destinationSearch) + { + // verify the required parameter 'destinationSearch' is set + if (destinationSearch == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'destinationSearch' when calling IngestionClient->SearchDestinations"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = destinationSearch; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post>("/1/destinations/search", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchDestinations", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search among destinations. Search among destinations with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of List<Destination> + public async System.Threading.Tasks.Task> SearchDestinationsAsync(DestinationSearch destinationSearch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse> localVarResponse = await SearchDestinationsWithHttpInfoAsync(destinationSearch, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Search among destinations. Search among destinations with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Destination>) + public async System.Threading.Tasks.Task>> SearchDestinationsWithHttpInfoAsync(DestinationSearch destinationSearch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'destinationSearch' is set + if (destinationSearch == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'destinationSearch' when calling IngestionClient->SearchDestinations"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = destinationSearch; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync>("/1/destinations/search", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchDestinations", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search among sources. Search among sources with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// List<Source> + public List SearchSources(SourceSearch sourceSearch) + { + Algolia.Search.Ingestion.Client.ApiResponse> localVarResponse = SearchSourcesWithHttpInfo(sourceSearch); + return localVarResponse.Data; + } + + /// + /// Search among sources. Search among sources with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of List<Source> + public Algolia.Search.Ingestion.Client.ApiResponse> SearchSourcesWithHttpInfo(SourceSearch sourceSearch) + { + // verify the required parameter 'sourceSearch' is set + if (sourceSearch == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'sourceSearch' when calling IngestionClient->SearchSources"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = sourceSearch; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post>("/1/sources/search", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchSources", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search among sources. Search among sources with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of List<Source> + public async System.Threading.Tasks.Task> SearchSourcesAsync(SourceSearch sourceSearch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse> localVarResponse = await SearchSourcesWithHttpInfoAsync(sourceSearch, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Search among sources. Search among sources with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Source>) + public async System.Threading.Tasks.Task>> SearchSourcesWithHttpInfoAsync(SourceSearch sourceSearch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'sourceSearch' is set + if (sourceSearch == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'sourceSearch' when calling IngestionClient->SearchSources"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = sourceSearch; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync>("/1/sources/search", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchSources", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search among tasks. Search among tasks with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// List<Task> + public List SearchTasks(TaskSearch taskSearch) + { + Algolia.Search.Ingestion.Client.ApiResponse> localVarResponse = SearchTasksWithHttpInfo(taskSearch); + return localVarResponse.Data; + } + + /// + /// Search among tasks. Search among tasks with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of List<Task> + public Algolia.Search.Ingestion.Client.ApiResponse> SearchTasksWithHttpInfo(TaskSearch taskSearch) + { + // verify the required parameter 'taskSearch' is set + if (taskSearch == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskSearch' when calling IngestionClient->SearchTasks"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = taskSearch; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post>("/1/tasks/search", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchTasks", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search among tasks. Search among tasks with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of List<Task> + public async System.Threading.Tasks.Task> SearchTasksAsync(TaskSearch taskSearch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse> localVarResponse = await SearchTasksWithHttpInfoAsync(taskSearch, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Search among tasks. Search among tasks with a defined set of parameters. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Task>) + public async System.Threading.Tasks.Task>> SearchTasksWithHttpInfoAsync(TaskSearch taskSearch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'taskSearch' is set + if (taskSearch == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskSearch' when calling IngestionClient->SearchTasks"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = taskSearch; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync>("/1/tasks/search", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchTasks", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Trigger a stream listing request. Trigger a stream listing request for a Singer specification compatible docker type source. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// DockerSourceDiscover + public DockerSourceDiscover TriggerDockerSourceDiscover(string sourceID) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = TriggerDockerSourceDiscoverWithHttpInfo(sourceID); + return localVarResponse.Data; + } + + /// + /// Trigger a stream listing request. Trigger a stream listing request for a Singer specification compatible docker type source. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// ApiResponse of DockerSourceDiscover + public Algolia.Search.Ingestion.Client.ApiResponse TriggerDockerSourceDiscoverWithHttpInfo(string sourceID) + { + // verify the required parameter 'sourceID' is set + if (sourceID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'sourceID' when calling IngestionClient->TriggerDockerSourceDiscover"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("sourceID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(sourceID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/sources/{sourceID}/discover", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TriggerDockerSourceDiscover", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Trigger a stream listing request. Trigger a stream listing request for a Singer specification compatible docker type source. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Cancellation Token to cancel the request. + /// Task of DockerSourceDiscover + public async System.Threading.Tasks.Task TriggerDockerSourceDiscoverAsync(string sourceID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await TriggerDockerSourceDiscoverWithHttpInfoAsync(sourceID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Trigger a stream listing request. Trigger a stream listing request for a Singer specification compatible docker type source. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DockerSourceDiscover) + public async System.Threading.Tasks.Task> TriggerDockerSourceDiscoverWithHttpInfoAsync(string sourceID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'sourceID' is set + if (sourceID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'sourceID' when calling IngestionClient->TriggerDockerSourceDiscover"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("sourceID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(sourceID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/sources/{sourceID}/discover", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TriggerDockerSourceDiscover", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update a authentication. Update the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// + /// AuthenticationUpdateResponse + public AuthenticationUpdateResponse UpdateAuthentication(string authenticationID, AuthenticationUpdate authenticationUpdate) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = UpdateAuthenticationWithHttpInfo(authenticationID, authenticationUpdate); + return localVarResponse.Data; + } + + /// + /// Update a authentication. Update the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// + /// ApiResponse of AuthenticationUpdateResponse + public Algolia.Search.Ingestion.Client.ApiResponse UpdateAuthenticationWithHttpInfo(string authenticationID, AuthenticationUpdate authenticationUpdate) + { + // verify the required parameter 'authenticationID' is set + if (authenticationID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'authenticationID' when calling IngestionClient->UpdateAuthentication"); + + // verify the required parameter 'authenticationUpdate' is set + if (authenticationUpdate == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'authenticationUpdate' when calling IngestionClient->UpdateAuthentication"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("authenticationID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(authenticationID)); // path parameter + localVarRequestOptions.Data = authenticationUpdate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Patch("/1/authentications/{authenticationID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateAuthentication", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update a authentication. Update the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// + /// Cancellation Token to cancel the request. + /// Task of AuthenticationUpdateResponse + public async System.Threading.Tasks.Task UpdateAuthenticationAsync(string authenticationID, AuthenticationUpdate authenticationUpdate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await UpdateAuthenticationWithHttpInfoAsync(authenticationID, authenticationUpdate, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Update a authentication. Update the authentication of the given authenticationID. + /// + /// Thrown when fails to make API call + /// The authentication UUID. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (AuthenticationUpdateResponse) + public async System.Threading.Tasks.Task> UpdateAuthenticationWithHttpInfoAsync(string authenticationID, AuthenticationUpdate authenticationUpdate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'authenticationID' is set + if (authenticationID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'authenticationID' when calling IngestionClient->UpdateAuthentication"); + + // verify the required parameter 'authenticationUpdate' is set + if (authenticationUpdate == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'authenticationUpdate' when calling IngestionClient->UpdateAuthentication"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("authenticationID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(authenticationID)); // path parameter + localVarRequestOptions.Data = authenticationUpdate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PatchAsync("/1/authentications/{authenticationID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateAuthentication", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update a destination. Update the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// + /// DestinationUpdateResponse + public DestinationUpdateResponse UpdateDestination(string destinationID, DestinationUpdate destinationUpdate) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = UpdateDestinationWithHttpInfo(destinationID, destinationUpdate); + return localVarResponse.Data; + } + + /// + /// Update a destination. Update the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// + /// ApiResponse of DestinationUpdateResponse + public Algolia.Search.Ingestion.Client.ApiResponse UpdateDestinationWithHttpInfo(string destinationID, DestinationUpdate destinationUpdate) + { + // verify the required parameter 'destinationID' is set + if (destinationID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'destinationID' when calling IngestionClient->UpdateDestination"); + + // verify the required parameter 'destinationUpdate' is set + if (destinationUpdate == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'destinationUpdate' when calling IngestionClient->UpdateDestination"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("destinationID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(destinationID)); // path parameter + localVarRequestOptions.Data = destinationUpdate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Patch("/1/destinations/{destinationID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateDestination", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update a destination. Update the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// + /// Cancellation Token to cancel the request. + /// Task of DestinationUpdateResponse + public async System.Threading.Tasks.Task UpdateDestinationAsync(string destinationID, DestinationUpdate destinationUpdate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await UpdateDestinationWithHttpInfoAsync(destinationID, destinationUpdate, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Update a destination. Update the destination of the given destinationID. + /// + /// Thrown when fails to make API call + /// The destination UUID. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DestinationUpdateResponse) + public async System.Threading.Tasks.Task> UpdateDestinationWithHttpInfoAsync(string destinationID, DestinationUpdate destinationUpdate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'destinationID' is set + if (destinationID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'destinationID' when calling IngestionClient->UpdateDestination"); + + // verify the required parameter 'destinationUpdate' is set + if (destinationUpdate == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'destinationUpdate' when calling IngestionClient->UpdateDestination"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("destinationID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(destinationID)); // path parameter + localVarRequestOptions.Data = destinationUpdate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PatchAsync("/1/destinations/{destinationID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateDestination", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update a source. Update the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// + /// SourceUpdateResponse + public SourceUpdateResponse UpdateSource(string sourceID, SourceUpdate sourceUpdate) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = UpdateSourceWithHttpInfo(sourceID, sourceUpdate); + return localVarResponse.Data; + } + + /// + /// Update a source. Update the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// + /// ApiResponse of SourceUpdateResponse + public Algolia.Search.Ingestion.Client.ApiResponse UpdateSourceWithHttpInfo(string sourceID, SourceUpdate sourceUpdate) + { + // verify the required parameter 'sourceID' is set + if (sourceID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'sourceID' when calling IngestionClient->UpdateSource"); + + // verify the required parameter 'sourceUpdate' is set + if (sourceUpdate == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'sourceUpdate' when calling IngestionClient->UpdateSource"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("sourceID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(sourceID)); // path parameter + localVarRequestOptions.Data = sourceUpdate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Patch("/1/sources/{sourceID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateSource", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update a source. Update the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// + /// Cancellation Token to cancel the request. + /// Task of SourceUpdateResponse + public async System.Threading.Tasks.Task UpdateSourceAsync(string sourceID, SourceUpdate sourceUpdate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await UpdateSourceWithHttpInfoAsync(sourceID, sourceUpdate, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Update a source. Update the source of the given sourceID. + /// + /// Thrown when fails to make API call + /// The source UUID. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SourceUpdateResponse) + public async System.Threading.Tasks.Task> UpdateSourceWithHttpInfoAsync(string sourceID, SourceUpdate sourceUpdate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'sourceID' is set + if (sourceID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'sourceID' when calling IngestionClient->UpdateSource"); + + // verify the required parameter 'sourceUpdate' is set + if (sourceUpdate == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'sourceUpdate' when calling IngestionClient->UpdateSource"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("sourceID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(sourceID)); // path parameter + localVarRequestOptions.Data = sourceUpdate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PatchAsync("/1/sources/{sourceID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateSource", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update a task. Update the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// + /// TaskUpdateResponse + public TaskUpdateResponse UpdateTask(string taskID, TaskUpdate taskUpdate) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = UpdateTaskWithHttpInfo(taskID, taskUpdate); + return localVarResponse.Data; + } + + /// + /// Update a task. Update the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// + /// ApiResponse of TaskUpdateResponse + public Algolia.Search.Ingestion.Client.ApiResponse UpdateTaskWithHttpInfo(string taskID, TaskUpdate taskUpdate) + { + // verify the required parameter 'taskID' is set + if (taskID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskID' when calling IngestionClient->UpdateTask"); + + // verify the required parameter 'taskUpdate' is set + if (taskUpdate == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskUpdate' when calling IngestionClient->UpdateTask"); + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("taskID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(taskID)); // path parameter + localVarRequestOptions.Data = taskUpdate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Patch("/1/tasks/{taskID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateTask", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update a task. Update the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// + /// Cancellation Token to cancel the request. + /// Task of TaskUpdateResponse + public async System.Threading.Tasks.Task UpdateTaskAsync(string taskID, TaskUpdate taskUpdate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Ingestion.Client.ApiResponse localVarResponse = await UpdateTaskWithHttpInfoAsync(taskID, taskUpdate, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Update a task. Update the task of the given taskID. + /// + /// Thrown when fails to make API call + /// The task UUID. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (TaskUpdateResponse) + public async System.Threading.Tasks.Task> UpdateTaskWithHttpInfoAsync(string taskID, TaskUpdate taskUpdate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'taskID' is set + if (taskID == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskID' when calling IngestionClient->UpdateTask"); + + // verify the required parameter 'taskUpdate' is set + if (taskUpdate == null) + throw new Algolia.Search.Ingestion.Client.ApiException(400, "Missing required parameter 'taskUpdate' when calling IngestionClient->UpdateTask"); + + + Algolia.Search.Ingestion.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Ingestion.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Ingestion.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("taskID", Algolia.Search.Ingestion.Client.ClientUtils.ParameterToString(taskID)); // path parameter + localVarRequestOptions.Data = taskUpdate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PatchAsync("/1/tasks/{taskID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateTask", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + } +} diff --git a/algoliasearch/Ingestion/Client/ApiClient.cs b/algoliasearch/Ingestion/Client/ApiClient.cs new file mode 100644 index 000000000..b1040fb5e --- /dev/null +++ b/algoliasearch/Ingestion/Client/ApiClient.cs @@ -0,0 +1,736 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs; +using System.Net.Http; +using System.Net.Http.Headers; + +namespace Algolia.Search.Ingestion.Client +{ + /// + /// To Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec + { + private readonly IReadableConfiguration _configuration; + private static readonly string _contentType = "application/json"; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is Algolia.Search.Ingestion.Models.AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((Algolia.Search.Ingestion.Models.AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public async Task Deserialize(HttpResponseMessage response) + { + var result = (T)await Deserialize(response, typeof(T)).ConfigureAwait(false); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal async Task Deserialize(HttpResponseMessage response, Type type) + { + IList headers = response.Headers.Select(x => x.Key + "=" + x.Value).ToList(); + + if (type == typeof(byte[])) // return byte array + { + return await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + } + else if (type == typeof(FileParameter)) + { + return new FileParameter(await response.Content.ReadAsStreamAsync().ConfigureAwait(false)); + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + if (headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + File.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(await response.Content.ReadAsStringAsync().ConfigureAwait(false), null, System.Globalization.DateTimeStyles.RoundtripKind); + } + + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public string RootElement { get; set; } + public string Namespace { get; set; } + public string DateFormat { get; set; } + + public string ContentType + { + get { return _contentType; } + set { throw new InvalidOperationException("Not allowed to set content type."); } + } + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + /// + /// The Dispose method will manage the HttpClient lifecycle when not passed by constructor. + /// + public partial class ApiClient : IDisposable, ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + + private readonly HttpClientHandler _httpClientHandler; + private readonly HttpClient _httpClient; + private readonly bool _disposeClient; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + public ApiClient() : + this(Algolia.Search.Ingestion.Client.GlobalConfiguration.Instance.BasePath) + { + } + + /// + /// Initializes a new instance of the . + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = new HttpClientHandler(); + _httpClient = new HttpClient(_httpClientHandler, true); + _disposeClient = true; + _baseUrl = basePath; + } + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, HttpClientHandler handler = null) : + this(client, Algolia.Search.Ingestion.Client.GlobalConfiguration.Instance.BasePath, handler) + { + } + + /// + /// Initializes a new instance of the . + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client cannot be null"); + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = handler; + _httpClient = client; + _baseUrl = basePath; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + if (_disposeClient) + { + _httpClient.Dispose(); + } + } + + /// Prepares multipart/form-data content + HttpContent PrepareMultipartFormDataContent(RequestOptions options) + { + string boundary = "---------" + Guid.NewGuid().ToString().ToUpperInvariant(); + var multipartContent = new MultipartFormDataContent(boundary); + foreach (var formParameter in options.FormParameters) + { + multipartContent.Add(new StringContent(formParameter.Value), formParameter.Key); + } + + if (options.FileParameters != null && options.FileParameters.Count > 0) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var content = new StreamContent(file.Content); + content.Headers.ContentType = new MediaTypeHeaderValue(file.ContentType); + multipartContent.Add(content, fileParam.Key, file.Name); + } + } + } + return multipartContent; + } + + /// + /// Provides all logic for constructing a new HttpRequestMessage. + /// At this point, all information for querying the service is known. Here, it is simply + /// mapped into the a HttpRequestMessage. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// [private] A new HttpRequestMessage instance. + /// + private HttpRequestMessage NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + WebRequestPathBuilder builder = new WebRequestPathBuilder(_baseUrl, path); + + builder.AddPathParameters(options.PathParameters); + + builder.AddQueryParameters(options.QueryParameters); + + HttpRequestMessage request = new HttpRequestMessage(method, builder.GetFullUri()); + + if (configuration.UserAgent != null) + { + request.Headers.TryAddWithoutValidation("User-Agent", configuration.UserAgent); + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.Headers.Add(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + // Todo make content headers actually content headers + request.Headers.TryAddWithoutValidation(headerParam.Key, value); + } + } + } + + List> contentList = new List>(); + + string contentType = null; + if (options.HeaderParameters != null && options.HeaderParameters.ContainsKey("Content-Type")) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes.FirstOrDefault(); + } + + if (contentType == "multipart/form-data") + { + request.Content = PrepareMultipartFormDataContent(options); + } + else if (contentType == "application/x-www-form-urlencoded") + { + request.Content = new FormUrlEncodedContent(options.FormParameters); + } + else + { + if (options.Data != null) + { + if (options.Data is FileParameter fp) + { + contentType = contentType ?? "application/octet-stream"; + + var streamContent = new StreamContent(fp.Content); + streamContent.Headers.ContentType = new MediaTypeHeaderValue(contentType); + request.Content = streamContent; + } + else + { + var serializer = new CustomJsonCodec(SerializerSettings, configuration); + request.Content = new StringContent(serializer.Serialize(options.Data), new UTF8Encoding(), + "application/json"); + } + } + } + + + + // TODO provide an alternative that allows cookies per request instead of per API client + if (options.Cookies != null && options.Cookies.Count > 0) + { + request.Properties["CookieContainer"] = options.Cookies; + } + + return request; + } + + partial void InterceptRequest(HttpRequestMessage req); + partial void InterceptResponse(HttpRequestMessage req, HttpResponseMessage response); + + private async Task> ToApiResponse(HttpResponseMessage response, object responseData, Uri uri) + { + T result = (T)responseData; + string rawContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ReasonPhrase, + Cookies = new List() + }; + + // process response headers, e.g. Access-Control-Allow-Methods + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + // process response content headers, e.g. Content-Type + if (response.Content.Headers != null) + { + foreach (var responseHeader in response.Content.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (_httpClientHandler != null && response != null) + { + try + { + foreach (Cookie cookie in _httpClientHandler.CookieContainer.GetCookies(uri)) + { + transformed.Cookies.Add(cookie); + } + } + catch (PlatformNotSupportedException) { } + } + + return transformed; + } + + private ApiResponse Exec(HttpRequestMessage req, IReadableConfiguration configuration) + { + return ExecAsync(req, configuration).GetAwaiter().GetResult(); + } + + private async Task> ExecAsync(HttpRequestMessage req, + IReadableConfiguration configuration, + System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + CancellationTokenSource timeoutTokenSource = null; + CancellationTokenSource finalTokenSource = null; + var deserializer = new CustomJsonCodec(SerializerSettings, configuration); + var finalToken = cancellationToken; + + try + { + if (configuration.Timeout > 0) + { + timeoutTokenSource = new CancellationTokenSource(configuration.Timeout); + finalTokenSource = CancellationTokenSource.CreateLinkedTokenSource(finalToken, timeoutTokenSource.Token); + finalToken = finalTokenSource.Token; + } + + if (configuration.Proxy != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Configuration `Proxy` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + _httpClientHandler.Proxy = configuration.Proxy; + } + + var cookieContainer = req.Properties.ContainsKey("CookieContainer") ? req.Properties["CookieContainer"] as List : null; + + if (cookieContainer != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Request property `CookieContainer` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + foreach (var cookie in cookieContainer) + { + _httpClientHandler.CookieContainer.Add(cookie); + } + } + + InterceptRequest(req); + + HttpResponseMessage response; + response = await _httpClient.SendAsync(req, finalToken).ConfigureAwait(false); + + if (!response.IsSuccessStatusCode) + { + return await ToApiResponse(response, default(T), req.RequestUri).ConfigureAwait(false); + } + + object responseData = await deserializer.Deserialize(response).ConfigureAwait(false); + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(Algolia.Search.Ingestion.Models.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + responseData = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + else if (typeof(T).Name == "Stream") // for binary response + { + responseData = (T)(object)await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + } + + InterceptResponse(req, response); + + return await ToApiResponse(response, responseData, req.RequestUri).ConfigureAwait(false); + } + catch (OperationCanceledException original) + { + if (timeoutTokenSource != null && timeoutTokenSource.IsCancellationRequested) + { + throw new TaskCanceledException($"[{req.Method}] {req.RequestUri} was timeout.", + new TimeoutException(original.Message, original)); + } + throw; + } + finally + { + if (timeoutTokenSource != null) + { + timeoutTokenSource.Dispose(); + } + + if (finalTokenSource != null) + { + finalTokenSource.Dispose(); + } + } + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(new HttpMethod("PATCH"), path, options, config), config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(new HttpMethod("PATCH"), path, options, config), config); + } + #endregion ISynchronousClient + } +} diff --git a/algoliasearch/Ingestion/Client/ApiException.cs b/algoliasearch/Ingestion/Client/ApiException.cs new file mode 100644 index 000000000..420ce9f29 --- /dev/null +++ b/algoliasearch/Ingestion/Client/ApiException.cs @@ -0,0 +1,62 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.Ingestion.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// Gets or sets the error code (HTTP status code) + /// + /// The error code (HTTP status code). + public int ErrorCode { get; set; } + + /// + /// Gets or sets the error content (body json object) + /// + /// The error content (Http response body). + public object ErrorContent { get; private set; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public ApiException() { } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + public ApiException(int errorCode, string message) : base(message) + { + this.ErrorCode = errorCode; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + /// Error content. + /// HTTP Headers. + public ApiException(int errorCode, string message, object errorContent = null, Multimap headers = null) : base(message) + { + this.ErrorCode = errorCode; + this.ErrorContent = errorContent; + this.Headers = headers; + } + } + +} diff --git a/algoliasearch/Ingestion/Client/ApiResponse.cs b/algoliasearch/Ingestion/Client/ApiResponse.cs new file mode 100644 index 000000000..136c1b04b --- /dev/null +++ b/algoliasearch/Ingestion/Client/ApiResponse.cs @@ -0,0 +1,160 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; + +namespace Algolia.Search.Ingestion.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public interface IApiResponse + { + /// + /// The data type of + /// + Type ResponseType { get; } + + /// + /// The content of this response + /// + Object Content { get; } + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + Multimap Headers { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + List Cookies { get; set; } + + /// + /// The raw content of this response + /// + string RawContent { get; } + } + + /// + /// API Response + /// + public class ApiResponse : IApiResponse + { + #region Properties + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; } + + /// + /// Gets or sets the data (parsed HTTP body) + /// + /// The data. + public T Data { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + public string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + public List Cookies { get; set; } + + /// + /// The content of this response + /// + public Type ResponseType + { + get { return typeof(T); } + } + + /// + /// The data type of + /// + public object Content + { + get { return Data; } + } + + /// + /// The raw content + /// + public string RawContent { get; } + + #endregion Properties + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data, string rawContent) + { + StatusCode = statusCode; + Headers = headers; + Data = data; + RawContent = rawContent; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) : this(statusCode, headers, data, null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null) + { + } + + #endregion Constructors + } +} diff --git a/algoliasearch/Ingestion/Client/ClientUtils.cs b/algoliasearch/Ingestion/Client/ClientUtils.cs new file mode 100644 index 000000000..6667c6540 --- /dev/null +++ b/algoliasearch/Ingestion/Client/ClientUtils.cs @@ -0,0 +1,244 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; + +namespace Algolia.Search.Ingestion.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// Convert params to key/value pairs. + /// Use collectionFormat to properly format lists and collections. + /// + /// The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi + /// Key name. + /// Value object. + /// A multimap of keys with 1..n associated values. + public static Multimap ParameterToMultiMap(string collectionFormat, string name, object value) + { + var parameters = new Multimap(); + + if (value is ICollection collection && collectionFormat == "multi") + { + foreach (var item in collection) + { + parameters.Add(name, ParameterToString(item)); + } + } + else if (value is IDictionary dictionary) + { + if (collectionFormat == "deepObject") + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value)); + } + } + else + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value)); + } + } + } + else + { + parameters.Add(name, ParameterToString(value)); + } + + return parameters; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// An optional configuration instance, providing formatting options used in processing. + /// Formatted string. + public static string ParameterToString(object obj, IReadableConfiguration configuration = null) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is bool boolean) + return boolean ? "true" : "false"; + if (obj is ICollection collection) + { + List entries = new List(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry, configuration)); + return string.Join(",", entries); + } + if (obj is Enum && HasEnumMemberAttrValue(obj)) + return GetEnumMemberAttrValue(obj); + + return Convert.ToString(obj, CultureInfo.InvariantCulture); + } + + /// + /// Serializes the given object when not null. Otherwise return null. + /// + /// The object to serialize. + /// Serialized string. + public static string Serialize(object obj) + { + return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null; + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Is the Enum decorated with EnumMember Attribute + /// + /// + /// true if found + private static bool HasEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) return true; + return false; + } + + /// + /// Get the EnumMember value + /// + /// + /// EnumMember value as string otherwise null + private static string GetEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) + { + return attr.Value; + } + return null; + } + } +} diff --git a/algoliasearch/Ingestion/Client/Configuration.cs b/algoliasearch/Ingestion/Client/Configuration.cs new file mode 100644 index 000000000..992273adf --- /dev/null +++ b/algoliasearch/Ingestion/Client/Configuration.cs @@ -0,0 +1,587 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Net.Http; +using System.Net.Security; + +namespace Algolia.Search.Ingestion.Client +{ + /// + /// Represents a set of configuration settings + /// + public class Configuration : IReadableConfiguration + { + #region Constants + + /// + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.RawContent), + response.RawContent, response.Headers); + } + return null; + }; + + #endregion Static Members + + #region Private Members + + /// + /// Defines the base path of the target API server. + /// Example: http://localhost:3000/v1/ + /// + private string _basePath; + + private bool _useDefaultCredentials = false; + + /// + /// Gets or sets the API key based on the authentication name. + /// This is the key and value comprising the "secret" for accessing an API. + /// + /// The API key. + private IDictionary _apiKey; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + /// + /// Gets or sets the servers defined in the OpenAPI spec. + /// + /// The servers + private IList> _servers; + + /// + /// Gets or sets the operation servers defined in the OpenAPI spec. + /// + /// The operation servers + private IReadOnlyDictionary>> _operationServers; + + #endregion Private Members + + #region Constructors + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration() + { + Proxy = null; + UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + BasePath = "https://data.us.algolia.com"; + DefaultHeaders = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + Servers = new List>() + { + { + new Dictionary { + {"url", "https://data.{region}.algolia.com"}, + {"description", "No description provided"}, + { + "variables", new Dictionary { + { + "region", new Dictionary { + {"description", "No description provided"}, + {"default_value", "us"}, + { + "enum_values", new List() { + "eu", + "us" + } + } + } + } + } + } + } + } + }; + OperationServers = new Dictionary>>() + { + }; + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration( + IDictionary defaultHeaders, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "https://data.us.algolia.com") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeaders == null) + throw new ArgumentNullException("defaultHeaders"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeaders) + { + DefaultHeaders.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + #endregion Constructors + + #region Properties + + /// + /// Gets or sets the base path for API access. + /// + public virtual string BasePath + { + get { return _basePath; } + set { _basePath = value; } + } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + public virtual bool UseDefaultCredentials + { + get { return _useDefaultCredentials; } + set { _useDefaultCredentials = value; } + } + + /// + /// Gets or sets the default header. + /// + [Obsolete("Use DefaultHeaders instead.")] + public virtual IDictionary DefaultHeader + { + get + { + return DefaultHeaders; + } + set + { + DefaultHeaders = value; + } + } + + /// + /// Gets or sets the default headers. + /// + public virtual IDictionary DefaultHeaders { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { get; set; } + + /// + /// Gets or sets the proxy + /// + /// Proxy. + public virtual WebProxy Proxy { get; set; } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix(string apiKeyIdentifier) + { + string apiKeyValue; + ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue); + string apiKeyPrefix; + if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) + { + return apiKeyPrefix + " " + apiKeyValue; + } + + return apiKeyValue; + } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } + + set + { + if (string.IsNullOrEmpty(value)) + { + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } + } + } + + /// + /// Gets or sets the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// Whatever you set here will be prepended to the value defined in AddApiKey. + /// + /// An example invocation here might be: + /// + /// ApiKeyPrefix["Authorization"] = "Bearer"; + /// + /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// + /// + /// OAuth2 workflows should set tokens via AccessToken. + /// + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + /// + /// Gets or sets the servers. + /// + /// The servers. + public virtual IList> Servers + { + get { return _servers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Servers may not be null."); + } + _servers = value; + } + } + + /// + /// Gets or sets the operation servers. + /// + /// The operation servers. + public virtual IReadOnlyDictionary>> OperationServers + { + get { return _operationServers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Operation servers may not be null."); + } + _operationServers = value; + } + } + + /// + /// Returns URL based on server settings without providing values + /// for the variables + /// + /// Array index of the server settings. + /// The server URL. + public string GetServerUrl(int index) + { + return GetServerUrl(Servers, index, null); + } + + /// + /// Returns URL based on server settings. + /// + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + public string GetServerUrl(int index, Dictionary inputVariables) + { + return GetServerUrl(Servers, index, inputVariables); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index) + { + return GetOperationServerUrl(operation, index, null); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables) + { + if (operation != null && OperationServers.TryGetValue(operation, out var operationServer)) + { + return GetServerUrl(operationServer, index, inputVariables); + } + + return null; + } + + /// + /// Returns URL based on server settings. + /// + /// Dictionary of server settings. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + private string GetServerUrl(IList> servers, int index, Dictionary inputVariables) + { + if (index < 0 || index >= servers.Count) + { + throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}."); + } + + if (inputVariables == null) + { + inputVariables = new Dictionary(); + } + + IReadOnlyDictionary server = servers[index]; + string url = (string)server["url"]; + + if (server.ContainsKey("variables")) + { + // go through each variable and assign a value + foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"]) + { + + IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value); + + if (inputVariables.ContainsKey(variable.Key)) + { + if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + { + url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); + } + else + { + throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}"); + } + } + else + { + // use default value + url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]); + } + } + } + + return url; + } + + /// + /// Gets and Sets the RemoteCertificateValidationCallback + /// + public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; } + + #endregion Properties + + #region Methods + + /// + /// Returns a string with essential information for debugging. + /// + public static string ToDebugReport() + { + string report = "C# SDK (Algolia.Search.Ingestion) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: 1.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; + } + + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey(string key, string value) + { + ApiKey[key] = value; + } + + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix(string key, string value) + { + ApiKeyPrefix[key] = value; + } + + #endregion Methods + + #region Static Members + /// + /// Merge configurations. + /// + /// First configuration. + /// Second configuration. + /// Merged configuration. + public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) + { + if (second == null) return first ?? GlobalConfiguration.Instance; + + Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; + foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; + foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value; + + var config = new Configuration + { + ApiKey = apiKey, + ApiKeyPrefix = apiKeyPrefix, + DefaultHeaders = defaultHeaders, + BasePath = second.BasePath ?? first.BasePath, + Timeout = second.Timeout, + Proxy = second.Proxy ?? first.Proxy, + UserAgent = second.UserAgent ?? first.UserAgent, + TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, + DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat, + UseDefaultCredentials = second.UseDefaultCredentials, + RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback, + }; + return config; + } + #endregion Static Members + } +} diff --git a/algoliasearch/Ingestion/Client/ExceptionFactory.cs b/algoliasearch/Ingestion/Client/ExceptionFactory.cs new file mode 100644 index 000000000..0d5c63b42 --- /dev/null +++ b/algoliasearch/Ingestion/Client/ExceptionFactory.cs @@ -0,0 +1,16 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.Ingestion.Client +{ + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions + public delegate Exception ExceptionFactory(string methodName, IApiResponse response); +} diff --git a/algoliasearch/Ingestion/Client/FileParameter.cs b/algoliasearch/Ingestion/Client/FileParameter.cs new file mode 100644 index 000000000..c4e4611d0 --- /dev/null +++ b/algoliasearch/Ingestion/Client/FileParameter.cs @@ -0,0 +1,74 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.IO; + +namespace Algolia.Search.Ingestion.Client +{ + + /// + /// Represents a File passed to the API as a Parameter, allows using different backends for files + /// + public class FileParameter + { + /// + /// The filename + /// + public string Name { get; set; } = "no_name_provided"; + + /// + /// The content type of the file + /// + public string ContentType { get; set; } = "application/octet-stream"; + + /// + /// The content of the file + /// + public Stream Content { get; set; } + + /// + /// Construct a FileParameter just from the contents, will extract the filename from a filestream + /// + /// The file content + public FileParameter(Stream content) + { + if (content is FileStream fs) + { + Name = fs.Name; + } + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The file content + public FileParameter(string filename, Stream content) + { + Name = filename; + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The content type of the file + /// The file content + public FileParameter(string filename, string contentType, Stream content) + { + Name = filename; + ContentType = contentType; + Content = content; + } + + /// + /// Implicit conversion of stream to file parameter. Useful for backwards compatibility. + /// + /// Stream to convert + /// FileParameter + public static implicit operator FileParameter(Stream s) => new FileParameter(s); + } +} diff --git a/algoliasearch/Ingestion/Client/GlobalConfiguration.cs b/algoliasearch/Ingestion/Client/GlobalConfiguration.cs new file mode 100644 index 000000000..6a3a5b614 --- /dev/null +++ b/algoliasearch/Ingestion/Client/GlobalConfiguration.cs @@ -0,0 +1,61 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.Collections.Generic; + +namespace Algolia.Search.Ingestion.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .openapi-generator-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + #region Private Members + + private static readonly object GlobalConfigSync = new { }; + private static IReadableConfiguration _globalConfiguration; + + #endregion Private Members + + #region Constructors + + /// + private GlobalConfiguration() + { + } + + /// + public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath) + { + } + + static GlobalConfiguration() + { + Instance = new GlobalConfiguration(); + } + + #endregion Constructors + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static IReadableConfiguration Instance + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + } +} diff --git a/algoliasearch/Ingestion/Client/IAsynchronousClient.cs b/algoliasearch/Ingestion/Client/IAsynchronousClient.cs new file mode 100644 index 000000000..8e036d455 --- /dev/null +++ b/algoliasearch/Ingestion/Client/IAsynchronousClient.cs @@ -0,0 +1,94 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Threading.Tasks; + +namespace Algolia.Search.Ingestion.Client +{ + /// + /// Contract for Asynchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface IAsynchronousClient + { + /// + /// Executes a non-blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } +} diff --git a/algoliasearch/Ingestion/Client/IReadableConfiguration.cs b/algoliasearch/Ingestion/Client/IReadableConfiguration.cs new file mode 100644 index 000000000..13674ac49 --- /dev/null +++ b/algoliasearch/Ingestion/Client/IReadableConfiguration.cs @@ -0,0 +1,111 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; + +namespace Algolia.Search.Ingestion.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + /// + /// Gets the API key. + /// + /// API key. + IDictionary ApiKey { get; } + + /// + /// Gets the API key prefix. + /// + /// API key prefix. + IDictionary ApiKeyPrefix { get; } + + /// + /// Gets the base path. + /// + /// Base path. + string BasePath { get; } + + /// + /// Gets the date time format. + /// + /// Date time format. + string DateTimeFormat { get; } + + /// + /// Gets the default header. + /// + /// Default header. + [Obsolete("Use DefaultHeaders instead.")] + IDictionary DefaultHeader { get; } + + /// + /// Gets the default headers. + /// + /// Default headers. + IDictionary DefaultHeaders { get; } + + /// + /// Gets the temp folder path. + /// + /// Temp folder path. + string TempFolderPath { get; } + + /// + /// Gets the HTTP connection timeout (in milliseconds) + /// + /// HTTP connection timeout. + int Timeout { get; } + + /// + /// Gets the proxy. + /// + /// Proxy. + WebProxy Proxy { get; } + + /// + /// Gets the user agent. + /// + /// User agent. + string UserAgent { get; } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + bool UseDefaultCredentials { get; } + + /// + /// Get the servers associated with the operation. + /// + /// Operation servers. + IReadOnlyDictionary>> OperationServers { get; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + string GetApiKeyWithPrefix(string apiKeyIdentifier); + + /// + /// Gets the Operation server url at the provided index. + /// + /// Operation server name. + /// Index of the operation server settings. + /// + string GetOperationServerUrl(string operation, int index); + + /// + /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and + /// overriding certificate errors in the scope of a request. + /// + RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; } + } +} diff --git a/algoliasearch/Ingestion/Client/ISynchronousClient.cs b/algoliasearch/Ingestion/Client/ISynchronousClient.cs new file mode 100644 index 000000000..927223733 --- /dev/null +++ b/algoliasearch/Ingestion/Client/ISynchronousClient.cs @@ -0,0 +1,87 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.IO; + +namespace Algolia.Search.Ingestion.Client +{ + /// + /// Contract for Synchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface ISynchronousClient + { + /// + /// Executes a blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null); + } +} diff --git a/algoliasearch/Ingestion/Client/Multimap.cs b/algoliasearch/Ingestion/Client/Multimap.cs new file mode 100644 index 000000000..c7c8e8951 --- /dev/null +++ b/algoliasearch/Ingestion/Client/Multimap.cs @@ -0,0 +1,289 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Algolia.Search.Ingestion.Client +{ + /// + /// A dictionary in which one key has many associated values. + /// + /// The type of the key + /// The type of the value associated with the key. + public class Multimap : IDictionary> + { + #region Private Fields + + private readonly Dictionary> _dictionary; + + #endregion Private Fields + + #region Constructors + + /// + /// Empty Constructor. + /// + public Multimap() + { + _dictionary = new Dictionary>(); + } + + /// + /// Constructor with comparer. + /// + /// + public Multimap(IEqualityComparer comparer) + { + _dictionary = new Dictionary>(comparer); + } + + #endregion Constructors + + #region Enumerators + + /// + /// To get the enumerator. + /// + /// Enumerator + public IEnumerator>> GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + /// + /// To get the enumerator. + /// + /// Enumerator + IEnumerator IEnumerable.GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + #endregion Enumerators + + #region Public Members + /// + /// Add values to Multimap + /// + /// Key value pair + public void Add(KeyValuePair> item) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + + /// + /// Add Multimap to Multimap + /// + /// Multimap + public void Add(Multimap multimap) + { + foreach (var item in multimap) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + + /// + /// Clear Multimap + /// + public void Clear() + { + _dictionary.Clear(); + } + + /// + /// Determines whether Multimap contains the specified item. + /// + /// Key value pair + /// Method needs to be implemented + /// true if the Multimap contains the item; otherwise, false. + public bool Contains(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Copy items of the Multimap to an array, + /// starting at a particular array index. + /// + /// The array that is the destination of the items copied + /// from Multimap. The array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + /// Method needs to be implemented + public void CopyTo(KeyValuePair>[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + /// + /// Removes the specified item from the Multimap. + /// + /// Key value pair + /// true if the item is successfully removed; otherwise, false. + /// Method needs to be implemented + public bool Remove(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Gets the number of items contained in the Multimap. + /// + public int Count => _dictionary.Count; + + /// + /// Gets a value indicating whether the Multimap is read-only. + /// + public bool IsReadOnly => false; + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add the value to Multimap. + public void Add(TKey key, IList value) + { + if (value != null && value.Count > 0) + { + if (_dictionary.TryGetValue(key, out var list)) + { + foreach (var k in value) list.Add(k); + } + else + { + list = new List(value); + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + } + + /// + /// Determines whether the Multimap contains an item with the specified key. + /// + /// The key to locate in the Multimap. + /// true if the Multimap contains an item with + /// the key; otherwise, false. + public bool ContainsKey(TKey key) + { + return _dictionary.ContainsKey(key); + } + + /// + /// Removes item with the specified key from the Multimap. + /// + /// The key to locate in the Multimap. + /// true if the item is successfully removed; otherwise, false. + public bool Remove(TKey key) + { + return TryRemove(key, out var _); + } + + /// + /// Gets the value associated with the specified key. + /// + /// The key whose value to get. + /// When this method returns, the value associated with the specified key, if the + /// key is found; otherwise, the default value for the type of the value parameter. + /// This parameter is passed uninitialized. + /// true if the object that implements Multimap contains + /// an item with the specified key; otherwise, false. + public bool TryGetValue(TKey key, out IList value) + { + return _dictionary.TryGetValue(key, out value); + } + + /// + /// Gets or sets the item with the specified key. + /// + /// The key of the item to get or set. + /// The value of the specified key. + public IList this[TKey key] + { + get => _dictionary[key]; + set => _dictionary[key] = value; + } + + /// + /// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap. + /// + public ICollection Keys => _dictionary.Keys; + + /// + /// Gets a System.Collections.Generic.ICollection containing the values of the Multimap. + /// + public ICollection> Values => _dictionary.Values; + + /// + /// Copy the items of the Multimap to an System.Array, + /// starting at a particular System.Array index. + /// + /// The one-dimensional System.Array that is the destination of the items copied + /// from Multimap. The System.Array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + public void CopyTo(Array array, int index) + { + ((ICollection)_dictionary).CopyTo(array, index); + } + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add value to Multimap. + public void Add(TKey key, TValue value) + { + if (value != null) + { + if (_dictionary.TryGetValue(key, out var list)) + { + list.Add(value); + } + else + { + list = new List { value }; + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add value to Multimap."); + } + } + } + + #endregion Public Members + + #region Private Members + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryRemove(TKey key, out IList value) + { + _dictionary.TryGetValue(key, out value); + return _dictionary.Remove(key); + } + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryAdd(TKey key, IList value) + { + try + { + _dictionary.Add(key, value); + } + catch (ArgumentException) + { + return false; + } + + return true; + } + #endregion Private Members + } +} diff --git a/algoliasearch/Ingestion/Client/OpenAPIDateConverter.cs b/algoliasearch/Ingestion/Client/OpenAPIDateConverter.cs new file mode 100644 index 000000000..526a6f98e --- /dev/null +++ b/algoliasearch/Ingestion/Client/OpenAPIDateConverter.cs @@ -0,0 +1,23 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using Newtonsoft.Json.Converters; + +namespace Algolia.Search.Ingestion.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class OpenAPIDateConverter : IsoDateTimeConverter + { + /// + /// Initializes a new instance of the class. + /// + public OpenAPIDateConverter() + { + // full-date = date-fullyear "-" date-month "-" date-mday + DateTimeFormat = "yyyy-MM-dd"; + } + } +} diff --git a/algoliasearch/Ingestion/Client/RequestOptions.cs b/algoliasearch/Ingestion/Client/RequestOptions.cs new file mode 100644 index 000000000..d28367503 --- /dev/null +++ b/algoliasearch/Ingestion/Client/RequestOptions.cs @@ -0,0 +1,68 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; + +namespace Algolia.Search.Ingestion.Client +{ + /// + /// A container for generalized request inputs. This type allows consumers to extend the request functionality + /// by abstracting away from the default (built-in) request framework (e.g. RestSharp). + /// + public class RequestOptions + { + /// + /// Parameters to be bound to path parts of the Request's URL + /// + public Dictionary PathParameters { get; set; } + + /// + /// Query parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap QueryParameters { get; set; } + + /// + /// Header parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap HeaderParameters { get; set; } + + /// + /// Form parameters to be sent along with the request. + /// + public Dictionary FormParameters { get; set; } + + /// + /// File parameters to be sent along with the request. + /// + public Multimap FileParameters { get; set; } + + /// + /// Cookies to be sent along with the request. + /// + public List Cookies { get; set; } + + /// + /// Any data associated with a request body. + /// + public Object Data { get; set; } + + /// + /// Constructs a new instance of + /// + public RequestOptions() + { + PathParameters = new Dictionary(); + QueryParameters = new Multimap(); + HeaderParameters = new Multimap(); + FormParameters = new Dictionary(); + FileParameters = new Multimap(); + Cookies = new List(); + } + } +} diff --git a/algoliasearch/Ingestion/Client/WebRequestPathBuilder.cs b/algoliasearch/Ingestion/Client/WebRequestPathBuilder.cs new file mode 100644 index 000000000..7e11ee785 --- /dev/null +++ b/algoliasearch/Ingestion/Client/WebRequestPathBuilder.cs @@ -0,0 +1,47 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using System; +using System.Collections.Generic; + +namespace Algolia.Search.Ingestion.Client +{ + /// + /// A URI builder + /// + class WebRequestPathBuilder + { + private string _baseUrl; + private string _path; + private string _query = "?"; + public WebRequestPathBuilder(string baseUrl, string path) + { + _baseUrl = baseUrl; + _path = path; + } + + public void AddPathParameters(Dictionary parameters) + { + foreach (var parameter in parameters) + { + _path = _path.Replace("{" + parameter.Key + "}", Uri.EscapeDataString(parameter.Value)); + } + } + + public void AddQueryParameters(Multimap parameters) + { + foreach (var parameter in parameters) + { + foreach (var value in parameter.Value) + { + _query = _query + parameter.Key + "=" + Uri.EscapeDataString(value) + "&"; + } + } + } + + public string GetFullUri() + { + return _baseUrl + _path + _query.Substring(0, _query.Length - 1); + } + } +} diff --git a/algoliasearch/Ingestion/Models/AbstractOpenAPISchema.cs b/algoliasearch/Ingestion/Models/AbstractOpenAPISchema.cs new file mode 100644 index 000000000..a8bb046ae --- /dev/null +++ b/algoliasearch/Ingestion/Models/AbstractOpenAPISchema.cs @@ -0,0 +1,70 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification + /// + public abstract partial class AbstractOpenAPISchema + { + /// + /// Custom JSON serializer + /// + static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Error, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Custom JSON serializer for objects with additional properties + /// + static public readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Ignore, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Gets or Sets the actual instance + /// + public abstract Object ActualInstance { get; set; } + + /// + /// Gets or Sets IsNullable to indicate whether the instance is nullable + /// + public bool IsNullable { get; protected set; } + + /// + /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf` + /// + public string SchemaType { get; protected set; } + + /// + /// Converts the instance into JSON string. + /// + public abstract string ToJson(); + } +} diff --git a/algoliasearch/Ingestion/Models/ActionType.cs b/algoliasearch/Ingestion/Models/ActionType.cs new file mode 100644 index 000000000..06f873f34 --- /dev/null +++ b/algoliasearch/Ingestion/Models/ActionType.cs @@ -0,0 +1,49 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The action to perform on the Algolia index. + /// + /// The action to perform on the Algolia index. + [JsonConverter(typeof(StringEnumConverter))] + public enum ActionType + { + /// + /// Enum Replace for value: replace + /// + [EnumMember(Value = "replace")] + Replace = 1, + + /// + /// Enum Save for value: save + /// + [EnumMember(Value = "save")] + Save = 2, + + /// + /// Enum Partial for value: partial + /// + [EnumMember(Value = "partial")] + Partial = 3 + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthAPIKey.cs b/algoliasearch/Ingestion/Models/AuthAPIKey.cs new file mode 100644 index 000000000..e689f1357 --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthAPIKey.cs @@ -0,0 +1,133 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Authentication input used for token credentials. + /// + [DataContract(Name = "AuthAPIKey")] + public partial class AuthAPIKey : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AuthAPIKey() { } + /// + /// Initializes a new instance of the class. + /// + /// key (required). + public AuthAPIKey(string key = default(string)) + { + // to ensure "key" is required (not null) + if (key == null) + { + throw new ArgumentNullException("key is a required property for AuthAPIKey and cannot be null"); + } + this.Key = key; + } + + /// + /// Gets or Sets Key + /// + [DataMember(Name = "key", IsRequired = true, EmitDefaultValue = true)] + public string Key { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AuthAPIKey {\n"); + sb.Append(" Key: ").Append(Key).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthAPIKey); + } + + /// + /// Returns true if AuthAPIKey instances are equal + /// + /// Instance of AuthAPIKey to be compared + /// Boolean + public bool Equals(AuthAPIKey input) + { + if (input == null) + { + return false; + } + return + ( + this.Key == input.Key || + (this.Key != null && + this.Key.Equals(input.Key)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Key != null) + { + hashCode = (hashCode * 59) + this.Key.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthAPIKeyPartial.cs b/algoliasearch/Ingestion/Models/AuthAPIKeyPartial.cs new file mode 100644 index 000000000..16dbdebbc --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthAPIKeyPartial.cs @@ -0,0 +1,123 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Authentication input used for token credentials. + /// + [DataContract(Name = "AuthAPIKeyPartial")] + public partial class AuthAPIKeyPartial : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// key. + public AuthAPIKeyPartial(string key = default(string)) + { + this.Key = key; + } + + /// + /// Gets or Sets Key + /// + [DataMember(Name = "key", EmitDefaultValue = false)] + public string Key { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AuthAPIKeyPartial {\n"); + sb.Append(" Key: ").Append(Key).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthAPIKeyPartial); + } + + /// + /// Returns true if AuthAPIKeyPartial instances are equal + /// + /// Instance of AuthAPIKeyPartial to be compared + /// Boolean + public bool Equals(AuthAPIKeyPartial input) + { + if (input == null) + { + return false; + } + return + ( + this.Key == input.Key || + (this.Key != null && + this.Key.Equals(input.Key)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Key != null) + { + hashCode = (hashCode * 59) + this.Key.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthAlgolia.cs b/algoliasearch/Ingestion/Models/AuthAlgolia.cs new file mode 100644 index 000000000..8d0ca241c --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthAlgolia.cs @@ -0,0 +1,158 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// AuthAlgolia + /// + [DataContract(Name = "AuthAlgolia")] + public partial class AuthAlgolia : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AuthAlgolia() { } + /// + /// Initializes a new instance of the class. + /// + /// Algolia Application ID. (required). + /// Algolia API Key, with the correct rights to push to an index and change settings. (required). + public AuthAlgolia(string appID = default(string), string apiKey = default(string)) + { + // to ensure "appID" is required (not null) + if (appID == null) + { + throw new ArgumentNullException("appID is a required property for AuthAlgolia and cannot be null"); + } + this.AppID = appID; + // to ensure "apiKey" is required (not null) + if (apiKey == null) + { + throw new ArgumentNullException("apiKey is a required property for AuthAlgolia and cannot be null"); + } + this.ApiKey = apiKey; + } + + /// + /// Algolia Application ID. + /// + /// Algolia Application ID. + [DataMember(Name = "appID", IsRequired = true, EmitDefaultValue = true)] + public string AppID { get; set; } + + /// + /// Algolia API Key, with the correct rights to push to an index and change settings. + /// + /// Algolia API Key, with the correct rights to push to an index and change settings. + [DataMember(Name = "apiKey", IsRequired = true, EmitDefaultValue = true)] + public string ApiKey { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AuthAlgolia {\n"); + sb.Append(" AppID: ").Append(AppID).Append("\n"); + sb.Append(" ApiKey: ").Append(ApiKey).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthAlgolia); + } + + /// + /// Returns true if AuthAlgolia instances are equal + /// + /// Instance of AuthAlgolia to be compared + /// Boolean + public bool Equals(AuthAlgolia input) + { + if (input == null) + { + return false; + } + return + ( + this.AppID == input.AppID || + (this.AppID != null && + this.AppID.Equals(input.AppID)) + ) && + ( + this.ApiKey == input.ApiKey || + (this.ApiKey != null && + this.ApiKey.Equals(input.ApiKey)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AppID != null) + { + hashCode = (hashCode * 59) + this.AppID.GetHashCode(); + } + if (this.ApiKey != null) + { + hashCode = (hashCode * 59) + this.ApiKey.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthAlgoliaPartial.cs b/algoliasearch/Ingestion/Models/AuthAlgoliaPartial.cs new file mode 100644 index 000000000..d44cb9d2d --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthAlgoliaPartial.cs @@ -0,0 +1,143 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// AuthAlgoliaPartial + /// + [DataContract(Name = "AuthAlgoliaPartial")] + public partial class AuthAlgoliaPartial : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Algolia Application ID.. + /// Algolia API Key, with the correct rights to push to an index and change settings.. + public AuthAlgoliaPartial(string appID = default(string), string apiKey = default(string)) + { + this.AppID = appID; + this.ApiKey = apiKey; + } + + /// + /// Algolia Application ID. + /// + /// Algolia Application ID. + [DataMember(Name = "appID", EmitDefaultValue = false)] + public string AppID { get; set; } + + /// + /// Algolia API Key, with the correct rights to push to an index and change settings. + /// + /// Algolia API Key, with the correct rights to push to an index and change settings. + [DataMember(Name = "apiKey", EmitDefaultValue = false)] + public string ApiKey { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AuthAlgoliaPartial {\n"); + sb.Append(" AppID: ").Append(AppID).Append("\n"); + sb.Append(" ApiKey: ").Append(ApiKey).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthAlgoliaPartial); + } + + /// + /// Returns true if AuthAlgoliaPartial instances are equal + /// + /// Instance of AuthAlgoliaPartial to be compared + /// Boolean + public bool Equals(AuthAlgoliaPartial input) + { + if (input == null) + { + return false; + } + return + ( + this.AppID == input.AppID || + (this.AppID != null && + this.AppID.Equals(input.AppID)) + ) && + ( + this.ApiKey == input.ApiKey || + (this.ApiKey != null && + this.ApiKey.Equals(input.ApiKey)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AppID != null) + { + hashCode = (hashCode * 59) + this.AppID.GetHashCode(); + } + if (this.ApiKey != null) + { + hashCode = (hashCode * 59) + this.ApiKey.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthBasic.cs b/algoliasearch/Ingestion/Models/AuthBasic.cs new file mode 100644 index 000000000..163965b3d --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthBasic.cs @@ -0,0 +1,156 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Authentication input for Basic login with username and password. + /// + [DataContract(Name = "AuthBasic")] + public partial class AuthBasic : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AuthBasic() { } + /// + /// Initializes a new instance of the class. + /// + /// username (required). + /// password (required). + public AuthBasic(string username = default(string), string password = default(string)) + { + // to ensure "username" is required (not null) + if (username == null) + { + throw new ArgumentNullException("username is a required property for AuthBasic and cannot be null"); + } + this.Username = username; + // to ensure "password" is required (not null) + if (password == null) + { + throw new ArgumentNullException("password is a required property for AuthBasic and cannot be null"); + } + this.Password = password; + } + + /// + /// Gets or Sets Username + /// + [DataMember(Name = "username", IsRequired = true, EmitDefaultValue = true)] + public string Username { get; set; } + + /// + /// Gets or Sets Password + /// + [DataMember(Name = "password", IsRequired = true, EmitDefaultValue = true)] + public string Password { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AuthBasic {\n"); + sb.Append(" Username: ").Append(Username).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthBasic); + } + + /// + /// Returns true if AuthBasic instances are equal + /// + /// Instance of AuthBasic to be compared + /// Boolean + public bool Equals(AuthBasic input) + { + if (input == null) + { + return false; + } + return + ( + this.Username == input.Username || + (this.Username != null && + this.Username.Equals(input.Username)) + ) && + ( + this.Password == input.Password || + (this.Password != null && + this.Password.Equals(input.Password)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Username != null) + { + hashCode = (hashCode * 59) + this.Username.GetHashCode(); + } + if (this.Password != null) + { + hashCode = (hashCode * 59) + this.Password.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthBasicPartial.cs b/algoliasearch/Ingestion/Models/AuthBasicPartial.cs new file mode 100644 index 000000000..252ee3950 --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthBasicPartial.cs @@ -0,0 +1,141 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Authentication input for Basic login with username and password. + /// + [DataContract(Name = "AuthBasicPartial")] + public partial class AuthBasicPartial : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// username. + /// password. + public AuthBasicPartial(string username = default(string), string password = default(string)) + { + this.Username = username; + this.Password = password; + } + + /// + /// Gets or Sets Username + /// + [DataMember(Name = "username", EmitDefaultValue = false)] + public string Username { get; set; } + + /// + /// Gets or Sets Password + /// + [DataMember(Name = "password", EmitDefaultValue = false)] + public string Password { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AuthBasicPartial {\n"); + sb.Append(" Username: ").Append(Username).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthBasicPartial); + } + + /// + /// Returns true if AuthBasicPartial instances are equal + /// + /// Instance of AuthBasicPartial to be compared + /// Boolean + public bool Equals(AuthBasicPartial input) + { + if (input == null) + { + return false; + } + return + ( + this.Username == input.Username || + (this.Username != null && + this.Username.Equals(input.Username)) + ) && + ( + this.Password == input.Password || + (this.Password != null && + this.Password.Equals(input.Password)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Username != null) + { + hashCode = (hashCode * 59) + this.Username.GetHashCode(); + } + if (this.Password != null) + { + hashCode = (hashCode * 59) + this.Password.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthGoogleServiceAccount.cs b/algoliasearch/Ingestion/Models/AuthGoogleServiceAccount.cs new file mode 100644 index 000000000..4f6ede9b7 --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthGoogleServiceAccount.cs @@ -0,0 +1,158 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Authentication input to connect to a Google service (e.g. BigQuery). + /// + [DataContract(Name = "AuthGoogleServiceAccount")] + public partial class AuthGoogleServiceAccount : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AuthGoogleServiceAccount() { } + /// + /// Initializes a new instance of the class. + /// + /// Email address of the Service Account. (required). + /// Private key of the Service Account. (required). + public AuthGoogleServiceAccount(string clientEmail = default(string), string privateKey = default(string)) + { + // to ensure "clientEmail" is required (not null) + if (clientEmail == null) + { + throw new ArgumentNullException("clientEmail is a required property for AuthGoogleServiceAccount and cannot be null"); + } + this.ClientEmail = clientEmail; + // to ensure "privateKey" is required (not null) + if (privateKey == null) + { + throw new ArgumentNullException("privateKey is a required property for AuthGoogleServiceAccount and cannot be null"); + } + this.PrivateKey = privateKey; + } + + /// + /// Email address of the Service Account. + /// + /// Email address of the Service Account. + [DataMember(Name = "clientEmail", IsRequired = true, EmitDefaultValue = true)] + public string ClientEmail { get; set; } + + /// + /// Private key of the Service Account. + /// + /// Private key of the Service Account. + [DataMember(Name = "privateKey", IsRequired = true, EmitDefaultValue = true)] + public string PrivateKey { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AuthGoogleServiceAccount {\n"); + sb.Append(" ClientEmail: ").Append(ClientEmail).Append("\n"); + sb.Append(" PrivateKey: ").Append(PrivateKey).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthGoogleServiceAccount); + } + + /// + /// Returns true if AuthGoogleServiceAccount instances are equal + /// + /// Instance of AuthGoogleServiceAccount to be compared + /// Boolean + public bool Equals(AuthGoogleServiceAccount input) + { + if (input == null) + { + return false; + } + return + ( + this.ClientEmail == input.ClientEmail || + (this.ClientEmail != null && + this.ClientEmail.Equals(input.ClientEmail)) + ) && + ( + this.PrivateKey == input.PrivateKey || + (this.PrivateKey != null && + this.PrivateKey.Equals(input.PrivateKey)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ClientEmail != null) + { + hashCode = (hashCode * 59) + this.ClientEmail.GetHashCode(); + } + if (this.PrivateKey != null) + { + hashCode = (hashCode * 59) + this.PrivateKey.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthGoogleServiceAccountPartial.cs b/algoliasearch/Ingestion/Models/AuthGoogleServiceAccountPartial.cs new file mode 100644 index 000000000..a4070c5b5 --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthGoogleServiceAccountPartial.cs @@ -0,0 +1,143 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Authentication input to connect to a Google service (e.g. BigQuery). + /// + [DataContract(Name = "AuthGoogleServiceAccountPartial")] + public partial class AuthGoogleServiceAccountPartial : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Email address of the Service Account.. + /// Private key of the Service Account.. + public AuthGoogleServiceAccountPartial(string clientEmail = default(string), string privateKey = default(string)) + { + this.ClientEmail = clientEmail; + this.PrivateKey = privateKey; + } + + /// + /// Email address of the Service Account. + /// + /// Email address of the Service Account. + [DataMember(Name = "clientEmail", EmitDefaultValue = false)] + public string ClientEmail { get; set; } + + /// + /// Private key of the Service Account. + /// + /// Private key of the Service Account. + [DataMember(Name = "privateKey", EmitDefaultValue = false)] + public string PrivateKey { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AuthGoogleServiceAccountPartial {\n"); + sb.Append(" ClientEmail: ").Append(ClientEmail).Append("\n"); + sb.Append(" PrivateKey: ").Append(PrivateKey).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthGoogleServiceAccountPartial); + } + + /// + /// Returns true if AuthGoogleServiceAccountPartial instances are equal + /// + /// Instance of AuthGoogleServiceAccountPartial to be compared + /// Boolean + public bool Equals(AuthGoogleServiceAccountPartial input) + { + if (input == null) + { + return false; + } + return + ( + this.ClientEmail == input.ClientEmail || + (this.ClientEmail != null && + this.ClientEmail.Equals(input.ClientEmail)) + ) && + ( + this.PrivateKey == input.PrivateKey || + (this.PrivateKey != null && + this.PrivateKey.Equals(input.PrivateKey)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ClientEmail != null) + { + hashCode = (hashCode * 59) + this.ClientEmail.GetHashCode(); + } + if (this.PrivateKey != null) + { + hashCode = (hashCode * 59) + this.PrivateKey.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthInput.cs b/algoliasearch/Ingestion/Models/AuthInput.cs new file mode 100644 index 000000000..d7fc8a536 --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthInput.cs @@ -0,0 +1,426 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// AuthInput + /// + [JsonConverter(typeof(AuthInputJsonConverter))] + [DataContract(Name = "AuthInput")] + public partial class AuthInput : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of AuthGoogleServiceAccount. + public AuthInput(AuthGoogleServiceAccount actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of AuthBasic. + public AuthInput(AuthBasic actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of AuthAPIKey. + public AuthInput(AuthAPIKey actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of AuthOAuth. + public AuthInput(AuthOAuth actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of AuthAlgolia. + public AuthInput(AuthAlgolia actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(AuthAPIKey)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(AuthAlgolia)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(AuthBasic)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(AuthGoogleServiceAccount)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(AuthOAuth)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: AuthAPIKey, AuthAlgolia, AuthBasic, AuthGoogleServiceAccount, AuthOAuth"); + } + } + } + + /// + /// Get the actual instance of `AuthGoogleServiceAccount`. If the actual instance is not `AuthGoogleServiceAccount`, + /// the InvalidClassException will be thrown + /// + /// An instance of AuthGoogleServiceAccount + public AuthGoogleServiceAccount GetterAuthGoogleServiceAccount() + { + return (AuthGoogleServiceAccount)this.ActualInstance; + } + + /// + /// Get the actual instance of `AuthBasic`. If the actual instance is not `AuthBasic`, + /// the InvalidClassException will be thrown + /// + /// An instance of AuthBasic + public AuthBasic GetterAuthBasic() + { + return (AuthBasic)this.ActualInstance; + } + + /// + /// Get the actual instance of `AuthAPIKey`. If the actual instance is not `AuthAPIKey`, + /// the InvalidClassException will be thrown + /// + /// An instance of AuthAPIKey + public AuthAPIKey GetterAuthAPIKey() + { + return (AuthAPIKey)this.ActualInstance; + } + + /// + /// Get the actual instance of `AuthOAuth`. If the actual instance is not `AuthOAuth`, + /// the InvalidClassException will be thrown + /// + /// An instance of AuthOAuth + public AuthOAuth GetterAuthOAuth() + { + return (AuthOAuth)this.ActualInstance; + } + + /// + /// Get the actual instance of `AuthAlgolia`. If the actual instance is not `AuthAlgolia`, + /// the InvalidClassException will be thrown + /// + /// An instance of AuthAlgolia + public AuthAlgolia GetterAuthAlgolia() + { + return (AuthAlgolia)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class AuthInput {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, AuthInput.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of AuthInput + /// + /// JSON string + /// An instance of AuthInput + public static AuthInput FromJson(string jsonString) + { + AuthInput newAuthInput = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newAuthInput; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(AuthAPIKey).GetProperty("AdditionalProperties") == null) + { + newAuthInput = new AuthInput(JsonConvert.DeserializeObject(jsonString, AuthInput.SerializerSettings)); + } + else + { + newAuthInput = new AuthInput(JsonConvert.DeserializeObject(jsonString, AuthInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("AuthAPIKey"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into AuthAPIKey: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(AuthAlgolia).GetProperty("AdditionalProperties") == null) + { + newAuthInput = new AuthInput(JsonConvert.DeserializeObject(jsonString, AuthInput.SerializerSettings)); + } + else + { + newAuthInput = new AuthInput(JsonConvert.DeserializeObject(jsonString, AuthInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("AuthAlgolia"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into AuthAlgolia: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(AuthBasic).GetProperty("AdditionalProperties") == null) + { + newAuthInput = new AuthInput(JsonConvert.DeserializeObject(jsonString, AuthInput.SerializerSettings)); + } + else + { + newAuthInput = new AuthInput(JsonConvert.DeserializeObject(jsonString, AuthInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("AuthBasic"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into AuthBasic: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(AuthGoogleServiceAccount).GetProperty("AdditionalProperties") == null) + { + newAuthInput = new AuthInput(JsonConvert.DeserializeObject(jsonString, AuthInput.SerializerSettings)); + } + else + { + newAuthInput = new AuthInput(JsonConvert.DeserializeObject(jsonString, AuthInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("AuthGoogleServiceAccount"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into AuthGoogleServiceAccount: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(AuthOAuth).GetProperty("AdditionalProperties") == null) + { + newAuthInput = new AuthInput(JsonConvert.DeserializeObject(jsonString, AuthInput.SerializerSettings)); + } + else + { + newAuthInput = new AuthInput(JsonConvert.DeserializeObject(jsonString, AuthInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("AuthOAuth"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into AuthOAuth: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newAuthInput; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthInput); + } + + /// + /// Returns true if AuthInput instances are equal + /// + /// Instance of AuthInput to be compared + /// Boolean + public bool Equals(AuthInput input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for AuthInput + /// + public class AuthInputJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(AuthInput).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return AuthInput.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthInputPartial.cs b/algoliasearch/Ingestion/Models/AuthInputPartial.cs new file mode 100644 index 000000000..6e6d2a522 --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthInputPartial.cs @@ -0,0 +1,426 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// AuthInputPartial + /// + [JsonConverter(typeof(AuthInputPartialJsonConverter))] + [DataContract(Name = "AuthInputPartial")] + public partial class AuthInputPartial : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of AuthGoogleServiceAccountPartial. + public AuthInputPartial(AuthGoogleServiceAccountPartial actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of AuthBasicPartial. + public AuthInputPartial(AuthBasicPartial actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of AuthAPIKeyPartial. + public AuthInputPartial(AuthAPIKeyPartial actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of AuthOAuthPartial. + public AuthInputPartial(AuthOAuthPartial actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of AuthAlgoliaPartial. + public AuthInputPartial(AuthAlgoliaPartial actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(AuthAPIKeyPartial)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(AuthAlgoliaPartial)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(AuthBasicPartial)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(AuthGoogleServiceAccountPartial)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(AuthOAuthPartial)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: AuthAPIKeyPartial, AuthAlgoliaPartial, AuthBasicPartial, AuthGoogleServiceAccountPartial, AuthOAuthPartial"); + } + } + } + + /// + /// Get the actual instance of `AuthGoogleServiceAccountPartial`. If the actual instance is not `AuthGoogleServiceAccountPartial`, + /// the InvalidClassException will be thrown + /// + /// An instance of AuthGoogleServiceAccountPartial + public AuthGoogleServiceAccountPartial GetterAuthGoogleServiceAccountPartial() + { + return (AuthGoogleServiceAccountPartial)this.ActualInstance; + } + + /// + /// Get the actual instance of `AuthBasicPartial`. If the actual instance is not `AuthBasicPartial`, + /// the InvalidClassException will be thrown + /// + /// An instance of AuthBasicPartial + public AuthBasicPartial GetterAuthBasicPartial() + { + return (AuthBasicPartial)this.ActualInstance; + } + + /// + /// Get the actual instance of `AuthAPIKeyPartial`. If the actual instance is not `AuthAPIKeyPartial`, + /// the InvalidClassException will be thrown + /// + /// An instance of AuthAPIKeyPartial + public AuthAPIKeyPartial GetterAuthAPIKeyPartial() + { + return (AuthAPIKeyPartial)this.ActualInstance; + } + + /// + /// Get the actual instance of `AuthOAuthPartial`. If the actual instance is not `AuthOAuthPartial`, + /// the InvalidClassException will be thrown + /// + /// An instance of AuthOAuthPartial + public AuthOAuthPartial GetterAuthOAuthPartial() + { + return (AuthOAuthPartial)this.ActualInstance; + } + + /// + /// Get the actual instance of `AuthAlgoliaPartial`. If the actual instance is not `AuthAlgoliaPartial`, + /// the InvalidClassException will be thrown + /// + /// An instance of AuthAlgoliaPartial + public AuthAlgoliaPartial GetterAuthAlgoliaPartial() + { + return (AuthAlgoliaPartial)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class AuthInputPartial {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, AuthInputPartial.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of AuthInputPartial + /// + /// JSON string + /// An instance of AuthInputPartial + public static AuthInputPartial FromJson(string jsonString) + { + AuthInputPartial newAuthInputPartial = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newAuthInputPartial; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(AuthAPIKeyPartial).GetProperty("AdditionalProperties") == null) + { + newAuthInputPartial = new AuthInputPartial(JsonConvert.DeserializeObject(jsonString, AuthInputPartial.SerializerSettings)); + } + else + { + newAuthInputPartial = new AuthInputPartial(JsonConvert.DeserializeObject(jsonString, AuthInputPartial.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("AuthAPIKeyPartial"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into AuthAPIKeyPartial: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(AuthAlgoliaPartial).GetProperty("AdditionalProperties") == null) + { + newAuthInputPartial = new AuthInputPartial(JsonConvert.DeserializeObject(jsonString, AuthInputPartial.SerializerSettings)); + } + else + { + newAuthInputPartial = new AuthInputPartial(JsonConvert.DeserializeObject(jsonString, AuthInputPartial.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("AuthAlgoliaPartial"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into AuthAlgoliaPartial: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(AuthBasicPartial).GetProperty("AdditionalProperties") == null) + { + newAuthInputPartial = new AuthInputPartial(JsonConvert.DeserializeObject(jsonString, AuthInputPartial.SerializerSettings)); + } + else + { + newAuthInputPartial = new AuthInputPartial(JsonConvert.DeserializeObject(jsonString, AuthInputPartial.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("AuthBasicPartial"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into AuthBasicPartial: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(AuthGoogleServiceAccountPartial).GetProperty("AdditionalProperties") == null) + { + newAuthInputPartial = new AuthInputPartial(JsonConvert.DeserializeObject(jsonString, AuthInputPartial.SerializerSettings)); + } + else + { + newAuthInputPartial = new AuthInputPartial(JsonConvert.DeserializeObject(jsonString, AuthInputPartial.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("AuthGoogleServiceAccountPartial"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into AuthGoogleServiceAccountPartial: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(AuthOAuthPartial).GetProperty("AdditionalProperties") == null) + { + newAuthInputPartial = new AuthInputPartial(JsonConvert.DeserializeObject(jsonString, AuthInputPartial.SerializerSettings)); + } + else + { + newAuthInputPartial = new AuthInputPartial(JsonConvert.DeserializeObject(jsonString, AuthInputPartial.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("AuthOAuthPartial"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into AuthOAuthPartial: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newAuthInputPartial; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthInputPartial); + } + + /// + /// Returns true if AuthInputPartial instances are equal + /// + /// Instance of AuthInputPartial to be compared + /// Boolean + public bool Equals(AuthInputPartial input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for AuthInputPartial + /// + public class AuthInputPartialJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(AuthInputPartial).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return AuthInputPartial.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthOAuth.cs b/algoliasearch/Ingestion/Models/AuthOAuth.cs new file mode 100644 index 000000000..41f38d601 --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthOAuth.cs @@ -0,0 +1,182 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Authentication input for OAuth login. + /// + [DataContract(Name = "AuthOAuth")] + public partial class AuthOAuth : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AuthOAuth() { } + /// + /// Initializes a new instance of the class. + /// + /// The OAuth endpoint URL. (required). + /// The clientID. (required). + /// The secret. (required). + public AuthOAuth(string url = default(string), string clientId = default(string), string clientSecret = default(string)) + { + // to ensure "url" is required (not null) + if (url == null) + { + throw new ArgumentNullException("url is a required property for AuthOAuth and cannot be null"); + } + this.Url = url; + // to ensure "clientId" is required (not null) + if (clientId == null) + { + throw new ArgumentNullException("clientId is a required property for AuthOAuth and cannot be null"); + } + this.ClientId = clientId; + // to ensure "clientSecret" is required (not null) + if (clientSecret == null) + { + throw new ArgumentNullException("clientSecret is a required property for AuthOAuth and cannot be null"); + } + this.ClientSecret = clientSecret; + } + + /// + /// The OAuth endpoint URL. + /// + /// The OAuth endpoint URL. + [DataMember(Name = "url", IsRequired = true, EmitDefaultValue = true)] + public string Url { get; set; } + + /// + /// The clientID. + /// + /// The clientID. + [DataMember(Name = "client_id", IsRequired = true, EmitDefaultValue = true)] + public string ClientId { get; set; } + + /// + /// The secret. + /// + /// The secret. + [DataMember(Name = "client_secret", IsRequired = true, EmitDefaultValue = true)] + public string ClientSecret { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AuthOAuth {\n"); + sb.Append(" Url: ").Append(Url).Append("\n"); + sb.Append(" ClientId: ").Append(ClientId).Append("\n"); + sb.Append(" ClientSecret: ").Append(ClientSecret).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthOAuth); + } + + /// + /// Returns true if AuthOAuth instances are equal + /// + /// Instance of AuthOAuth to be compared + /// Boolean + public bool Equals(AuthOAuth input) + { + if (input == null) + { + return false; + } + return + ( + this.Url == input.Url || + (this.Url != null && + this.Url.Equals(input.Url)) + ) && + ( + this.ClientId == input.ClientId || + (this.ClientId != null && + this.ClientId.Equals(input.ClientId)) + ) && + ( + this.ClientSecret == input.ClientSecret || + (this.ClientSecret != null && + this.ClientSecret.Equals(input.ClientSecret)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Url != null) + { + hashCode = (hashCode * 59) + this.Url.GetHashCode(); + } + if (this.ClientId != null) + { + hashCode = (hashCode * 59) + this.ClientId.GetHashCode(); + } + if (this.ClientSecret != null) + { + hashCode = (hashCode * 59) + this.ClientSecret.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthOAuthPartial.cs b/algoliasearch/Ingestion/Models/AuthOAuthPartial.cs new file mode 100644 index 000000000..35723e8ed --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthOAuthPartial.cs @@ -0,0 +1,162 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Authentication input for OAuth login. + /// + [DataContract(Name = "AuthOAuthPartial")] + public partial class AuthOAuthPartial : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// The OAuth endpoint URL.. + /// The clientID.. + /// The secret.. + public AuthOAuthPartial(string url = default(string), string clientId = default(string), string clientSecret = default(string)) + { + this.Url = url; + this.ClientId = clientId; + this.ClientSecret = clientSecret; + } + + /// + /// The OAuth endpoint URL. + /// + /// The OAuth endpoint URL. + [DataMember(Name = "url", EmitDefaultValue = false)] + public string Url { get; set; } + + /// + /// The clientID. + /// + /// The clientID. + [DataMember(Name = "client_id", EmitDefaultValue = false)] + public string ClientId { get; set; } + + /// + /// The secret. + /// + /// The secret. + [DataMember(Name = "client_secret", EmitDefaultValue = false)] + public string ClientSecret { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AuthOAuthPartial {\n"); + sb.Append(" Url: ").Append(Url).Append("\n"); + sb.Append(" ClientId: ").Append(ClientId).Append("\n"); + sb.Append(" ClientSecret: ").Append(ClientSecret).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthOAuthPartial); + } + + /// + /// Returns true if AuthOAuthPartial instances are equal + /// + /// Instance of AuthOAuthPartial to be compared + /// Boolean + public bool Equals(AuthOAuthPartial input) + { + if (input == null) + { + return false; + } + return + ( + this.Url == input.Url || + (this.Url != null && + this.Url.Equals(input.Url)) + ) && + ( + this.ClientId == input.ClientId || + (this.ClientId != null && + this.ClientId.Equals(input.ClientId)) + ) && + ( + this.ClientSecret == input.ClientSecret || + (this.ClientSecret != null && + this.ClientSecret.Equals(input.ClientSecret)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Url != null) + { + hashCode = (hashCode * 59) + this.Url.GetHashCode(); + } + if (this.ClientId != null) + { + hashCode = (hashCode * 59) + this.ClientId.GetHashCode(); + } + if (this.ClientSecret != null) + { + hashCode = (hashCode * 59) + this.ClientSecret.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/Authentication.cs b/algoliasearch/Ingestion/Models/Authentication.cs new file mode 100644 index 000000000..634d7074e --- /dev/null +++ b/algoliasearch/Ingestion/Models/Authentication.cs @@ -0,0 +1,252 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// An authentication is used to login into a Source or a Destination. + /// + [DataContract(Name = "Authentication")] + public partial class Authentication : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public AuthenticationType Type { get; set; } + + /// + /// Gets or Sets Platform + /// + [DataMember(Name = "platform", EmitDefaultValue = false)] + public Platform? Platform { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Authentication() { } + /// + /// Initializes a new instance of the class. + /// + /// The authentication UUID. (required). + /// type (required). + /// An human readable name describing the object. (required). + /// platform. + /// input (required). + /// Date of creation (RFC3339 format). (required). + /// Date of last update (RFC3339 format).. + public Authentication(string authenticationID = default(string), AuthenticationType type = default(AuthenticationType), string name = default(string), Platform? platform = default(Platform?), AuthInput input = default(AuthInput), string createdAt = default(string), string updatedAt = default(string)) + { + // to ensure "authenticationID" is required (not null) + if (authenticationID == null) + { + throw new ArgumentNullException("authenticationID is a required property for Authentication and cannot be null"); + } + this.AuthenticationID = authenticationID; + this.Type = type; + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for Authentication and cannot be null"); + } + this.Name = name; + // to ensure "input" is required (not null) + if (input == null) + { + throw new ArgumentNullException("input is a required property for Authentication and cannot be null"); + } + this.Input = input; + // to ensure "createdAt" is required (not null) + if (createdAt == null) + { + throw new ArgumentNullException("createdAt is a required property for Authentication and cannot be null"); + } + this.CreatedAt = createdAt; + this.Platform = platform; + this.UpdatedAt = updatedAt; + } + + /// + /// The authentication UUID. + /// + /// The authentication UUID. + [DataMember(Name = "authenticationID", IsRequired = true, EmitDefaultValue = true)] + public string AuthenticationID { get; set; } + + /// + /// An human readable name describing the object. + /// + /// An human readable name describing the object. + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Gets or Sets Input + /// + [DataMember(Name = "input", IsRequired = true, EmitDefaultValue = true)] + public AuthInput Input { get; set; } + + /// + /// Date of creation (RFC3339 format). + /// + /// Date of creation (RFC3339 format). + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public string CreatedAt { get; set; } + + /// + /// Date of last update (RFC3339 format). + /// + /// Date of last update (RFC3339 format). + [DataMember(Name = "updatedAt", EmitDefaultValue = false)] + public string UpdatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Authentication {\n"); + sb.Append(" AuthenticationID: ").Append(AuthenticationID).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Platform: ").Append(Platform).Append("\n"); + sb.Append(" Input: ").Append(Input).Append("\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Authentication); + } + + /// + /// Returns true if Authentication instances are equal + /// + /// Instance of Authentication to be compared + /// Boolean + public bool Equals(Authentication input) + { + if (input == null) + { + return false; + } + return + ( + this.AuthenticationID == input.AuthenticationID || + (this.AuthenticationID != null && + this.AuthenticationID.Equals(input.AuthenticationID)) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Platform == input.Platform || + this.Platform.Equals(input.Platform) + ) && + ( + this.Input == input.Input || + (this.Input != null && + this.Input.Equals(input.Input)) + ) && + ( + this.CreatedAt == input.CreatedAt || + (this.CreatedAt != null && + this.CreatedAt.Equals(input.CreatedAt)) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AuthenticationID != null) + { + hashCode = (hashCode * 59) + this.AuthenticationID.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Platform.GetHashCode(); + if (this.Input != null) + { + hashCode = (hashCode * 59) + this.Input.GetHashCode(); + } + if (this.CreatedAt != null) + { + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + } + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthenticationCreate.cs b/algoliasearch/Ingestion/Models/AuthenticationCreate.cs new file mode 100644 index 000000000..72bcd512f --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthenticationCreate.cs @@ -0,0 +1,185 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The payload when creating an authentication. + /// + [DataContract(Name = "AuthenticationCreate")] + public partial class AuthenticationCreate : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public AuthenticationType Type { get; set; } + + /// + /// Gets or Sets Platform + /// + [DataMember(Name = "platform", EmitDefaultValue = false)] + public Platform? Platform { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AuthenticationCreate() { } + /// + /// Initializes a new instance of the class. + /// + /// type (required). + /// An human readable name describing the object. (required). + /// platform. + /// input (required). + public AuthenticationCreate(AuthenticationType type = default(AuthenticationType), string name = default(string), Platform? platform = default(Platform?), AuthInput input = default(AuthInput)) + { + this.Type = type; + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for AuthenticationCreate and cannot be null"); + } + this.Name = name; + // to ensure "input" is required (not null) + if (input == null) + { + throw new ArgumentNullException("input is a required property for AuthenticationCreate and cannot be null"); + } + this.Input = input; + this.Platform = platform; + } + + /// + /// An human readable name describing the object. + /// + /// An human readable name describing the object. + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Gets or Sets Input + /// + [DataMember(Name = "input", IsRequired = true, EmitDefaultValue = true)] + public AuthInput Input { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AuthenticationCreate {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Platform: ").Append(Platform).Append("\n"); + sb.Append(" Input: ").Append(Input).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthenticationCreate); + } + + /// + /// Returns true if AuthenticationCreate instances are equal + /// + /// Instance of AuthenticationCreate to be compared + /// Boolean + public bool Equals(AuthenticationCreate input) + { + if (input == null) + { + return false; + } + return + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Platform == input.Platform || + this.Platform.Equals(input.Platform) + ) && + ( + this.Input == input.Input || + (this.Input != null && + this.Input.Equals(input.Input)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Platform.GetHashCode(); + if (this.Input != null) + { + hashCode = (hashCode * 59) + this.Input.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthenticationCreateResponse.cs b/algoliasearch/Ingestion/Models/AuthenticationCreateResponse.cs new file mode 100644 index 000000000..963bca0eb --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthenticationCreateResponse.cs @@ -0,0 +1,182 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Response from the API when the Authentication is successfully created. + /// + [DataContract(Name = "AuthenticationCreateResponse")] + public partial class AuthenticationCreateResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AuthenticationCreateResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// The authentication UUID. (required). + /// An human readable name describing the object. (required). + /// Date of creation (RFC3339 format). (required). + public AuthenticationCreateResponse(string authenticationID = default(string), string name = default(string), string createdAt = default(string)) + { + // to ensure "authenticationID" is required (not null) + if (authenticationID == null) + { + throw new ArgumentNullException("authenticationID is a required property for AuthenticationCreateResponse and cannot be null"); + } + this.AuthenticationID = authenticationID; + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for AuthenticationCreateResponse and cannot be null"); + } + this.Name = name; + // to ensure "createdAt" is required (not null) + if (createdAt == null) + { + throw new ArgumentNullException("createdAt is a required property for AuthenticationCreateResponse and cannot be null"); + } + this.CreatedAt = createdAt; + } + + /// + /// The authentication UUID. + /// + /// The authentication UUID. + [DataMember(Name = "authenticationID", IsRequired = true, EmitDefaultValue = true)] + public string AuthenticationID { get; set; } + + /// + /// An human readable name describing the object. + /// + /// An human readable name describing the object. + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Date of creation (RFC3339 format). + /// + /// Date of creation (RFC3339 format). + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public string CreatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AuthenticationCreateResponse {\n"); + sb.Append(" AuthenticationID: ").Append(AuthenticationID).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthenticationCreateResponse); + } + + /// + /// Returns true if AuthenticationCreateResponse instances are equal + /// + /// Instance of AuthenticationCreateResponse to be compared + /// Boolean + public bool Equals(AuthenticationCreateResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.AuthenticationID == input.AuthenticationID || + (this.AuthenticationID != null && + this.AuthenticationID.Equals(input.AuthenticationID)) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.CreatedAt == input.CreatedAt || + (this.CreatedAt != null && + this.CreatedAt.Equals(input.CreatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AuthenticationID != null) + { + hashCode = (hashCode * 59) + this.AuthenticationID.GetHashCode(); + } + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.CreatedAt != null) + { + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthenticationSearch.cs b/algoliasearch/Ingestion/Models/AuthenticationSearch.cs new file mode 100644 index 000000000..03b3968cc --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthenticationSearch.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Payload to search for multiple authentications, based on the given `authenticationIDs`. + /// + [DataContract(Name = "AuthenticationSearch")] + public partial class AuthenticationSearch : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AuthenticationSearch() { } + /// + /// Initializes a new instance of the class. + /// + /// authenticationIDs (required). + public AuthenticationSearch(List authenticationIDs = default(List)) + { + // to ensure "authenticationIDs" is required (not null) + if (authenticationIDs == null) + { + throw new ArgumentNullException("authenticationIDs is a required property for AuthenticationSearch and cannot be null"); + } + this.AuthenticationIDs = authenticationIDs; + } + + /// + /// Gets or Sets AuthenticationIDs + /// + [DataMember(Name = "authenticationIDs", IsRequired = true, EmitDefaultValue = true)] + public List AuthenticationIDs { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AuthenticationSearch {\n"); + sb.Append(" AuthenticationIDs: ").Append(AuthenticationIDs).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthenticationSearch); + } + + /// + /// Returns true if AuthenticationSearch instances are equal + /// + /// Instance of AuthenticationSearch to be compared + /// Boolean + public bool Equals(AuthenticationSearch input) + { + if (input == null) + { + return false; + } + return + ( + this.AuthenticationIDs == input.AuthenticationIDs || + this.AuthenticationIDs != null && + input.AuthenticationIDs != null && + this.AuthenticationIDs.SequenceEqual(input.AuthenticationIDs) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AuthenticationIDs != null) + { + hashCode = (hashCode * 59) + this.AuthenticationIDs.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthenticationSortKeys.cs b/algoliasearch/Ingestion/Models/AuthenticationSortKeys.cs new file mode 100644 index 000000000..950aab048 --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthenticationSortKeys.cs @@ -0,0 +1,61 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Used to sort the Authentication list endpoint. + /// + /// Used to sort the Authentication list endpoint. + [JsonConverter(typeof(StringEnumConverter))] + public enum AuthenticationSortKeys + { + /// + /// Enum Name for value: name + /// + [EnumMember(Value = "name")] + Name = 1, + + /// + /// Enum AuthType for value: auth_type + /// + [EnumMember(Value = "auth_type")] + AuthType = 2, + + /// + /// Enum Platform for value: platform + /// + [EnumMember(Value = "platform")] + Platform = 3, + + /// + /// Enum UpdatedAt for value: updatedAt + /// + [EnumMember(Value = "updatedAt")] + UpdatedAt = 4, + + /// + /// Enum CreatedAt for value: createdAt + /// + [EnumMember(Value = "createdAt")] + CreatedAt = 5 + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthenticationType.cs b/algoliasearch/Ingestion/Models/AuthenticationType.cs new file mode 100644 index 000000000..cfaa006d7 --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthenticationType.cs @@ -0,0 +1,61 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Type of the Authentication, defines what kind of object is stored in the input. + /// + /// Type of the Authentication, defines what kind of object is stored in the input. + [JsonConverter(typeof(StringEnumConverter))] + public enum AuthenticationType + { + /// + /// Enum GoogleServiceAccount for value: googleServiceAccount + /// + [EnumMember(Value = "googleServiceAccount")] + GoogleServiceAccount = 1, + + /// + /// Enum Basic for value: basic + /// + [EnumMember(Value = "basic")] + Basic = 2, + + /// + /// Enum ApiKey for value: apiKey + /// + [EnumMember(Value = "apiKey")] + ApiKey = 3, + + /// + /// Enum Oauth for value: oauth + /// + [EnumMember(Value = "oauth")] + Oauth = 4, + + /// + /// Enum Algolia for value: algolia + /// + [EnumMember(Value = "algolia")] + Algolia = 5 + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthenticationUpdate.cs b/algoliasearch/Ingestion/Models/AuthenticationUpdate.cs new file mode 100644 index 000000000..4ff1da95e --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthenticationUpdate.cs @@ -0,0 +1,170 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Payload to partially update an Authentication. + /// + [DataContract(Name = "AuthenticationUpdate")] + public partial class AuthenticationUpdate : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", EmitDefaultValue = false)] + public AuthenticationType? Type { get; set; } + + /// + /// Gets or Sets Platform + /// + [DataMember(Name = "platform", EmitDefaultValue = false)] + public Platform? Platform { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// type. + /// An human readable name describing the object.. + /// platform. + /// input. + public AuthenticationUpdate(AuthenticationType? type = default(AuthenticationType?), string name = default(string), Platform? platform = default(Platform?), AuthInputPartial input = default(AuthInputPartial)) + { + this.Type = type; + this.Name = name; + this.Platform = platform; + this.Input = input; + } + + /// + /// An human readable name describing the object. + /// + /// An human readable name describing the object. + [DataMember(Name = "name", EmitDefaultValue = false)] + public string Name { get; set; } + + /// + /// Gets or Sets Input + /// + [DataMember(Name = "input", EmitDefaultValue = false)] + public AuthInputPartial Input { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AuthenticationUpdate {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Platform: ").Append(Platform).Append("\n"); + sb.Append(" Input: ").Append(Input).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthenticationUpdate); + } + + /// + /// Returns true if AuthenticationUpdate instances are equal + /// + /// Instance of AuthenticationUpdate to be compared + /// Boolean + public bool Equals(AuthenticationUpdate input) + { + if (input == null) + { + return false; + } + return + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Platform == input.Platform || + this.Platform.Equals(input.Platform) + ) && + ( + this.Input == input.Input || + (this.Input != null && + this.Input.Equals(input.Input)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Platform.GetHashCode(); + if (this.Input != null) + { + hashCode = (hashCode * 59) + this.Input.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/AuthenticationUpdateResponse.cs b/algoliasearch/Ingestion/Models/AuthenticationUpdateResponse.cs new file mode 100644 index 000000000..9c9cab154 --- /dev/null +++ b/algoliasearch/Ingestion/Models/AuthenticationUpdateResponse.cs @@ -0,0 +1,182 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Response from the API when the Authentication is successfully updated. + /// + [DataContract(Name = "AuthenticationUpdateResponse")] + public partial class AuthenticationUpdateResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AuthenticationUpdateResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// The authentication UUID. (required). + /// An human readable name describing the object. (required). + /// Date of last update (RFC3339 format). (required). + public AuthenticationUpdateResponse(string authenticationID = default(string), string name = default(string), string updatedAt = default(string)) + { + // to ensure "authenticationID" is required (not null) + if (authenticationID == null) + { + throw new ArgumentNullException("authenticationID is a required property for AuthenticationUpdateResponse and cannot be null"); + } + this.AuthenticationID = authenticationID; + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for AuthenticationUpdateResponse and cannot be null"); + } + this.Name = name; + // to ensure "updatedAt" is required (not null) + if (updatedAt == null) + { + throw new ArgumentNullException("updatedAt is a required property for AuthenticationUpdateResponse and cannot be null"); + } + this.UpdatedAt = updatedAt; + } + + /// + /// The authentication UUID. + /// + /// The authentication UUID. + [DataMember(Name = "authenticationID", IsRequired = true, EmitDefaultValue = true)] + public string AuthenticationID { get; set; } + + /// + /// An human readable name describing the object. + /// + /// An human readable name describing the object. + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Date of last update (RFC3339 format). + /// + /// Date of last update (RFC3339 format). + [DataMember(Name = "updatedAt", IsRequired = true, EmitDefaultValue = true)] + public string UpdatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AuthenticationUpdateResponse {\n"); + sb.Append(" AuthenticationID: ").Append(AuthenticationID).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AuthenticationUpdateResponse); + } + + /// + /// Returns true if AuthenticationUpdateResponse instances are equal + /// + /// Instance of AuthenticationUpdateResponse to be compared + /// Boolean + public bool Equals(AuthenticationUpdateResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.AuthenticationID == input.AuthenticationID || + (this.AuthenticationID != null && + this.AuthenticationID.Equals(input.AuthenticationID)) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AuthenticationID != null) + { + hashCode = (hashCode * 59) + this.AuthenticationID.GetHashCode(); + } + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/BigCommerceChannel.cs b/algoliasearch/Ingestion/Models/BigCommerceChannel.cs new file mode 100644 index 000000000..b4d0ac966 --- /dev/null +++ b/algoliasearch/Ingestion/Models/BigCommerceChannel.cs @@ -0,0 +1,145 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// BigCommerceChannel + /// + [DataContract(Name = "BigCommerceChannel")] + public partial class BigCommerceChannel : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BigCommerceChannel() { } + /// + /// Initializes a new instance of the class. + /// + /// The ID of the bigcommerce channel. (required). + /// An array of currencies for the given channel `ID`, a currency is a trigram string that represents the currency code.. + public BigCommerceChannel(int id = default(int), List currencies = default(List)) + { + this.Id = id; + this.Currencies = currencies; + } + + /// + /// The ID of the bigcommerce channel. + /// + /// The ID of the bigcommerce channel. + [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)] + public int Id { get; set; } + + /// + /// An array of currencies for the given channel `ID`, a currency is a trigram string that represents the currency code. + /// + /// An array of currencies for the given channel `ID`, a currency is a trigram string that represents the currency code. + [DataMember(Name = "currencies", EmitDefaultValue = false)] + public List Currencies { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BigCommerceChannel {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Currencies: ").Append(Currencies).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BigCommerceChannel); + } + + /// + /// Returns true if BigCommerceChannel instances are equal + /// + /// Instance of BigCommerceChannel to be compared + /// Boolean + public bool Equals(BigCommerceChannel input) + { + if (input == null) + { + return false; + } + return + ( + this.Id == input.Id || + this.Id.Equals(input.Id) + ) && + ( + this.Currencies == input.Currencies || + this.Currencies != null && + input.Currencies != null && + this.Currencies.SequenceEqual(input.Currencies) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + if (this.Currencies != null) + { + hashCode = (hashCode * 59) + this.Currencies.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/BigCommerceMetafield.cs b/algoliasearch/Ingestion/Models/BigCommerceMetafield.cs new file mode 100644 index 000000000..a109959fc --- /dev/null +++ b/algoliasearch/Ingestion/Models/BigCommerceMetafield.cs @@ -0,0 +1,158 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// BigCommerceMetafield + /// + [DataContract(Name = "BigCommerceMetafield")] + public partial class BigCommerceMetafield : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BigCommerceMetafield() { } + /// + /// Initializes a new instance of the class. + /// + /// The namespace of the metafield. (required). + /// The key identifier of the metafield. (required). + public BigCommerceMetafield(string varNamespace = default(string), string key = default(string)) + { + // to ensure "varNamespace" is required (not null) + if (varNamespace == null) + { + throw new ArgumentNullException("varNamespace is a required property for BigCommerceMetafield and cannot be null"); + } + this.VarNamespace = varNamespace; + // to ensure "key" is required (not null) + if (key == null) + { + throw new ArgumentNullException("key is a required property for BigCommerceMetafield and cannot be null"); + } + this.Key = key; + } + + /// + /// The namespace of the metafield. + /// + /// The namespace of the metafield. + [DataMember(Name = "namespace", IsRequired = true, EmitDefaultValue = true)] + public string VarNamespace { get; set; } + + /// + /// The key identifier of the metafield. + /// + /// The key identifier of the metafield. + [DataMember(Name = "key", IsRequired = true, EmitDefaultValue = true)] + public string Key { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BigCommerceMetafield {\n"); + sb.Append(" VarNamespace: ").Append(VarNamespace).Append("\n"); + sb.Append(" Key: ").Append(Key).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BigCommerceMetafield); + } + + /// + /// Returns true if BigCommerceMetafield instances are equal + /// + /// Instance of BigCommerceMetafield to be compared + /// Boolean + public bool Equals(BigCommerceMetafield input) + { + if (input == null) + { + return false; + } + return + ( + this.VarNamespace == input.VarNamespace || + (this.VarNamespace != null && + this.VarNamespace.Equals(input.VarNamespace)) + ) && + ( + this.Key == input.Key || + (this.Key != null && + this.Key.Equals(input.Key)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.VarNamespace != null) + { + hashCode = (hashCode * 59) + this.VarNamespace.GetHashCode(); + } + if (this.Key != null) + { + hashCode = (hashCode * 59) + this.Key.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/BigQueryDataType.cs b/algoliasearch/Ingestion/Models/BigQueryDataType.cs new file mode 100644 index 000000000..2714308c2 --- /dev/null +++ b/algoliasearch/Ingestion/Models/BigQueryDataType.cs @@ -0,0 +1,42 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Defines BigQueryDataType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum BigQueryDataType + { + /// + /// Enum Ga4 for value: ga4 + /// + [EnumMember(Value = "ga4")] + Ga4 = 1, + + /// + /// Enum Ga360 for value: ga360 + /// + [EnumMember(Value = "ga360")] + Ga360 = 2 + } + +} diff --git a/algoliasearch/Ingestion/Models/DeleteResponse.cs b/algoliasearch/Ingestion/Models/DeleteResponse.cs new file mode 100644 index 000000000..bccb4c2df --- /dev/null +++ b/algoliasearch/Ingestion/Models/DeleteResponse.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// DeleteResponse + /// + [DataContract(Name = "DeleteResponse")] + public partial class DeleteResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DeleteResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Date of deletion (RFC3339 format). (required). + public DeleteResponse(string deletedAt = default(string)) + { + // to ensure "deletedAt" is required (not null) + if (deletedAt == null) + { + throw new ArgumentNullException("deletedAt is a required property for DeleteResponse and cannot be null"); + } + this.DeletedAt = deletedAt; + } + + /// + /// Date of deletion (RFC3339 format). + /// + /// Date of deletion (RFC3339 format). + [DataMember(Name = "deletedAt", IsRequired = true, EmitDefaultValue = true)] + public string DeletedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DeleteResponse {\n"); + sb.Append(" DeletedAt: ").Append(DeletedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DeleteResponse); + } + + /// + /// Returns true if DeleteResponse instances are equal + /// + /// Instance of DeleteResponse to be compared + /// Boolean + public bool Equals(DeleteResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.DeletedAt == input.DeletedAt || + (this.DeletedAt != null && + this.DeletedAt.Equals(input.DeletedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.DeletedAt != null) + { + hashCode = (hashCode * 59) + this.DeletedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/Destination.cs b/algoliasearch/Ingestion/Models/Destination.cs new file mode 100644 index 000000000..39a473b2d --- /dev/null +++ b/algoliasearch/Ingestion/Models/Destination.cs @@ -0,0 +1,256 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// A destination describe how the data is indexed on the Algolia side. + /// + [DataContract(Name = "Destination")] + public partial class Destination : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public DestinationType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Destination() { } + /// + /// Initializes a new instance of the class. + /// + /// The destination UUID. (required). + /// type (required). + /// An human readable name describing the object. (required). + /// input (required). + /// Date of creation (RFC3339 format). (required). + /// Date of last update (RFC3339 format).. + /// authenticationID. + public Destination(string destinationID = default(string), DestinationType type = default(DestinationType), string name = default(string), DestinationInput input = default(DestinationInput), string createdAt = default(string), string updatedAt = default(string), string authenticationID = default(string)) + { + // to ensure "destinationID" is required (not null) + if (destinationID == null) + { + throw new ArgumentNullException("destinationID is a required property for Destination and cannot be null"); + } + this.DestinationID = destinationID; + this.Type = type; + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for Destination and cannot be null"); + } + this.Name = name; + // to ensure "input" is required (not null) + if (input == null) + { + throw new ArgumentNullException("input is a required property for Destination and cannot be null"); + } + this.Input = input; + // to ensure "createdAt" is required (not null) + if (createdAt == null) + { + throw new ArgumentNullException("createdAt is a required property for Destination and cannot be null"); + } + this.CreatedAt = createdAt; + this.UpdatedAt = updatedAt; + this.AuthenticationID = authenticationID; + } + + /// + /// The destination UUID. + /// + /// The destination UUID. + [DataMember(Name = "destinationID", IsRequired = true, EmitDefaultValue = true)] + public string DestinationID { get; set; } + + /// + /// An human readable name describing the object. + /// + /// An human readable name describing the object. + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Gets or Sets Input + /// + [DataMember(Name = "input", IsRequired = true, EmitDefaultValue = true)] + public DestinationInput Input { get; set; } + + /// + /// Date of creation (RFC3339 format). + /// + /// Date of creation (RFC3339 format). + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public string CreatedAt { get; set; } + + /// + /// Date of last update (RFC3339 format). + /// + /// Date of last update (RFC3339 format). + [DataMember(Name = "updatedAt", EmitDefaultValue = false)] + public string UpdatedAt { get; set; } + + /// + /// Gets or Sets AuthenticationID + /// + [DataMember(Name = "authenticationID", EmitDefaultValue = false)] + public string AuthenticationID { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Destination {\n"); + sb.Append(" DestinationID: ").Append(DestinationID).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Input: ").Append(Input).Append("\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append(" AuthenticationID: ").Append(AuthenticationID).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Destination); + } + + /// + /// Returns true if Destination instances are equal + /// + /// Instance of Destination to be compared + /// Boolean + public bool Equals(Destination input) + { + if (input == null) + { + return false; + } + return + ( + this.DestinationID == input.DestinationID || + (this.DestinationID != null && + this.DestinationID.Equals(input.DestinationID)) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Input == input.Input || + (this.Input != null && + this.Input.Equals(input.Input)) + ) && + ( + this.CreatedAt == input.CreatedAt || + (this.CreatedAt != null && + this.CreatedAt.Equals(input.CreatedAt)) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ) && + ( + this.AuthenticationID == input.AuthenticationID || + (this.AuthenticationID != null && + this.AuthenticationID.Equals(input.AuthenticationID)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.DestinationID != null) + { + hashCode = (hashCode * 59) + this.DestinationID.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.Input != null) + { + hashCode = (hashCode * 59) + this.Input.GetHashCode(); + } + if (this.CreatedAt != null) + { + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + } + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + if (this.AuthenticationID != null) + { + hashCode = (hashCode * 59) + this.AuthenticationID.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/DestinationCreate.cs b/algoliasearch/Ingestion/Models/DestinationCreate.cs new file mode 100644 index 000000000..c6a1f2065 --- /dev/null +++ b/algoliasearch/Ingestion/Models/DestinationCreate.cs @@ -0,0 +1,190 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The payload when creating a destination. + /// + [DataContract(Name = "DestinationCreate")] + public partial class DestinationCreate : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public DestinationType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DestinationCreate() { } + /// + /// Initializes a new instance of the class. + /// + /// type (required). + /// An human readable name describing the object. (required). + /// input (required). + /// The authentication UUID.. + public DestinationCreate(DestinationType type = default(DestinationType), string name = default(string), DestinationInput input = default(DestinationInput), string authenticationID = default(string)) + { + this.Type = type; + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for DestinationCreate and cannot be null"); + } + this.Name = name; + // to ensure "input" is required (not null) + if (input == null) + { + throw new ArgumentNullException("input is a required property for DestinationCreate and cannot be null"); + } + this.Input = input; + this.AuthenticationID = authenticationID; + } + + /// + /// An human readable name describing the object. + /// + /// An human readable name describing the object. + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Gets or Sets Input + /// + [DataMember(Name = "input", IsRequired = true, EmitDefaultValue = true)] + public DestinationInput Input { get; set; } + + /// + /// The authentication UUID. + /// + /// The authentication UUID. + [DataMember(Name = "authenticationID", EmitDefaultValue = false)] + public string AuthenticationID { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DestinationCreate {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Input: ").Append(Input).Append("\n"); + sb.Append(" AuthenticationID: ").Append(AuthenticationID).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DestinationCreate); + } + + /// + /// Returns true if DestinationCreate instances are equal + /// + /// Instance of DestinationCreate to be compared + /// Boolean + public bool Equals(DestinationCreate input) + { + if (input == null) + { + return false; + } + return + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Input == input.Input || + (this.Input != null && + this.Input.Equals(input.Input)) + ) && + ( + this.AuthenticationID == input.AuthenticationID || + (this.AuthenticationID != null && + this.AuthenticationID.Equals(input.AuthenticationID)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.Input != null) + { + hashCode = (hashCode * 59) + this.Input.GetHashCode(); + } + if (this.AuthenticationID != null) + { + hashCode = (hashCode * 59) + this.AuthenticationID.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/DestinationCreateResponse.cs b/algoliasearch/Ingestion/Models/DestinationCreateResponse.cs new file mode 100644 index 000000000..a30f5ccd6 --- /dev/null +++ b/algoliasearch/Ingestion/Models/DestinationCreateResponse.cs @@ -0,0 +1,182 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Response from the API when the Destination is successfully created. + /// + [DataContract(Name = "DestinationCreateResponse")] + public partial class DestinationCreateResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DestinationCreateResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// The destination UUID. (required). + /// An human readable name describing the object. (required). + /// Date of creation (RFC3339 format). (required). + public DestinationCreateResponse(string destinationID = default(string), string name = default(string), string createdAt = default(string)) + { + // to ensure "destinationID" is required (not null) + if (destinationID == null) + { + throw new ArgumentNullException("destinationID is a required property for DestinationCreateResponse and cannot be null"); + } + this.DestinationID = destinationID; + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for DestinationCreateResponse and cannot be null"); + } + this.Name = name; + // to ensure "createdAt" is required (not null) + if (createdAt == null) + { + throw new ArgumentNullException("createdAt is a required property for DestinationCreateResponse and cannot be null"); + } + this.CreatedAt = createdAt; + } + + /// + /// The destination UUID. + /// + /// The destination UUID. + [DataMember(Name = "destinationID", IsRequired = true, EmitDefaultValue = true)] + public string DestinationID { get; set; } + + /// + /// An human readable name describing the object. + /// + /// An human readable name describing the object. + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Date of creation (RFC3339 format). + /// + /// Date of creation (RFC3339 format). + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public string CreatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DestinationCreateResponse {\n"); + sb.Append(" DestinationID: ").Append(DestinationID).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DestinationCreateResponse); + } + + /// + /// Returns true if DestinationCreateResponse instances are equal + /// + /// Instance of DestinationCreateResponse to be compared + /// Boolean + public bool Equals(DestinationCreateResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.DestinationID == input.DestinationID || + (this.DestinationID != null && + this.DestinationID.Equals(input.DestinationID)) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.CreatedAt == input.CreatedAt || + (this.CreatedAt != null && + this.CreatedAt.Equals(input.CreatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.DestinationID != null) + { + hashCode = (hashCode * 59) + this.DestinationID.GetHashCode(); + } + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.CreatedAt != null) + { + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/DestinationIndexName.cs b/algoliasearch/Ingestion/Models/DestinationIndexName.cs new file mode 100644 index 000000000..1221ac097 --- /dev/null +++ b/algoliasearch/Ingestion/Models/DestinationIndexName.cs @@ -0,0 +1,168 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// DestinationIndexName + /// + [DataContract(Name = "DestinationIndexName")] + public partial class DestinationIndexName : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets RecordType + /// + [DataMember(Name = "recordType", EmitDefaultValue = false)] + public RecordType? RecordType { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DestinationIndexName() { } + /// + /// Initializes a new instance of the class. + /// + /// The index name to store data in. (required). + /// recordType. + /// Determines the attributes to exclude from an Algolia record. To remove nested element, you can separate the path to the element with dots (`.`): - \"foo.bar\": will remove `bar` from `foo`. To remove elements from an array, you can use the following: - \"foo.[0].bar\": will only remove `bar` from the first element of `foo`. - \"foo.[*].bar\": will remove `bar` from every elements of `foo`. . + public DestinationIndexName(string indexName = default(string), RecordType? recordType = default(RecordType?), List attributesToExclude = default(List)) + { + // to ensure "indexName" is required (not null) + if (indexName == null) + { + throw new ArgumentNullException("indexName is a required property for DestinationIndexName and cannot be null"); + } + this.IndexName = indexName; + this.RecordType = recordType; + this.AttributesToExclude = attributesToExclude; + } + + /// + /// The index name to store data in. + /// + /// The index name to store data in. + [DataMember(Name = "indexName", IsRequired = true, EmitDefaultValue = true)] + public string IndexName { get; set; } + + /// + /// Determines the attributes to exclude from an Algolia record. To remove nested element, you can separate the path to the element with dots (`.`): - \"foo.bar\": will remove `bar` from `foo`. To remove elements from an array, you can use the following: - \"foo.[0].bar\": will only remove `bar` from the first element of `foo`. - \"foo.[*].bar\": will remove `bar` from every elements of `foo`. + /// + /// Determines the attributes to exclude from an Algolia record. To remove nested element, you can separate the path to the element with dots (`.`): - \"foo.bar\": will remove `bar` from `foo`. To remove elements from an array, you can use the following: - \"foo.[0].bar\": will only remove `bar` from the first element of `foo`. - \"foo.[*].bar\": will remove `bar` from every elements of `foo`. + [DataMember(Name = "attributesToExclude", EmitDefaultValue = false)] + public List AttributesToExclude { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DestinationIndexName {\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append(" RecordType: ").Append(RecordType).Append("\n"); + sb.Append(" AttributesToExclude: ").Append(AttributesToExclude).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DestinationIndexName); + } + + /// + /// Returns true if DestinationIndexName instances are equal + /// + /// Instance of DestinationIndexName to be compared + /// Boolean + public bool Equals(DestinationIndexName input) + { + if (input == null) + { + return false; + } + return + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ) && + ( + this.RecordType == input.RecordType || + this.RecordType.Equals(input.RecordType) + ) && + ( + this.AttributesToExclude == input.AttributesToExclude || + this.AttributesToExclude != null && + input.AttributesToExclude != null && + this.AttributesToExclude.SequenceEqual(input.AttributesToExclude) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RecordType.GetHashCode(); + if (this.AttributesToExclude != null) + { + hashCode = (hashCode * 59) + this.AttributesToExclude.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/DestinationIndexPrefix.cs b/algoliasearch/Ingestion/Models/DestinationIndexPrefix.cs new file mode 100644 index 000000000..4dd089d25 --- /dev/null +++ b/algoliasearch/Ingestion/Models/DestinationIndexPrefix.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// DestinationIndexPrefix + /// + [DataContract(Name = "DestinationIndexPrefix")] + public partial class DestinationIndexPrefix : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DestinationIndexPrefix() { } + /// + /// Initializes a new instance of the class. + /// + /// The prefix of the final index name. (required). + public DestinationIndexPrefix(string indexPrefix = default(string)) + { + // to ensure "indexPrefix" is required (not null) + if (indexPrefix == null) + { + throw new ArgumentNullException("indexPrefix is a required property for DestinationIndexPrefix and cannot be null"); + } + this.IndexPrefix = indexPrefix; + } + + /// + /// The prefix of the final index name. + /// + /// The prefix of the final index name. + [DataMember(Name = "indexPrefix", IsRequired = true, EmitDefaultValue = true)] + public string IndexPrefix { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DestinationIndexPrefix {\n"); + sb.Append(" IndexPrefix: ").Append(IndexPrefix).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DestinationIndexPrefix); + } + + /// + /// Returns true if DestinationIndexPrefix instances are equal + /// + /// Instance of DestinationIndexPrefix to be compared + /// Boolean + public bool Equals(DestinationIndexPrefix input) + { + if (input == null) + { + return false; + } + return + ( + this.IndexPrefix == input.IndexPrefix || + (this.IndexPrefix != null && + this.IndexPrefix.Equals(input.IndexPrefix)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.IndexPrefix != null) + { + hashCode = (hashCode * 59) + this.IndexPrefix.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/DestinationInput.cs b/algoliasearch/Ingestion/Models/DestinationInput.cs new file mode 100644 index 000000000..8b21485c0 --- /dev/null +++ b/algoliasearch/Ingestion/Models/DestinationInput.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// DestinationInput + /// + [JsonConverter(typeof(DestinationInputJsonConverter))] + [DataContract(Name = "DestinationInput")] + public partial class DestinationInput : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of DestinationIndexPrefix. + public DestinationInput(DestinationIndexPrefix actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of DestinationIndexName. + public DestinationInput(DestinationIndexName actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(DestinationIndexName)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(DestinationIndexPrefix)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: DestinationIndexName, DestinationIndexPrefix"); + } + } + } + + /// + /// Get the actual instance of `DestinationIndexPrefix`. If the actual instance is not `DestinationIndexPrefix`, + /// the InvalidClassException will be thrown + /// + /// An instance of DestinationIndexPrefix + public DestinationIndexPrefix GetterDestinationIndexPrefix() + { + return (DestinationIndexPrefix)this.ActualInstance; + } + + /// + /// Get the actual instance of `DestinationIndexName`. If the actual instance is not `DestinationIndexName`, + /// the InvalidClassException will be thrown + /// + /// An instance of DestinationIndexName + public DestinationIndexName GetterDestinationIndexName() + { + return (DestinationIndexName)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class DestinationInput {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, DestinationInput.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of DestinationInput + /// + /// JSON string + /// An instance of DestinationInput + public static DestinationInput FromJson(string jsonString) + { + DestinationInput newDestinationInput = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newDestinationInput; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(DestinationIndexName).GetProperty("AdditionalProperties") == null) + { + newDestinationInput = new DestinationInput(JsonConvert.DeserializeObject(jsonString, DestinationInput.SerializerSettings)); + } + else + { + newDestinationInput = new DestinationInput(JsonConvert.DeserializeObject(jsonString, DestinationInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("DestinationIndexName"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into DestinationIndexName: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(DestinationIndexPrefix).GetProperty("AdditionalProperties") == null) + { + newDestinationInput = new DestinationInput(JsonConvert.DeserializeObject(jsonString, DestinationInput.SerializerSettings)); + } + else + { + newDestinationInput = new DestinationInput(JsonConvert.DeserializeObject(jsonString, DestinationInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("DestinationIndexPrefix"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into DestinationIndexPrefix: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newDestinationInput; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DestinationInput); + } + + /// + /// Returns true if DestinationInput instances are equal + /// + /// Instance of DestinationInput to be compared + /// Boolean + public bool Equals(DestinationInput input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for DestinationInput + /// + public class DestinationInputJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(DestinationInput).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return DestinationInput.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/DestinationSearch.cs b/algoliasearch/Ingestion/Models/DestinationSearch.cs new file mode 100644 index 000000000..132d8feb2 --- /dev/null +++ b/algoliasearch/Ingestion/Models/DestinationSearch.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Payload to search for multiple destinations, based on the given `destinationIDs`. + /// + [DataContract(Name = "DestinationSearch")] + public partial class DestinationSearch : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DestinationSearch() { } + /// + /// Initializes a new instance of the class. + /// + /// destinationIDs (required). + public DestinationSearch(List destinationIDs = default(List)) + { + // to ensure "destinationIDs" is required (not null) + if (destinationIDs == null) + { + throw new ArgumentNullException("destinationIDs is a required property for DestinationSearch and cannot be null"); + } + this.DestinationIDs = destinationIDs; + } + + /// + /// Gets or Sets DestinationIDs + /// + [DataMember(Name = "destinationIDs", IsRequired = true, EmitDefaultValue = true)] + public List DestinationIDs { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DestinationSearch {\n"); + sb.Append(" DestinationIDs: ").Append(DestinationIDs).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DestinationSearch); + } + + /// + /// Returns true if DestinationSearch instances are equal + /// + /// Instance of DestinationSearch to be compared + /// Boolean + public bool Equals(DestinationSearch input) + { + if (input == null) + { + return false; + } + return + ( + this.DestinationIDs == input.DestinationIDs || + this.DestinationIDs != null && + input.DestinationIDs != null && + this.DestinationIDs.SequenceEqual(input.DestinationIDs) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.DestinationIDs != null) + { + hashCode = (hashCode * 59) + this.DestinationIDs.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/DestinationSortKeys.cs b/algoliasearch/Ingestion/Models/DestinationSortKeys.cs new file mode 100644 index 000000000..4652d9a2f --- /dev/null +++ b/algoliasearch/Ingestion/Models/DestinationSortKeys.cs @@ -0,0 +1,55 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Used to sort the Destination list endpoint. + /// + /// Used to sort the Destination list endpoint. + [JsonConverter(typeof(StringEnumConverter))] + public enum DestinationSortKeys + { + /// + /// Enum Name for value: name + /// + [EnumMember(Value = "name")] + Name = 1, + + /// + /// Enum Type for value: type + /// + [EnumMember(Value = "type")] + Type = 2, + + /// + /// Enum UpdatedAt for value: updatedAt + /// + [EnumMember(Value = "updatedAt")] + UpdatedAt = 3, + + /// + /// Enum CreatedAt for value: createdAt + /// + [EnumMember(Value = "createdAt")] + CreatedAt = 4 + } + +} diff --git a/algoliasearch/Ingestion/Models/DestinationType.cs b/algoliasearch/Ingestion/Models/DestinationType.cs new file mode 100644 index 000000000..f047fdd01 --- /dev/null +++ b/algoliasearch/Ingestion/Models/DestinationType.cs @@ -0,0 +1,49 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Type of the Destination, defines in which Algolia product the data will be stored. + /// + /// Type of the Destination, defines in which Algolia product the data will be stored. + [JsonConverter(typeof(StringEnumConverter))] + public enum DestinationType + { + /// + /// Enum Search for value: search + /// + [EnumMember(Value = "search")] + Search = 1, + + /// + /// Enum Insights for value: insights + /// + [EnumMember(Value = "insights")] + Insights = 2, + + /// + /// Enum Flow for value: flow + /// + [EnumMember(Value = "flow")] + Flow = 3 + } + +} diff --git a/algoliasearch/Ingestion/Models/DestinationUpdate.cs b/algoliasearch/Ingestion/Models/DestinationUpdate.cs new file mode 100644 index 000000000..4740096da --- /dev/null +++ b/algoliasearch/Ingestion/Models/DestinationUpdate.cs @@ -0,0 +1,174 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Payload to partially update a Destination. + /// + [DataContract(Name = "DestinationUpdate")] + public partial class DestinationUpdate : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", EmitDefaultValue = false)] + public DestinationType? Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// type. + /// An human readable name describing the object.. + /// input. + /// authenticationID. + public DestinationUpdate(DestinationType? type = default(DestinationType?), string name = default(string), DestinationInput input = default(DestinationInput), string authenticationID = default(string)) + { + this.Type = type; + this.Name = name; + this.Input = input; + this.AuthenticationID = authenticationID; + } + + /// + /// An human readable name describing the object. + /// + /// An human readable name describing the object. + [DataMember(Name = "name", EmitDefaultValue = false)] + public string Name { get; set; } + + /// + /// Gets or Sets Input + /// + [DataMember(Name = "input", EmitDefaultValue = false)] + public DestinationInput Input { get; set; } + + /// + /// Gets or Sets AuthenticationID + /// + [DataMember(Name = "authenticationID", EmitDefaultValue = false)] + public string AuthenticationID { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DestinationUpdate {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Input: ").Append(Input).Append("\n"); + sb.Append(" AuthenticationID: ").Append(AuthenticationID).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DestinationUpdate); + } + + /// + /// Returns true if DestinationUpdate instances are equal + /// + /// Instance of DestinationUpdate to be compared + /// Boolean + public bool Equals(DestinationUpdate input) + { + if (input == null) + { + return false; + } + return + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Input == input.Input || + (this.Input != null && + this.Input.Equals(input.Input)) + ) && + ( + this.AuthenticationID == input.AuthenticationID || + (this.AuthenticationID != null && + this.AuthenticationID.Equals(input.AuthenticationID)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.Input != null) + { + hashCode = (hashCode * 59) + this.Input.GetHashCode(); + } + if (this.AuthenticationID != null) + { + hashCode = (hashCode * 59) + this.AuthenticationID.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/DestinationUpdateResponse.cs b/algoliasearch/Ingestion/Models/DestinationUpdateResponse.cs new file mode 100644 index 000000000..65680eb47 --- /dev/null +++ b/algoliasearch/Ingestion/Models/DestinationUpdateResponse.cs @@ -0,0 +1,182 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Response from the API when the Destination is successfully updated. + /// + [DataContract(Name = "DestinationUpdateResponse")] + public partial class DestinationUpdateResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DestinationUpdateResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// The destination UUID. (required). + /// An human readable name describing the object. (required). + /// Date of last update (RFC3339 format). (required). + public DestinationUpdateResponse(string destinationID = default(string), string name = default(string), string updatedAt = default(string)) + { + // to ensure "destinationID" is required (not null) + if (destinationID == null) + { + throw new ArgumentNullException("destinationID is a required property for DestinationUpdateResponse and cannot be null"); + } + this.DestinationID = destinationID; + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for DestinationUpdateResponse and cannot be null"); + } + this.Name = name; + // to ensure "updatedAt" is required (not null) + if (updatedAt == null) + { + throw new ArgumentNullException("updatedAt is a required property for DestinationUpdateResponse and cannot be null"); + } + this.UpdatedAt = updatedAt; + } + + /// + /// The destination UUID. + /// + /// The destination UUID. + [DataMember(Name = "destinationID", IsRequired = true, EmitDefaultValue = true)] + public string DestinationID { get; set; } + + /// + /// An human readable name describing the object. + /// + /// An human readable name describing the object. + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Date of last update (RFC3339 format). + /// + /// Date of last update (RFC3339 format). + [DataMember(Name = "updatedAt", IsRequired = true, EmitDefaultValue = true)] + public string UpdatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DestinationUpdateResponse {\n"); + sb.Append(" DestinationID: ").Append(DestinationID).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DestinationUpdateResponse); + } + + /// + /// Returns true if DestinationUpdateResponse instances are equal + /// + /// Instance of DestinationUpdateResponse to be compared + /// Boolean + public bool Equals(DestinationUpdateResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.DestinationID == input.DestinationID || + (this.DestinationID != null && + this.DestinationID.Equals(input.DestinationID)) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.DestinationID != null) + { + hashCode = (hashCode * 59) + this.DestinationID.GetHashCode(); + } + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/DockerImageType.cs b/algoliasearch/Ingestion/Models/DockerImageType.cs new file mode 100644 index 000000000..a5a5bc547 --- /dev/null +++ b/algoliasearch/Ingestion/Models/DockerImageType.cs @@ -0,0 +1,49 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The type of the image. + /// + /// The type of the image. + [JsonConverter(typeof(StringEnumConverter))] + public enum DockerImageType + { + /// + /// Enum Singer for value: singer + /// + [EnumMember(Value = "singer")] + Singer = 1, + + /// + /// Enum Custom for value: custom + /// + [EnumMember(Value = "custom")] + Custom = 2, + + /// + /// Enum Airbyte for value: airbyte + /// + [EnumMember(Value = "airbyte")] + Airbyte = 3 + } + +} diff --git a/algoliasearch/Ingestion/Models/DockerRegistry.cs b/algoliasearch/Ingestion/Models/DockerRegistry.cs new file mode 100644 index 000000000..ddc78e172 --- /dev/null +++ b/algoliasearch/Ingestion/Models/DockerRegistry.cs @@ -0,0 +1,43 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The registry where the image is stored. + /// + /// The registry where the image is stored. + [JsonConverter(typeof(StringEnumConverter))] + public enum DockerRegistry + { + /// + /// Enum Dockerhub for value: dockerhub + /// + [EnumMember(Value = "dockerhub")] + Dockerhub = 1, + + /// + /// Enum Ghcr for value: ghcr + /// + [EnumMember(Value = "ghcr")] + Ghcr = 2 + } + +} diff --git a/algoliasearch/Ingestion/Models/DockerSourceDiscover.cs b/algoliasearch/Ingestion/Models/DockerSourceDiscover.cs new file mode 100644 index 000000000..c701542e0 --- /dev/null +++ b/algoliasearch/Ingestion/Models/DockerSourceDiscover.cs @@ -0,0 +1,158 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// DockerSourceDiscover + /// + [DataContract(Name = "dockerSourceDiscover")] + public partial class DockerSourceDiscover : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DockerSourceDiscover() { } + /// + /// Initializes a new instance of the class. + /// + /// The run UUID. (required). + /// Date of creation (RFC3339 format). (required). + public DockerSourceDiscover(string runID = default(string), string createdAt = default(string)) + { + // to ensure "runID" is required (not null) + if (runID == null) + { + throw new ArgumentNullException("runID is a required property for DockerSourceDiscover and cannot be null"); + } + this.RunID = runID; + // to ensure "createdAt" is required (not null) + if (createdAt == null) + { + throw new ArgumentNullException("createdAt is a required property for DockerSourceDiscover and cannot be null"); + } + this.CreatedAt = createdAt; + } + + /// + /// The run UUID. + /// + /// The run UUID. + [DataMember(Name = "runID", IsRequired = true, EmitDefaultValue = true)] + public string RunID { get; set; } + + /// + /// Date of creation (RFC3339 format). + /// + /// Date of creation (RFC3339 format). + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public string CreatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DockerSourceDiscover {\n"); + sb.Append(" RunID: ").Append(RunID).Append("\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DockerSourceDiscover); + } + + /// + /// Returns true if DockerSourceDiscover instances are equal + /// + /// Instance of DockerSourceDiscover to be compared + /// Boolean + public bool Equals(DockerSourceDiscover input) + { + if (input == null) + { + return false; + } + return + ( + this.RunID == input.RunID || + (this.RunID != null && + this.RunID.Equals(input.RunID)) + ) && + ( + this.CreatedAt == input.CreatedAt || + (this.CreatedAt != null && + this.CreatedAt.Equals(input.CreatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RunID != null) + { + hashCode = (hashCode * 59) + this.RunID.GetHashCode(); + } + if (this.CreatedAt != null) + { + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/DockerSourceStreams.cs b/algoliasearch/Ingestion/Models/DockerSourceStreams.cs new file mode 100644 index 000000000..043986846 --- /dev/null +++ b/algoliasearch/Ingestion/Models/DockerSourceStreams.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// DockerSourceStreams + /// + [DataContract(Name = "dockerSourceStreams")] + public partial class DockerSourceStreams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DockerSourceStreams() { } + /// + /// Initializes a new instance of the class. + /// + /// streams (required). + public DockerSourceStreams(List streams = default(List)) + { + // to ensure "streams" is required (not null) + if (streams == null) + { + throw new ArgumentNullException("streams is a required property for DockerSourceStreams and cannot be null"); + } + this.Streams = streams; + } + + /// + /// Gets or Sets Streams + /// + [DataMember(Name = "streams", IsRequired = true, EmitDefaultValue = true)] + public List Streams { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DockerSourceStreams {\n"); + sb.Append(" Streams: ").Append(Streams).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DockerSourceStreams); + } + + /// + /// Returns true if DockerSourceStreams instances are equal + /// + /// Instance of DockerSourceStreams to be compared + /// Boolean + public bool Equals(DockerSourceStreams input) + { + if (input == null) + { + return false; + } + return + ( + this.Streams == input.Streams || + this.Streams != null && + input.Streams != null && + this.Streams.SequenceEqual(input.Streams) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Streams != null) + { + hashCode = (hashCode * 59) + this.Streams.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/ErrorBase.cs b/algoliasearch/Ingestion/Models/ErrorBase.cs new file mode 100644 index 000000000..f88775dcf --- /dev/null +++ b/algoliasearch/Ingestion/Models/ErrorBase.cs @@ -0,0 +1,147 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Error. + /// + [DataContract(Name = "ErrorBase")] + public partial class ErrorBase : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// message. + public ErrorBase(string message = default(string)) : base() + { + this.Message = message; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Message + /// + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ErrorBase {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ErrorBase); + } + + /// + /// Returns true if ErrorBase instances are equal + /// + /// Instance of ErrorBase to be compared + /// Boolean + public bool Equals(ErrorBase input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/Event.cs b/algoliasearch/Ingestion/Models/Event.cs new file mode 100644 index 000000000..7677e7a13 --- /dev/null +++ b/algoliasearch/Ingestion/Models/Event.cs @@ -0,0 +1,269 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// An event describe a step of the task execution flow.. + /// + [DataContract(Name = "Event")] + public partial class Event : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Status + /// + [DataMember(Name = "status", IsRequired = true, EmitDefaultValue = true)] + public EventStatus Status { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public EventType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Event() { } + /// + /// Initializes a new instance of the class. + /// + /// The event UUID. (required). + /// The run UUID. (required). + /// The parent event, the cause of this event.. + /// status (required). + /// type (required). + /// The extracted record batch size. (required). + /// data. + /// Date of publish (RFC3339 format). (required). + public Event(string eventID = default(string), string runID = default(string), string parentID = default(string), EventStatus status = default(EventStatus), EventType type = default(EventType), int batchSize = default(int), Dictionary data = default(Dictionary), string publishedAt = default(string)) + { + // to ensure "eventID" is required (not null) + if (eventID == null) + { + throw new ArgumentNullException("eventID is a required property for Event and cannot be null"); + } + this.EventID = eventID; + // to ensure "runID" is required (not null) + if (runID == null) + { + throw new ArgumentNullException("runID is a required property for Event and cannot be null"); + } + this.RunID = runID; + this.Status = status; + this.Type = type; + this.BatchSize = batchSize; + // to ensure "publishedAt" is required (not null) + if (publishedAt == null) + { + throw new ArgumentNullException("publishedAt is a required property for Event and cannot be null"); + } + this.PublishedAt = publishedAt; + this.ParentID = parentID; + this.Data = data; + } + + /// + /// The event UUID. + /// + /// The event UUID. + [DataMember(Name = "eventID", IsRequired = true, EmitDefaultValue = true)] + public string EventID { get; set; } + + /// + /// The run UUID. + /// + /// The run UUID. + [DataMember(Name = "runID", IsRequired = true, EmitDefaultValue = true)] + public string RunID { get; set; } + + /// + /// The parent event, the cause of this event. + /// + /// The parent event, the cause of this event. + [DataMember(Name = "parentID", EmitDefaultValue = false)] + public string ParentID { get; set; } + + /// + /// The extracted record batch size. + /// + /// The extracted record batch size. + [DataMember(Name = "batchSize", IsRequired = true, EmitDefaultValue = true)] + public int BatchSize { get; set; } + + /// + /// Gets or Sets Data + /// + [DataMember(Name = "data", EmitDefaultValue = false)] + public Dictionary Data { get; set; } + + /// + /// Date of publish (RFC3339 format). + /// + /// Date of publish (RFC3339 format). + [DataMember(Name = "publishedAt", IsRequired = true, EmitDefaultValue = true)] + public string PublishedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Event {\n"); + sb.Append(" EventID: ").Append(EventID).Append("\n"); + sb.Append(" RunID: ").Append(RunID).Append("\n"); + sb.Append(" ParentID: ").Append(ParentID).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" BatchSize: ").Append(BatchSize).Append("\n"); + sb.Append(" Data: ").Append(Data).Append("\n"); + sb.Append(" PublishedAt: ").Append(PublishedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Event); + } + + /// + /// Returns true if Event instances are equal + /// + /// Instance of Event to be compared + /// Boolean + public bool Equals(Event input) + { + if (input == null) + { + return false; + } + return + ( + this.EventID == input.EventID || + (this.EventID != null && + this.EventID.Equals(input.EventID)) + ) && + ( + this.RunID == input.RunID || + (this.RunID != null && + this.RunID.Equals(input.RunID)) + ) && + ( + this.ParentID == input.ParentID || + (this.ParentID != null && + this.ParentID.Equals(input.ParentID)) + ) && + ( + this.Status == input.Status || + this.Status.Equals(input.Status) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.BatchSize == input.BatchSize || + this.BatchSize.Equals(input.BatchSize) + ) && + ( + this.Data == input.Data || + this.Data != null && + input.Data != null && + this.Data.SequenceEqual(input.Data) + ) && + ( + this.PublishedAt == input.PublishedAt || + (this.PublishedAt != null && + this.PublishedAt.Equals(input.PublishedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EventID != null) + { + hashCode = (hashCode * 59) + this.EventID.GetHashCode(); + } + if (this.RunID != null) + { + hashCode = (hashCode * 59) + this.RunID.GetHashCode(); + } + if (this.ParentID != null) + { + hashCode = (hashCode * 59) + this.ParentID.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Status.GetHashCode(); + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + hashCode = (hashCode * 59) + this.BatchSize.GetHashCode(); + if (this.Data != null) + { + hashCode = (hashCode * 59) + this.Data.GetHashCode(); + } + if (this.PublishedAt != null) + { + hashCode = (hashCode * 59) + this.PublishedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // BatchSize (int) minimum + if (this.BatchSize < (int)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for BatchSize, must be a value greater than or equal to 0.", new[] { "BatchSize" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/EventSortKeys.cs b/algoliasearch/Ingestion/Models/EventSortKeys.cs new file mode 100644 index 000000000..df52d7470 --- /dev/null +++ b/algoliasearch/Ingestion/Models/EventSortKeys.cs @@ -0,0 +1,49 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Used to sort the Event list endpoint. + /// + /// Used to sort the Event list endpoint. + [JsonConverter(typeof(StringEnumConverter))] + public enum EventSortKeys + { + /// + /// Enum Status for value: status + /// + [EnumMember(Value = "status")] + Status = 1, + + /// + /// Enum Type for value: type + /// + [EnumMember(Value = "type")] + Type = 2, + + /// + /// Enum PublishedAt for value: publishedAt + /// + [EnumMember(Value = "publishedAt")] + PublishedAt = 3 + } + +} diff --git a/algoliasearch/Ingestion/Models/EventStatus.cs b/algoliasearch/Ingestion/Models/EventStatus.cs new file mode 100644 index 000000000..efe558556 --- /dev/null +++ b/algoliasearch/Ingestion/Models/EventStatus.cs @@ -0,0 +1,66 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Defines EventStatus + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EventStatus + { + /// + /// Enum Created for value: created + /// + [EnumMember(Value = "created")] + Created = 1, + + /// + /// Enum Started for value: started + /// + [EnumMember(Value = "started")] + Started = 2, + + /// + /// Enum Retried for value: retried + /// + [EnumMember(Value = "retried")] + Retried = 3, + + /// + /// Enum Failed for value: failed + /// + [EnumMember(Value = "failed")] + Failed = 4, + + /// + /// Enum Succeeded for value: succeeded + /// + [EnumMember(Value = "succeeded")] + Succeeded = 5, + + /// + /// Enum Critical for value: critical + /// + [EnumMember(Value = "critical")] + Critical = 6 + } + +} diff --git a/algoliasearch/Ingestion/Models/EventType.cs b/algoliasearch/Ingestion/Models/EventType.cs new file mode 100644 index 000000000..02dc4829f --- /dev/null +++ b/algoliasearch/Ingestion/Models/EventType.cs @@ -0,0 +1,54 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Defines EventType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EventType + { + /// + /// Enum Fetch for value: fetch + /// + [EnumMember(Value = "fetch")] + Fetch = 1, + + /// + /// Enum Record for value: record + /// + [EnumMember(Value = "record")] + Record = 2, + + /// + /// Enum Log for value: log + /// + [EnumMember(Value = "log")] + Log = 3, + + /// + /// Enum Transform for value: transform + /// + [EnumMember(Value = "transform")] + Transform = 4 + } + +} diff --git a/algoliasearch/Ingestion/Models/ListAuthenticationsResponse.cs b/algoliasearch/Ingestion/Models/ListAuthenticationsResponse.cs new file mode 100644 index 000000000..fccc28767 --- /dev/null +++ b/algoliasearch/Ingestion/Models/ListAuthenticationsResponse.cs @@ -0,0 +1,157 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// ListAuthenticationsResponse + /// + [DataContract(Name = "listAuthenticationsResponse")] + public partial class ListAuthenticationsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ListAuthenticationsResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// authentications (required). + /// pagination (required). + public ListAuthenticationsResponse(List authentications = default(List), Pagination pagination = default(Pagination)) + { + // to ensure "authentications" is required (not null) + if (authentications == null) + { + throw new ArgumentNullException("authentications is a required property for ListAuthenticationsResponse and cannot be null"); + } + this.Authentications = authentications; + // to ensure "pagination" is required (not null) + if (pagination == null) + { + throw new ArgumentNullException("pagination is a required property for ListAuthenticationsResponse and cannot be null"); + } + this.Pagination = pagination; + } + + /// + /// Gets or Sets Authentications + /// + [DataMember(Name = "authentications", IsRequired = true, EmitDefaultValue = true)] + public List Authentications { get; set; } + + /// + /// Gets or Sets Pagination + /// + [DataMember(Name = "pagination", IsRequired = true, EmitDefaultValue = true)] + public Pagination Pagination { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ListAuthenticationsResponse {\n"); + sb.Append(" Authentications: ").Append(Authentications).Append("\n"); + sb.Append(" Pagination: ").Append(Pagination).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ListAuthenticationsResponse); + } + + /// + /// Returns true if ListAuthenticationsResponse instances are equal + /// + /// Instance of ListAuthenticationsResponse to be compared + /// Boolean + public bool Equals(ListAuthenticationsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Authentications == input.Authentications || + this.Authentications != null && + input.Authentications != null && + this.Authentications.SequenceEqual(input.Authentications) + ) && + ( + this.Pagination == input.Pagination || + (this.Pagination != null && + this.Pagination.Equals(input.Pagination)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Authentications != null) + { + hashCode = (hashCode * 59) + this.Authentications.GetHashCode(); + } + if (this.Pagination != null) + { + hashCode = (hashCode * 59) + this.Pagination.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/ListDestinationsResponse.cs b/algoliasearch/Ingestion/Models/ListDestinationsResponse.cs new file mode 100644 index 000000000..5895cbdc7 --- /dev/null +++ b/algoliasearch/Ingestion/Models/ListDestinationsResponse.cs @@ -0,0 +1,157 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// ListDestinationsResponse + /// + [DataContract(Name = "listDestinationsResponse")] + public partial class ListDestinationsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ListDestinationsResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// destinations (required). + /// pagination (required). + public ListDestinationsResponse(List destinations = default(List), Pagination pagination = default(Pagination)) + { + // to ensure "destinations" is required (not null) + if (destinations == null) + { + throw new ArgumentNullException("destinations is a required property for ListDestinationsResponse and cannot be null"); + } + this.Destinations = destinations; + // to ensure "pagination" is required (not null) + if (pagination == null) + { + throw new ArgumentNullException("pagination is a required property for ListDestinationsResponse and cannot be null"); + } + this.Pagination = pagination; + } + + /// + /// Gets or Sets Destinations + /// + [DataMember(Name = "destinations", IsRequired = true, EmitDefaultValue = true)] + public List Destinations { get; set; } + + /// + /// Gets or Sets Pagination + /// + [DataMember(Name = "pagination", IsRequired = true, EmitDefaultValue = true)] + public Pagination Pagination { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ListDestinationsResponse {\n"); + sb.Append(" Destinations: ").Append(Destinations).Append("\n"); + sb.Append(" Pagination: ").Append(Pagination).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ListDestinationsResponse); + } + + /// + /// Returns true if ListDestinationsResponse instances are equal + /// + /// Instance of ListDestinationsResponse to be compared + /// Boolean + public bool Equals(ListDestinationsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Destinations == input.Destinations || + this.Destinations != null && + input.Destinations != null && + this.Destinations.SequenceEqual(input.Destinations) + ) && + ( + this.Pagination == input.Pagination || + (this.Pagination != null && + this.Pagination.Equals(input.Pagination)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Destinations != null) + { + hashCode = (hashCode * 59) + this.Destinations.GetHashCode(); + } + if (this.Pagination != null) + { + hashCode = (hashCode * 59) + this.Pagination.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/ListEventsResponse.cs b/algoliasearch/Ingestion/Models/ListEventsResponse.cs new file mode 100644 index 000000000..ec3f82698 --- /dev/null +++ b/algoliasearch/Ingestion/Models/ListEventsResponse.cs @@ -0,0 +1,180 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// ListEventsResponse + /// + [DataContract(Name = "listEventsResponse")] + public partial class ListEventsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ListEventsResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// events (required). + /// pagination (required). + /// window (required). + public ListEventsResponse(List events = default(List), Pagination pagination = default(Pagination), Window window = default(Window)) + { + // to ensure "events" is required (not null) + if (events == null) + { + throw new ArgumentNullException("events is a required property for ListEventsResponse and cannot be null"); + } + this.Events = events; + // to ensure "pagination" is required (not null) + if (pagination == null) + { + throw new ArgumentNullException("pagination is a required property for ListEventsResponse and cannot be null"); + } + this.Pagination = pagination; + // to ensure "window" is required (not null) + if (window == null) + { + throw new ArgumentNullException("window is a required property for ListEventsResponse and cannot be null"); + } + this.Window = window; + } + + /// + /// Gets or Sets Events + /// + [DataMember(Name = "events", IsRequired = true, EmitDefaultValue = true)] + public List Events { get; set; } + + /// + /// Gets or Sets Pagination + /// + [DataMember(Name = "pagination", IsRequired = true, EmitDefaultValue = true)] + public Pagination Pagination { get; set; } + + /// + /// Gets or Sets Window + /// + [DataMember(Name = "window", IsRequired = true, EmitDefaultValue = true)] + public Window Window { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ListEventsResponse {\n"); + sb.Append(" Events: ").Append(Events).Append("\n"); + sb.Append(" Pagination: ").Append(Pagination).Append("\n"); + sb.Append(" Window: ").Append(Window).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ListEventsResponse); + } + + /// + /// Returns true if ListEventsResponse instances are equal + /// + /// Instance of ListEventsResponse to be compared + /// Boolean + public bool Equals(ListEventsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Events == input.Events || + this.Events != null && + input.Events != null && + this.Events.SequenceEqual(input.Events) + ) && + ( + this.Pagination == input.Pagination || + (this.Pagination != null && + this.Pagination.Equals(input.Pagination)) + ) && + ( + this.Window == input.Window || + (this.Window != null && + this.Window.Equals(input.Window)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Events != null) + { + hashCode = (hashCode * 59) + this.Events.GetHashCode(); + } + if (this.Pagination != null) + { + hashCode = (hashCode * 59) + this.Pagination.GetHashCode(); + } + if (this.Window != null) + { + hashCode = (hashCode * 59) + this.Window.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/ListSourcesResponse.cs b/algoliasearch/Ingestion/Models/ListSourcesResponse.cs new file mode 100644 index 000000000..52cfe4653 --- /dev/null +++ b/algoliasearch/Ingestion/Models/ListSourcesResponse.cs @@ -0,0 +1,157 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// ListSourcesResponse + /// + [DataContract(Name = "listSourcesResponse")] + public partial class ListSourcesResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ListSourcesResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// sources (required). + /// pagination (required). + public ListSourcesResponse(List sources = default(List), Pagination pagination = default(Pagination)) + { + // to ensure "sources" is required (not null) + if (sources == null) + { + throw new ArgumentNullException("sources is a required property for ListSourcesResponse and cannot be null"); + } + this.Sources = sources; + // to ensure "pagination" is required (not null) + if (pagination == null) + { + throw new ArgumentNullException("pagination is a required property for ListSourcesResponse and cannot be null"); + } + this.Pagination = pagination; + } + + /// + /// Gets or Sets Sources + /// + [DataMember(Name = "sources", IsRequired = true, EmitDefaultValue = true)] + public List Sources { get; set; } + + /// + /// Gets or Sets Pagination + /// + [DataMember(Name = "pagination", IsRequired = true, EmitDefaultValue = true)] + public Pagination Pagination { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ListSourcesResponse {\n"); + sb.Append(" Sources: ").Append(Sources).Append("\n"); + sb.Append(" Pagination: ").Append(Pagination).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ListSourcesResponse); + } + + /// + /// Returns true if ListSourcesResponse instances are equal + /// + /// Instance of ListSourcesResponse to be compared + /// Boolean + public bool Equals(ListSourcesResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Sources == input.Sources || + this.Sources != null && + input.Sources != null && + this.Sources.SequenceEqual(input.Sources) + ) && + ( + this.Pagination == input.Pagination || + (this.Pagination != null && + this.Pagination.Equals(input.Pagination)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Sources != null) + { + hashCode = (hashCode * 59) + this.Sources.GetHashCode(); + } + if (this.Pagination != null) + { + hashCode = (hashCode * 59) + this.Pagination.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/ListTasksResponse.cs b/algoliasearch/Ingestion/Models/ListTasksResponse.cs new file mode 100644 index 000000000..99a21917c --- /dev/null +++ b/algoliasearch/Ingestion/Models/ListTasksResponse.cs @@ -0,0 +1,157 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// A list of tasks with pagination details. + /// + [DataContract(Name = "listTasksResponse")] + public partial class ListTasksResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ListTasksResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// tasks (required). + /// pagination (required). + public ListTasksResponse(List tasks = default(List), Pagination pagination = default(Pagination)) + { + // to ensure "tasks" is required (not null) + if (tasks == null) + { + throw new ArgumentNullException("tasks is a required property for ListTasksResponse and cannot be null"); + } + this.Tasks = tasks; + // to ensure "pagination" is required (not null) + if (pagination == null) + { + throw new ArgumentNullException("pagination is a required property for ListTasksResponse and cannot be null"); + } + this.Pagination = pagination; + } + + /// + /// Gets or Sets Tasks + /// + [DataMember(Name = "tasks", IsRequired = true, EmitDefaultValue = true)] + public List Tasks { get; set; } + + /// + /// Gets or Sets Pagination + /// + [DataMember(Name = "pagination", IsRequired = true, EmitDefaultValue = true)] + public Pagination Pagination { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ListTasksResponse {\n"); + sb.Append(" Tasks: ").Append(Tasks).Append("\n"); + sb.Append(" Pagination: ").Append(Pagination).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ListTasksResponse); + } + + /// + /// Returns true if ListTasksResponse instances are equal + /// + /// Instance of ListTasksResponse to be compared + /// Boolean + public bool Equals(ListTasksResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Tasks == input.Tasks || + this.Tasks != null && + input.Tasks != null && + this.Tasks.SequenceEqual(input.Tasks) + ) && + ( + this.Pagination == input.Pagination || + (this.Pagination != null && + this.Pagination.Equals(input.Pagination)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Tasks != null) + { + hashCode = (hashCode * 59) + this.Tasks.GetHashCode(); + } + if (this.Pagination != null) + { + hashCode = (hashCode * 59) + this.Pagination.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/MappingTypeCSV.cs b/algoliasearch/Ingestion/Models/MappingTypeCSV.cs new file mode 100644 index 000000000..e95f51dff --- /dev/null +++ b/algoliasearch/Ingestion/Models/MappingTypeCSV.cs @@ -0,0 +1,60 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Defines MappingTypeCSV + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum MappingTypeCSV + { + /// + /// Enum String for value: string + /// + [EnumMember(Value = "string")] + String = 1, + + /// + /// Enum Integer for value: integer + /// + [EnumMember(Value = "integer")] + Integer = 2, + + /// + /// Enum Float for value: float + /// + [EnumMember(Value = "float")] + Float = 3, + + /// + /// Enum Boolean for value: boolean + /// + [EnumMember(Value = "boolean")] + Boolean = 4, + + /// + /// Enum Json for value: json + /// + [EnumMember(Value = "json")] + Json = 5 + } + +} diff --git a/algoliasearch/Ingestion/Models/MethodType.cs b/algoliasearch/Ingestion/Models/MethodType.cs new file mode 100644 index 000000000..94f3599f0 --- /dev/null +++ b/algoliasearch/Ingestion/Models/MethodType.cs @@ -0,0 +1,42 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Defines MethodType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum MethodType + { + /// + /// Enum GET for value: GET + /// + [EnumMember(Value = "GET")] + GET = 1, + + /// + /// Enum POST for value: POST + /// + [EnumMember(Value = "POST")] + POST = 2 + } + +} diff --git a/algoliasearch/Ingestion/Models/OnDemandDateUtilsInput.cs b/algoliasearch/Ingestion/Models/OnDemandDateUtilsInput.cs new file mode 100644 index 000000000..218eaf193 --- /dev/null +++ b/algoliasearch/Ingestion/Models/OnDemandDateUtilsInput.cs @@ -0,0 +1,158 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The input for an `onDemand` task whose source is of type `bigquery` and for which extracted data spans a given time range. + /// + [DataContract(Name = "OnDemandDateUtilsInput")] + public partial class OnDemandDateUtilsInput : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected OnDemandDateUtilsInput() { } + /// + /// Initializes a new instance of the class. + /// + /// The start date of the extraction (RFC3339 format). (required). + /// The end date of the extraction (RFC3339 format). (required). + public OnDemandDateUtilsInput(string startDate = default(string), string endDate = default(string)) + { + // to ensure "startDate" is required (not null) + if (startDate == null) + { + throw new ArgumentNullException("startDate is a required property for OnDemandDateUtilsInput and cannot be null"); + } + this.StartDate = startDate; + // to ensure "endDate" is required (not null) + if (endDate == null) + { + throw new ArgumentNullException("endDate is a required property for OnDemandDateUtilsInput and cannot be null"); + } + this.EndDate = endDate; + } + + /// + /// The start date of the extraction (RFC3339 format). + /// + /// The start date of the extraction (RFC3339 format). + [DataMember(Name = "startDate", IsRequired = true, EmitDefaultValue = true)] + public string StartDate { get; set; } + + /// + /// The end date of the extraction (RFC3339 format). + /// + /// The end date of the extraction (RFC3339 format). + [DataMember(Name = "endDate", IsRequired = true, EmitDefaultValue = true)] + public string EndDate { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OnDemandDateUtilsInput {\n"); + sb.Append(" StartDate: ").Append(StartDate).Append("\n"); + sb.Append(" EndDate: ").Append(EndDate).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as OnDemandDateUtilsInput); + } + + /// + /// Returns true if OnDemandDateUtilsInput instances are equal + /// + /// Instance of OnDemandDateUtilsInput to be compared + /// Boolean + public bool Equals(OnDemandDateUtilsInput input) + { + if (input == null) + { + return false; + } + return + ( + this.StartDate == input.StartDate || + (this.StartDate != null && + this.StartDate.Equals(input.StartDate)) + ) && + ( + this.EndDate == input.EndDate || + (this.EndDate != null && + this.EndDate.Equals(input.EndDate)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.StartDate != null) + { + hashCode = (hashCode * 59) + this.StartDate.GetHashCode(); + } + if (this.EndDate != null) + { + hashCode = (hashCode * 59) + this.EndDate.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/OnDemandTrigger.cs b/algoliasearch/Ingestion/Models/OnDemandTrigger.cs new file mode 100644 index 000000000..a4df3453b --- /dev/null +++ b/algoliasearch/Ingestion/Models/OnDemandTrigger.cs @@ -0,0 +1,143 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The trigger information of a task of type `onDemand`. + /// + [DataContract(Name = "OnDemandTrigger")] + public partial class OnDemandTrigger : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public OnDemandTriggerType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected OnDemandTrigger() { } + /// + /// Initializes a new instance of the class. + /// + /// type (required). + /// The last time the scheduled task ran (RFC3339 format).. + public OnDemandTrigger(OnDemandTriggerType type = default(OnDemandTriggerType), string lastRun = default(string)) + { + this.Type = type; + this.LastRun = lastRun; + } + + /// + /// The last time the scheduled task ran (RFC3339 format). + /// + /// The last time the scheduled task ran (RFC3339 format). + [DataMember(Name = "lastRun", EmitDefaultValue = false)] + public string LastRun { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OnDemandTrigger {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" LastRun: ").Append(LastRun).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as OnDemandTrigger); + } + + /// + /// Returns true if OnDemandTrigger instances are equal + /// + /// Instance of OnDemandTrigger to be compared + /// Boolean + public bool Equals(OnDemandTrigger input) + { + if (input == null) + { + return false; + } + return + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.LastRun == input.LastRun || + (this.LastRun != null && + this.LastRun.Equals(input.LastRun)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.LastRun != null) + { + hashCode = (hashCode * 59) + this.LastRun.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/OnDemandTriggerInput.cs b/algoliasearch/Ingestion/Models/OnDemandTriggerInput.cs new file mode 100644 index 000000000..0a3959dec --- /dev/null +++ b/algoliasearch/Ingestion/Models/OnDemandTriggerInput.cs @@ -0,0 +1,124 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The trigger information of a task of type `onDemand`. + /// + [DataContract(Name = "OnDemandTriggerInput")] + public partial class OnDemandTriggerInput : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public OnDemandTriggerType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected OnDemandTriggerInput() { } + /// + /// Initializes a new instance of the class. + /// + /// type (required). + public OnDemandTriggerInput(OnDemandTriggerType type = default(OnDemandTriggerType)) + { + this.Type = type; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OnDemandTriggerInput {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as OnDemandTriggerInput); + } + + /// + /// Returns true if OnDemandTriggerInput instances are equal + /// + /// Instance of OnDemandTriggerInput to be compared + /// Boolean + public bool Equals(OnDemandTriggerInput input) + { + if (input == null) + { + return false; + } + return + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/OnDemandTriggerType.cs b/algoliasearch/Ingestion/Models/OnDemandTriggerType.cs new file mode 100644 index 000000000..a22a15a12 --- /dev/null +++ b/algoliasearch/Ingestion/Models/OnDemandTriggerType.cs @@ -0,0 +1,37 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// A task which is manually executed via the run task endpoint. + /// + /// A task which is manually executed via the run task endpoint. + [JsonConverter(typeof(StringEnumConverter))] + public enum OnDemandTriggerType + { + /// + /// Enum OnDemand for value: onDemand + /// + [EnumMember(Value = "onDemand")] + OnDemand = 1 + } + +} diff --git a/algoliasearch/Ingestion/Models/OrderKeys.cs b/algoliasearch/Ingestion/Models/OrderKeys.cs new file mode 100644 index 000000000..af47373af --- /dev/null +++ b/algoliasearch/Ingestion/Models/OrderKeys.cs @@ -0,0 +1,43 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Used to order a sorted request. + /// + /// Used to order a sorted request. + [JsonConverter(typeof(StringEnumConverter))] + public enum OrderKeys + { + /// + /// Enum Asc for value: asc + /// + [EnumMember(Value = "asc")] + Asc = 1, + + /// + /// Enum Desc for value: desc + /// + [EnumMember(Value = "desc")] + Desc = 2 + } + +} diff --git a/algoliasearch/Ingestion/Models/Pagination.cs b/algoliasearch/Ingestion/Models/Pagination.cs new file mode 100644 index 000000000..8bfb01c45 --- /dev/null +++ b/algoliasearch/Ingestion/Models/Pagination.cs @@ -0,0 +1,166 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Pagination + /// + [DataContract(Name = "Pagination")] + public partial class Pagination : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Pagination() { } + /// + /// Initializes a new instance of the class. + /// + /// nbPages (required). + /// page (required). + /// nbItems (required). + /// itemsPerPage (required). + public Pagination(int nbPages = default(int), int page = default(int), int nbItems = default(int), int itemsPerPage = default(int)) + { + this.NbPages = nbPages; + this.Page = page; + this.NbItems = nbItems; + this.ItemsPerPage = itemsPerPage; + } + + /// + /// Gets or Sets NbPages + /// + [DataMember(Name = "nbPages", IsRequired = true, EmitDefaultValue = true)] + public int NbPages { get; set; } + + /// + /// Gets or Sets Page + /// + [DataMember(Name = "page", IsRequired = true, EmitDefaultValue = true)] + public int Page { get; set; } + + /// + /// Gets or Sets NbItems + /// + [DataMember(Name = "nbItems", IsRequired = true, EmitDefaultValue = true)] + public int NbItems { get; set; } + + /// + /// Gets or Sets ItemsPerPage + /// + [DataMember(Name = "itemsPerPage", IsRequired = true, EmitDefaultValue = true)] + public int ItemsPerPage { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Pagination {\n"); + sb.Append(" NbPages: ").Append(NbPages).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" NbItems: ").Append(NbItems).Append("\n"); + sb.Append(" ItemsPerPage: ").Append(ItemsPerPage).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Pagination); + } + + /// + /// Returns true if Pagination instances are equal + /// + /// Instance of Pagination to be compared + /// Boolean + public bool Equals(Pagination input) + { + if (input == null) + { + return false; + } + return + ( + this.NbPages == input.NbPages || + this.NbPages.Equals(input.NbPages) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.NbItems == input.NbItems || + this.NbItems.Equals(input.NbItems) + ) && + ( + this.ItemsPerPage == input.ItemsPerPage || + this.ItemsPerPage.Equals(input.ItemsPerPage) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.NbPages.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.NbItems.GetHashCode(); + hashCode = (hashCode * 59) + this.ItemsPerPage.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/Platform.cs b/algoliasearch/Ingestion/Models/Platform.cs new file mode 100644 index 000000000..4b98bb56c --- /dev/null +++ b/algoliasearch/Ingestion/Models/Platform.cs @@ -0,0 +1,43 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Describe which platform the Authentication is used for. + /// + /// Describe which platform the Authentication is used for. + [JsonConverter(typeof(StringEnumConverter))] + public enum Platform + { + /// + /// Enum Bigcommerce for value: bigcommerce + /// + [EnumMember(Value = "bigcommerce")] + Bigcommerce = 1, + + /// + /// Enum Commercetools for value: commercetools + /// + [EnumMember(Value = "commercetools")] + Commercetools = 2 + } + +} diff --git a/algoliasearch/Ingestion/Models/PlatformNone.cs b/algoliasearch/Ingestion/Models/PlatformNone.cs new file mode 100644 index 000000000..3072880db --- /dev/null +++ b/algoliasearch/Ingestion/Models/PlatformNone.cs @@ -0,0 +1,37 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Used to filter Authentication without platform property. + /// + /// Used to filter Authentication without platform property. + [JsonConverter(typeof(StringEnumConverter))] + public enum PlatformNone + { + /// + /// Enum None for value: none + /// + [EnumMember(Value = "none")] + None = 1 + } + +} diff --git a/algoliasearch/Ingestion/Models/PlatformWithNone.cs b/algoliasearch/Ingestion/Models/PlatformWithNone.cs new file mode 100644 index 000000000..c201c003a --- /dev/null +++ b/algoliasearch/Ingestion/Models/PlatformWithNone.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// PlatformWithNone + /// + [JsonConverter(typeof(PlatformWithNoneJsonConverter))] + [DataContract(Name = "platformWithNone")] + public partial class PlatformWithNone : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of Platform. + public PlatformWithNone(Platform actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of PlatformNone. + public PlatformWithNone(PlatformNone actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(Platform)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(PlatformNone)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: Platform, PlatformNone"); + } + } + } + + /// + /// Get the actual instance of `Platform`. If the actual instance is not `Platform`, + /// the InvalidClassException will be thrown + /// + /// An instance of Platform + public Platform GetterPlatform() + { + return (Platform)this.ActualInstance; + } + + /// + /// Get the actual instance of `PlatformNone`. If the actual instance is not `PlatformNone`, + /// the InvalidClassException will be thrown + /// + /// An instance of PlatformNone + public PlatformNone GetterPlatformNone() + { + return (PlatformNone)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class PlatformWithNone {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, PlatformWithNone.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of PlatformWithNone + /// + /// JSON string + /// An instance of PlatformWithNone + public static PlatformWithNone FromJson(string jsonString) + { + PlatformWithNone newPlatformWithNone = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newPlatformWithNone; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(Platform).GetProperty("AdditionalProperties") == null) + { + newPlatformWithNone = new PlatformWithNone(JsonConvert.DeserializeObject(jsonString, PlatformWithNone.SerializerSettings)); + } + else + { + newPlatformWithNone = new PlatformWithNone(JsonConvert.DeserializeObject(jsonString, PlatformWithNone.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("Platform"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into Platform: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(PlatformNone).GetProperty("AdditionalProperties") == null) + { + newPlatformWithNone = new PlatformWithNone(JsonConvert.DeserializeObject(jsonString, PlatformWithNone.SerializerSettings)); + } + else + { + newPlatformWithNone = new PlatformWithNone(JsonConvert.DeserializeObject(jsonString, PlatformWithNone.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("PlatformNone"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PlatformNone: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newPlatformWithNone; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as PlatformWithNone); + } + + /// + /// Returns true if PlatformWithNone instances are equal + /// + /// Instance of PlatformWithNone to be compared + /// Boolean + public bool Equals(PlatformWithNone input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for PlatformWithNone + /// + public class PlatformWithNoneJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(PlatformWithNone).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return PlatformWithNone.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/RecordType.cs b/algoliasearch/Ingestion/Models/RecordType.cs new file mode 100644 index 000000000..5418d887a --- /dev/null +++ b/algoliasearch/Ingestion/Models/RecordType.cs @@ -0,0 +1,43 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Determines the indexing strategy to use for a given e-commerce source. + /// + /// Determines the indexing strategy to use for a given e-commerce source. + [JsonConverter(typeof(StringEnumConverter))] + public enum RecordType + { + /// + /// Enum Product for value: product + /// + [EnumMember(Value = "product")] + Product = 1, + + /// + /// Enum Variant for value: variant + /// + [EnumMember(Value = "variant")] + Variant = 2 + } + +} diff --git a/algoliasearch/Ingestion/Models/Run.cs b/algoliasearch/Ingestion/Models/Run.cs new file mode 100644 index 000000000..26ff33e3b --- /dev/null +++ b/algoliasearch/Ingestion/Models/Run.cs @@ -0,0 +1,363 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Run + /// + [DataContract(Name = "Run")] + public partial class Run : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Status + /// + [DataMember(Name = "status", IsRequired = true, EmitDefaultValue = true)] + public RunStatus Status { get; set; } + + /// + /// Gets or Sets Outcome + /// + [DataMember(Name = "outcome", EmitDefaultValue = false)] + public RunOutcome? Outcome { get; set; } + + /// + /// Gets or Sets ReasonCode + /// + [DataMember(Name = "reasonCode", EmitDefaultValue = false)] + public RunReasonCode? ReasonCode { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public RunType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Run() { } + /// + /// Initializes a new instance of the class. + /// + /// The run UUID. (required). + /// appID (required). + /// The task UUID. (required). + /// status (required). + /// progress. + /// outcome. + /// A percentage representing the accepted failure threshold to determine if a `run` succeeded or not.. + /// Explains the result of outcome.. + /// reasonCode. + /// type (required). + /// Date of creation (RFC3339 format). (required). + /// Date of start (RFC3339 format).. + /// Date of finish (RFC3339 format).. + public Run(string runID = default(string), string appID = default(string), string taskID = default(string), RunStatus status = default(RunStatus), RunProgress progress = default(RunProgress), RunOutcome? outcome = default(RunOutcome?), int failureThreshold = default(int), string reason = default(string), RunReasonCode? reasonCode = default(RunReasonCode?), RunType type = default(RunType), string createdAt = default(string), string startedAt = default(string), string finishedAt = default(string)) + { + // to ensure "runID" is required (not null) + if (runID == null) + { + throw new ArgumentNullException("runID is a required property for Run and cannot be null"); + } + this.RunID = runID; + // to ensure "appID" is required (not null) + if (appID == null) + { + throw new ArgumentNullException("appID is a required property for Run and cannot be null"); + } + this.AppID = appID; + // to ensure "taskID" is required (not null) + if (taskID == null) + { + throw new ArgumentNullException("taskID is a required property for Run and cannot be null"); + } + this.TaskID = taskID; + this.Status = status; + this.Type = type; + // to ensure "createdAt" is required (not null) + if (createdAt == null) + { + throw new ArgumentNullException("createdAt is a required property for Run and cannot be null"); + } + this.CreatedAt = createdAt; + this.Progress = progress; + this.Outcome = outcome; + this.FailureThreshold = failureThreshold; + this.Reason = reason; + this.ReasonCode = reasonCode; + this.StartedAt = startedAt; + this.FinishedAt = finishedAt; + } + + /// + /// The run UUID. + /// + /// The run UUID. + [DataMember(Name = "runID", IsRequired = true, EmitDefaultValue = true)] + public string RunID { get; set; } + + /// + /// Gets or Sets AppID + /// + [DataMember(Name = "appID", IsRequired = true, EmitDefaultValue = true)] + public string AppID { get; set; } + + /// + /// The task UUID. + /// + /// The task UUID. + [DataMember(Name = "taskID", IsRequired = true, EmitDefaultValue = true)] + public string TaskID { get; set; } + + /// + /// Gets or Sets Progress + /// + [DataMember(Name = "progress", EmitDefaultValue = false)] + public RunProgress Progress { get; set; } + + /// + /// A percentage representing the accepted failure threshold to determine if a `run` succeeded or not. + /// + /// A percentage representing the accepted failure threshold to determine if a `run` succeeded or not. + [DataMember(Name = "failureThreshold", EmitDefaultValue = false)] + public int FailureThreshold { get; set; } + + /// + /// Explains the result of outcome. + /// + /// Explains the result of outcome. + [DataMember(Name = "reason", EmitDefaultValue = false)] + public string Reason { get; set; } + + /// + /// Date of creation (RFC3339 format). + /// + /// Date of creation (RFC3339 format). + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public string CreatedAt { get; set; } + + /// + /// Date of start (RFC3339 format). + /// + /// Date of start (RFC3339 format). + [DataMember(Name = "startedAt", EmitDefaultValue = false)] + public string StartedAt { get; set; } + + /// + /// Date of finish (RFC3339 format). + /// + /// Date of finish (RFC3339 format). + [DataMember(Name = "finishedAt", EmitDefaultValue = false)] + public string FinishedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Run {\n"); + sb.Append(" RunID: ").Append(RunID).Append("\n"); + sb.Append(" AppID: ").Append(AppID).Append("\n"); + sb.Append(" TaskID: ").Append(TaskID).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Progress: ").Append(Progress).Append("\n"); + sb.Append(" Outcome: ").Append(Outcome).Append("\n"); + sb.Append(" FailureThreshold: ").Append(FailureThreshold).Append("\n"); + sb.Append(" Reason: ").Append(Reason).Append("\n"); + sb.Append(" ReasonCode: ").Append(ReasonCode).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append(" StartedAt: ").Append(StartedAt).Append("\n"); + sb.Append(" FinishedAt: ").Append(FinishedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Run); + } + + /// + /// Returns true if Run instances are equal + /// + /// Instance of Run to be compared + /// Boolean + public bool Equals(Run input) + { + if (input == null) + { + return false; + } + return + ( + this.RunID == input.RunID || + (this.RunID != null && + this.RunID.Equals(input.RunID)) + ) && + ( + this.AppID == input.AppID || + (this.AppID != null && + this.AppID.Equals(input.AppID)) + ) && + ( + this.TaskID == input.TaskID || + (this.TaskID != null && + this.TaskID.Equals(input.TaskID)) + ) && + ( + this.Status == input.Status || + this.Status.Equals(input.Status) + ) && + ( + this.Progress == input.Progress || + (this.Progress != null && + this.Progress.Equals(input.Progress)) + ) && + ( + this.Outcome == input.Outcome || + this.Outcome.Equals(input.Outcome) + ) && + ( + this.FailureThreshold == input.FailureThreshold || + this.FailureThreshold.Equals(input.FailureThreshold) + ) && + ( + this.Reason == input.Reason || + (this.Reason != null && + this.Reason.Equals(input.Reason)) + ) && + ( + this.ReasonCode == input.ReasonCode || + this.ReasonCode.Equals(input.ReasonCode) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.CreatedAt == input.CreatedAt || + (this.CreatedAt != null && + this.CreatedAt.Equals(input.CreatedAt)) + ) && + ( + this.StartedAt == input.StartedAt || + (this.StartedAt != null && + this.StartedAt.Equals(input.StartedAt)) + ) && + ( + this.FinishedAt == input.FinishedAt || + (this.FinishedAt != null && + this.FinishedAt.Equals(input.FinishedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RunID != null) + { + hashCode = (hashCode * 59) + this.RunID.GetHashCode(); + } + if (this.AppID != null) + { + hashCode = (hashCode * 59) + this.AppID.GetHashCode(); + } + if (this.TaskID != null) + { + hashCode = (hashCode * 59) + this.TaskID.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Status.GetHashCode(); + if (this.Progress != null) + { + hashCode = (hashCode * 59) + this.Progress.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Outcome.GetHashCode(); + hashCode = (hashCode * 59) + this.FailureThreshold.GetHashCode(); + if (this.Reason != null) + { + hashCode = (hashCode * 59) + this.Reason.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ReasonCode.GetHashCode(); + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.CreatedAt != null) + { + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + } + if (this.StartedAt != null) + { + hashCode = (hashCode * 59) + this.StartedAt.GetHashCode(); + } + if (this.FinishedAt != null) + { + hashCode = (hashCode * 59) + this.FinishedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // FailureThreshold (int) maximum + if (this.FailureThreshold > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for FailureThreshold, must be a value less than or equal to 100.", new[] { "FailureThreshold" }); + } + + // FailureThreshold (int) minimum + if (this.FailureThreshold < (int)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for FailureThreshold, must be a value greater than or equal to 0.", new[] { "FailureThreshold" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/RunListResponse.cs b/algoliasearch/Ingestion/Models/RunListResponse.cs new file mode 100644 index 000000000..743140c66 --- /dev/null +++ b/algoliasearch/Ingestion/Models/RunListResponse.cs @@ -0,0 +1,180 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// RunListResponse + /// + [DataContract(Name = "RunListResponse")] + public partial class RunListResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RunListResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// runs (required). + /// pagination (required). + /// window (required). + public RunListResponse(List runs = default(List), Pagination pagination = default(Pagination), Window window = default(Window)) + { + // to ensure "runs" is required (not null) + if (runs == null) + { + throw new ArgumentNullException("runs is a required property for RunListResponse and cannot be null"); + } + this.Runs = runs; + // to ensure "pagination" is required (not null) + if (pagination == null) + { + throw new ArgumentNullException("pagination is a required property for RunListResponse and cannot be null"); + } + this.Pagination = pagination; + // to ensure "window" is required (not null) + if (window == null) + { + throw new ArgumentNullException("window is a required property for RunListResponse and cannot be null"); + } + this.Window = window; + } + + /// + /// Gets or Sets Runs + /// + [DataMember(Name = "runs", IsRequired = true, EmitDefaultValue = true)] + public List Runs { get; set; } + + /// + /// Gets or Sets Pagination + /// + [DataMember(Name = "pagination", IsRequired = true, EmitDefaultValue = true)] + public Pagination Pagination { get; set; } + + /// + /// Gets or Sets Window + /// + [DataMember(Name = "window", IsRequired = true, EmitDefaultValue = true)] + public Window Window { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RunListResponse {\n"); + sb.Append(" Runs: ").Append(Runs).Append("\n"); + sb.Append(" Pagination: ").Append(Pagination).Append("\n"); + sb.Append(" Window: ").Append(Window).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RunListResponse); + } + + /// + /// Returns true if RunListResponse instances are equal + /// + /// Instance of RunListResponse to be compared + /// Boolean + public bool Equals(RunListResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Runs == input.Runs || + this.Runs != null && + input.Runs != null && + this.Runs.SequenceEqual(input.Runs) + ) && + ( + this.Pagination == input.Pagination || + (this.Pagination != null && + this.Pagination.Equals(input.Pagination)) + ) && + ( + this.Window == input.Window || + (this.Window != null && + this.Window.Equals(input.Window)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Runs != null) + { + hashCode = (hashCode * 59) + this.Runs.GetHashCode(); + } + if (this.Pagination != null) + { + hashCode = (hashCode * 59) + this.Pagination.GetHashCode(); + } + if (this.Window != null) + { + hashCode = (hashCode * 59) + this.Window.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/RunOutcome.cs b/algoliasearch/Ingestion/Models/RunOutcome.cs new file mode 100644 index 000000000..1da47d142 --- /dev/null +++ b/algoliasearch/Ingestion/Models/RunOutcome.cs @@ -0,0 +1,48 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Defines RunOutcome + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RunOutcome + { + /// + /// Enum Success for value: success + /// + [EnumMember(Value = "success")] + Success = 1, + + /// + /// Enum Failure for value: failure + /// + [EnumMember(Value = "failure")] + Failure = 2, + + /// + /// Enum Processing for value: processing + /// + [EnumMember(Value = "processing")] + Processing = 3 + } + +} diff --git a/algoliasearch/Ingestion/Models/RunProgress.cs b/algoliasearch/Ingestion/Models/RunProgress.cs new file mode 100644 index 000000000..c3b324d41 --- /dev/null +++ b/algoliasearch/Ingestion/Models/RunProgress.cs @@ -0,0 +1,133 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// RunProgress + /// + [DataContract(Name = "Run_progress")] + public partial class RunProgress : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// expectedNbOfEvents. + /// receivedNbOfEvents. + public RunProgress(int expectedNbOfEvents = default(int), int receivedNbOfEvents = default(int)) + { + this.ExpectedNbOfEvents = expectedNbOfEvents; + this.ReceivedNbOfEvents = receivedNbOfEvents; + } + + /// + /// Gets or Sets ExpectedNbOfEvents + /// + [DataMember(Name = "expectedNbOfEvents", EmitDefaultValue = false)] + public int ExpectedNbOfEvents { get; set; } + + /// + /// Gets or Sets ReceivedNbOfEvents + /// + [DataMember(Name = "receivedNbOfEvents", EmitDefaultValue = false)] + public int ReceivedNbOfEvents { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RunProgress {\n"); + sb.Append(" ExpectedNbOfEvents: ").Append(ExpectedNbOfEvents).Append("\n"); + sb.Append(" ReceivedNbOfEvents: ").Append(ReceivedNbOfEvents).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RunProgress); + } + + /// + /// Returns true if RunProgress instances are equal + /// + /// Instance of RunProgress to be compared + /// Boolean + public bool Equals(RunProgress input) + { + if (input == null) + { + return false; + } + return + ( + this.ExpectedNbOfEvents == input.ExpectedNbOfEvents || + this.ExpectedNbOfEvents.Equals(input.ExpectedNbOfEvents) + ) && + ( + this.ReceivedNbOfEvents == input.ReceivedNbOfEvents || + this.ReceivedNbOfEvents.Equals(input.ReceivedNbOfEvents) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.ExpectedNbOfEvents.GetHashCode(); + hashCode = (hashCode * 59) + this.ReceivedNbOfEvents.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/RunReasonCode.cs b/algoliasearch/Ingestion/Models/RunReasonCode.cs new file mode 100644 index 000000000..0b2851bfe --- /dev/null +++ b/algoliasearch/Ingestion/Models/RunReasonCode.cs @@ -0,0 +1,73 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// An identifier that pairs with the outcome reason. + /// + /// An identifier that pairs with the outcome reason. + [JsonConverter(typeof(StringEnumConverter))] + public enum RunReasonCode + { + /// + /// Enum Internal for value: internal + /// + [EnumMember(Value = "internal")] + Internal = 1, + + /// + /// Enum Critical for value: critical + /// + [EnumMember(Value = "critical")] + Critical = 2, + + /// + /// Enum NoEvents for value: no_events + /// + [EnumMember(Value = "no_events")] + NoEvents = 3, + + /// + /// Enum TooManyErrors for value: too_many_errors + /// + [EnumMember(Value = "too_many_errors")] + TooManyErrors = 4, + + /// + /// Enum Ok for value: ok + /// + [EnumMember(Value = "ok")] + Ok = 5, + + /// + /// Enum Discarded for value: discarded + /// + [EnumMember(Value = "discarded")] + Discarded = 6, + + /// + /// Enum Blocking for value: blocking + /// + [EnumMember(Value = "blocking")] + Blocking = 7 + } + +} diff --git a/algoliasearch/Ingestion/Models/RunResponse.cs b/algoliasearch/Ingestion/Models/RunResponse.cs new file mode 100644 index 000000000..54a3e33e3 --- /dev/null +++ b/algoliasearch/Ingestion/Models/RunResponse.cs @@ -0,0 +1,158 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The response from the run task API, containing an Observability Run ID and the time it was created at. + /// + [DataContract(Name = "RunResponse")] + public partial class RunResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RunResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// The run UUID. (required). + /// Date of creation (RFC3339 format). (required). + public RunResponse(string runID = default(string), string createdAt = default(string)) + { + // to ensure "runID" is required (not null) + if (runID == null) + { + throw new ArgumentNullException("runID is a required property for RunResponse and cannot be null"); + } + this.RunID = runID; + // to ensure "createdAt" is required (not null) + if (createdAt == null) + { + throw new ArgumentNullException("createdAt is a required property for RunResponse and cannot be null"); + } + this.CreatedAt = createdAt; + } + + /// + /// The run UUID. + /// + /// The run UUID. + [DataMember(Name = "runID", IsRequired = true, EmitDefaultValue = true)] + public string RunID { get; set; } + + /// + /// Date of creation (RFC3339 format). + /// + /// Date of creation (RFC3339 format). + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public string CreatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RunResponse {\n"); + sb.Append(" RunID: ").Append(RunID).Append("\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RunResponse); + } + + /// + /// Returns true if RunResponse instances are equal + /// + /// Instance of RunResponse to be compared + /// Boolean + public bool Equals(RunResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.RunID == input.RunID || + (this.RunID != null && + this.RunID.Equals(input.RunID)) + ) && + ( + this.CreatedAt == input.CreatedAt || + (this.CreatedAt != null && + this.CreatedAt.Equals(input.CreatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RunID != null) + { + hashCode = (hashCode * 59) + this.RunID.GetHashCode(); + } + if (this.CreatedAt != null) + { + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/RunSortKeys.cs b/algoliasearch/Ingestion/Models/RunSortKeys.cs new file mode 100644 index 000000000..8ec45904b --- /dev/null +++ b/algoliasearch/Ingestion/Models/RunSortKeys.cs @@ -0,0 +1,49 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Used to sort the Run list endpoint. + /// + /// Used to sort the Run list endpoint. + [JsonConverter(typeof(StringEnumConverter))] + public enum RunSortKeys + { + /// + /// Enum Status for value: status + /// + [EnumMember(Value = "status")] + Status = 1, + + /// + /// Enum UpdatedAt for value: updatedAt + /// + [EnumMember(Value = "updatedAt")] + UpdatedAt = 2, + + /// + /// Enum CreatedAt for value: createdAt + /// + [EnumMember(Value = "createdAt")] + CreatedAt = 3 + } + +} diff --git a/algoliasearch/Ingestion/Models/RunStatus.cs b/algoliasearch/Ingestion/Models/RunStatus.cs new file mode 100644 index 000000000..47377d912 --- /dev/null +++ b/algoliasearch/Ingestion/Models/RunStatus.cs @@ -0,0 +1,60 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Defines RunStatus + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RunStatus + { + /// + /// Enum Created for value: created + /// + [EnumMember(Value = "created")] + Created = 1, + + /// + /// Enum Started for value: started + /// + [EnumMember(Value = "started")] + Started = 2, + + /// + /// Enum Idled for value: idled + /// + [EnumMember(Value = "idled")] + Idled = 3, + + /// + /// Enum Finished for value: finished + /// + [EnumMember(Value = "finished")] + Finished = 4, + + /// + /// Enum Skipped for value: skipped + /// + [EnumMember(Value = "skipped")] + Skipped = 5 + } + +} diff --git a/algoliasearch/Ingestion/Models/RunType.cs b/algoliasearch/Ingestion/Models/RunType.cs new file mode 100644 index 000000000..1289d0dd3 --- /dev/null +++ b/algoliasearch/Ingestion/Models/RunType.cs @@ -0,0 +1,48 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Defines RunType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RunType + { + /// + /// Enum Reindex for value: reindex + /// + [EnumMember(Value = "reindex")] + Reindex = 1, + + /// + /// Enum Update for value: update + /// + [EnumMember(Value = "update")] + Update = 2, + + /// + /// Enum Discover for value: discover + /// + [EnumMember(Value = "discover")] + Discover = 3 + } + +} diff --git a/algoliasearch/Ingestion/Models/ScheduleDateUtilsInput.cs b/algoliasearch/Ingestion/Models/ScheduleDateUtilsInput.cs new file mode 100644 index 000000000..a7595b69e --- /dev/null +++ b/algoliasearch/Ingestion/Models/ScheduleDateUtilsInput.cs @@ -0,0 +1,137 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The input for a `schedule` task whose source is of type `bigquery` and for which extracted data spans a fixed number of days. + /// + [DataContract(Name = "ScheduleDateUtilsInput")] + public partial class ScheduleDateUtilsInput : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ScheduleDateUtilsInput() { } + /// + /// Initializes a new instance of the class. + /// + /// The timeframe of the extraction, in number of days from today. (required). + public ScheduleDateUtilsInput(int timeframe = default(int)) + { + this.Timeframe = timeframe; + } + + /// + /// The timeframe of the extraction, in number of days from today. + /// + /// The timeframe of the extraction, in number of days from today. + [DataMember(Name = "timeframe", IsRequired = true, EmitDefaultValue = true)] + public int Timeframe { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ScheduleDateUtilsInput {\n"); + sb.Append(" Timeframe: ").Append(Timeframe).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ScheduleDateUtilsInput); + } + + /// + /// Returns true if ScheduleDateUtilsInput instances are equal + /// + /// Instance of ScheduleDateUtilsInput to be compared + /// Boolean + public bool Equals(ScheduleDateUtilsInput input) + { + if (input == null) + { + return false; + } + return + ( + this.Timeframe == input.Timeframe || + this.Timeframe.Equals(input.Timeframe) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Timeframe.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Timeframe (int) maximum + if (this.Timeframe > (int)30) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Timeframe, must be a value less than or equal to 30.", new[] { "Timeframe" }); + } + + // Timeframe (int) minimum + if (this.Timeframe < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Timeframe, must be a value greater than or equal to 1.", new[] { "Timeframe" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/ScheduleTrigger.cs b/algoliasearch/Ingestion/Models/ScheduleTrigger.cs new file mode 100644 index 000000000..1e2b45605 --- /dev/null +++ b/algoliasearch/Ingestion/Models/ScheduleTrigger.cs @@ -0,0 +1,191 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The trigger information for a task of type 'schedule'. + /// + [DataContract(Name = "ScheduleTrigger")] + public partial class ScheduleTrigger : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public ScheduleTriggerType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ScheduleTrigger() { } + /// + /// Initializes a new instance of the class. + /// + /// type (required). + /// A cron expression that represent at which regularity the task should run. (required). + /// The last time the scheduled task ran (RFC3339 format).. + /// The next scheduled run of the task (RFC3339 format). (required). + public ScheduleTrigger(ScheduleTriggerType type = default(ScheduleTriggerType), string cron = default(string), string lastRun = default(string), string nextRun = default(string)) + { + this.Type = type; + // to ensure "cron" is required (not null) + if (cron == null) + { + throw new ArgumentNullException("cron is a required property for ScheduleTrigger and cannot be null"); + } + this.Cron = cron; + // to ensure "nextRun" is required (not null) + if (nextRun == null) + { + throw new ArgumentNullException("nextRun is a required property for ScheduleTrigger and cannot be null"); + } + this.NextRun = nextRun; + this.LastRun = lastRun; + } + + /// + /// A cron expression that represent at which regularity the task should run. + /// + /// A cron expression that represent at which regularity the task should run. + [DataMember(Name = "cron", IsRequired = true, EmitDefaultValue = true)] + public string Cron { get; set; } + + /// + /// The last time the scheduled task ran (RFC3339 format). + /// + /// The last time the scheduled task ran (RFC3339 format). + [DataMember(Name = "lastRun", EmitDefaultValue = false)] + public string LastRun { get; set; } + + /// + /// The next scheduled run of the task (RFC3339 format). + /// + /// The next scheduled run of the task (RFC3339 format). + [DataMember(Name = "nextRun", IsRequired = true, EmitDefaultValue = true)] + public string NextRun { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ScheduleTrigger {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Cron: ").Append(Cron).Append("\n"); + sb.Append(" LastRun: ").Append(LastRun).Append("\n"); + sb.Append(" NextRun: ").Append(NextRun).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ScheduleTrigger); + } + + /// + /// Returns true if ScheduleTrigger instances are equal + /// + /// Instance of ScheduleTrigger to be compared + /// Boolean + public bool Equals(ScheduleTrigger input) + { + if (input == null) + { + return false; + } + return + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.Cron == input.Cron || + (this.Cron != null && + this.Cron.Equals(input.Cron)) + ) && + ( + this.LastRun == input.LastRun || + (this.LastRun != null && + this.LastRun.Equals(input.LastRun)) + ) && + ( + this.NextRun == input.NextRun || + (this.NextRun != null && + this.NextRun.Equals(input.NextRun)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.Cron != null) + { + hashCode = (hashCode * 59) + this.Cron.GetHashCode(); + } + if (this.LastRun != null) + { + hashCode = (hashCode * 59) + this.LastRun.GetHashCode(); + } + if (this.NextRun != null) + { + hashCode = (hashCode * 59) + this.NextRun.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/ScheduleTriggerInput.cs b/algoliasearch/Ingestion/Models/ScheduleTriggerInput.cs new file mode 100644 index 000000000..007a75cf5 --- /dev/null +++ b/algoliasearch/Ingestion/Models/ScheduleTriggerInput.cs @@ -0,0 +1,148 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The trigger input for a task of type 'schedule'. + /// + [DataContract(Name = "ScheduleTriggerInput")] + public partial class ScheduleTriggerInput : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public ScheduleTriggerType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ScheduleTriggerInput() { } + /// + /// Initializes a new instance of the class. + /// + /// type (required). + /// A cron expression that represent at which regularity the task should run. (required). + public ScheduleTriggerInput(ScheduleTriggerType type = default(ScheduleTriggerType), string cron = default(string)) + { + this.Type = type; + // to ensure "cron" is required (not null) + if (cron == null) + { + throw new ArgumentNullException("cron is a required property for ScheduleTriggerInput and cannot be null"); + } + this.Cron = cron; + } + + /// + /// A cron expression that represent at which regularity the task should run. + /// + /// A cron expression that represent at which regularity the task should run. + [DataMember(Name = "cron", IsRequired = true, EmitDefaultValue = true)] + public string Cron { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ScheduleTriggerInput {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Cron: ").Append(Cron).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ScheduleTriggerInput); + } + + /// + /// Returns true if ScheduleTriggerInput instances are equal + /// + /// Instance of ScheduleTriggerInput to be compared + /// Boolean + public bool Equals(ScheduleTriggerInput input) + { + if (input == null) + { + return false; + } + return + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.Cron == input.Cron || + (this.Cron != null && + this.Cron.Equals(input.Cron)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.Cron != null) + { + hashCode = (hashCode * 59) + this.Cron.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/ScheduleTriggerType.cs b/algoliasearch/Ingestion/Models/ScheduleTriggerType.cs new file mode 100644 index 000000000..84bdf224c --- /dev/null +++ b/algoliasearch/Ingestion/Models/ScheduleTriggerType.cs @@ -0,0 +1,37 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// A task which is triggered by a schedule (cron expression). + /// + /// A task which is triggered by a schedule (cron expression). + [JsonConverter(typeof(StringEnumConverter))] + public enum ScheduleTriggerType + { + /// + /// Enum Schedule for value: schedule + /// + [EnumMember(Value = "schedule")] + Schedule = 1 + } + +} diff --git a/algoliasearch/Ingestion/Models/Source.cs b/algoliasearch/Ingestion/Models/Source.cs new file mode 100644 index 000000000..56bc9b2a8 --- /dev/null +++ b/algoliasearch/Ingestion/Models/Source.cs @@ -0,0 +1,256 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Source + /// + [DataContract(Name = "Source")] + public partial class Source : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public SourceType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Source() { } + /// + /// Initializes a new instance of the class. + /// + /// The source UUID. (required). + /// type (required). + /// name (required). + /// input (required). + /// The authentication UUID.. + /// Date of creation (RFC3339 format). (required). + /// Date of last update (RFC3339 format).. + public Source(string sourceID = default(string), SourceType type = default(SourceType), string name = default(string), SourceInput input = default(SourceInput), string authenticationID = default(string), string createdAt = default(string), string updatedAt = default(string)) + { + // to ensure "sourceID" is required (not null) + if (sourceID == null) + { + throw new ArgumentNullException("sourceID is a required property for Source and cannot be null"); + } + this.SourceID = sourceID; + this.Type = type; + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for Source and cannot be null"); + } + this.Name = name; + // to ensure "input" is required (not null) + if (input == null) + { + throw new ArgumentNullException("input is a required property for Source and cannot be null"); + } + this.Input = input; + // to ensure "createdAt" is required (not null) + if (createdAt == null) + { + throw new ArgumentNullException("createdAt is a required property for Source and cannot be null"); + } + this.CreatedAt = createdAt; + this.AuthenticationID = authenticationID; + this.UpdatedAt = updatedAt; + } + + /// + /// The source UUID. + /// + /// The source UUID. + [DataMember(Name = "sourceID", IsRequired = true, EmitDefaultValue = true)] + public string SourceID { get; set; } + + /// + /// Gets or Sets Name + /// + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Gets or Sets Input + /// + [DataMember(Name = "input", IsRequired = true, EmitDefaultValue = true)] + public SourceInput Input { get; set; } + + /// + /// The authentication UUID. + /// + /// The authentication UUID. + [DataMember(Name = "authenticationID", EmitDefaultValue = false)] + public string AuthenticationID { get; set; } + + /// + /// Date of creation (RFC3339 format). + /// + /// Date of creation (RFC3339 format). + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public string CreatedAt { get; set; } + + /// + /// Date of last update (RFC3339 format). + /// + /// Date of last update (RFC3339 format). + [DataMember(Name = "updatedAt", EmitDefaultValue = false)] + public string UpdatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Source {\n"); + sb.Append(" SourceID: ").Append(SourceID).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Input: ").Append(Input).Append("\n"); + sb.Append(" AuthenticationID: ").Append(AuthenticationID).Append("\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Source); + } + + /// + /// Returns true if Source instances are equal + /// + /// Instance of Source to be compared + /// Boolean + public bool Equals(Source input) + { + if (input == null) + { + return false; + } + return + ( + this.SourceID == input.SourceID || + (this.SourceID != null && + this.SourceID.Equals(input.SourceID)) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Input == input.Input || + (this.Input != null && + this.Input.Equals(input.Input)) + ) && + ( + this.AuthenticationID == input.AuthenticationID || + (this.AuthenticationID != null && + this.AuthenticationID.Equals(input.AuthenticationID)) + ) && + ( + this.CreatedAt == input.CreatedAt || + (this.CreatedAt != null && + this.CreatedAt.Equals(input.CreatedAt)) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SourceID != null) + { + hashCode = (hashCode * 59) + this.SourceID.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.Input != null) + { + hashCode = (hashCode * 59) + this.Input.GetHashCode(); + } + if (this.AuthenticationID != null) + { + hashCode = (hashCode * 59) + this.AuthenticationID.GetHashCode(); + } + if (this.CreatedAt != null) + { + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + } + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceBigCommerce.cs b/algoliasearch/Ingestion/Models/SourceBigCommerce.cs new file mode 100644 index 000000000..0bd27fe40 --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceBigCommerce.cs @@ -0,0 +1,199 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// SourceBigCommerce + /// + [DataContract(Name = "SourceBigCommerce")] + public partial class SourceBigCommerce : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// The store hash identifying the store the shopper is signing in to.. + /// channel. + /// customFields. + /// productMetafields. + /// variantMetafields. + public SourceBigCommerce(string storeHash = default(string), BigCommerceChannel channel = default(BigCommerceChannel), List customFields = default(List), List productMetafields = default(List), List variantMetafields = default(List)) + { + this.StoreHash = storeHash; + this.Channel = channel; + this.CustomFields = customFields; + this.ProductMetafields = productMetafields; + this.VariantMetafields = variantMetafields; + } + + /// + /// The store hash identifying the store the shopper is signing in to. + /// + /// The store hash identifying the store the shopper is signing in to. + [DataMember(Name = "storeHash", EmitDefaultValue = false)] + public string StoreHash { get; set; } + + /// + /// Gets or Sets Channel + /// + [DataMember(Name = "channel", EmitDefaultValue = false)] + public BigCommerceChannel Channel { get; set; } + + /// + /// Gets or Sets CustomFields + /// + [DataMember(Name = "customFields", EmitDefaultValue = false)] + public List CustomFields { get; set; } + + /// + /// Gets or Sets ProductMetafields + /// + [DataMember(Name = "productMetafields", EmitDefaultValue = false)] + public List ProductMetafields { get; set; } + + /// + /// Gets or Sets VariantMetafields + /// + [DataMember(Name = "variantMetafields", EmitDefaultValue = false)] + public List VariantMetafields { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SourceBigCommerce {\n"); + sb.Append(" StoreHash: ").Append(StoreHash).Append("\n"); + sb.Append(" Channel: ").Append(Channel).Append("\n"); + sb.Append(" CustomFields: ").Append(CustomFields).Append("\n"); + sb.Append(" ProductMetafields: ").Append(ProductMetafields).Append("\n"); + sb.Append(" VariantMetafields: ").Append(VariantMetafields).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SourceBigCommerce); + } + + /// + /// Returns true if SourceBigCommerce instances are equal + /// + /// Instance of SourceBigCommerce to be compared + /// Boolean + public bool Equals(SourceBigCommerce input) + { + if (input == null) + { + return false; + } + return + ( + this.StoreHash == input.StoreHash || + (this.StoreHash != null && + this.StoreHash.Equals(input.StoreHash)) + ) && + ( + this.Channel == input.Channel || + (this.Channel != null && + this.Channel.Equals(input.Channel)) + ) && + ( + this.CustomFields == input.CustomFields || + this.CustomFields != null && + input.CustomFields != null && + this.CustomFields.SequenceEqual(input.CustomFields) + ) && + ( + this.ProductMetafields == input.ProductMetafields || + this.ProductMetafields != null && + input.ProductMetafields != null && + this.ProductMetafields.SequenceEqual(input.ProductMetafields) + ) && + ( + this.VariantMetafields == input.VariantMetafields || + this.VariantMetafields != null && + input.VariantMetafields != null && + this.VariantMetafields.SequenceEqual(input.VariantMetafields) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.StoreHash != null) + { + hashCode = (hashCode * 59) + this.StoreHash.GetHashCode(); + } + if (this.Channel != null) + { + hashCode = (hashCode * 59) + this.Channel.GetHashCode(); + } + if (this.CustomFields != null) + { + hashCode = (hashCode * 59) + this.CustomFields.GetHashCode(); + } + if (this.ProductMetafields != null) + { + hashCode = (hashCode * 59) + this.ProductMetafields.GetHashCode(); + } + if (this.VariantMetafields != null) + { + hashCode = (hashCode * 59) + this.VariantMetafields.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceBigQuery.cs b/algoliasearch/Ingestion/Models/SourceBigQuery.cs new file mode 100644 index 000000000..c6da65eb7 --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceBigQuery.cs @@ -0,0 +1,248 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// SourceBigQuery + /// + [DataContract(Name = "SourceBigQuery")] + public partial class SourceBigQuery : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets DataType + /// + [DataMember(Name = "dataType", EmitDefaultValue = false)] + public BigQueryDataType? DataType { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SourceBigQuery() { } + /// + /// Initializes a new instance of the class. + /// + /// Project ID of the BigQuery Source. (required). + /// Dataset ID of the BigQuery Source. (required). + /// dataType. + /// Table name (for default BQ).. + /// Table prefix (for Google Analytics).. + /// Custom SQL request to extract data from the BigQuery table.. + /// The name of the column that contains the unique ID, used as `objectID` in Algolia.. + public SourceBigQuery(string projectID = default(string), string datasetID = default(string), BigQueryDataType? dataType = default(BigQueryDataType?), string table = default(string), string tablePrefix = default(string), string customSQLRequest = default(string), string uniqueIDColumn = default(string)) + { + // to ensure "projectID" is required (not null) + if (projectID == null) + { + throw new ArgumentNullException("projectID is a required property for SourceBigQuery and cannot be null"); + } + this.ProjectID = projectID; + // to ensure "datasetID" is required (not null) + if (datasetID == null) + { + throw new ArgumentNullException("datasetID is a required property for SourceBigQuery and cannot be null"); + } + this.DatasetID = datasetID; + this.DataType = dataType; + this.Table = table; + this.TablePrefix = tablePrefix; + this.CustomSQLRequest = customSQLRequest; + this.UniqueIDColumn = uniqueIDColumn; + } + + /// + /// Project ID of the BigQuery Source. + /// + /// Project ID of the BigQuery Source. + [DataMember(Name = "projectID", IsRequired = true, EmitDefaultValue = true)] + public string ProjectID { get; set; } + + /// + /// Dataset ID of the BigQuery Source. + /// + /// Dataset ID of the BigQuery Source. + [DataMember(Name = "datasetID", IsRequired = true, EmitDefaultValue = true)] + public string DatasetID { get; set; } + + /// + /// Table name (for default BQ). + /// + /// Table name (for default BQ). + [DataMember(Name = "table", EmitDefaultValue = false)] + public string Table { get; set; } + + /// + /// Table prefix (for Google Analytics). + /// + /// Table prefix (for Google Analytics). + [DataMember(Name = "tablePrefix", EmitDefaultValue = false)] + public string TablePrefix { get; set; } + + /// + /// Custom SQL request to extract data from the BigQuery table. + /// + /// Custom SQL request to extract data from the BigQuery table. + [DataMember(Name = "customSQLRequest", EmitDefaultValue = false)] + public string CustomSQLRequest { get; set; } + + /// + /// The name of the column that contains the unique ID, used as `objectID` in Algolia. + /// + /// The name of the column that contains the unique ID, used as `objectID` in Algolia. + [DataMember(Name = "uniqueIDColumn", EmitDefaultValue = false)] + public string UniqueIDColumn { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SourceBigQuery {\n"); + sb.Append(" ProjectID: ").Append(ProjectID).Append("\n"); + sb.Append(" DatasetID: ").Append(DatasetID).Append("\n"); + sb.Append(" DataType: ").Append(DataType).Append("\n"); + sb.Append(" Table: ").Append(Table).Append("\n"); + sb.Append(" TablePrefix: ").Append(TablePrefix).Append("\n"); + sb.Append(" CustomSQLRequest: ").Append(CustomSQLRequest).Append("\n"); + sb.Append(" UniqueIDColumn: ").Append(UniqueIDColumn).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SourceBigQuery); + } + + /// + /// Returns true if SourceBigQuery instances are equal + /// + /// Instance of SourceBigQuery to be compared + /// Boolean + public bool Equals(SourceBigQuery input) + { + if (input == null) + { + return false; + } + return + ( + this.ProjectID == input.ProjectID || + (this.ProjectID != null && + this.ProjectID.Equals(input.ProjectID)) + ) && + ( + this.DatasetID == input.DatasetID || + (this.DatasetID != null && + this.DatasetID.Equals(input.DatasetID)) + ) && + ( + this.DataType == input.DataType || + this.DataType.Equals(input.DataType) + ) && + ( + this.Table == input.Table || + (this.Table != null && + this.Table.Equals(input.Table)) + ) && + ( + this.TablePrefix == input.TablePrefix || + (this.TablePrefix != null && + this.TablePrefix.Equals(input.TablePrefix)) + ) && + ( + this.CustomSQLRequest == input.CustomSQLRequest || + (this.CustomSQLRequest != null && + this.CustomSQLRequest.Equals(input.CustomSQLRequest)) + ) && + ( + this.UniqueIDColumn == input.UniqueIDColumn || + (this.UniqueIDColumn != null && + this.UniqueIDColumn.Equals(input.UniqueIDColumn)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ProjectID != null) + { + hashCode = (hashCode * 59) + this.ProjectID.GetHashCode(); + } + if (this.DatasetID != null) + { + hashCode = (hashCode * 59) + this.DatasetID.GetHashCode(); + } + hashCode = (hashCode * 59) + this.DataType.GetHashCode(); + if (this.Table != null) + { + hashCode = (hashCode * 59) + this.Table.GetHashCode(); + } + if (this.TablePrefix != null) + { + hashCode = (hashCode * 59) + this.TablePrefix.GetHashCode(); + } + if (this.CustomSQLRequest != null) + { + hashCode = (hashCode * 59) + this.CustomSQLRequest.GetHashCode(); + } + if (this.UniqueIDColumn != null) + { + hashCode = (hashCode * 59) + this.UniqueIDColumn.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceCSV.cs b/algoliasearch/Ingestion/Models/SourceCSV.cs new file mode 100644 index 000000000..4541b8333 --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceCSV.cs @@ -0,0 +1,219 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// SourceCSV + /// + [DataContract(Name = "SourceCSV")] + public partial class SourceCSV : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Method + /// + [DataMember(Name = "method", EmitDefaultValue = false)] + public MethodType? Method { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SourceCSV() { } + /// + /// Initializes a new instance of the class. + /// + /// The URL of the file. (required). + /// The name of the column that contains the unique ID, used as `objectID` in Algolia.. + /// Mapping of type for every column. For example {\"myColumn\": \"boolean\", \"myOtherColumn\": \"json\"}. . + /// method. + /// The character used to split the value on each line, default to a comma (\\r, \\n, 0xFFFD, and space are forbidden). (default to ","). + public SourceCSV(string url = default(string), string uniqueIDColumn = default(string), Dictionary mapping = default(Dictionary), MethodType? method = default(MethodType?), string delimiter = @",") + { + // to ensure "url" is required (not null) + if (url == null) + { + throw new ArgumentNullException("url is a required property for SourceCSV and cannot be null"); + } + this.Url = url; + this.UniqueIDColumn = uniqueIDColumn; + this.Mapping = mapping; + this.Method = method; + // use default value if no "delimiter" provided + this.Delimiter = delimiter ?? @","; + } + + /// + /// The URL of the file. + /// + /// The URL of the file. + [DataMember(Name = "url", IsRequired = true, EmitDefaultValue = true)] + public string Url { get; set; } + + /// + /// The name of the column that contains the unique ID, used as `objectID` in Algolia. + /// + /// The name of the column that contains the unique ID, used as `objectID` in Algolia. + [DataMember(Name = "uniqueIDColumn", EmitDefaultValue = false)] + public string UniqueIDColumn { get; set; } + + /// + /// Mapping of type for every column. For example {\"myColumn\": \"boolean\", \"myOtherColumn\": \"json\"}. + /// + /// Mapping of type for every column. For example {\"myColumn\": \"boolean\", \"myOtherColumn\": \"json\"}. + [DataMember(Name = "mapping", EmitDefaultValue = false)] + public Dictionary Mapping { get; set; } + + /// + /// The character used to split the value on each line, default to a comma (\\r, \\n, 0xFFFD, and space are forbidden). + /// + /// The character used to split the value on each line, default to a comma (\\r, \\n, 0xFFFD, and space are forbidden). + [DataMember(Name = "delimiter", EmitDefaultValue = false)] + public string Delimiter { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SourceCSV {\n"); + sb.Append(" Url: ").Append(Url).Append("\n"); + sb.Append(" UniqueIDColumn: ").Append(UniqueIDColumn).Append("\n"); + sb.Append(" Mapping: ").Append(Mapping).Append("\n"); + sb.Append(" Method: ").Append(Method).Append("\n"); + sb.Append(" Delimiter: ").Append(Delimiter).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SourceCSV); + } + + /// + /// Returns true if SourceCSV instances are equal + /// + /// Instance of SourceCSV to be compared + /// Boolean + public bool Equals(SourceCSV input) + { + if (input == null) + { + return false; + } + return + ( + this.Url == input.Url || + (this.Url != null && + this.Url.Equals(input.Url)) + ) && + ( + this.UniqueIDColumn == input.UniqueIDColumn || + (this.UniqueIDColumn != null && + this.UniqueIDColumn.Equals(input.UniqueIDColumn)) + ) && + ( + this.Mapping == input.Mapping || + this.Mapping != null && + input.Mapping != null && + this.Mapping.SequenceEqual(input.Mapping) + ) && + ( + this.Method == input.Method || + this.Method.Equals(input.Method) + ) && + ( + this.Delimiter == input.Delimiter || + (this.Delimiter != null && + this.Delimiter.Equals(input.Delimiter)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Url != null) + { + hashCode = (hashCode * 59) + this.Url.GetHashCode(); + } + if (this.UniqueIDColumn != null) + { + hashCode = (hashCode * 59) + this.UniqueIDColumn.GetHashCode(); + } + if (this.Mapping != null) + { + hashCode = (hashCode * 59) + this.Mapping.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Method.GetHashCode(); + if (this.Delimiter != null) + { + hashCode = (hashCode * 59) + this.Delimiter.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Delimiter (string) maxLength + if (this.Delimiter != null && this.Delimiter.Length > 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Delimiter, length must be less than 1.", new[] { "Delimiter" }); + } + + // Delimiter (string) minLength + if (this.Delimiter != null && this.Delimiter.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Delimiter, length must be greater than 1.", new[] { "Delimiter" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceCommercetools.cs b/algoliasearch/Ingestion/Models/SourceCommercetools.cs new file mode 100644 index 000000000..5264bddc0 --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceCommercetools.cs @@ -0,0 +1,210 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// SourceCommercetools + /// + [DataContract(Name = "SourceCommercetools")] + public partial class SourceCommercetools : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SourceCommercetools() { } + /// + /// Initializes a new instance of the class. + /// + /// storeKeys. + /// Array of locales that must match the following pattern: ^[a-z]{2}(-[A-Z]{2})?$. For example [\"fr-FR\", \"en\"]. . + /// url (required). + /// projectKey (required). + /// Determines the value that will be stored in the Algolia record if there's no inventory information on the product. (default to true). + public SourceCommercetools(List storeKeys = default(List), List locales = default(List), string url = default(string), string projectKey = default(string), bool fallbackIsInStockValue = true) + { + // to ensure "url" is required (not null) + if (url == null) + { + throw new ArgumentNullException("url is a required property for SourceCommercetools and cannot be null"); + } + this.Url = url; + // to ensure "projectKey" is required (not null) + if (projectKey == null) + { + throw new ArgumentNullException("projectKey is a required property for SourceCommercetools and cannot be null"); + } + this.ProjectKey = projectKey; + this.StoreKeys = storeKeys; + this.Locales = locales; + this.FallbackIsInStockValue = fallbackIsInStockValue; + } + + /// + /// Gets or Sets StoreKeys + /// + [DataMember(Name = "storeKeys", EmitDefaultValue = false)] + public List StoreKeys { get; set; } + + /// + /// Array of locales that must match the following pattern: ^[a-z]{2}(-[A-Z]{2})?$. For example [\"fr-FR\", \"en\"]. + /// + /// Array of locales that must match the following pattern: ^[a-z]{2}(-[A-Z]{2})?$. For example [\"fr-FR\", \"en\"]. + [DataMember(Name = "locales", EmitDefaultValue = false)] + public List Locales { get; set; } + + /// + /// Gets or Sets Url + /// + [DataMember(Name = "url", IsRequired = true, EmitDefaultValue = true)] + public string Url { get; set; } + + /// + /// Gets or Sets ProjectKey + /// + [DataMember(Name = "projectKey", IsRequired = true, EmitDefaultValue = true)] + public string ProjectKey { get; set; } + + /// + /// Determines the value that will be stored in the Algolia record if there's no inventory information on the product. + /// + /// Determines the value that will be stored in the Algolia record if there's no inventory information on the product. + [DataMember(Name = "fallbackIsInStockValue", EmitDefaultValue = true)] + public bool FallbackIsInStockValue { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SourceCommercetools {\n"); + sb.Append(" StoreKeys: ").Append(StoreKeys).Append("\n"); + sb.Append(" Locales: ").Append(Locales).Append("\n"); + sb.Append(" Url: ").Append(Url).Append("\n"); + sb.Append(" ProjectKey: ").Append(ProjectKey).Append("\n"); + sb.Append(" FallbackIsInStockValue: ").Append(FallbackIsInStockValue).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SourceCommercetools); + } + + /// + /// Returns true if SourceCommercetools instances are equal + /// + /// Instance of SourceCommercetools to be compared + /// Boolean + public bool Equals(SourceCommercetools input) + { + if (input == null) + { + return false; + } + return + ( + this.StoreKeys == input.StoreKeys || + this.StoreKeys != null && + input.StoreKeys != null && + this.StoreKeys.SequenceEqual(input.StoreKeys) + ) && + ( + this.Locales == input.Locales || + this.Locales != null && + input.Locales != null && + this.Locales.SequenceEqual(input.Locales) + ) && + ( + this.Url == input.Url || + (this.Url != null && + this.Url.Equals(input.Url)) + ) && + ( + this.ProjectKey == input.ProjectKey || + (this.ProjectKey != null && + this.ProjectKey.Equals(input.ProjectKey)) + ) && + ( + this.FallbackIsInStockValue == input.FallbackIsInStockValue || + this.FallbackIsInStockValue.Equals(input.FallbackIsInStockValue) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.StoreKeys != null) + { + hashCode = (hashCode * 59) + this.StoreKeys.GetHashCode(); + } + if (this.Locales != null) + { + hashCode = (hashCode * 59) + this.Locales.GetHashCode(); + } + if (this.Url != null) + { + hashCode = (hashCode * 59) + this.Url.GetHashCode(); + } + if (this.ProjectKey != null) + { + hashCode = (hashCode * 59) + this.ProjectKey.GetHashCode(); + } + hashCode = (hashCode * 59) + this.FallbackIsInStockValue.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceCreate.cs b/algoliasearch/Ingestion/Models/SourceCreate.cs new file mode 100644 index 000000000..cc4f4662f --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceCreate.cs @@ -0,0 +1,189 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// SourceCreate + /// + [DataContract(Name = "SourceCreate")] + public partial class SourceCreate : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public SourceType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SourceCreate() { } + /// + /// Initializes a new instance of the class. + /// + /// type (required). + /// name (required). + /// input (required). + /// The authentication UUID.. + public SourceCreate(SourceType type = default(SourceType), string name = default(string), SourceInput input = default(SourceInput), string authenticationID = default(string)) + { + this.Type = type; + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for SourceCreate and cannot be null"); + } + this.Name = name; + // to ensure "input" is required (not null) + if (input == null) + { + throw new ArgumentNullException("input is a required property for SourceCreate and cannot be null"); + } + this.Input = input; + this.AuthenticationID = authenticationID; + } + + /// + /// Gets or Sets Name + /// + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Gets or Sets Input + /// + [DataMember(Name = "input", IsRequired = true, EmitDefaultValue = true)] + public SourceInput Input { get; set; } + + /// + /// The authentication UUID. + /// + /// The authentication UUID. + [DataMember(Name = "authenticationID", EmitDefaultValue = false)] + public string AuthenticationID { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SourceCreate {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Input: ").Append(Input).Append("\n"); + sb.Append(" AuthenticationID: ").Append(AuthenticationID).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SourceCreate); + } + + /// + /// Returns true if SourceCreate instances are equal + /// + /// Instance of SourceCreate to be compared + /// Boolean + public bool Equals(SourceCreate input) + { + if (input == null) + { + return false; + } + return + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Input == input.Input || + (this.Input != null && + this.Input.Equals(input.Input)) + ) && + ( + this.AuthenticationID == input.AuthenticationID || + (this.AuthenticationID != null && + this.AuthenticationID.Equals(input.AuthenticationID)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.Input != null) + { + hashCode = (hashCode * 59) + this.Input.GetHashCode(); + } + if (this.AuthenticationID != null) + { + hashCode = (hashCode * 59) + this.AuthenticationID.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceCreateResponse.cs b/algoliasearch/Ingestion/Models/SourceCreateResponse.cs new file mode 100644 index 000000000..84455ae0d --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceCreateResponse.cs @@ -0,0 +1,181 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// SourceCreateResponse + /// + [DataContract(Name = "SourceCreateResponse")] + public partial class SourceCreateResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SourceCreateResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// The source UUID. (required). + /// name (required). + /// Date of creation (RFC3339 format). (required). + public SourceCreateResponse(string sourceID = default(string), string name = default(string), string createdAt = default(string)) + { + // to ensure "sourceID" is required (not null) + if (sourceID == null) + { + throw new ArgumentNullException("sourceID is a required property for SourceCreateResponse and cannot be null"); + } + this.SourceID = sourceID; + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for SourceCreateResponse and cannot be null"); + } + this.Name = name; + // to ensure "createdAt" is required (not null) + if (createdAt == null) + { + throw new ArgumentNullException("createdAt is a required property for SourceCreateResponse and cannot be null"); + } + this.CreatedAt = createdAt; + } + + /// + /// The source UUID. + /// + /// The source UUID. + [DataMember(Name = "sourceID", IsRequired = true, EmitDefaultValue = true)] + public string SourceID { get; set; } + + /// + /// Gets or Sets Name + /// + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Date of creation (RFC3339 format). + /// + /// Date of creation (RFC3339 format). + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public string CreatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SourceCreateResponse {\n"); + sb.Append(" SourceID: ").Append(SourceID).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SourceCreateResponse); + } + + /// + /// Returns true if SourceCreateResponse instances are equal + /// + /// Instance of SourceCreateResponse to be compared + /// Boolean + public bool Equals(SourceCreateResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.SourceID == input.SourceID || + (this.SourceID != null && + this.SourceID.Equals(input.SourceID)) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.CreatedAt == input.CreatedAt || + (this.CreatedAt != null && + this.CreatedAt.Equals(input.CreatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SourceID != null) + { + hashCode = (hashCode * 59) + this.SourceID.GetHashCode(); + } + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.CreatedAt != null) + { + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceDocker.cs b/algoliasearch/Ingestion/Models/SourceDocker.cs new file mode 100644 index 000000000..a0ad5eff0 --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceDocker.cs @@ -0,0 +1,205 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// SourceDocker + /// + [DataContract(Name = "SourceDocker")] + public partial class SourceDocker : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets ImageType + /// + [DataMember(Name = "imageType", IsRequired = true, EmitDefaultValue = true)] + public DockerImageType ImageType { get; set; } + + /// + /// Gets or Sets Registry + /// + [DataMember(Name = "registry", IsRequired = true, EmitDefaultValue = true)] + public DockerRegistry Registry { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SourceDocker() { } + /// + /// Initializes a new instance of the class. + /// + /// imageType (required). + /// registry (required). + /// The name of the image to pull. (required). + /// The version of the image, defaults to `latest`.. + /// The configuration of the spec. (required). + public SourceDocker(DockerImageType imageType = default(DockerImageType), DockerRegistry registry = default(DockerRegistry), string image = default(string), string varVersion = default(string), Object varConfiguration = default(Object)) + { + this.ImageType = imageType; + this.Registry = registry; + // to ensure "image" is required (not null) + if (image == null) + { + throw new ArgumentNullException("image is a required property for SourceDocker and cannot be null"); + } + this.Image = image; + // to ensure "varConfiguration" is required (not null) + if (varConfiguration == null) + { + throw new ArgumentNullException("varConfiguration is a required property for SourceDocker and cannot be null"); + } + this.VarConfiguration = varConfiguration; + this.VarVersion = varVersion; + } + + /// + /// The name of the image to pull. + /// + /// The name of the image to pull. + [DataMember(Name = "image", IsRequired = true, EmitDefaultValue = true)] + public string Image { get; set; } + + /// + /// The version of the image, defaults to `latest`. + /// + /// The version of the image, defaults to `latest`. + [DataMember(Name = "version", EmitDefaultValue = false)] + public string VarVersion { get; set; } + + /// + /// The configuration of the spec. + /// + /// The configuration of the spec. + [DataMember(Name = "configuration", IsRequired = true, EmitDefaultValue = true)] + public Object VarConfiguration { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SourceDocker {\n"); + sb.Append(" ImageType: ").Append(ImageType).Append("\n"); + sb.Append(" Registry: ").Append(Registry).Append("\n"); + sb.Append(" Image: ").Append(Image).Append("\n"); + sb.Append(" VarVersion: ").Append(VarVersion).Append("\n"); + sb.Append(" VarConfiguration: ").Append(VarConfiguration).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SourceDocker); + } + + /// + /// Returns true if SourceDocker instances are equal + /// + /// Instance of SourceDocker to be compared + /// Boolean + public bool Equals(SourceDocker input) + { + if (input == null) + { + return false; + } + return + ( + this.ImageType == input.ImageType || + this.ImageType.Equals(input.ImageType) + ) && + ( + this.Registry == input.Registry || + this.Registry.Equals(input.Registry) + ) && + ( + this.Image == input.Image || + (this.Image != null && + this.Image.Equals(input.Image)) + ) && + ( + this.VarVersion == input.VarVersion || + (this.VarVersion != null && + this.VarVersion.Equals(input.VarVersion)) + ) && + ( + this.VarConfiguration == input.VarConfiguration || + (this.VarConfiguration != null && + this.VarConfiguration.Equals(input.VarConfiguration)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.ImageType.GetHashCode(); + hashCode = (hashCode * 59) + this.Registry.GetHashCode(); + if (this.Image != null) + { + hashCode = (hashCode * 59) + this.Image.GetHashCode(); + } + if (this.VarVersion != null) + { + hashCode = (hashCode * 59) + this.VarVersion.GetHashCode(); + } + if (this.VarConfiguration != null) + { + hashCode = (hashCode * 59) + this.VarConfiguration.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceInput.cs b/algoliasearch/Ingestion/Models/SourceInput.cs new file mode 100644 index 000000000..95c8bec57 --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceInput.cs @@ -0,0 +1,472 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// SourceInput + /// + [JsonConverter(typeof(SourceInputJsonConverter))] + [DataContract(Name = "SourceInput")] + public partial class SourceInput : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SourceCommercetools. + public SourceInput(SourceCommercetools actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SourceBigCommerce. + public SourceInput(SourceBigCommerce actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SourceJSON. + public SourceInput(SourceJSON actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SourceCSV. + public SourceInput(SourceCSV actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SourceBigQuery. + public SourceInput(SourceBigQuery actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SourceDocker. + public SourceInput(SourceDocker actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(SourceBigCommerce)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SourceBigQuery)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SourceCSV)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SourceCommercetools)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SourceDocker)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SourceJSON)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: SourceBigCommerce, SourceBigQuery, SourceCSV, SourceCommercetools, SourceDocker, SourceJSON"); + } + } + } + + /// + /// Get the actual instance of `SourceCommercetools`. If the actual instance is not `SourceCommercetools`, + /// the InvalidClassException will be thrown + /// + /// An instance of SourceCommercetools + public SourceCommercetools GetterSourceCommercetools() + { + return (SourceCommercetools)this.ActualInstance; + } + + /// + /// Get the actual instance of `SourceBigCommerce`. If the actual instance is not `SourceBigCommerce`, + /// the InvalidClassException will be thrown + /// + /// An instance of SourceBigCommerce + public SourceBigCommerce GetterSourceBigCommerce() + { + return (SourceBigCommerce)this.ActualInstance; + } + + /// + /// Get the actual instance of `SourceJSON`. If the actual instance is not `SourceJSON`, + /// the InvalidClassException will be thrown + /// + /// An instance of SourceJSON + public SourceJSON GetterSourceJSON() + { + return (SourceJSON)this.ActualInstance; + } + + /// + /// Get the actual instance of `SourceCSV`. If the actual instance is not `SourceCSV`, + /// the InvalidClassException will be thrown + /// + /// An instance of SourceCSV + public SourceCSV GetterSourceCSV() + { + return (SourceCSV)this.ActualInstance; + } + + /// + /// Get the actual instance of `SourceBigQuery`. If the actual instance is not `SourceBigQuery`, + /// the InvalidClassException will be thrown + /// + /// An instance of SourceBigQuery + public SourceBigQuery GetterSourceBigQuery() + { + return (SourceBigQuery)this.ActualInstance; + } + + /// + /// Get the actual instance of `SourceDocker`. If the actual instance is not `SourceDocker`, + /// the InvalidClassException will be thrown + /// + /// An instance of SourceDocker + public SourceDocker GetterSourceDocker() + { + return (SourceDocker)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class SourceInput {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, SourceInput.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of SourceInput + /// + /// JSON string + /// An instance of SourceInput + public static SourceInput FromJson(string jsonString) + { + SourceInput newSourceInput = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newSourceInput; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SourceBigCommerce).GetProperty("AdditionalProperties") == null) + { + newSourceInput = new SourceInput(JsonConvert.DeserializeObject(jsonString, SourceInput.SerializerSettings)); + } + else + { + newSourceInput = new SourceInput(JsonConvert.DeserializeObject(jsonString, SourceInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SourceBigCommerce"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SourceBigCommerce: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SourceBigQuery).GetProperty("AdditionalProperties") == null) + { + newSourceInput = new SourceInput(JsonConvert.DeserializeObject(jsonString, SourceInput.SerializerSettings)); + } + else + { + newSourceInput = new SourceInput(JsonConvert.DeserializeObject(jsonString, SourceInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SourceBigQuery"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SourceBigQuery: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SourceCSV).GetProperty("AdditionalProperties") == null) + { + newSourceInput = new SourceInput(JsonConvert.DeserializeObject(jsonString, SourceInput.SerializerSettings)); + } + else + { + newSourceInput = new SourceInput(JsonConvert.DeserializeObject(jsonString, SourceInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SourceCSV"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SourceCSV: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SourceCommercetools).GetProperty("AdditionalProperties") == null) + { + newSourceInput = new SourceInput(JsonConvert.DeserializeObject(jsonString, SourceInput.SerializerSettings)); + } + else + { + newSourceInput = new SourceInput(JsonConvert.DeserializeObject(jsonString, SourceInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SourceCommercetools"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SourceCommercetools: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SourceDocker).GetProperty("AdditionalProperties") == null) + { + newSourceInput = new SourceInput(JsonConvert.DeserializeObject(jsonString, SourceInput.SerializerSettings)); + } + else + { + newSourceInput = new SourceInput(JsonConvert.DeserializeObject(jsonString, SourceInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SourceDocker"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SourceDocker: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SourceJSON).GetProperty("AdditionalProperties") == null) + { + newSourceInput = new SourceInput(JsonConvert.DeserializeObject(jsonString, SourceInput.SerializerSettings)); + } + else + { + newSourceInput = new SourceInput(JsonConvert.DeserializeObject(jsonString, SourceInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SourceJSON"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SourceJSON: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newSourceInput; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SourceInput); + } + + /// + /// Returns true if SourceInput instances are equal + /// + /// Instance of SourceInput to be compared + /// Boolean + public bool Equals(SourceInput input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for SourceInput + /// + public class SourceInputJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(SourceInput).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return SourceInput.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceJSON.cs b/algoliasearch/Ingestion/Models/SourceJSON.cs new file mode 100644 index 000000000..4653b4aab --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceJSON.cs @@ -0,0 +1,167 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// SourceJSON + /// + [DataContract(Name = "SourceJSON")] + public partial class SourceJSON : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Method + /// + [DataMember(Name = "method", EmitDefaultValue = false)] + public MethodType? Method { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SourceJSON() { } + /// + /// Initializes a new instance of the class. + /// + /// The URL of the file. (required). + /// The name of the column that contains the unique ID, used as `objectID` in Algolia.. + /// method. + public SourceJSON(string url = default(string), string uniqueIDColumn = default(string), MethodType? method = default(MethodType?)) + { + // to ensure "url" is required (not null) + if (url == null) + { + throw new ArgumentNullException("url is a required property for SourceJSON and cannot be null"); + } + this.Url = url; + this.UniqueIDColumn = uniqueIDColumn; + this.Method = method; + } + + /// + /// The URL of the file. + /// + /// The URL of the file. + [DataMember(Name = "url", IsRequired = true, EmitDefaultValue = true)] + public string Url { get; set; } + + /// + /// The name of the column that contains the unique ID, used as `objectID` in Algolia. + /// + /// The name of the column that contains the unique ID, used as `objectID` in Algolia. + [DataMember(Name = "uniqueIDColumn", EmitDefaultValue = false)] + public string UniqueIDColumn { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SourceJSON {\n"); + sb.Append(" Url: ").Append(Url).Append("\n"); + sb.Append(" UniqueIDColumn: ").Append(UniqueIDColumn).Append("\n"); + sb.Append(" Method: ").Append(Method).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SourceJSON); + } + + /// + /// Returns true if SourceJSON instances are equal + /// + /// Instance of SourceJSON to be compared + /// Boolean + public bool Equals(SourceJSON input) + { + if (input == null) + { + return false; + } + return + ( + this.Url == input.Url || + (this.Url != null && + this.Url.Equals(input.Url)) + ) && + ( + this.UniqueIDColumn == input.UniqueIDColumn || + (this.UniqueIDColumn != null && + this.UniqueIDColumn.Equals(input.UniqueIDColumn)) + ) && + ( + this.Method == input.Method || + this.Method.Equals(input.Method) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Url != null) + { + hashCode = (hashCode * 59) + this.Url.GetHashCode(); + } + if (this.UniqueIDColumn != null) + { + hashCode = (hashCode * 59) + this.UniqueIDColumn.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Method.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceSearch.cs b/algoliasearch/Ingestion/Models/SourceSearch.cs new file mode 100644 index 000000000..58a9cbc43 --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceSearch.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// SourceSearch + /// + [DataContract(Name = "SourceSearch")] + public partial class SourceSearch : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SourceSearch() { } + /// + /// Initializes a new instance of the class. + /// + /// sourceIDs (required). + public SourceSearch(List sourceIDs = default(List)) + { + // to ensure "sourceIDs" is required (not null) + if (sourceIDs == null) + { + throw new ArgumentNullException("sourceIDs is a required property for SourceSearch and cannot be null"); + } + this.SourceIDs = sourceIDs; + } + + /// + /// Gets or Sets SourceIDs + /// + [DataMember(Name = "sourceIDs", IsRequired = true, EmitDefaultValue = true)] + public List SourceIDs { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SourceSearch {\n"); + sb.Append(" SourceIDs: ").Append(SourceIDs).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SourceSearch); + } + + /// + /// Returns true if SourceSearch instances are equal + /// + /// Instance of SourceSearch to be compared + /// Boolean + public bool Equals(SourceSearch input) + { + if (input == null) + { + return false; + } + return + ( + this.SourceIDs == input.SourceIDs || + this.SourceIDs != null && + input.SourceIDs != null && + this.SourceIDs.SequenceEqual(input.SourceIDs) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SourceIDs != null) + { + hashCode = (hashCode * 59) + this.SourceIDs.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceSortKeys.cs b/algoliasearch/Ingestion/Models/SourceSortKeys.cs new file mode 100644 index 000000000..2b96d581e --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceSortKeys.cs @@ -0,0 +1,55 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Used to sort the Source list endpoint. + /// + /// Used to sort the Source list endpoint. + [JsonConverter(typeof(StringEnumConverter))] + public enum SourceSortKeys + { + /// + /// Enum Name for value: name + /// + [EnumMember(Value = "name")] + Name = 1, + + /// + /// Enum Type for value: type + /// + [EnumMember(Value = "type")] + Type = 2, + + /// + /// Enum UpdatedAt for value: updatedAt + /// + [EnumMember(Value = "updatedAt")] + UpdatedAt = 3, + + /// + /// Enum CreatedAt for value: createdAt + /// + [EnumMember(Value = "createdAt")] + CreatedAt = 4 + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceType.cs b/algoliasearch/Ingestion/Models/SourceType.cs new file mode 100644 index 000000000..b4805b1bc --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceType.cs @@ -0,0 +1,66 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Defines SourceType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum SourceType + { + /// + /// Enum Bigcommerce for value: bigcommerce + /// + [EnumMember(Value = "bigcommerce")] + Bigcommerce = 1, + + /// + /// Enum Commercetools for value: commercetools + /// + [EnumMember(Value = "commercetools")] + Commercetools = 2, + + /// + /// Enum Json for value: json + /// + [EnumMember(Value = "json")] + Json = 3, + + /// + /// Enum Csv for value: csv + /// + [EnumMember(Value = "csv")] + Csv = 4, + + /// + /// Enum Bigquery for value: bigquery + /// + [EnumMember(Value = "bigquery")] + Bigquery = 5, + + /// + /// Enum Docker for value: docker + /// + [EnumMember(Value = "docker")] + Docker = 6 + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceUpdate.cs b/algoliasearch/Ingestion/Models/SourceUpdate.cs new file mode 100644 index 000000000..5ad0841b4 --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceUpdate.cs @@ -0,0 +1,160 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// SourceUpdate + /// + [DataContract(Name = "SourceUpdate")] + public partial class SourceUpdate : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name. + /// input. + /// The authentication UUID.. + public SourceUpdate(string name = default(string), SourceUpdateInput input = default(SourceUpdateInput), string authenticationID = default(string)) + { + this.Name = name; + this.Input = input; + this.AuthenticationID = authenticationID; + } + + /// + /// Gets or Sets Name + /// + [DataMember(Name = "name", EmitDefaultValue = false)] + public string Name { get; set; } + + /// + /// Gets or Sets Input + /// + [DataMember(Name = "input", EmitDefaultValue = false)] + public SourceUpdateInput Input { get; set; } + + /// + /// The authentication UUID. + /// + /// The authentication UUID. + [DataMember(Name = "authenticationID", EmitDefaultValue = false)] + public string AuthenticationID { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SourceUpdate {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Input: ").Append(Input).Append("\n"); + sb.Append(" AuthenticationID: ").Append(AuthenticationID).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SourceUpdate); + } + + /// + /// Returns true if SourceUpdate instances are equal + /// + /// Instance of SourceUpdate to be compared + /// Boolean + public bool Equals(SourceUpdate input) + { + if (input == null) + { + return false; + } + return + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Input == input.Input || + (this.Input != null && + this.Input.Equals(input.Input)) + ) && + ( + this.AuthenticationID == input.AuthenticationID || + (this.AuthenticationID != null && + this.AuthenticationID.Equals(input.AuthenticationID)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.Input != null) + { + hashCode = (hashCode * 59) + this.Input.GetHashCode(); + } + if (this.AuthenticationID != null) + { + hashCode = (hashCode * 59) + this.AuthenticationID.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceUpdateCommercetools.cs b/algoliasearch/Ingestion/Models/SourceUpdateCommercetools.cs new file mode 100644 index 000000000..0e2dc0d39 --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceUpdateCommercetools.cs @@ -0,0 +1,145 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// SourceUpdateCommercetools + /// + [DataContract(Name = "SourceUpdateCommercetools")] + public partial class SourceUpdateCommercetools : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Unique and immutable key of the referenced Store.. + /// Array of locales that must match the following pattern: ^[a-z]{2}(-[A-Z]{2})?$. For example [\"fr-FR\", \"en\"]. . + public SourceUpdateCommercetools(List storeKeys = default(List), List locales = default(List)) + { + this.StoreKeys = storeKeys; + this.Locales = locales; + } + + /// + /// Unique and immutable key of the referenced Store. + /// + /// Unique and immutable key of the referenced Store. + [DataMember(Name = "storeKeys", EmitDefaultValue = false)] + public List StoreKeys { get; set; } + + /// + /// Array of locales that must match the following pattern: ^[a-z]{2}(-[A-Z]{2})?$. For example [\"fr-FR\", \"en\"]. + /// + /// Array of locales that must match the following pattern: ^[a-z]{2}(-[A-Z]{2})?$. For example [\"fr-FR\", \"en\"]. + [DataMember(Name = "locales", EmitDefaultValue = false)] + public List Locales { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SourceUpdateCommercetools {\n"); + sb.Append(" StoreKeys: ").Append(StoreKeys).Append("\n"); + sb.Append(" Locales: ").Append(Locales).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SourceUpdateCommercetools); + } + + /// + /// Returns true if SourceUpdateCommercetools instances are equal + /// + /// Instance of SourceUpdateCommercetools to be compared + /// Boolean + public bool Equals(SourceUpdateCommercetools input) + { + if (input == null) + { + return false; + } + return + ( + this.StoreKeys == input.StoreKeys || + this.StoreKeys != null && + input.StoreKeys != null && + this.StoreKeys.SequenceEqual(input.StoreKeys) + ) && + ( + this.Locales == input.Locales || + this.Locales != null && + input.Locales != null && + this.Locales.SequenceEqual(input.Locales) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.StoreKeys != null) + { + hashCode = (hashCode * 59) + this.StoreKeys.GetHashCode(); + } + if (this.Locales != null) + { + hashCode = (hashCode * 59) + this.Locales.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceUpdateDocker.cs b/algoliasearch/Ingestion/Models/SourceUpdateDocker.cs new file mode 100644 index 000000000..68820a186 --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceUpdateDocker.cs @@ -0,0 +1,186 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// SourceUpdateDocker + /// + [DataContract(Name = "SourceUpdateDocker")] + public partial class SourceUpdateDocker : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Registry + /// + [DataMember(Name = "registry", EmitDefaultValue = false)] + public DockerRegistry? Registry { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SourceUpdateDocker() { } + /// + /// Initializes a new instance of the class. + /// + /// registry. + /// The name of the image to pull.. + /// The version of the image, defaults to `latest`.. + /// The configuration of the spec. (required). + public SourceUpdateDocker(DockerRegistry? registry = default(DockerRegistry?), string image = default(string), string varVersion = default(string), Object varConfiguration = default(Object)) + { + // to ensure "varConfiguration" is required (not null) + if (varConfiguration == null) + { + throw new ArgumentNullException("varConfiguration is a required property for SourceUpdateDocker and cannot be null"); + } + this.VarConfiguration = varConfiguration; + this.Registry = registry; + this.Image = image; + this.VarVersion = varVersion; + } + + /// + /// The name of the image to pull. + /// + /// The name of the image to pull. + [DataMember(Name = "image", EmitDefaultValue = false)] + public string Image { get; set; } + + /// + /// The version of the image, defaults to `latest`. + /// + /// The version of the image, defaults to `latest`. + [DataMember(Name = "version", EmitDefaultValue = false)] + public string VarVersion { get; set; } + + /// + /// The configuration of the spec. + /// + /// The configuration of the spec. + [DataMember(Name = "configuration", IsRequired = true, EmitDefaultValue = true)] + public Object VarConfiguration { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SourceUpdateDocker {\n"); + sb.Append(" Registry: ").Append(Registry).Append("\n"); + sb.Append(" Image: ").Append(Image).Append("\n"); + sb.Append(" VarVersion: ").Append(VarVersion).Append("\n"); + sb.Append(" VarConfiguration: ").Append(VarConfiguration).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SourceUpdateDocker); + } + + /// + /// Returns true if SourceUpdateDocker instances are equal + /// + /// Instance of SourceUpdateDocker to be compared + /// Boolean + public bool Equals(SourceUpdateDocker input) + { + if (input == null) + { + return false; + } + return + ( + this.Registry == input.Registry || + this.Registry.Equals(input.Registry) + ) && + ( + this.Image == input.Image || + (this.Image != null && + this.Image.Equals(input.Image)) + ) && + ( + this.VarVersion == input.VarVersion || + (this.VarVersion != null && + this.VarVersion.Equals(input.VarVersion)) + ) && + ( + this.VarConfiguration == input.VarConfiguration || + (this.VarConfiguration != null && + this.VarConfiguration.Equals(input.VarConfiguration)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Registry.GetHashCode(); + if (this.Image != null) + { + hashCode = (hashCode * 59) + this.Image.GetHashCode(); + } + if (this.VarVersion != null) + { + hashCode = (hashCode * 59) + this.VarVersion.GetHashCode(); + } + if (this.VarConfiguration != null) + { + hashCode = (hashCode * 59) + this.VarConfiguration.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceUpdateInput.cs b/algoliasearch/Ingestion/Models/SourceUpdateInput.cs new file mode 100644 index 000000000..0cbb4e609 --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceUpdateInput.cs @@ -0,0 +1,426 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// SourceUpdateInput + /// + [JsonConverter(typeof(SourceUpdateInputJsonConverter))] + [DataContract(Name = "SourceUpdateInput")] + public partial class SourceUpdateInput : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SourceUpdateCommercetools. + public SourceUpdateInput(SourceUpdateCommercetools actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SourceJSON. + public SourceUpdateInput(SourceJSON actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SourceCSV. + public SourceUpdateInput(SourceCSV actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SourceBigQuery. + public SourceUpdateInput(SourceBigQuery actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SourceUpdateDocker. + public SourceUpdateInput(SourceUpdateDocker actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(SourceBigQuery)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SourceCSV)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SourceJSON)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SourceUpdateCommercetools)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SourceUpdateDocker)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: SourceBigQuery, SourceCSV, SourceJSON, SourceUpdateCommercetools, SourceUpdateDocker"); + } + } + } + + /// + /// Get the actual instance of `SourceUpdateCommercetools`. If the actual instance is not `SourceUpdateCommercetools`, + /// the InvalidClassException will be thrown + /// + /// An instance of SourceUpdateCommercetools + public SourceUpdateCommercetools GetterSourceUpdateCommercetools() + { + return (SourceUpdateCommercetools)this.ActualInstance; + } + + /// + /// Get the actual instance of `SourceJSON`. If the actual instance is not `SourceJSON`, + /// the InvalidClassException will be thrown + /// + /// An instance of SourceJSON + public SourceJSON GetterSourceJSON() + { + return (SourceJSON)this.ActualInstance; + } + + /// + /// Get the actual instance of `SourceCSV`. If the actual instance is not `SourceCSV`, + /// the InvalidClassException will be thrown + /// + /// An instance of SourceCSV + public SourceCSV GetterSourceCSV() + { + return (SourceCSV)this.ActualInstance; + } + + /// + /// Get the actual instance of `SourceBigQuery`. If the actual instance is not `SourceBigQuery`, + /// the InvalidClassException will be thrown + /// + /// An instance of SourceBigQuery + public SourceBigQuery GetterSourceBigQuery() + { + return (SourceBigQuery)this.ActualInstance; + } + + /// + /// Get the actual instance of `SourceUpdateDocker`. If the actual instance is not `SourceUpdateDocker`, + /// the InvalidClassException will be thrown + /// + /// An instance of SourceUpdateDocker + public SourceUpdateDocker GetterSourceUpdateDocker() + { + return (SourceUpdateDocker)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class SourceUpdateInput {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, SourceUpdateInput.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of SourceUpdateInput + /// + /// JSON string + /// An instance of SourceUpdateInput + public static SourceUpdateInput FromJson(string jsonString) + { + SourceUpdateInput newSourceUpdateInput = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newSourceUpdateInput; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SourceBigQuery).GetProperty("AdditionalProperties") == null) + { + newSourceUpdateInput = new SourceUpdateInput(JsonConvert.DeserializeObject(jsonString, SourceUpdateInput.SerializerSettings)); + } + else + { + newSourceUpdateInput = new SourceUpdateInput(JsonConvert.DeserializeObject(jsonString, SourceUpdateInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SourceBigQuery"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SourceBigQuery: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SourceCSV).GetProperty("AdditionalProperties") == null) + { + newSourceUpdateInput = new SourceUpdateInput(JsonConvert.DeserializeObject(jsonString, SourceUpdateInput.SerializerSettings)); + } + else + { + newSourceUpdateInput = new SourceUpdateInput(JsonConvert.DeserializeObject(jsonString, SourceUpdateInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SourceCSV"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SourceCSV: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SourceJSON).GetProperty("AdditionalProperties") == null) + { + newSourceUpdateInput = new SourceUpdateInput(JsonConvert.DeserializeObject(jsonString, SourceUpdateInput.SerializerSettings)); + } + else + { + newSourceUpdateInput = new SourceUpdateInput(JsonConvert.DeserializeObject(jsonString, SourceUpdateInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SourceJSON"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SourceJSON: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SourceUpdateCommercetools).GetProperty("AdditionalProperties") == null) + { + newSourceUpdateInput = new SourceUpdateInput(JsonConvert.DeserializeObject(jsonString, SourceUpdateInput.SerializerSettings)); + } + else + { + newSourceUpdateInput = new SourceUpdateInput(JsonConvert.DeserializeObject(jsonString, SourceUpdateInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SourceUpdateCommercetools"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SourceUpdateCommercetools: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SourceUpdateDocker).GetProperty("AdditionalProperties") == null) + { + newSourceUpdateInput = new SourceUpdateInput(JsonConvert.DeserializeObject(jsonString, SourceUpdateInput.SerializerSettings)); + } + else + { + newSourceUpdateInput = new SourceUpdateInput(JsonConvert.DeserializeObject(jsonString, SourceUpdateInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SourceUpdateDocker"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SourceUpdateDocker: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newSourceUpdateInput; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SourceUpdateInput); + } + + /// + /// Returns true if SourceUpdateInput instances are equal + /// + /// Instance of SourceUpdateInput to be compared + /// Boolean + public bool Equals(SourceUpdateInput input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for SourceUpdateInput + /// + public class SourceUpdateInputJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(SourceUpdateInput).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return SourceUpdateInput.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SourceUpdateResponse.cs b/algoliasearch/Ingestion/Models/SourceUpdateResponse.cs new file mode 100644 index 000000000..3b1a7fade --- /dev/null +++ b/algoliasearch/Ingestion/Models/SourceUpdateResponse.cs @@ -0,0 +1,181 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// SourceUpdateResponse + /// + [DataContract(Name = "SourceUpdateResponse")] + public partial class SourceUpdateResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SourceUpdateResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// The source UUID. (required). + /// name (required). + /// Date of last update (RFC3339 format). (required). + public SourceUpdateResponse(string sourceID = default(string), string name = default(string), string updatedAt = default(string)) + { + // to ensure "sourceID" is required (not null) + if (sourceID == null) + { + throw new ArgumentNullException("sourceID is a required property for SourceUpdateResponse and cannot be null"); + } + this.SourceID = sourceID; + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for SourceUpdateResponse and cannot be null"); + } + this.Name = name; + // to ensure "updatedAt" is required (not null) + if (updatedAt == null) + { + throw new ArgumentNullException("updatedAt is a required property for SourceUpdateResponse and cannot be null"); + } + this.UpdatedAt = updatedAt; + } + + /// + /// The source UUID. + /// + /// The source UUID. + [DataMember(Name = "sourceID", IsRequired = true, EmitDefaultValue = true)] + public string SourceID { get; set; } + + /// + /// Gets or Sets Name + /// + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Date of last update (RFC3339 format). + /// + /// Date of last update (RFC3339 format). + [DataMember(Name = "updatedAt", IsRequired = true, EmitDefaultValue = true)] + public string UpdatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SourceUpdateResponse {\n"); + sb.Append(" SourceID: ").Append(SourceID).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SourceUpdateResponse); + } + + /// + /// Returns true if SourceUpdateResponse instances are equal + /// + /// Instance of SourceUpdateResponse to be compared + /// Boolean + public bool Equals(SourceUpdateResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.SourceID == input.SourceID || + (this.SourceID != null && + this.SourceID.Equals(input.SourceID)) + ) && + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SourceID != null) + { + hashCode = (hashCode * 59) + this.SourceID.GetHashCode(); + } + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SubscriptionTrigger.cs b/algoliasearch/Ingestion/Models/SubscriptionTrigger.cs new file mode 100644 index 000000000..2c459a289 --- /dev/null +++ b/algoliasearch/Ingestion/Models/SubscriptionTrigger.cs @@ -0,0 +1,124 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The trigger input for a task of type 'subscription'. + /// + [DataContract(Name = "SubscriptionTrigger")] + public partial class SubscriptionTrigger : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public SubscriptionTriggerType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SubscriptionTrigger() { } + /// + /// Initializes a new instance of the class. + /// + /// type (required). + public SubscriptionTrigger(SubscriptionTriggerType type = default(SubscriptionTriggerType)) + { + this.Type = type; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SubscriptionTrigger {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SubscriptionTrigger); + } + + /// + /// Returns true if SubscriptionTrigger instances are equal + /// + /// Instance of SubscriptionTrigger to be compared + /// Boolean + public bool Equals(SubscriptionTrigger input) + { + if (input == null) + { + return false; + } + return + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/SubscriptionTriggerType.cs b/algoliasearch/Ingestion/Models/SubscriptionTriggerType.cs new file mode 100644 index 000000000..45c495cd8 --- /dev/null +++ b/algoliasearch/Ingestion/Models/SubscriptionTriggerType.cs @@ -0,0 +1,37 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// A task which is triggered by an external subscription (e.g. Webhook). + /// + /// A task which is triggered by an external subscription (e.g. Webhook). + [JsonConverter(typeof(StringEnumConverter))] + public enum SubscriptionTriggerType + { + /// + /// Enum Subscription for value: subscription + /// + [EnumMember(Value = "subscription")] + Subscription = 1 + } + +} diff --git a/algoliasearch/Ingestion/Models/Task.cs b/algoliasearch/Ingestion/Models/Task.cs new file mode 100644 index 000000000..a5c40b3c7 --- /dev/null +++ b/algoliasearch/Ingestion/Models/Task.cs @@ -0,0 +1,322 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Task + /// + [DataContract(Name = "Task")] + public partial class Task : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Action + /// + [DataMember(Name = "action", IsRequired = true, EmitDefaultValue = true)] + public ActionType Action { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Task() { } + /// + /// Initializes a new instance of the class. + /// + /// The task UUID. (required). + /// The source UUID. (required). + /// The destination UUID. (required). + /// trigger (required). + /// input. + /// Whether the task is enabled or not. (required) (default to true). + /// A percentage representing the accepted failure threshold to determine if a `run` succeeded or not.. + /// action (required). + /// Date of creation (RFC3339 format). (required). + /// Date of last update (RFC3339 format).. + public Task(string taskID = default(string), string sourceID = default(string), string destinationID = default(string), Trigger trigger = default(Trigger), TaskInput input = default(TaskInput), bool enabled = true, int failureThreshold = default(int), ActionType action = default(ActionType), string createdAt = default(string), string updatedAt = default(string)) + { + // to ensure "taskID" is required (not null) + if (taskID == null) + { + throw new ArgumentNullException("taskID is a required property for Task and cannot be null"); + } + this.TaskID = taskID; + // to ensure "sourceID" is required (not null) + if (sourceID == null) + { + throw new ArgumentNullException("sourceID is a required property for Task and cannot be null"); + } + this.SourceID = sourceID; + // to ensure "destinationID" is required (not null) + if (destinationID == null) + { + throw new ArgumentNullException("destinationID is a required property for Task and cannot be null"); + } + this.DestinationID = destinationID; + // to ensure "trigger" is required (not null) + if (trigger == null) + { + throw new ArgumentNullException("trigger is a required property for Task and cannot be null"); + } + this.Trigger = trigger; + this.Enabled = enabled; + this.Action = action; + // to ensure "createdAt" is required (not null) + if (createdAt == null) + { + throw new ArgumentNullException("createdAt is a required property for Task and cannot be null"); + } + this.CreatedAt = createdAt; + this.Input = input; + this.FailureThreshold = failureThreshold; + this.UpdatedAt = updatedAt; + } + + /// + /// The task UUID. + /// + /// The task UUID. + [DataMember(Name = "taskID", IsRequired = true, EmitDefaultValue = true)] + public string TaskID { get; set; } + + /// + /// The source UUID. + /// + /// The source UUID. + [DataMember(Name = "sourceID", IsRequired = true, EmitDefaultValue = true)] + public string SourceID { get; set; } + + /// + /// The destination UUID. + /// + /// The destination UUID. + [DataMember(Name = "destinationID", IsRequired = true, EmitDefaultValue = true)] + public string DestinationID { get; set; } + + /// + /// Gets or Sets Trigger + /// + [DataMember(Name = "trigger", IsRequired = true, EmitDefaultValue = true)] + public Trigger Trigger { get; set; } + + /// + /// Gets or Sets Input + /// + [DataMember(Name = "input", EmitDefaultValue = false)] + public TaskInput Input { get; set; } + + /// + /// Whether the task is enabled or not. + /// + /// Whether the task is enabled or not. + [DataMember(Name = "enabled", IsRequired = true, EmitDefaultValue = true)] + public bool Enabled { get; set; } + + /// + /// A percentage representing the accepted failure threshold to determine if a `run` succeeded or not. + /// + /// A percentage representing the accepted failure threshold to determine if a `run` succeeded or not. + [DataMember(Name = "failureThreshold", EmitDefaultValue = false)] + public int FailureThreshold { get; set; } + + /// + /// Date of creation (RFC3339 format). + /// + /// Date of creation (RFC3339 format). + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public string CreatedAt { get; set; } + + /// + /// Date of last update (RFC3339 format). + /// + /// Date of last update (RFC3339 format). + [DataMember(Name = "updatedAt", EmitDefaultValue = false)] + public string UpdatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Task {\n"); + sb.Append(" TaskID: ").Append(TaskID).Append("\n"); + sb.Append(" SourceID: ").Append(SourceID).Append("\n"); + sb.Append(" DestinationID: ").Append(DestinationID).Append("\n"); + sb.Append(" Trigger: ").Append(Trigger).Append("\n"); + sb.Append(" Input: ").Append(Input).Append("\n"); + sb.Append(" Enabled: ").Append(Enabled).Append("\n"); + sb.Append(" FailureThreshold: ").Append(FailureThreshold).Append("\n"); + sb.Append(" Action: ").Append(Action).Append("\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Task); + } + + /// + /// Returns true if Task instances are equal + /// + /// Instance of Task to be compared + /// Boolean + public bool Equals(Task input) + { + if (input == null) + { + return false; + } + return + ( + this.TaskID == input.TaskID || + (this.TaskID != null && + this.TaskID.Equals(input.TaskID)) + ) && + ( + this.SourceID == input.SourceID || + (this.SourceID != null && + this.SourceID.Equals(input.SourceID)) + ) && + ( + this.DestinationID == input.DestinationID || + (this.DestinationID != null && + this.DestinationID.Equals(input.DestinationID)) + ) && + ( + this.Trigger == input.Trigger || + (this.Trigger != null && + this.Trigger.Equals(input.Trigger)) + ) && + ( + this.Input == input.Input || + (this.Input != null && + this.Input.Equals(input.Input)) + ) && + ( + this.Enabled == input.Enabled || + this.Enabled.Equals(input.Enabled) + ) && + ( + this.FailureThreshold == input.FailureThreshold || + this.FailureThreshold.Equals(input.FailureThreshold) + ) && + ( + this.Action == input.Action || + this.Action.Equals(input.Action) + ) && + ( + this.CreatedAt == input.CreatedAt || + (this.CreatedAt != null && + this.CreatedAt.Equals(input.CreatedAt)) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.TaskID != null) + { + hashCode = (hashCode * 59) + this.TaskID.GetHashCode(); + } + if (this.SourceID != null) + { + hashCode = (hashCode * 59) + this.SourceID.GetHashCode(); + } + if (this.DestinationID != null) + { + hashCode = (hashCode * 59) + this.DestinationID.GetHashCode(); + } + if (this.Trigger != null) + { + hashCode = (hashCode * 59) + this.Trigger.GetHashCode(); + } + if (this.Input != null) + { + hashCode = (hashCode * 59) + this.Input.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Enabled.GetHashCode(); + hashCode = (hashCode * 59) + this.FailureThreshold.GetHashCode(); + hashCode = (hashCode * 59) + this.Action.GetHashCode(); + if (this.CreatedAt != null) + { + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + } + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // FailureThreshold (int) maximum + if (this.FailureThreshold > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for FailureThreshold, must be a value less than or equal to 100.", new[] { "FailureThreshold" }); + } + + // FailureThreshold (int) minimum + if (this.FailureThreshold < (int)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for FailureThreshold, must be a value greater than or equal to 0.", new[] { "FailureThreshold" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/TaskCreate.cs b/algoliasearch/Ingestion/Models/TaskCreate.cs new file mode 100644 index 000000000..bd999b0fd --- /dev/null +++ b/algoliasearch/Ingestion/Models/TaskCreate.cs @@ -0,0 +1,255 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The payload for a task creation. + /// + [DataContract(Name = "TaskCreate")] + public partial class TaskCreate : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Action + /// + [DataMember(Name = "action", IsRequired = true, EmitDefaultValue = true)] + public ActionType Action { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TaskCreate() { } + /// + /// Initializes a new instance of the class. + /// + /// The source UUID. (required). + /// The destination UUID. (required). + /// trigger (required). + /// action (required). + /// Whether the task is enabled or not.. + /// A percentage representing the accepted failure threshold to determine if a `run` succeeded or not.. + /// input. + public TaskCreate(string sourceID = default(string), string destinationID = default(string), TaskCreateTrigger trigger = default(TaskCreateTrigger), ActionType action = default(ActionType), bool enabled = default(bool), int failureThreshold = default(int), TaskInput input = default(TaskInput)) + { + // to ensure "sourceID" is required (not null) + if (sourceID == null) + { + throw new ArgumentNullException("sourceID is a required property for TaskCreate and cannot be null"); + } + this.SourceID = sourceID; + // to ensure "destinationID" is required (not null) + if (destinationID == null) + { + throw new ArgumentNullException("destinationID is a required property for TaskCreate and cannot be null"); + } + this.DestinationID = destinationID; + // to ensure "trigger" is required (not null) + if (trigger == null) + { + throw new ArgumentNullException("trigger is a required property for TaskCreate and cannot be null"); + } + this.Trigger = trigger; + this.Action = action; + this.Enabled = enabled; + this.FailureThreshold = failureThreshold; + this.Input = input; + } + + /// + /// The source UUID. + /// + /// The source UUID. + [DataMember(Name = "sourceID", IsRequired = true, EmitDefaultValue = true)] + public string SourceID { get; set; } + + /// + /// The destination UUID. + /// + /// The destination UUID. + [DataMember(Name = "destinationID", IsRequired = true, EmitDefaultValue = true)] + public string DestinationID { get; set; } + + /// + /// Gets or Sets Trigger + /// + [DataMember(Name = "trigger", IsRequired = true, EmitDefaultValue = true)] + public TaskCreateTrigger Trigger { get; set; } + + /// + /// Whether the task is enabled or not. + /// + /// Whether the task is enabled or not. + [DataMember(Name = "enabled", EmitDefaultValue = true)] + public bool Enabled { get; set; } + + /// + /// A percentage representing the accepted failure threshold to determine if a `run` succeeded or not. + /// + /// A percentage representing the accepted failure threshold to determine if a `run` succeeded or not. + [DataMember(Name = "failureThreshold", EmitDefaultValue = false)] + public int FailureThreshold { get; set; } + + /// + /// Gets or Sets Input + /// + [DataMember(Name = "input", EmitDefaultValue = false)] + public TaskInput Input { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TaskCreate {\n"); + sb.Append(" SourceID: ").Append(SourceID).Append("\n"); + sb.Append(" DestinationID: ").Append(DestinationID).Append("\n"); + sb.Append(" Trigger: ").Append(Trigger).Append("\n"); + sb.Append(" Action: ").Append(Action).Append("\n"); + sb.Append(" Enabled: ").Append(Enabled).Append("\n"); + sb.Append(" FailureThreshold: ").Append(FailureThreshold).Append("\n"); + sb.Append(" Input: ").Append(Input).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TaskCreate); + } + + /// + /// Returns true if TaskCreate instances are equal + /// + /// Instance of TaskCreate to be compared + /// Boolean + public bool Equals(TaskCreate input) + { + if (input == null) + { + return false; + } + return + ( + this.SourceID == input.SourceID || + (this.SourceID != null && + this.SourceID.Equals(input.SourceID)) + ) && + ( + this.DestinationID == input.DestinationID || + (this.DestinationID != null && + this.DestinationID.Equals(input.DestinationID)) + ) && + ( + this.Trigger == input.Trigger || + (this.Trigger != null && + this.Trigger.Equals(input.Trigger)) + ) && + ( + this.Action == input.Action || + this.Action.Equals(input.Action) + ) && + ( + this.Enabled == input.Enabled || + this.Enabled.Equals(input.Enabled) + ) && + ( + this.FailureThreshold == input.FailureThreshold || + this.FailureThreshold.Equals(input.FailureThreshold) + ) && + ( + this.Input == input.Input || + (this.Input != null && + this.Input.Equals(input.Input)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SourceID != null) + { + hashCode = (hashCode * 59) + this.SourceID.GetHashCode(); + } + if (this.DestinationID != null) + { + hashCode = (hashCode * 59) + this.DestinationID.GetHashCode(); + } + if (this.Trigger != null) + { + hashCode = (hashCode * 59) + this.Trigger.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Action.GetHashCode(); + hashCode = (hashCode * 59) + this.Enabled.GetHashCode(); + hashCode = (hashCode * 59) + this.FailureThreshold.GetHashCode(); + if (this.Input != null) + { + hashCode = (hashCode * 59) + this.Input.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // FailureThreshold (int) maximum + if (this.FailureThreshold > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for FailureThreshold, must be a value less than or equal to 100.", new[] { "FailureThreshold" }); + } + + // FailureThreshold (int) minimum + if (this.FailureThreshold < (int)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for FailureThreshold, must be a value greater than or equal to 0.", new[] { "FailureThreshold" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/TaskCreateResponse.cs b/algoliasearch/Ingestion/Models/TaskCreateResponse.cs new file mode 100644 index 000000000..1b8dbd1d5 --- /dev/null +++ b/algoliasearch/Ingestion/Models/TaskCreateResponse.cs @@ -0,0 +1,158 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The response from the API after a task creation. + /// + [DataContract(Name = "TaskCreateResponse")] + public partial class TaskCreateResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TaskCreateResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// The task UUID. (required). + /// Date of creation (RFC3339 format). (required). + public TaskCreateResponse(string taskID = default(string), string createdAt = default(string)) + { + // to ensure "taskID" is required (not null) + if (taskID == null) + { + throw new ArgumentNullException("taskID is a required property for TaskCreateResponse and cannot be null"); + } + this.TaskID = taskID; + // to ensure "createdAt" is required (not null) + if (createdAt == null) + { + throw new ArgumentNullException("createdAt is a required property for TaskCreateResponse and cannot be null"); + } + this.CreatedAt = createdAt; + } + + /// + /// The task UUID. + /// + /// The task UUID. + [DataMember(Name = "taskID", IsRequired = true, EmitDefaultValue = true)] + public string TaskID { get; set; } + + /// + /// Date of creation (RFC3339 format). + /// + /// Date of creation (RFC3339 format). + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public string CreatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TaskCreateResponse {\n"); + sb.Append(" TaskID: ").Append(TaskID).Append("\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TaskCreateResponse); + } + + /// + /// Returns true if TaskCreateResponse instances are equal + /// + /// Instance of TaskCreateResponse to be compared + /// Boolean + public bool Equals(TaskCreateResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.TaskID == input.TaskID || + (this.TaskID != null && + this.TaskID.Equals(input.TaskID)) + ) && + ( + this.CreatedAt == input.CreatedAt || + (this.CreatedAt != null && + this.CreatedAt.Equals(input.CreatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.TaskID != null) + { + hashCode = (hashCode * 59) + this.TaskID.GetHashCode(); + } + if (this.CreatedAt != null) + { + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/TaskCreateTrigger.cs b/algoliasearch/Ingestion/Models/TaskCreateTrigger.cs new file mode 100644 index 000000000..94696fd03 --- /dev/null +++ b/algoliasearch/Ingestion/Models/TaskCreateTrigger.cs @@ -0,0 +1,334 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// TaskCreateTrigger + /// + [JsonConverter(typeof(TaskCreateTriggerJsonConverter))] + [DataContract(Name = "TaskCreateTrigger")] + public partial class TaskCreateTrigger : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of OnDemandTriggerInput. + public TaskCreateTrigger(OnDemandTriggerInput actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of ScheduleTriggerInput. + public TaskCreateTrigger(ScheduleTriggerInput actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SubscriptionTrigger. + public TaskCreateTrigger(SubscriptionTrigger actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(OnDemandTriggerInput)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(ScheduleTriggerInput)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SubscriptionTrigger)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: OnDemandTriggerInput, ScheduleTriggerInput, SubscriptionTrigger"); + } + } + } + + /// + /// Get the actual instance of `OnDemandTriggerInput`. If the actual instance is not `OnDemandTriggerInput`, + /// the InvalidClassException will be thrown + /// + /// An instance of OnDemandTriggerInput + public OnDemandTriggerInput GetterOnDemandTriggerInput() + { + return (OnDemandTriggerInput)this.ActualInstance; + } + + /// + /// Get the actual instance of `ScheduleTriggerInput`. If the actual instance is not `ScheduleTriggerInput`, + /// the InvalidClassException will be thrown + /// + /// An instance of ScheduleTriggerInput + public ScheduleTriggerInput GetterScheduleTriggerInput() + { + return (ScheduleTriggerInput)this.ActualInstance; + } + + /// + /// Get the actual instance of `SubscriptionTrigger`. If the actual instance is not `SubscriptionTrigger`, + /// the InvalidClassException will be thrown + /// + /// An instance of SubscriptionTrigger + public SubscriptionTrigger GetterSubscriptionTrigger() + { + return (SubscriptionTrigger)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class TaskCreateTrigger {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, TaskCreateTrigger.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of TaskCreateTrigger + /// + /// JSON string + /// An instance of TaskCreateTrigger + public static TaskCreateTrigger FromJson(string jsonString) + { + TaskCreateTrigger newTaskCreateTrigger = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newTaskCreateTrigger; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(OnDemandTriggerInput).GetProperty("AdditionalProperties") == null) + { + newTaskCreateTrigger = new TaskCreateTrigger(JsonConvert.DeserializeObject(jsonString, TaskCreateTrigger.SerializerSettings)); + } + else + { + newTaskCreateTrigger = new TaskCreateTrigger(JsonConvert.DeserializeObject(jsonString, TaskCreateTrigger.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("OnDemandTriggerInput"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into OnDemandTriggerInput: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(ScheduleTriggerInput).GetProperty("AdditionalProperties") == null) + { + newTaskCreateTrigger = new TaskCreateTrigger(JsonConvert.DeserializeObject(jsonString, TaskCreateTrigger.SerializerSettings)); + } + else + { + newTaskCreateTrigger = new TaskCreateTrigger(JsonConvert.DeserializeObject(jsonString, TaskCreateTrigger.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("ScheduleTriggerInput"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into ScheduleTriggerInput: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SubscriptionTrigger).GetProperty("AdditionalProperties") == null) + { + newTaskCreateTrigger = new TaskCreateTrigger(JsonConvert.DeserializeObject(jsonString, TaskCreateTrigger.SerializerSettings)); + } + else + { + newTaskCreateTrigger = new TaskCreateTrigger(JsonConvert.DeserializeObject(jsonString, TaskCreateTrigger.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SubscriptionTrigger"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SubscriptionTrigger: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newTaskCreateTrigger; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TaskCreateTrigger); + } + + /// + /// Returns true if TaskCreateTrigger instances are equal + /// + /// Instance of TaskCreateTrigger to be compared + /// Boolean + public bool Equals(TaskCreateTrigger input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for TaskCreateTrigger + /// + public class TaskCreateTriggerJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(TaskCreateTrigger).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return TaskCreateTrigger.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/TaskInput.cs b/algoliasearch/Ingestion/Models/TaskInput.cs new file mode 100644 index 000000000..412419b0f --- /dev/null +++ b/algoliasearch/Ingestion/Models/TaskInput.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// TaskInput + /// + [JsonConverter(typeof(TaskInputJsonConverter))] + [DataContract(Name = "TaskInput")] + public partial class TaskInput : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of OnDemandDateUtilsInput. + public TaskInput(OnDemandDateUtilsInput actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of ScheduleDateUtilsInput. + public TaskInput(ScheduleDateUtilsInput actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(OnDemandDateUtilsInput)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(ScheduleDateUtilsInput)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: OnDemandDateUtilsInput, ScheduleDateUtilsInput"); + } + } + } + + /// + /// Get the actual instance of `OnDemandDateUtilsInput`. If the actual instance is not `OnDemandDateUtilsInput`, + /// the InvalidClassException will be thrown + /// + /// An instance of OnDemandDateUtilsInput + public OnDemandDateUtilsInput GetterOnDemandDateUtilsInput() + { + return (OnDemandDateUtilsInput)this.ActualInstance; + } + + /// + /// Get the actual instance of `ScheduleDateUtilsInput`. If the actual instance is not `ScheduleDateUtilsInput`, + /// the InvalidClassException will be thrown + /// + /// An instance of ScheduleDateUtilsInput + public ScheduleDateUtilsInput GetterScheduleDateUtilsInput() + { + return (ScheduleDateUtilsInput)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class TaskInput {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, TaskInput.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of TaskInput + /// + /// JSON string + /// An instance of TaskInput + public static TaskInput FromJson(string jsonString) + { + TaskInput newTaskInput = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newTaskInput; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(OnDemandDateUtilsInput).GetProperty("AdditionalProperties") == null) + { + newTaskInput = new TaskInput(JsonConvert.DeserializeObject(jsonString, TaskInput.SerializerSettings)); + } + else + { + newTaskInput = new TaskInput(JsonConvert.DeserializeObject(jsonString, TaskInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("OnDemandDateUtilsInput"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into OnDemandDateUtilsInput: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(ScheduleDateUtilsInput).GetProperty("AdditionalProperties") == null) + { + newTaskInput = new TaskInput(JsonConvert.DeserializeObject(jsonString, TaskInput.SerializerSettings)); + } + else + { + newTaskInput = new TaskInput(JsonConvert.DeserializeObject(jsonString, TaskInput.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("ScheduleDateUtilsInput"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into ScheduleDateUtilsInput: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newTaskInput; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TaskInput); + } + + /// + /// Returns true if TaskInput instances are equal + /// + /// Instance of TaskInput to be compared + /// Boolean + public bool Equals(TaskInput input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for TaskInput + /// + public class TaskInputJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(TaskInput).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return TaskInput.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/TaskSearch.cs b/algoliasearch/Ingestion/Models/TaskSearch.cs new file mode 100644 index 000000000..826729461 --- /dev/null +++ b/algoliasearch/Ingestion/Models/TaskSearch.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// TaskSearch + /// + [DataContract(Name = "TaskSearch")] + public partial class TaskSearch : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TaskSearch() { } + /// + /// Initializes a new instance of the class. + /// + /// taskIDs (required). + public TaskSearch(List taskIDs = default(List)) + { + // to ensure "taskIDs" is required (not null) + if (taskIDs == null) + { + throw new ArgumentNullException("taskIDs is a required property for TaskSearch and cannot be null"); + } + this.TaskIDs = taskIDs; + } + + /// + /// Gets or Sets TaskIDs + /// + [DataMember(Name = "taskIDs", IsRequired = true, EmitDefaultValue = true)] + public List TaskIDs { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TaskSearch {\n"); + sb.Append(" TaskIDs: ").Append(TaskIDs).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TaskSearch); + } + + /// + /// Returns true if TaskSearch instances are equal + /// + /// Instance of TaskSearch to be compared + /// Boolean + public bool Equals(TaskSearch input) + { + if (input == null) + { + return false; + } + return + ( + this.TaskIDs == input.TaskIDs || + this.TaskIDs != null && + input.TaskIDs != null && + this.TaskIDs.SequenceEqual(input.TaskIDs) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.TaskIDs != null) + { + hashCode = (hashCode * 59) + this.TaskIDs.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/TaskSortKeys.cs b/algoliasearch/Ingestion/Models/TaskSortKeys.cs new file mode 100644 index 000000000..abe61ac73 --- /dev/null +++ b/algoliasearch/Ingestion/Models/TaskSortKeys.cs @@ -0,0 +1,61 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Used to sort the Task list endpoint. + /// + /// Used to sort the Task list endpoint. + [JsonConverter(typeof(StringEnumConverter))] + public enum TaskSortKeys + { + /// + /// Enum Enabled for value: enabled + /// + [EnumMember(Value = "enabled")] + Enabled = 1, + + /// + /// Enum TriggerType for value: triggerType + /// + [EnumMember(Value = "triggerType")] + TriggerType = 2, + + /// + /// Enum Action for value: action + /// + [EnumMember(Value = "action")] + Action = 3, + + /// + /// Enum UpdatedAt for value: updatedAt + /// + [EnumMember(Value = "updatedAt")] + UpdatedAt = 4, + + /// + /// Enum CreatedAt for value: createdAt + /// + [EnumMember(Value = "createdAt")] + CreatedAt = 5 + } + +} diff --git a/algoliasearch/Ingestion/Models/TaskUpdate.cs b/algoliasearch/Ingestion/Models/TaskUpdate.cs new file mode 100644 index 000000000..6997f8b1a --- /dev/null +++ b/algoliasearch/Ingestion/Models/TaskUpdate.cs @@ -0,0 +1,202 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The payload for a task update. + /// + [DataContract(Name = "TaskUpdate")] + public partial class TaskUpdate : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// The destination UUID.. + /// trigger. + /// input. + /// Whether the task is enabled or not.. + /// A percentage representing the accepted failure threshold to determine if a `run` succeeded or not.. + public TaskUpdate(string destinationID = default(string), TriggerUpdateInput trigger = default(TriggerUpdateInput), TaskInput input = default(TaskInput), bool enabled = default(bool), int failureThreshold = default(int)) + { + this.DestinationID = destinationID; + this.Trigger = trigger; + this.Input = input; + this.Enabled = enabled; + this.FailureThreshold = failureThreshold; + } + + /// + /// The destination UUID. + /// + /// The destination UUID. + [DataMember(Name = "destinationID", EmitDefaultValue = false)] + public string DestinationID { get; set; } + + /// + /// Gets or Sets Trigger + /// + [DataMember(Name = "trigger", EmitDefaultValue = false)] + public TriggerUpdateInput Trigger { get; set; } + + /// + /// Gets or Sets Input + /// + [DataMember(Name = "input", EmitDefaultValue = false)] + public TaskInput Input { get; set; } + + /// + /// Whether the task is enabled or not. + /// + /// Whether the task is enabled or not. + [DataMember(Name = "enabled", EmitDefaultValue = true)] + public bool Enabled { get; set; } + + /// + /// A percentage representing the accepted failure threshold to determine if a `run` succeeded or not. + /// + /// A percentage representing the accepted failure threshold to determine if a `run` succeeded or not. + [DataMember(Name = "failureThreshold", EmitDefaultValue = false)] + public int FailureThreshold { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TaskUpdate {\n"); + sb.Append(" DestinationID: ").Append(DestinationID).Append("\n"); + sb.Append(" Trigger: ").Append(Trigger).Append("\n"); + sb.Append(" Input: ").Append(Input).Append("\n"); + sb.Append(" Enabled: ").Append(Enabled).Append("\n"); + sb.Append(" FailureThreshold: ").Append(FailureThreshold).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TaskUpdate); + } + + /// + /// Returns true if TaskUpdate instances are equal + /// + /// Instance of TaskUpdate to be compared + /// Boolean + public bool Equals(TaskUpdate input) + { + if (input == null) + { + return false; + } + return + ( + this.DestinationID == input.DestinationID || + (this.DestinationID != null && + this.DestinationID.Equals(input.DestinationID)) + ) && + ( + this.Trigger == input.Trigger || + (this.Trigger != null && + this.Trigger.Equals(input.Trigger)) + ) && + ( + this.Input == input.Input || + (this.Input != null && + this.Input.Equals(input.Input)) + ) && + ( + this.Enabled == input.Enabled || + this.Enabled.Equals(input.Enabled) + ) && + ( + this.FailureThreshold == input.FailureThreshold || + this.FailureThreshold.Equals(input.FailureThreshold) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.DestinationID != null) + { + hashCode = (hashCode * 59) + this.DestinationID.GetHashCode(); + } + if (this.Trigger != null) + { + hashCode = (hashCode * 59) + this.Trigger.GetHashCode(); + } + if (this.Input != null) + { + hashCode = (hashCode * 59) + this.Input.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Enabled.GetHashCode(); + hashCode = (hashCode * 59) + this.FailureThreshold.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // FailureThreshold (int) maximum + if (this.FailureThreshold > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for FailureThreshold, must be a value less than or equal to 100.", new[] { "FailureThreshold" }); + } + + // FailureThreshold (int) minimum + if (this.FailureThreshold < (int)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for FailureThreshold, must be a value greater than or equal to 0.", new[] { "FailureThreshold" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/TaskUpdateResponse.cs b/algoliasearch/Ingestion/Models/TaskUpdateResponse.cs new file mode 100644 index 000000000..321aac2dd --- /dev/null +++ b/algoliasearch/Ingestion/Models/TaskUpdateResponse.cs @@ -0,0 +1,158 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The response from the API after a task update. + /// + [DataContract(Name = "TaskUpdateResponse")] + public partial class TaskUpdateResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TaskUpdateResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// The task UUID. (required). + /// Date of last update (RFC3339 format). (required). + public TaskUpdateResponse(string taskID = default(string), string updatedAt = default(string)) + { + // to ensure "taskID" is required (not null) + if (taskID == null) + { + throw new ArgumentNullException("taskID is a required property for TaskUpdateResponse and cannot be null"); + } + this.TaskID = taskID; + // to ensure "updatedAt" is required (not null) + if (updatedAt == null) + { + throw new ArgumentNullException("updatedAt is a required property for TaskUpdateResponse and cannot be null"); + } + this.UpdatedAt = updatedAt; + } + + /// + /// The task UUID. + /// + /// The task UUID. + [DataMember(Name = "taskID", IsRequired = true, EmitDefaultValue = true)] + public string TaskID { get; set; } + + /// + /// Date of last update (RFC3339 format). + /// + /// Date of last update (RFC3339 format). + [DataMember(Name = "updatedAt", IsRequired = true, EmitDefaultValue = true)] + public string UpdatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TaskUpdateResponse {\n"); + sb.Append(" TaskID: ").Append(TaskID).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TaskUpdateResponse); + } + + /// + /// Returns true if TaskUpdateResponse instances are equal + /// + /// Instance of TaskUpdateResponse to be compared + /// Boolean + public bool Equals(TaskUpdateResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.TaskID == input.TaskID || + (this.TaskID != null && + this.TaskID.Equals(input.TaskID)) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.TaskID != null) + { + hashCode = (hashCode * 59) + this.TaskID.GetHashCode(); + } + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/Trigger.cs b/algoliasearch/Ingestion/Models/Trigger.cs new file mode 100644 index 000000000..0882b7477 --- /dev/null +++ b/algoliasearch/Ingestion/Models/Trigger.cs @@ -0,0 +1,334 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// Trigger + /// + [JsonConverter(typeof(TriggerJsonConverter))] + [DataContract(Name = "Trigger")] + public partial class Trigger : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of OnDemandTrigger. + public Trigger(OnDemandTrigger actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of ScheduleTrigger. + public Trigger(ScheduleTrigger actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SubscriptionTrigger. + public Trigger(SubscriptionTrigger actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(OnDemandTrigger)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(ScheduleTrigger)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SubscriptionTrigger)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: OnDemandTrigger, ScheduleTrigger, SubscriptionTrigger"); + } + } + } + + /// + /// Get the actual instance of `OnDemandTrigger`. If the actual instance is not `OnDemandTrigger`, + /// the InvalidClassException will be thrown + /// + /// An instance of OnDemandTrigger + public OnDemandTrigger GetterOnDemandTrigger() + { + return (OnDemandTrigger)this.ActualInstance; + } + + /// + /// Get the actual instance of `ScheduleTrigger`. If the actual instance is not `ScheduleTrigger`, + /// the InvalidClassException will be thrown + /// + /// An instance of ScheduleTrigger + public ScheduleTrigger GetterScheduleTrigger() + { + return (ScheduleTrigger)this.ActualInstance; + } + + /// + /// Get the actual instance of `SubscriptionTrigger`. If the actual instance is not `SubscriptionTrigger`, + /// the InvalidClassException will be thrown + /// + /// An instance of SubscriptionTrigger + public SubscriptionTrigger GetterSubscriptionTrigger() + { + return (SubscriptionTrigger)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Trigger {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, Trigger.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of Trigger + /// + /// JSON string + /// An instance of Trigger + public static Trigger FromJson(string jsonString) + { + Trigger newTrigger = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newTrigger; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(OnDemandTrigger).GetProperty("AdditionalProperties") == null) + { + newTrigger = new Trigger(JsonConvert.DeserializeObject(jsonString, Trigger.SerializerSettings)); + } + else + { + newTrigger = new Trigger(JsonConvert.DeserializeObject(jsonString, Trigger.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("OnDemandTrigger"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into OnDemandTrigger: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(ScheduleTrigger).GetProperty("AdditionalProperties") == null) + { + newTrigger = new Trigger(JsonConvert.DeserializeObject(jsonString, Trigger.SerializerSettings)); + } + else + { + newTrigger = new Trigger(JsonConvert.DeserializeObject(jsonString, Trigger.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("ScheduleTrigger"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into ScheduleTrigger: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SubscriptionTrigger).GetProperty("AdditionalProperties") == null) + { + newTrigger = new Trigger(JsonConvert.DeserializeObject(jsonString, Trigger.SerializerSettings)); + } + else + { + newTrigger = new Trigger(JsonConvert.DeserializeObject(jsonString, Trigger.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SubscriptionTrigger"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SubscriptionTrigger: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newTrigger; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Trigger); + } + + /// + /// Returns true if Trigger instances are equal + /// + /// Instance of Trigger to be compared + /// Boolean + public bool Equals(Trigger input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for Trigger + /// + public class TriggerJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(Trigger).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return Trigger.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/TriggerType.cs b/algoliasearch/Ingestion/Models/TriggerType.cs new file mode 100644 index 000000000..589369d37 --- /dev/null +++ b/algoliasearch/Ingestion/Models/TriggerType.cs @@ -0,0 +1,49 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The type of the task reflect how it can be used: - onDemand: a task that runs manually - schedule: a task that runs regularly, following a given cron expression - subscription: a task that runs after a subscription event is received from an integration (e.g. Webhook). + /// + /// The type of the task reflect how it can be used: - onDemand: a task that runs manually - schedule: a task that runs regularly, following a given cron expression - subscription: a task that runs after a subscription event is received from an integration (e.g. Webhook). + [JsonConverter(typeof(StringEnumConverter))] + public enum TriggerType + { + /// + /// Enum OnDemand for value: onDemand + /// + [EnumMember(Value = "onDemand")] + OnDemand = 1, + + /// + /// Enum Schedule for value: schedule + /// + [EnumMember(Value = "schedule")] + Schedule = 2, + + /// + /// Enum Subscription for value: subscription + /// + [EnumMember(Value = "subscription")] + Subscription = 3 + } + +} diff --git a/algoliasearch/Ingestion/Models/TriggerUpdateInput.cs b/algoliasearch/Ingestion/Models/TriggerUpdateInput.cs new file mode 100644 index 000000000..097726448 --- /dev/null +++ b/algoliasearch/Ingestion/Models/TriggerUpdateInput.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The trigger input for a task update. + /// + [DataContract(Name = "TriggerUpdateInput")] + public partial class TriggerUpdateInput : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TriggerUpdateInput() { } + /// + /// Initializes a new instance of the class. + /// + /// A cron expression that represent at which regularity the task should run. (required). + public TriggerUpdateInput(string cron = default(string)) + { + // to ensure "cron" is required (not null) + if (cron == null) + { + throw new ArgumentNullException("cron is a required property for TriggerUpdateInput and cannot be null"); + } + this.Cron = cron; + } + + /// + /// A cron expression that represent at which regularity the task should run. + /// + /// A cron expression that represent at which regularity the task should run. + [DataMember(Name = "cron", IsRequired = true, EmitDefaultValue = true)] + public string Cron { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TriggerUpdateInput {\n"); + sb.Append(" Cron: ").Append(Cron).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TriggerUpdateInput); + } + + /// + /// Returns true if TriggerUpdateInput instances are equal + /// + /// Instance of TriggerUpdateInput to be compared + /// Boolean + public bool Equals(TriggerUpdateInput input) + { + if (input == null) + { + return false; + } + return + ( + this.Cron == input.Cron || + (this.Cron != null && + this.Cron.Equals(input.Cron)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Cron != null) + { + hashCode = (hashCode * 59) + this.Cron.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Ingestion/Models/Window.cs b/algoliasearch/Ingestion/Models/Window.cs new file mode 100644 index 000000000..ef8f951fb --- /dev/null +++ b/algoliasearch/Ingestion/Models/Window.cs @@ -0,0 +1,158 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Ingestion.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Ingestion.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Ingestion.Models +{ + /// + /// The window parameter represents the holds the dates used to query the Observability data from the database in a given window. + /// + [DataContract(Name = "Window")] + public partial class Window : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Window() { } + /// + /// Initializes a new instance of the class. + /// + /// A date in format RFC3339 representing the oldest possible data in query window. (required). + /// A date in format RFC3339 representing the newest possible data in query window. (required). + public Window(string startDate = default(string), string endDate = default(string)) + { + // to ensure "startDate" is required (not null) + if (startDate == null) + { + throw new ArgumentNullException("startDate is a required property for Window and cannot be null"); + } + this.StartDate = startDate; + // to ensure "endDate" is required (not null) + if (endDate == null) + { + throw new ArgumentNullException("endDate is a required property for Window and cannot be null"); + } + this.EndDate = endDate; + } + + /// + /// A date in format RFC3339 representing the oldest possible data in query window. + /// + /// A date in format RFC3339 representing the oldest possible data in query window. + [DataMember(Name = "startDate", IsRequired = true, EmitDefaultValue = true)] + public string StartDate { get; set; } + + /// + /// A date in format RFC3339 representing the newest possible data in query window. + /// + /// A date in format RFC3339 representing the newest possible data in query window. + [DataMember(Name = "endDate", IsRequired = true, EmitDefaultValue = true)] + public string EndDate { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Window {\n"); + sb.Append(" StartDate: ").Append(StartDate).Append("\n"); + sb.Append(" EndDate: ").Append(EndDate).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Window); + } + + /// + /// Returns true if Window instances are equal + /// + /// Instance of Window to be compared + /// Boolean + public bool Equals(Window input) + { + if (input == null) + { + return false; + } + return + ( + this.StartDate == input.StartDate || + (this.StartDate != null && + this.StartDate.Equals(input.StartDate)) + ) && + ( + this.EndDate == input.EndDate || + (this.EndDate != null && + this.EndDate.Equals(input.EndDate)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.StartDate != null) + { + hashCode = (hashCode * 59) + this.StartDate.GetHashCode(); + } + if (this.EndDate != null) + { + hashCode = (hashCode * 59) + this.EndDate.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Api/InsightsClient.cs b/algoliasearch/Insights/Api/InsightsClient.cs new file mode 100644 index 000000000..38ebad5ae --- /dev/null +++ b/algoliasearch/Insights/Api/InsightsClient.cs @@ -0,0 +1,1119 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Mime; +using Algolia.Search.Insights.Client; +using Algolia.Search.Insights.Models; + +namespace Algolia.Search.Insights.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IInsightsClient + { + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send events. + /// + /// + /// Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2&nbsp;MB. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of EventsResponse + System.Threading.Tasks.Task PushEventsAsync(InsightsEvents insightsEvents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send events. + /// + /// + /// Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2&nbsp;MB. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (EventsResponse) + System.Threading.Tasks.Task> PushEventsWithHttpInfoAsync(InsightsEvents insightsEvents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } + + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class InsightsClient : IDisposable, IInsightsClient + { + private Algolia.Search.Insights.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// + public InsightsClient() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + /// + public InsightsClient(string basePath) + { + this.Configuration = Algolia.Search.Insights.Client.Configuration.MergeConfigurations( + Algolia.Search.Insights.Client.GlobalConfiguration.Instance, + new Algolia.Search.Insights.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.Insights.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.Insights.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// An instance of Configuration. + /// + /// + public InsightsClient(Algolia.Search.Insights.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Algolia.Search.Insights.Client.Configuration.MergeConfigurations( + Algolia.Search.Insights.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.Insights.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.Insights.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public InsightsClient(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public InsightsClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.Insights.Client.Configuration.MergeConfigurations( + Algolia.Search.Insights.Client.GlobalConfiguration.Instance, + new Algolia.Search.Insights.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.Insights.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.Insights.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// + /// An instance of HttpClient. + /// An instance of Configuration. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public InsightsClient(HttpClient client, Algolia.Search.Insights.Client.Configuration configuration, HttpClientHandler handler = null) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.Insights.Client.Configuration.MergeConfigurations( + Algolia.Search.Insights.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.Insights.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.Insights.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + /// + public InsightsClient(Algolia.Search.Insights.Client.ISynchronousClient client, Algolia.Search.Insights.Client.IAsynchronousClient asyncClient, Algolia.Search.Insights.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Algolia.Search.Insights.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + this.ApiClient?.Dispose(); + } + + /// + /// Holds the ApiClient if created + /// + public Algolia.Search.Insights.Client.ApiClient ApiClient { get; set; } = null; + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Algolia.Search.Insights.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Algolia.Search.Insights.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Algolia.Search.Insights.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Algolia.Search.Insights.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Del(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.Insights.Client.ApiResponse localVarResponse = DelWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.Insights.Client.ApiResponse DelWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Insights.Client.ApiException(400, "Missing required parameter 'path' when calling InsightsClient->Del"); + + Algolia.Search.Insights.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Insights.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Insights.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Insights.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Insights.Client.ApiResponse localVarResponse = await DelWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Insights.Client.ApiException(400, "Missing required parameter 'path' when calling InsightsClient->Del"); + + + Algolia.Search.Insights.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Insights.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Insights.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Insights.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Get(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.Insights.Client.ApiResponse localVarResponse = GetWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.Insights.Client.ApiResponse GetWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Insights.Client.ApiException(400, "Missing required parameter 'path' when calling InsightsClient->Get"); + + Algolia.Search.Insights.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Insights.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Insights.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Insights.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Insights.Client.ApiResponse localVarResponse = await GetWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Insights.Client.ApiException(400, "Missing required parameter 'path' when calling InsightsClient->Get"); + + + Algolia.Search.Insights.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Insights.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Insights.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Insights.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Post(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.Insights.Client.ApiResponse localVarResponse = PostWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.Insights.Client.ApiResponse PostWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Insights.Client.ApiException(400, "Missing required parameter 'path' when calling InsightsClient->Post"); + + Algolia.Search.Insights.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Insights.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Insights.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Insights.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Insights.Client.ApiResponse localVarResponse = await PostWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Insights.Client.ApiException(400, "Missing required parameter 'path' when calling InsightsClient->Post"); + + + Algolia.Search.Insights.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Insights.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Insights.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Insights.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send events. Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2&nbsp;MB. + /// + /// Thrown when fails to make API call + /// + /// EventsResponse + public EventsResponse PushEvents(InsightsEvents insightsEvents) + { + Algolia.Search.Insights.Client.ApiResponse localVarResponse = PushEventsWithHttpInfo(insightsEvents); + return localVarResponse.Data; + } + + /// + /// Send events. Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2&nbsp;MB. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of EventsResponse + public Algolia.Search.Insights.Client.ApiResponse PushEventsWithHttpInfo(InsightsEvents insightsEvents) + { + // verify the required parameter 'insightsEvents' is set + if (insightsEvents == null) + throw new Algolia.Search.Insights.Client.ApiException(400, "Missing required parameter 'insightsEvents' when calling InsightsClient->PushEvents"); + + Algolia.Search.Insights.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Insights.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json", + "text/html" + }; + + var localVarContentType = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = insightsEvents; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/events", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("PushEvents", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send events. Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2&nbsp;MB. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of EventsResponse + public async System.Threading.Tasks.Task PushEventsAsync(InsightsEvents insightsEvents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Insights.Client.ApiResponse localVarResponse = await PushEventsWithHttpInfoAsync(insightsEvents, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send events. Send a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2&nbsp;MB. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (EventsResponse) + public async System.Threading.Tasks.Task> PushEventsWithHttpInfoAsync(InsightsEvents insightsEvents, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'insightsEvents' is set + if (insightsEvents == null) + throw new Algolia.Search.Insights.Client.ApiException(400, "Missing required parameter 'insightsEvents' when calling InsightsClient->PushEvents"); + + + Algolia.Search.Insights.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Insights.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json", + "text/html" + }; + + + var localVarContentType = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = insightsEvents; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/events", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("PushEvents", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Put(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.Insights.Client.ApiResponse localVarResponse = PutWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.Insights.Client.ApiResponse PutWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Insights.Client.ApiException(400, "Missing required parameter 'path' when calling InsightsClient->Put"); + + Algolia.Search.Insights.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Insights.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Insights.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Insights.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Insights.Client.ApiResponse localVarResponse = await PutWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Insights.Client.ApiException(400, "Missing required parameter 'path' when calling InsightsClient->Put"); + + + Algolia.Search.Insights.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Insights.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Insights.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Insights.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Insights.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + } +} diff --git a/algoliasearch/Insights/Client/ApiClient.cs b/algoliasearch/Insights/Client/ApiClient.cs new file mode 100644 index 000000000..83bcc17a2 --- /dev/null +++ b/algoliasearch/Insights/Client/ApiClient.cs @@ -0,0 +1,736 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs; +using System.Net.Http; +using System.Net.Http.Headers; + +namespace Algolia.Search.Insights.Client +{ + /// + /// To Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec + { + private readonly IReadableConfiguration _configuration; + private static readonly string _contentType = "application/json"; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is Algolia.Search.Insights.Models.AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((Algolia.Search.Insights.Models.AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public async Task Deserialize(HttpResponseMessage response) + { + var result = (T)await Deserialize(response, typeof(T)).ConfigureAwait(false); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal async Task Deserialize(HttpResponseMessage response, Type type) + { + IList headers = response.Headers.Select(x => x.Key + "=" + x.Value).ToList(); + + if (type == typeof(byte[])) // return byte array + { + return await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + } + else if (type == typeof(FileParameter)) + { + return new FileParameter(await response.Content.ReadAsStreamAsync().ConfigureAwait(false)); + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + if (headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + File.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(await response.Content.ReadAsStringAsync().ConfigureAwait(false), null, System.Globalization.DateTimeStyles.RoundtripKind); + } + + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public string RootElement { get; set; } + public string Namespace { get; set; } + public string DateFormat { get; set; } + + public string ContentType + { + get { return _contentType; } + set { throw new InvalidOperationException("Not allowed to set content type."); } + } + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + /// + /// The Dispose method will manage the HttpClient lifecycle when not passed by constructor. + /// + public partial class ApiClient : IDisposable, ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + + private readonly HttpClientHandler _httpClientHandler; + private readonly HttpClient _httpClient; + private readonly bool _disposeClient; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + public ApiClient() : + this(Algolia.Search.Insights.Client.GlobalConfiguration.Instance.BasePath) + { + } + + /// + /// Initializes a new instance of the . + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = new HttpClientHandler(); + _httpClient = new HttpClient(_httpClientHandler, true); + _disposeClient = true; + _baseUrl = basePath; + } + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, HttpClientHandler handler = null) : + this(client, Algolia.Search.Insights.Client.GlobalConfiguration.Instance.BasePath, handler) + { + } + + /// + /// Initializes a new instance of the . + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client cannot be null"); + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = handler; + _httpClient = client; + _baseUrl = basePath; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + if (_disposeClient) + { + _httpClient.Dispose(); + } + } + + /// Prepares multipart/form-data content + HttpContent PrepareMultipartFormDataContent(RequestOptions options) + { + string boundary = "---------" + Guid.NewGuid().ToString().ToUpperInvariant(); + var multipartContent = new MultipartFormDataContent(boundary); + foreach (var formParameter in options.FormParameters) + { + multipartContent.Add(new StringContent(formParameter.Value), formParameter.Key); + } + + if (options.FileParameters != null && options.FileParameters.Count > 0) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var content = new StreamContent(file.Content); + content.Headers.ContentType = new MediaTypeHeaderValue(file.ContentType); + multipartContent.Add(content, fileParam.Key, file.Name); + } + } + } + return multipartContent; + } + + /// + /// Provides all logic for constructing a new HttpRequestMessage. + /// At this point, all information for querying the service is known. Here, it is simply + /// mapped into the a HttpRequestMessage. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// [private] A new HttpRequestMessage instance. + /// + private HttpRequestMessage NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + WebRequestPathBuilder builder = new WebRequestPathBuilder(_baseUrl, path); + + builder.AddPathParameters(options.PathParameters); + + builder.AddQueryParameters(options.QueryParameters); + + HttpRequestMessage request = new HttpRequestMessage(method, builder.GetFullUri()); + + if (configuration.UserAgent != null) + { + request.Headers.TryAddWithoutValidation("User-Agent", configuration.UserAgent); + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.Headers.Add(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + // Todo make content headers actually content headers + request.Headers.TryAddWithoutValidation(headerParam.Key, value); + } + } + } + + List> contentList = new List>(); + + string contentType = null; + if (options.HeaderParameters != null && options.HeaderParameters.ContainsKey("Content-Type")) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes.FirstOrDefault(); + } + + if (contentType == "multipart/form-data") + { + request.Content = PrepareMultipartFormDataContent(options); + } + else if (contentType == "application/x-www-form-urlencoded") + { + request.Content = new FormUrlEncodedContent(options.FormParameters); + } + else + { + if (options.Data != null) + { + if (options.Data is FileParameter fp) + { + contentType = contentType ?? "application/octet-stream"; + + var streamContent = new StreamContent(fp.Content); + streamContent.Headers.ContentType = new MediaTypeHeaderValue(contentType); + request.Content = streamContent; + } + else + { + var serializer = new CustomJsonCodec(SerializerSettings, configuration); + request.Content = new StringContent(serializer.Serialize(options.Data), new UTF8Encoding(), + "application/json"); + } + } + } + + + + // TODO provide an alternative that allows cookies per request instead of per API client + if (options.Cookies != null && options.Cookies.Count > 0) + { + request.Properties["CookieContainer"] = options.Cookies; + } + + return request; + } + + partial void InterceptRequest(HttpRequestMessage req); + partial void InterceptResponse(HttpRequestMessage req, HttpResponseMessage response); + + private async Task> ToApiResponse(HttpResponseMessage response, object responseData, Uri uri) + { + T result = (T)responseData; + string rawContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ReasonPhrase, + Cookies = new List() + }; + + // process response headers, e.g. Access-Control-Allow-Methods + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + // process response content headers, e.g. Content-Type + if (response.Content.Headers != null) + { + foreach (var responseHeader in response.Content.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (_httpClientHandler != null && response != null) + { + try + { + foreach (Cookie cookie in _httpClientHandler.CookieContainer.GetCookies(uri)) + { + transformed.Cookies.Add(cookie); + } + } + catch (PlatformNotSupportedException) { } + } + + return transformed; + } + + private ApiResponse Exec(HttpRequestMessage req, IReadableConfiguration configuration) + { + return ExecAsync(req, configuration).GetAwaiter().GetResult(); + } + + private async Task> ExecAsync(HttpRequestMessage req, + IReadableConfiguration configuration, + System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + CancellationTokenSource timeoutTokenSource = null; + CancellationTokenSource finalTokenSource = null; + var deserializer = new CustomJsonCodec(SerializerSettings, configuration); + var finalToken = cancellationToken; + + try + { + if (configuration.Timeout > 0) + { + timeoutTokenSource = new CancellationTokenSource(configuration.Timeout); + finalTokenSource = CancellationTokenSource.CreateLinkedTokenSource(finalToken, timeoutTokenSource.Token); + finalToken = finalTokenSource.Token; + } + + if (configuration.Proxy != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Configuration `Proxy` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + _httpClientHandler.Proxy = configuration.Proxy; + } + + var cookieContainer = req.Properties.ContainsKey("CookieContainer") ? req.Properties["CookieContainer"] as List : null; + + if (cookieContainer != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Request property `CookieContainer` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + foreach (var cookie in cookieContainer) + { + _httpClientHandler.CookieContainer.Add(cookie); + } + } + + InterceptRequest(req); + + HttpResponseMessage response; + response = await _httpClient.SendAsync(req, finalToken).ConfigureAwait(false); + + if (!response.IsSuccessStatusCode) + { + return await ToApiResponse(response, default(T), req.RequestUri).ConfigureAwait(false); + } + + object responseData = await deserializer.Deserialize(response).ConfigureAwait(false); + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(Algolia.Search.Insights.Models.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + responseData = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + else if (typeof(T).Name == "Stream") // for binary response + { + responseData = (T)(object)await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + } + + InterceptResponse(req, response); + + return await ToApiResponse(response, responseData, req.RequestUri).ConfigureAwait(false); + } + catch (OperationCanceledException original) + { + if (timeoutTokenSource != null && timeoutTokenSource.IsCancellationRequested) + { + throw new TaskCanceledException($"[{req.Method}] {req.RequestUri} was timeout.", + new TimeoutException(original.Message, original)); + } + throw; + } + finally + { + if (timeoutTokenSource != null) + { + timeoutTokenSource.Dispose(); + } + + if (finalTokenSource != null) + { + finalTokenSource.Dispose(); + } + } + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(new HttpMethod("PATCH"), path, options, config), config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(new HttpMethod("PATCH"), path, options, config), config); + } + #endregion ISynchronousClient + } +} diff --git a/algoliasearch/Insights/Client/ApiException.cs b/algoliasearch/Insights/Client/ApiException.cs new file mode 100644 index 000000000..8c3720fc4 --- /dev/null +++ b/algoliasearch/Insights/Client/ApiException.cs @@ -0,0 +1,62 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.Insights.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// Gets or sets the error code (HTTP status code) + /// + /// The error code (HTTP status code). + public int ErrorCode { get; set; } + + /// + /// Gets or sets the error content (body json object) + /// + /// The error content (Http response body). + public object ErrorContent { get; private set; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public ApiException() { } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + public ApiException(int errorCode, string message) : base(message) + { + this.ErrorCode = errorCode; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + /// Error content. + /// HTTP Headers. + public ApiException(int errorCode, string message, object errorContent = null, Multimap headers = null) : base(message) + { + this.ErrorCode = errorCode; + this.ErrorContent = errorContent; + this.Headers = headers; + } + } + +} diff --git a/algoliasearch/Insights/Client/ApiResponse.cs b/algoliasearch/Insights/Client/ApiResponse.cs new file mode 100644 index 000000000..3ee8adeb0 --- /dev/null +++ b/algoliasearch/Insights/Client/ApiResponse.cs @@ -0,0 +1,160 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; + +namespace Algolia.Search.Insights.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public interface IApiResponse + { + /// + /// The data type of + /// + Type ResponseType { get; } + + /// + /// The content of this response + /// + Object Content { get; } + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + Multimap Headers { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + List Cookies { get; set; } + + /// + /// The raw content of this response + /// + string RawContent { get; } + } + + /// + /// API Response + /// + public class ApiResponse : IApiResponse + { + #region Properties + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; } + + /// + /// Gets or sets the data (parsed HTTP body) + /// + /// The data. + public T Data { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + public string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + public List Cookies { get; set; } + + /// + /// The content of this response + /// + public Type ResponseType + { + get { return typeof(T); } + } + + /// + /// The data type of + /// + public object Content + { + get { return Data; } + } + + /// + /// The raw content + /// + public string RawContent { get; } + + #endregion Properties + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data, string rawContent) + { + StatusCode = statusCode; + Headers = headers; + Data = data; + RawContent = rawContent; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) : this(statusCode, headers, data, null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null) + { + } + + #endregion Constructors + } +} diff --git a/algoliasearch/Insights/Client/ClientUtils.cs b/algoliasearch/Insights/Client/ClientUtils.cs new file mode 100644 index 000000000..fda1640a7 --- /dev/null +++ b/algoliasearch/Insights/Client/ClientUtils.cs @@ -0,0 +1,244 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; + +namespace Algolia.Search.Insights.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// Convert params to key/value pairs. + /// Use collectionFormat to properly format lists and collections. + /// + /// The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi + /// Key name. + /// Value object. + /// A multimap of keys with 1..n associated values. + public static Multimap ParameterToMultiMap(string collectionFormat, string name, object value) + { + var parameters = new Multimap(); + + if (value is ICollection collection && collectionFormat == "multi") + { + foreach (var item in collection) + { + parameters.Add(name, ParameterToString(item)); + } + } + else if (value is IDictionary dictionary) + { + if (collectionFormat == "deepObject") + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value)); + } + } + else + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value)); + } + } + } + else + { + parameters.Add(name, ParameterToString(value)); + } + + return parameters; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// An optional configuration instance, providing formatting options used in processing. + /// Formatted string. + public static string ParameterToString(object obj, IReadableConfiguration configuration = null) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is bool boolean) + return boolean ? "true" : "false"; + if (obj is ICollection collection) + { + List entries = new List(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry, configuration)); + return string.Join(",", entries); + } + if (obj is Enum && HasEnumMemberAttrValue(obj)) + return GetEnumMemberAttrValue(obj); + + return Convert.ToString(obj, CultureInfo.InvariantCulture); + } + + /// + /// Serializes the given object when not null. Otherwise return null. + /// + /// The object to serialize. + /// Serialized string. + public static string Serialize(object obj) + { + return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null; + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Is the Enum decorated with EnumMember Attribute + /// + /// + /// true if found + private static bool HasEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) return true; + return false; + } + + /// + /// Get the EnumMember value + /// + /// + /// EnumMember value as string otherwise null + private static string GetEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) + { + return attr.Value; + } + return null; + } + } +} diff --git a/algoliasearch/Insights/Client/Configuration.cs b/algoliasearch/Insights/Client/Configuration.cs new file mode 100644 index 000000000..85c86ff44 --- /dev/null +++ b/algoliasearch/Insights/Client/Configuration.cs @@ -0,0 +1,593 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Net.Http; +using System.Net.Security; + +namespace Algolia.Search.Insights.Client +{ + /// + /// Represents a set of configuration settings + /// + public class Configuration : IReadableConfiguration + { + #region Constants + + /// + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.RawContent), + response.RawContent, response.Headers); + } + return null; + }; + + #endregion Static Members + + #region Private Members + + /// + /// Defines the base path of the target API server. + /// Example: http://localhost:3000/v1/ + /// + private string _basePath; + + private bool _useDefaultCredentials = false; + + /// + /// Gets or sets the API key based on the authentication name. + /// This is the key and value comprising the "secret" for accessing an API. + /// + /// The API key. + private IDictionary _apiKey; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + /// + /// Gets or sets the servers defined in the OpenAPI spec. + /// + /// The servers + private IList> _servers; + + /// + /// Gets or sets the operation servers defined in the OpenAPI spec. + /// + /// The operation servers + private IReadOnlyDictionary>> _operationServers; + + #endregion Private Members + + #region Constructors + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration() + { + Proxy = null; + UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + BasePath = "https://insights.us.algolia.io"; + DefaultHeaders = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + Servers = new List>() + { + { + new Dictionary { + {"url", "https://insights.{region}.algolia.io"}, + {"description", "No description provided"}, + { + "variables", new Dictionary { + { + "region", new Dictionary { + {"description", "No description provided"}, + {"default_value", "us"}, + { + "enum_values", new List() { + "us", + "de" + } + } + } + } + } + } + } + }, + { + new Dictionary { + {"url", "https://insights.algolia.io"}, + {"description", "No description provided"}, + } + } + }; + OperationServers = new Dictionary>>() + { + }; + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration( + IDictionary defaultHeaders, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "https://insights.us.algolia.io") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeaders == null) + throw new ArgumentNullException("defaultHeaders"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeaders) + { + DefaultHeaders.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + #endregion Constructors + + #region Properties + + /// + /// Gets or sets the base path for API access. + /// + public virtual string BasePath + { + get { return _basePath; } + set { _basePath = value; } + } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + public virtual bool UseDefaultCredentials + { + get { return _useDefaultCredentials; } + set { _useDefaultCredentials = value; } + } + + /// + /// Gets or sets the default header. + /// + [Obsolete("Use DefaultHeaders instead.")] + public virtual IDictionary DefaultHeader + { + get + { + return DefaultHeaders; + } + set + { + DefaultHeaders = value; + } + } + + /// + /// Gets or sets the default headers. + /// + public virtual IDictionary DefaultHeaders { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { get; set; } + + /// + /// Gets or sets the proxy + /// + /// Proxy. + public virtual WebProxy Proxy { get; set; } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix(string apiKeyIdentifier) + { + string apiKeyValue; + ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue); + string apiKeyPrefix; + if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) + { + return apiKeyPrefix + " " + apiKeyValue; + } + + return apiKeyValue; + } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } + + set + { + if (string.IsNullOrEmpty(value)) + { + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } + } + } + + /// + /// Gets or sets the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// Whatever you set here will be prepended to the value defined in AddApiKey. + /// + /// An example invocation here might be: + /// + /// ApiKeyPrefix["Authorization"] = "Bearer"; + /// + /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// + /// + /// OAuth2 workflows should set tokens via AccessToken. + /// + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + /// + /// Gets or sets the servers. + /// + /// The servers. + public virtual IList> Servers + { + get { return _servers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Servers may not be null."); + } + _servers = value; + } + } + + /// + /// Gets or sets the operation servers. + /// + /// The operation servers. + public virtual IReadOnlyDictionary>> OperationServers + { + get { return _operationServers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Operation servers may not be null."); + } + _operationServers = value; + } + } + + /// + /// Returns URL based on server settings without providing values + /// for the variables + /// + /// Array index of the server settings. + /// The server URL. + public string GetServerUrl(int index) + { + return GetServerUrl(Servers, index, null); + } + + /// + /// Returns URL based on server settings. + /// + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + public string GetServerUrl(int index, Dictionary inputVariables) + { + return GetServerUrl(Servers, index, inputVariables); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index) + { + return GetOperationServerUrl(operation, index, null); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables) + { + if (operation != null && OperationServers.TryGetValue(operation, out var operationServer)) + { + return GetServerUrl(operationServer, index, inputVariables); + } + + return null; + } + + /// + /// Returns URL based on server settings. + /// + /// Dictionary of server settings. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + private string GetServerUrl(IList> servers, int index, Dictionary inputVariables) + { + if (index < 0 || index >= servers.Count) + { + throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}."); + } + + if (inputVariables == null) + { + inputVariables = new Dictionary(); + } + + IReadOnlyDictionary server = servers[index]; + string url = (string)server["url"]; + + if (server.ContainsKey("variables")) + { + // go through each variable and assign a value + foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"]) + { + + IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value); + + if (inputVariables.ContainsKey(variable.Key)) + { + if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + { + url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); + } + else + { + throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}"); + } + } + else + { + // use default value + url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]); + } + } + } + + return url; + } + + /// + /// Gets and Sets the RemoteCertificateValidationCallback + /// + public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; } + + #endregion Properties + + #region Methods + + /// + /// Returns a string with essential information for debugging. + /// + public static string ToDebugReport() + { + string report = "C# SDK (Algolia.Search.Insights) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: 1.0.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; + } + + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey(string key, string value) + { + ApiKey[key] = value; + } + + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix(string key, string value) + { + ApiKeyPrefix[key] = value; + } + + #endregion Methods + + #region Static Members + /// + /// Merge configurations. + /// + /// First configuration. + /// Second configuration. + /// Merged configuration. + public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) + { + if (second == null) return first ?? GlobalConfiguration.Instance; + + Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; + foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; + foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value; + + var config = new Configuration + { + ApiKey = apiKey, + ApiKeyPrefix = apiKeyPrefix, + DefaultHeaders = defaultHeaders, + BasePath = second.BasePath ?? first.BasePath, + Timeout = second.Timeout, + Proxy = second.Proxy ?? first.Proxy, + UserAgent = second.UserAgent ?? first.UserAgent, + TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, + DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat, + UseDefaultCredentials = second.UseDefaultCredentials, + RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback, + }; + return config; + } + #endregion Static Members + } +} diff --git a/algoliasearch/Insights/Client/ExceptionFactory.cs b/algoliasearch/Insights/Client/ExceptionFactory.cs new file mode 100644 index 000000000..2214c72cc --- /dev/null +++ b/algoliasearch/Insights/Client/ExceptionFactory.cs @@ -0,0 +1,16 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.Insights.Client +{ + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions + public delegate Exception ExceptionFactory(string methodName, IApiResponse response); +} diff --git a/algoliasearch/Insights/Client/FileParameter.cs b/algoliasearch/Insights/Client/FileParameter.cs new file mode 100644 index 000000000..3a6db9ff1 --- /dev/null +++ b/algoliasearch/Insights/Client/FileParameter.cs @@ -0,0 +1,74 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.IO; + +namespace Algolia.Search.Insights.Client +{ + + /// + /// Represents a File passed to the API as a Parameter, allows using different backends for files + /// + public class FileParameter + { + /// + /// The filename + /// + public string Name { get; set; } = "no_name_provided"; + + /// + /// The content type of the file + /// + public string ContentType { get; set; } = "application/octet-stream"; + + /// + /// The content of the file + /// + public Stream Content { get; set; } + + /// + /// Construct a FileParameter just from the contents, will extract the filename from a filestream + /// + /// The file content + public FileParameter(Stream content) + { + if (content is FileStream fs) + { + Name = fs.Name; + } + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The file content + public FileParameter(string filename, Stream content) + { + Name = filename; + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The content type of the file + /// The file content + public FileParameter(string filename, string contentType, Stream content) + { + Name = filename; + ContentType = contentType; + Content = content; + } + + /// + /// Implicit conversion of stream to file parameter. Useful for backwards compatibility. + /// + /// Stream to convert + /// FileParameter + public static implicit operator FileParameter(Stream s) => new FileParameter(s); + } +} diff --git a/algoliasearch/Insights/Client/GlobalConfiguration.cs b/algoliasearch/Insights/Client/GlobalConfiguration.cs new file mode 100644 index 000000000..940eb8c3b --- /dev/null +++ b/algoliasearch/Insights/Client/GlobalConfiguration.cs @@ -0,0 +1,61 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.Collections.Generic; + +namespace Algolia.Search.Insights.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .openapi-generator-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + #region Private Members + + private static readonly object GlobalConfigSync = new { }; + private static IReadableConfiguration _globalConfiguration; + + #endregion Private Members + + #region Constructors + + /// + private GlobalConfiguration() + { + } + + /// + public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath) + { + } + + static GlobalConfiguration() + { + Instance = new GlobalConfiguration(); + } + + #endregion Constructors + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static IReadableConfiguration Instance + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + } +} diff --git a/algoliasearch/Insights/Client/IAsynchronousClient.cs b/algoliasearch/Insights/Client/IAsynchronousClient.cs new file mode 100644 index 000000000..4247c4d69 --- /dev/null +++ b/algoliasearch/Insights/Client/IAsynchronousClient.cs @@ -0,0 +1,94 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Threading.Tasks; + +namespace Algolia.Search.Insights.Client +{ + /// + /// Contract for Asynchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface IAsynchronousClient + { + /// + /// Executes a non-blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } +} diff --git a/algoliasearch/Insights/Client/IReadableConfiguration.cs b/algoliasearch/Insights/Client/IReadableConfiguration.cs new file mode 100644 index 000000000..7afe6ee3d --- /dev/null +++ b/algoliasearch/Insights/Client/IReadableConfiguration.cs @@ -0,0 +1,111 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; + +namespace Algolia.Search.Insights.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + /// + /// Gets the API key. + /// + /// API key. + IDictionary ApiKey { get; } + + /// + /// Gets the API key prefix. + /// + /// API key prefix. + IDictionary ApiKeyPrefix { get; } + + /// + /// Gets the base path. + /// + /// Base path. + string BasePath { get; } + + /// + /// Gets the date time format. + /// + /// Date time format. + string DateTimeFormat { get; } + + /// + /// Gets the default header. + /// + /// Default header. + [Obsolete("Use DefaultHeaders instead.")] + IDictionary DefaultHeader { get; } + + /// + /// Gets the default headers. + /// + /// Default headers. + IDictionary DefaultHeaders { get; } + + /// + /// Gets the temp folder path. + /// + /// Temp folder path. + string TempFolderPath { get; } + + /// + /// Gets the HTTP connection timeout (in milliseconds) + /// + /// HTTP connection timeout. + int Timeout { get; } + + /// + /// Gets the proxy. + /// + /// Proxy. + WebProxy Proxy { get; } + + /// + /// Gets the user agent. + /// + /// User agent. + string UserAgent { get; } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + bool UseDefaultCredentials { get; } + + /// + /// Get the servers associated with the operation. + /// + /// Operation servers. + IReadOnlyDictionary>> OperationServers { get; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + string GetApiKeyWithPrefix(string apiKeyIdentifier); + + /// + /// Gets the Operation server url at the provided index. + /// + /// Operation server name. + /// Index of the operation server settings. + /// + string GetOperationServerUrl(string operation, int index); + + /// + /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and + /// overriding certificate errors in the scope of a request. + /// + RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; } + } +} diff --git a/algoliasearch/Insights/Client/ISynchronousClient.cs b/algoliasearch/Insights/Client/ISynchronousClient.cs new file mode 100644 index 000000000..25ce34b54 --- /dev/null +++ b/algoliasearch/Insights/Client/ISynchronousClient.cs @@ -0,0 +1,87 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.IO; + +namespace Algolia.Search.Insights.Client +{ + /// + /// Contract for Synchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface ISynchronousClient + { + /// + /// Executes a blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null); + } +} diff --git a/algoliasearch/Insights/Client/Multimap.cs b/algoliasearch/Insights/Client/Multimap.cs new file mode 100644 index 000000000..3671d5d12 --- /dev/null +++ b/algoliasearch/Insights/Client/Multimap.cs @@ -0,0 +1,289 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Algolia.Search.Insights.Client +{ + /// + /// A dictionary in which one key has many associated values. + /// + /// The type of the key + /// The type of the value associated with the key. + public class Multimap : IDictionary> + { + #region Private Fields + + private readonly Dictionary> _dictionary; + + #endregion Private Fields + + #region Constructors + + /// + /// Empty Constructor. + /// + public Multimap() + { + _dictionary = new Dictionary>(); + } + + /// + /// Constructor with comparer. + /// + /// + public Multimap(IEqualityComparer comparer) + { + _dictionary = new Dictionary>(comparer); + } + + #endregion Constructors + + #region Enumerators + + /// + /// To get the enumerator. + /// + /// Enumerator + public IEnumerator>> GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + /// + /// To get the enumerator. + /// + /// Enumerator + IEnumerator IEnumerable.GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + #endregion Enumerators + + #region Public Members + /// + /// Add values to Multimap + /// + /// Key value pair + public void Add(KeyValuePair> item) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + + /// + /// Add Multimap to Multimap + /// + /// Multimap + public void Add(Multimap multimap) + { + foreach (var item in multimap) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + + /// + /// Clear Multimap + /// + public void Clear() + { + _dictionary.Clear(); + } + + /// + /// Determines whether Multimap contains the specified item. + /// + /// Key value pair + /// Method needs to be implemented + /// true if the Multimap contains the item; otherwise, false. + public bool Contains(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Copy items of the Multimap to an array, + /// starting at a particular array index. + /// + /// The array that is the destination of the items copied + /// from Multimap. The array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + /// Method needs to be implemented + public void CopyTo(KeyValuePair>[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + /// + /// Removes the specified item from the Multimap. + /// + /// Key value pair + /// true if the item is successfully removed; otherwise, false. + /// Method needs to be implemented + public bool Remove(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Gets the number of items contained in the Multimap. + /// + public int Count => _dictionary.Count; + + /// + /// Gets a value indicating whether the Multimap is read-only. + /// + public bool IsReadOnly => false; + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add the value to Multimap. + public void Add(TKey key, IList value) + { + if (value != null && value.Count > 0) + { + if (_dictionary.TryGetValue(key, out var list)) + { + foreach (var k in value) list.Add(k); + } + else + { + list = new List(value); + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + } + + /// + /// Determines whether the Multimap contains an item with the specified key. + /// + /// The key to locate in the Multimap. + /// true if the Multimap contains an item with + /// the key; otherwise, false. + public bool ContainsKey(TKey key) + { + return _dictionary.ContainsKey(key); + } + + /// + /// Removes item with the specified key from the Multimap. + /// + /// The key to locate in the Multimap. + /// true if the item is successfully removed; otherwise, false. + public bool Remove(TKey key) + { + return TryRemove(key, out var _); + } + + /// + /// Gets the value associated with the specified key. + /// + /// The key whose value to get. + /// When this method returns, the value associated with the specified key, if the + /// key is found; otherwise, the default value for the type of the value parameter. + /// This parameter is passed uninitialized. + /// true if the object that implements Multimap contains + /// an item with the specified key; otherwise, false. + public bool TryGetValue(TKey key, out IList value) + { + return _dictionary.TryGetValue(key, out value); + } + + /// + /// Gets or sets the item with the specified key. + /// + /// The key of the item to get or set. + /// The value of the specified key. + public IList this[TKey key] + { + get => _dictionary[key]; + set => _dictionary[key] = value; + } + + /// + /// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap. + /// + public ICollection Keys => _dictionary.Keys; + + /// + /// Gets a System.Collections.Generic.ICollection containing the values of the Multimap. + /// + public ICollection> Values => _dictionary.Values; + + /// + /// Copy the items of the Multimap to an System.Array, + /// starting at a particular System.Array index. + /// + /// The one-dimensional System.Array that is the destination of the items copied + /// from Multimap. The System.Array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + public void CopyTo(Array array, int index) + { + ((ICollection)_dictionary).CopyTo(array, index); + } + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add value to Multimap. + public void Add(TKey key, TValue value) + { + if (value != null) + { + if (_dictionary.TryGetValue(key, out var list)) + { + list.Add(value); + } + else + { + list = new List { value }; + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add value to Multimap."); + } + } + } + + #endregion Public Members + + #region Private Members + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryRemove(TKey key, out IList value) + { + _dictionary.TryGetValue(key, out value); + return _dictionary.Remove(key); + } + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryAdd(TKey key, IList value) + { + try + { + _dictionary.Add(key, value); + } + catch (ArgumentException) + { + return false; + } + + return true; + } + #endregion Private Members + } +} diff --git a/algoliasearch/Insights/Client/OpenAPIDateConverter.cs b/algoliasearch/Insights/Client/OpenAPIDateConverter.cs new file mode 100644 index 000000000..df0cb0cd5 --- /dev/null +++ b/algoliasearch/Insights/Client/OpenAPIDateConverter.cs @@ -0,0 +1,23 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using Newtonsoft.Json.Converters; + +namespace Algolia.Search.Insights.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class OpenAPIDateConverter : IsoDateTimeConverter + { + /// + /// Initializes a new instance of the class. + /// + public OpenAPIDateConverter() + { + // full-date = date-fullyear "-" date-month "-" date-mday + DateTimeFormat = "yyyy-MM-dd"; + } + } +} diff --git a/algoliasearch/Insights/Client/RequestOptions.cs b/algoliasearch/Insights/Client/RequestOptions.cs new file mode 100644 index 000000000..b8c7dd872 --- /dev/null +++ b/algoliasearch/Insights/Client/RequestOptions.cs @@ -0,0 +1,68 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; + +namespace Algolia.Search.Insights.Client +{ + /// + /// A container for generalized request inputs. This type allows consumers to extend the request functionality + /// by abstracting away from the default (built-in) request framework (e.g. RestSharp). + /// + public class RequestOptions + { + /// + /// Parameters to be bound to path parts of the Request's URL + /// + public Dictionary PathParameters { get; set; } + + /// + /// Query parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap QueryParameters { get; set; } + + /// + /// Header parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap HeaderParameters { get; set; } + + /// + /// Form parameters to be sent along with the request. + /// + public Dictionary FormParameters { get; set; } + + /// + /// File parameters to be sent along with the request. + /// + public Multimap FileParameters { get; set; } + + /// + /// Cookies to be sent along with the request. + /// + public List Cookies { get; set; } + + /// + /// Any data associated with a request body. + /// + public Object Data { get; set; } + + /// + /// Constructs a new instance of + /// + public RequestOptions() + { + PathParameters = new Dictionary(); + QueryParameters = new Multimap(); + HeaderParameters = new Multimap(); + FormParameters = new Dictionary(); + FileParameters = new Multimap(); + Cookies = new List(); + } + } +} diff --git a/algoliasearch/Insights/Client/WebRequestPathBuilder.cs b/algoliasearch/Insights/Client/WebRequestPathBuilder.cs new file mode 100644 index 000000000..33fd3aa7f --- /dev/null +++ b/algoliasearch/Insights/Client/WebRequestPathBuilder.cs @@ -0,0 +1,47 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using System; +using System.Collections.Generic; + +namespace Algolia.Search.Insights.Client +{ + /// + /// A URI builder + /// + class WebRequestPathBuilder + { + private string _baseUrl; + private string _path; + private string _query = "?"; + public WebRequestPathBuilder(string baseUrl, string path) + { + _baseUrl = baseUrl; + _path = path; + } + + public void AddPathParameters(Dictionary parameters) + { + foreach (var parameter in parameters) + { + _path = _path.Replace("{" + parameter.Key + "}", Uri.EscapeDataString(parameter.Value)); + } + } + + public void AddQueryParameters(Multimap parameters) + { + foreach (var parameter in parameters) + { + foreach (var value in parameter.Value) + { + _query = _query + parameter.Key + "=" + Uri.EscapeDataString(value) + "&"; + } + } + } + + public string GetFullUri() + { + return _baseUrl + _path + _query.Substring(0, _query.Length - 1); + } + } +} diff --git a/algoliasearch/Insights/Models/AbstractOpenAPISchema.cs b/algoliasearch/Insights/Models/AbstractOpenAPISchema.cs new file mode 100644 index 000000000..56326b9a5 --- /dev/null +++ b/algoliasearch/Insights/Models/AbstractOpenAPISchema.cs @@ -0,0 +1,70 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification + /// + public abstract partial class AbstractOpenAPISchema + { + /// + /// Custom JSON serializer + /// + static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Error, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Custom JSON serializer for objects with additional properties + /// + static public readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Ignore, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Gets or Sets the actual instance + /// + public abstract Object ActualInstance { get; set; } + + /// + /// Gets or Sets IsNullable to indicate whether the instance is nullable + /// + public bool IsNullable { get; protected set; } + + /// + /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf` + /// + public string SchemaType { get; protected set; } + + /// + /// Converts the instance into JSON string. + /// + public abstract string ToJson(); + } +} diff --git a/algoliasearch/Insights/Models/AddToCartEvent.cs b/algoliasearch/Insights/Models/AddToCartEvent.cs new file mode 100644 index 000000000..63e511913 --- /dev/null +++ b/algoliasearch/Insights/Models/AddToCartEvent.cs @@ -0,0 +1,36 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Defines AddToCartEvent + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AddToCartEvent + { + /// + /// Enum AddToCart for value: addToCart + /// + [EnumMember(Value = "addToCart")] + AddToCart = 1 + } + +} diff --git a/algoliasearch/Insights/Models/AddedToCartObjectIDs.cs b/algoliasearch/Insights/Models/AddedToCartObjectIDs.cs new file mode 100644 index 000000000..787fc462d --- /dev/null +++ b/algoliasearch/Insights/Models/AddedToCartObjectIDs.cs @@ -0,0 +1,352 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Use this event to track when users add items to their shopping cart unrelated to a previous Algolia request. For example, if you don't use Algolia to build your category pages, use this event. To track add-to-cart events related to Algolia requests, use the \"Added to cart object IDs after search\" event. + /// + [DataContract(Name = "AddedToCartObjectIDs")] + public partial class AddedToCartObjectIDs : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets EventType + /// + [DataMember(Name = "eventType", IsRequired = true, EmitDefaultValue = true)] + public ConversionEvent EventType { get; set; } + + /// + /// Gets or Sets EventSubtype + /// + [DataMember(Name = "eventSubtype", IsRequired = true, EmitDefaultValue = true)] + public AddToCartEvent EventSubtype { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AddedToCartObjectIDs() { } + /// + /// Initializes a new instance of the class. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. (required). + /// eventType (required). + /// eventSubtype (required). + /// Name of the Algolia index. (required). + /// List of object identifiers for items of an Algolia index. (required). + /// Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. . + /// If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR.. + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. (required). + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. . + /// User token for authenticated users.. + public AddedToCartObjectIDs(string eventName = default(string), ConversionEvent eventType = default(ConversionEvent), AddToCartEvent eventSubtype = default(AddToCartEvent), string index = default(string), List objectIDs = default(List), List objectData = default(List), string currency = default(string), string userToken = default(string), long timestamp = default(long), string authenticatedUserToken = default(string)) + { + // to ensure "eventName" is required (not null) + if (eventName == null) + { + throw new ArgumentNullException("eventName is a required property for AddedToCartObjectIDs and cannot be null"); + } + this.EventName = eventName; + this.EventType = eventType; + this.EventSubtype = eventSubtype; + // to ensure "index" is required (not null) + if (index == null) + { + throw new ArgumentNullException("index is a required property for AddedToCartObjectIDs and cannot be null"); + } + this.Index = index; + // to ensure "objectIDs" is required (not null) + if (objectIDs == null) + { + throw new ArgumentNullException("objectIDs is a required property for AddedToCartObjectIDs and cannot be null"); + } + this.ObjectIDs = objectIDs; + // to ensure "userToken" is required (not null) + if (userToken == null) + { + throw new ArgumentNullException("userToken is a required property for AddedToCartObjectIDs and cannot be null"); + } + this.UserToken = userToken; + this.ObjectData = objectData; + this.Currency = currency; + this.Timestamp = timestamp; + this.AuthenticatedUserToken = authenticatedUserToken; + } + + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + [DataMember(Name = "eventName", IsRequired = true, EmitDefaultValue = true)] + public string EventName { get; set; } + + /// + /// Name of the Algolia index. + /// + /// Name of the Algolia index. + [DataMember(Name = "index", IsRequired = true, EmitDefaultValue = true)] + public string Index { get; set; } + + /// + /// List of object identifiers for items of an Algolia index. + /// + /// List of object identifiers for items of an Algolia index. + [DataMember(Name = "objectIDs", IsRequired = true, EmitDefaultValue = true)] + public List ObjectIDs { get; set; } + + /// + /// Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. + /// + /// Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. + [DataMember(Name = "objectData", EmitDefaultValue = false)] + public List ObjectData { get; set; } + + /// + /// If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. + /// + /// If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. + [DataMember(Name = "currency", EmitDefaultValue = false)] + public string Currency { get; set; } + + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + [DataMember(Name = "userToken", IsRequired = true, EmitDefaultValue = true)] + public string UserToken { get; set; } + + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + [DataMember(Name = "timestamp", EmitDefaultValue = false)] + public long Timestamp { get; set; } + + /// + /// User token for authenticated users. + /// + /// User token for authenticated users. + [DataMember(Name = "authenticatedUserToken", EmitDefaultValue = false)] + public string AuthenticatedUserToken { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AddedToCartObjectIDs {\n"); + sb.Append(" EventName: ").Append(EventName).Append("\n"); + sb.Append(" EventType: ").Append(EventType).Append("\n"); + sb.Append(" EventSubtype: ").Append(EventSubtype).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" ObjectIDs: ").Append(ObjectIDs).Append("\n"); + sb.Append(" ObjectData: ").Append(ObjectData).Append("\n"); + sb.Append(" Currency: ").Append(Currency).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" AuthenticatedUserToken: ").Append(AuthenticatedUserToken).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AddedToCartObjectIDs); + } + + /// + /// Returns true if AddedToCartObjectIDs instances are equal + /// + /// Instance of AddedToCartObjectIDs to be compared + /// Boolean + public bool Equals(AddedToCartObjectIDs input) + { + if (input == null) + { + return false; + } + return + ( + this.EventName == input.EventName || + (this.EventName != null && + this.EventName.Equals(input.EventName)) + ) && + ( + this.EventType == input.EventType || + this.EventType.Equals(input.EventType) + ) && + ( + this.EventSubtype == input.EventSubtype || + this.EventSubtype.Equals(input.EventSubtype) + ) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.ObjectIDs == input.ObjectIDs || + this.ObjectIDs != null && + input.ObjectIDs != null && + this.ObjectIDs.SequenceEqual(input.ObjectIDs) + ) && + ( + this.ObjectData == input.ObjectData || + this.ObjectData != null && + input.ObjectData != null && + this.ObjectData.SequenceEqual(input.ObjectData) + ) && + ( + this.Currency == input.Currency || + (this.Currency != null && + this.Currency.Equals(input.Currency)) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.Timestamp == input.Timestamp || + this.Timestamp.Equals(input.Timestamp) + ) && + ( + this.AuthenticatedUserToken == input.AuthenticatedUserToken || + (this.AuthenticatedUserToken != null && + this.AuthenticatedUserToken.Equals(input.AuthenticatedUserToken)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EventName != null) + { + hashCode = (hashCode * 59) + this.EventName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EventType.GetHashCode(); + hashCode = (hashCode * 59) + this.EventSubtype.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.ObjectIDs != null) + { + hashCode = (hashCode * 59) + this.ObjectIDs.GetHashCode(); + } + if (this.ObjectData != null) + { + hashCode = (hashCode * 59) + this.ObjectData.GetHashCode(); + } + if (this.Currency != null) + { + hashCode = (hashCode * 59) + this.Currency.GetHashCode(); + } + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + if (this.AuthenticatedUserToken != null) + { + hashCode = (hashCode * 59) + this.AuthenticatedUserToken.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // EventName (string) maxLength + if (this.EventName != null && this.EventName.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be less than 64.", new[] { "EventName" }); + } + + // EventName (string) minLength + if (this.EventName != null && this.EventName.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be greater than 1.", new[] { "EventName" }); + } + + if (this.EventName != null) + { + // EventName (string) pattern + Regex regexEventName = new Regex(@"[\x20-\x7E]{1,64}", RegexOptions.CultureInvariant); + if (!regexEventName.Match(this.EventName).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, must match a pattern of " + regexEventName, new[] { "EventName" }); + } + } + + // UserToken (string) maxLength + if (this.UserToken != null && this.UserToken.Length > 129) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be less than 129.", new[] { "UserToken" }); + } + + // UserToken (string) minLength + if (this.UserToken != null && this.UserToken.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be greater than 1.", new[] { "UserToken" }); + } + + if (this.UserToken != null) + { + // UserToken (string) pattern + Regex regexUserToken = new Regex(@"[a-zA-Z0-9_=/+-]{1,129}", RegexOptions.CultureInvariant); + if (!regexUserToken.Match(this.UserToken).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, must match a pattern of " + regexUserToken, new[] { "UserToken" }); + } + } + + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Models/AddedToCartObjectIDsAfterSearch.cs b/algoliasearch/Insights/Models/AddedToCartObjectIDsAfterSearch.cs new file mode 100644 index 000000000..3273771e0 --- /dev/null +++ b/algoliasearch/Insights/Models/AddedToCartObjectIDsAfterSearch.cs @@ -0,0 +1,398 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Use this event to track when users add items to their shopping cart after a previous Algolia request. If you're building your category pages with Algolia, you'll also use this event. + /// + [DataContract(Name = "AddedToCartObjectIDsAfterSearch")] + public partial class AddedToCartObjectIDsAfterSearch : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets EventType + /// + [DataMember(Name = "eventType", IsRequired = true, EmitDefaultValue = true)] + public ConversionEvent EventType { get; set; } + + /// + /// Gets or Sets EventSubtype + /// + [DataMember(Name = "eventSubtype", IsRequired = true, EmitDefaultValue = true)] + public AddToCartEvent EventSubtype { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AddedToCartObjectIDsAfterSearch() { } + /// + /// Initializes a new instance of the class. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. (required). + /// eventType (required). + /// eventSubtype (required). + /// Name of the Algolia index. (required). + /// Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. (required). + /// List of object identifiers for items of an Algolia index. (required). + /// Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. . + /// If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR.. + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. (required). + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. . + /// User token for authenticated users.. + public AddedToCartObjectIDsAfterSearch(string eventName = default(string), ConversionEvent eventType = default(ConversionEvent), AddToCartEvent eventSubtype = default(AddToCartEvent), string index = default(string), string queryID = default(string), List objectIDs = default(List), List objectData = default(List), string currency = default(string), string userToken = default(string), long timestamp = default(long), string authenticatedUserToken = default(string)) + { + // to ensure "eventName" is required (not null) + if (eventName == null) + { + throw new ArgumentNullException("eventName is a required property for AddedToCartObjectIDsAfterSearch and cannot be null"); + } + this.EventName = eventName; + this.EventType = eventType; + this.EventSubtype = eventSubtype; + // to ensure "index" is required (not null) + if (index == null) + { + throw new ArgumentNullException("index is a required property for AddedToCartObjectIDsAfterSearch and cannot be null"); + } + this.Index = index; + // to ensure "queryID" is required (not null) + if (queryID == null) + { + throw new ArgumentNullException("queryID is a required property for AddedToCartObjectIDsAfterSearch and cannot be null"); + } + this.QueryID = queryID; + // to ensure "objectIDs" is required (not null) + if (objectIDs == null) + { + throw new ArgumentNullException("objectIDs is a required property for AddedToCartObjectIDsAfterSearch and cannot be null"); + } + this.ObjectIDs = objectIDs; + // to ensure "userToken" is required (not null) + if (userToken == null) + { + throw new ArgumentNullException("userToken is a required property for AddedToCartObjectIDsAfterSearch and cannot be null"); + } + this.UserToken = userToken; + this.ObjectData = objectData; + this.Currency = currency; + this.Timestamp = timestamp; + this.AuthenticatedUserToken = authenticatedUserToken; + } + + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + [DataMember(Name = "eventName", IsRequired = true, EmitDefaultValue = true)] + public string EventName { get; set; } + + /// + /// Name of the Algolia index. + /// + /// Name of the Algolia index. + [DataMember(Name = "index", IsRequired = true, EmitDefaultValue = true)] + public string Index { get; set; } + + /// + /// Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. + /// + /// Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. + [DataMember(Name = "queryID", IsRequired = true, EmitDefaultValue = true)] + public string QueryID { get; set; } + + /// + /// List of object identifiers for items of an Algolia index. + /// + /// List of object identifiers for items of an Algolia index. + [DataMember(Name = "objectIDs", IsRequired = true, EmitDefaultValue = true)] + public List ObjectIDs { get; set; } + + /// + /// Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. + /// + /// Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. + [DataMember(Name = "objectData", EmitDefaultValue = false)] + public List ObjectData { get; set; } + + /// + /// If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. + /// + /// If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. + [DataMember(Name = "currency", EmitDefaultValue = false)] + public string Currency { get; set; } + + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + [DataMember(Name = "userToken", IsRequired = true, EmitDefaultValue = true)] + public string UserToken { get; set; } + + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + [DataMember(Name = "timestamp", EmitDefaultValue = false)] + public long Timestamp { get; set; } + + /// + /// User token for authenticated users. + /// + /// User token for authenticated users. + [DataMember(Name = "authenticatedUserToken", EmitDefaultValue = false)] + public string AuthenticatedUserToken { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AddedToCartObjectIDsAfterSearch {\n"); + sb.Append(" EventName: ").Append(EventName).Append("\n"); + sb.Append(" EventType: ").Append(EventType).Append("\n"); + sb.Append(" EventSubtype: ").Append(EventSubtype).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" QueryID: ").Append(QueryID).Append("\n"); + sb.Append(" ObjectIDs: ").Append(ObjectIDs).Append("\n"); + sb.Append(" ObjectData: ").Append(ObjectData).Append("\n"); + sb.Append(" Currency: ").Append(Currency).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" AuthenticatedUserToken: ").Append(AuthenticatedUserToken).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AddedToCartObjectIDsAfterSearch); + } + + /// + /// Returns true if AddedToCartObjectIDsAfterSearch instances are equal + /// + /// Instance of AddedToCartObjectIDsAfterSearch to be compared + /// Boolean + public bool Equals(AddedToCartObjectIDsAfterSearch input) + { + if (input == null) + { + return false; + } + return + ( + this.EventName == input.EventName || + (this.EventName != null && + this.EventName.Equals(input.EventName)) + ) && + ( + this.EventType == input.EventType || + this.EventType.Equals(input.EventType) + ) && + ( + this.EventSubtype == input.EventSubtype || + this.EventSubtype.Equals(input.EventSubtype) + ) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.QueryID == input.QueryID || + (this.QueryID != null && + this.QueryID.Equals(input.QueryID)) + ) && + ( + this.ObjectIDs == input.ObjectIDs || + this.ObjectIDs != null && + input.ObjectIDs != null && + this.ObjectIDs.SequenceEqual(input.ObjectIDs) + ) && + ( + this.ObjectData == input.ObjectData || + this.ObjectData != null && + input.ObjectData != null && + this.ObjectData.SequenceEqual(input.ObjectData) + ) && + ( + this.Currency == input.Currency || + (this.Currency != null && + this.Currency.Equals(input.Currency)) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.Timestamp == input.Timestamp || + this.Timestamp.Equals(input.Timestamp) + ) && + ( + this.AuthenticatedUserToken == input.AuthenticatedUserToken || + (this.AuthenticatedUserToken != null && + this.AuthenticatedUserToken.Equals(input.AuthenticatedUserToken)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EventName != null) + { + hashCode = (hashCode * 59) + this.EventName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EventType.GetHashCode(); + hashCode = (hashCode * 59) + this.EventSubtype.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.QueryID != null) + { + hashCode = (hashCode * 59) + this.QueryID.GetHashCode(); + } + if (this.ObjectIDs != null) + { + hashCode = (hashCode * 59) + this.ObjectIDs.GetHashCode(); + } + if (this.ObjectData != null) + { + hashCode = (hashCode * 59) + this.ObjectData.GetHashCode(); + } + if (this.Currency != null) + { + hashCode = (hashCode * 59) + this.Currency.GetHashCode(); + } + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + if (this.AuthenticatedUserToken != null) + { + hashCode = (hashCode * 59) + this.AuthenticatedUserToken.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // EventName (string) maxLength + if (this.EventName != null && this.EventName.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be less than 64.", new[] { "EventName" }); + } + + // EventName (string) minLength + if (this.EventName != null && this.EventName.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be greater than 1.", new[] { "EventName" }); + } + + if (this.EventName != null) + { + // EventName (string) pattern + Regex regexEventName = new Regex(@"[\x20-\x7E]{1,64}", RegexOptions.CultureInvariant); + if (!regexEventName.Match(this.EventName).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, must match a pattern of " + regexEventName, new[] { "EventName" }); + } + } + + // QueryID (string) maxLength + if (this.QueryID != null && this.QueryID.Length > 32) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for QueryID, length must be less than 32.", new[] { "QueryID" }); + } + + // QueryID (string) minLength + if (this.QueryID != null && this.QueryID.Length < 32) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for QueryID, length must be greater than 32.", new[] { "QueryID" }); + } + + if (this.QueryID != null) + { + // QueryID (string) pattern + Regex regexQueryID = new Regex(@"[0-9a-f]{32}", RegexOptions.CultureInvariant); + if (!regexQueryID.Match(this.QueryID).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for QueryID, must match a pattern of " + regexQueryID, new[] { "QueryID" }); + } + } + + // UserToken (string) maxLength + if (this.UserToken != null && this.UserToken.Length > 129) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be less than 129.", new[] { "UserToken" }); + } + + // UserToken (string) minLength + if (this.UserToken != null && this.UserToken.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be greater than 1.", new[] { "UserToken" }); + } + + if (this.UserToken != null) + { + // UserToken (string) pattern + Regex regexUserToken = new Regex(@"[a-zA-Z0-9_=/+-]{1,129}", RegexOptions.CultureInvariant); + if (!regexUserToken.Match(this.UserToken).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, must match a pattern of " + regexUserToken, new[] { "UserToken" }); + } + } + + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Models/ClickEvent.cs b/algoliasearch/Insights/Models/ClickEvent.cs new file mode 100644 index 000000000..95f387a13 --- /dev/null +++ b/algoliasearch/Insights/Models/ClickEvent.cs @@ -0,0 +1,36 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Defines ClickEvent + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ClickEvent + { + /// + /// Enum Click for value: click + /// + [EnumMember(Value = "click")] + Click = 1 + } + +} diff --git a/algoliasearch/Insights/Models/ClickedFilters.cs b/algoliasearch/Insights/Models/ClickedFilters.cs new file mode 100644 index 000000000..e73ce0be7 --- /dev/null +++ b/algoliasearch/Insights/Models/ClickedFilters.cs @@ -0,0 +1,299 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Use this event to track when users click facet filters in your user interface. + /// + [DataContract(Name = "ClickedFilters")] + public partial class ClickedFilters : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets EventType + /// + [DataMember(Name = "eventType", IsRequired = true, EmitDefaultValue = true)] + public ClickEvent EventType { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ClickedFilters() { } + /// + /// Initializes a new instance of the class. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. (required). + /// eventType (required). + /// Name of the Algolia index. (required). + /// Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`. (required). + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. (required). + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. . + /// User token for authenticated users.. + public ClickedFilters(string eventName = default(string), ClickEvent eventType = default(ClickEvent), string index = default(string), List filters = default(List), string userToken = default(string), long timestamp = default(long), string authenticatedUserToken = default(string)) + { + // to ensure "eventName" is required (not null) + if (eventName == null) + { + throw new ArgumentNullException("eventName is a required property for ClickedFilters and cannot be null"); + } + this.EventName = eventName; + this.EventType = eventType; + // to ensure "index" is required (not null) + if (index == null) + { + throw new ArgumentNullException("index is a required property for ClickedFilters and cannot be null"); + } + this.Index = index; + // to ensure "filters" is required (not null) + if (filters == null) + { + throw new ArgumentNullException("filters is a required property for ClickedFilters and cannot be null"); + } + this.Filters = filters; + // to ensure "userToken" is required (not null) + if (userToken == null) + { + throw new ArgumentNullException("userToken is a required property for ClickedFilters and cannot be null"); + } + this.UserToken = userToken; + this.Timestamp = timestamp; + this.AuthenticatedUserToken = authenticatedUserToken; + } + + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + [DataMember(Name = "eventName", IsRequired = true, EmitDefaultValue = true)] + public string EventName { get; set; } + + /// + /// Name of the Algolia index. + /// + /// Name of the Algolia index. + [DataMember(Name = "index", IsRequired = true, EmitDefaultValue = true)] + public string Index { get; set; } + + /// + /// Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`. + /// + /// Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`. + [DataMember(Name = "filters", IsRequired = true, EmitDefaultValue = true)] + public List Filters { get; set; } + + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + [DataMember(Name = "userToken", IsRequired = true, EmitDefaultValue = true)] + public string UserToken { get; set; } + + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + [DataMember(Name = "timestamp", EmitDefaultValue = false)] + public long Timestamp { get; set; } + + /// + /// User token for authenticated users. + /// + /// User token for authenticated users. + [DataMember(Name = "authenticatedUserToken", EmitDefaultValue = false)] + public string AuthenticatedUserToken { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ClickedFilters {\n"); + sb.Append(" EventName: ").Append(EventName).Append("\n"); + sb.Append(" EventType: ").Append(EventType).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" AuthenticatedUserToken: ").Append(AuthenticatedUserToken).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ClickedFilters); + } + + /// + /// Returns true if ClickedFilters instances are equal + /// + /// Instance of ClickedFilters to be compared + /// Boolean + public bool Equals(ClickedFilters input) + { + if (input == null) + { + return false; + } + return + ( + this.EventName == input.EventName || + (this.EventName != null && + this.EventName.Equals(input.EventName)) + ) && + ( + this.EventType == input.EventType || + this.EventType.Equals(input.EventType) + ) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.Filters == input.Filters || + this.Filters != null && + input.Filters != null && + this.Filters.SequenceEqual(input.Filters) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.Timestamp == input.Timestamp || + this.Timestamp.Equals(input.Timestamp) + ) && + ( + this.AuthenticatedUserToken == input.AuthenticatedUserToken || + (this.AuthenticatedUserToken != null && + this.AuthenticatedUserToken.Equals(input.AuthenticatedUserToken)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EventName != null) + { + hashCode = (hashCode * 59) + this.EventName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EventType.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + if (this.AuthenticatedUserToken != null) + { + hashCode = (hashCode * 59) + this.AuthenticatedUserToken.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // EventName (string) maxLength + if (this.EventName != null && this.EventName.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be less than 64.", new[] { "EventName" }); + } + + // EventName (string) minLength + if (this.EventName != null && this.EventName.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be greater than 1.", new[] { "EventName" }); + } + + if (this.EventName != null) + { + // EventName (string) pattern + Regex regexEventName = new Regex(@"[\x20-\x7E]{1,64}", RegexOptions.CultureInvariant); + if (!regexEventName.Match(this.EventName).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, must match a pattern of " + regexEventName, new[] { "EventName" }); + } + } + + // UserToken (string) maxLength + if (this.UserToken != null && this.UserToken.Length > 129) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be less than 129.", new[] { "UserToken" }); + } + + // UserToken (string) minLength + if (this.UserToken != null && this.UserToken.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be greater than 1.", new[] { "UserToken" }); + } + + if (this.UserToken != null) + { + // UserToken (string) pattern + Regex regexUserToken = new Regex(@"[a-zA-Z0-9_=/+-]{1,129}", RegexOptions.CultureInvariant); + if (!regexUserToken.Match(this.UserToken).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, must match a pattern of " + regexUserToken, new[] { "UserToken" }); + } + } + + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Models/ClickedObjectIDs.cs b/algoliasearch/Insights/Models/ClickedObjectIDs.cs new file mode 100644 index 000000000..bf4cf0cee --- /dev/null +++ b/algoliasearch/Insights/Models/ClickedObjectIDs.cs @@ -0,0 +1,280 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Use this event to track when users click items unrelated to a previous Algolia request. For example, if you don't use Algolia to build your category pages, use this event. To track click events related to Algolia requests, use the \"Clicked object IDs after search\" event. + /// + [DataContract(Name = "ClickedObjectIDs")] + public partial class ClickedObjectIDs : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets EventType + /// + [DataMember(Name = "eventType", IsRequired = true, EmitDefaultValue = true)] + public ClickEvent EventType { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ClickedObjectIDs() { } + /// + /// Initializes a new instance of the class. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. (required). + /// eventType (required). + /// Name of the Algolia index. (required). + /// List of object identifiers for items of an Algolia index. (required). + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. (required). + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. . + public ClickedObjectIDs(string eventName = default(string), ClickEvent eventType = default(ClickEvent), string index = default(string), List objectIDs = default(List), string userToken = default(string), long timestamp = default(long)) + { + // to ensure "eventName" is required (not null) + if (eventName == null) + { + throw new ArgumentNullException("eventName is a required property for ClickedObjectIDs and cannot be null"); + } + this.EventName = eventName; + this.EventType = eventType; + // to ensure "index" is required (not null) + if (index == null) + { + throw new ArgumentNullException("index is a required property for ClickedObjectIDs and cannot be null"); + } + this.Index = index; + // to ensure "objectIDs" is required (not null) + if (objectIDs == null) + { + throw new ArgumentNullException("objectIDs is a required property for ClickedObjectIDs and cannot be null"); + } + this.ObjectIDs = objectIDs; + // to ensure "userToken" is required (not null) + if (userToken == null) + { + throw new ArgumentNullException("userToken is a required property for ClickedObjectIDs and cannot be null"); + } + this.UserToken = userToken; + this.Timestamp = timestamp; + } + + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + [DataMember(Name = "eventName", IsRequired = true, EmitDefaultValue = true)] + public string EventName { get; set; } + + /// + /// Name of the Algolia index. + /// + /// Name of the Algolia index. + [DataMember(Name = "index", IsRequired = true, EmitDefaultValue = true)] + public string Index { get; set; } + + /// + /// List of object identifiers for items of an Algolia index. + /// + /// List of object identifiers for items of an Algolia index. + [DataMember(Name = "objectIDs", IsRequired = true, EmitDefaultValue = true)] + public List ObjectIDs { get; set; } + + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + [DataMember(Name = "userToken", IsRequired = true, EmitDefaultValue = true)] + public string UserToken { get; set; } + + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + [DataMember(Name = "timestamp", EmitDefaultValue = false)] + public long Timestamp { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ClickedObjectIDs {\n"); + sb.Append(" EventName: ").Append(EventName).Append("\n"); + sb.Append(" EventType: ").Append(EventType).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" ObjectIDs: ").Append(ObjectIDs).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ClickedObjectIDs); + } + + /// + /// Returns true if ClickedObjectIDs instances are equal + /// + /// Instance of ClickedObjectIDs to be compared + /// Boolean + public bool Equals(ClickedObjectIDs input) + { + if (input == null) + { + return false; + } + return + ( + this.EventName == input.EventName || + (this.EventName != null && + this.EventName.Equals(input.EventName)) + ) && + ( + this.EventType == input.EventType || + this.EventType.Equals(input.EventType) + ) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.ObjectIDs == input.ObjectIDs || + this.ObjectIDs != null && + input.ObjectIDs != null && + this.ObjectIDs.SequenceEqual(input.ObjectIDs) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.Timestamp == input.Timestamp || + this.Timestamp.Equals(input.Timestamp) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EventName != null) + { + hashCode = (hashCode * 59) + this.EventName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EventType.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.ObjectIDs != null) + { + hashCode = (hashCode * 59) + this.ObjectIDs.GetHashCode(); + } + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // EventName (string) maxLength + if (this.EventName != null && this.EventName.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be less than 64.", new[] { "EventName" }); + } + + // EventName (string) minLength + if (this.EventName != null && this.EventName.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be greater than 1.", new[] { "EventName" }); + } + + if (this.EventName != null) + { + // EventName (string) pattern + Regex regexEventName = new Regex(@"[\x20-\x7E]{1,64}", RegexOptions.CultureInvariant); + if (!regexEventName.Match(this.EventName).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, must match a pattern of " + regexEventName, new[] { "EventName" }); + } + } + + // UserToken (string) maxLength + if (this.UserToken != null && this.UserToken.Length > 129) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be less than 129.", new[] { "UserToken" }); + } + + // UserToken (string) minLength + if (this.UserToken != null && this.UserToken.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be greater than 1.", new[] { "UserToken" }); + } + + if (this.UserToken != null) + { + // UserToken (string) pattern + Regex regexUserToken = new Regex(@"[a-zA-Z0-9_=/+-]{1,129}", RegexOptions.CultureInvariant); + if (!regexUserToken.Match(this.UserToken).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, must match a pattern of " + regexUserToken, new[] { "UserToken" }); + } + } + + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Models/ClickedObjectIDsAfterSearch.cs b/algoliasearch/Insights/Models/ClickedObjectIDsAfterSearch.cs new file mode 100644 index 000000000..f7b2ebca5 --- /dev/null +++ b/algoliasearch/Insights/Models/ClickedObjectIDsAfterSearch.cs @@ -0,0 +1,370 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Click event after an Algolia request. Use this event to track when users click items in the search results. If you're building your category pages with Algolia, you'll also use this event. + /// + [DataContract(Name = "ClickedObjectIDsAfterSearch")] + public partial class ClickedObjectIDsAfterSearch : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets EventType + /// + [DataMember(Name = "eventType", IsRequired = true, EmitDefaultValue = true)] + public ClickEvent EventType { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ClickedObjectIDsAfterSearch() { } + /// + /// Initializes a new instance of the class. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. (required). + /// eventType (required). + /// Name of the Algolia index. (required). + /// List of object identifiers for items of an Algolia index. (required). + /// Position of the clicked objects in the search results. The first search result has a position of 1 (not 0). You must provide 1 `position` for each `objectID`. (required). + /// Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. (required). + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. (required). + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. . + /// User token for authenticated users.. + public ClickedObjectIDsAfterSearch(string eventName = default(string), ClickEvent eventType = default(ClickEvent), string index = default(string), List objectIDs = default(List), List positions = default(List), string queryID = default(string), string userToken = default(string), long timestamp = default(long), string authenticatedUserToken = default(string)) + { + // to ensure "eventName" is required (not null) + if (eventName == null) + { + throw new ArgumentNullException("eventName is a required property for ClickedObjectIDsAfterSearch and cannot be null"); + } + this.EventName = eventName; + this.EventType = eventType; + // to ensure "index" is required (not null) + if (index == null) + { + throw new ArgumentNullException("index is a required property for ClickedObjectIDsAfterSearch and cannot be null"); + } + this.Index = index; + // to ensure "objectIDs" is required (not null) + if (objectIDs == null) + { + throw new ArgumentNullException("objectIDs is a required property for ClickedObjectIDsAfterSearch and cannot be null"); + } + this.ObjectIDs = objectIDs; + // to ensure "positions" is required (not null) + if (positions == null) + { + throw new ArgumentNullException("positions is a required property for ClickedObjectIDsAfterSearch and cannot be null"); + } + this.Positions = positions; + // to ensure "queryID" is required (not null) + if (queryID == null) + { + throw new ArgumentNullException("queryID is a required property for ClickedObjectIDsAfterSearch and cannot be null"); + } + this.QueryID = queryID; + // to ensure "userToken" is required (not null) + if (userToken == null) + { + throw new ArgumentNullException("userToken is a required property for ClickedObjectIDsAfterSearch and cannot be null"); + } + this.UserToken = userToken; + this.Timestamp = timestamp; + this.AuthenticatedUserToken = authenticatedUserToken; + } + + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + [DataMember(Name = "eventName", IsRequired = true, EmitDefaultValue = true)] + public string EventName { get; set; } + + /// + /// Name of the Algolia index. + /// + /// Name of the Algolia index. + [DataMember(Name = "index", IsRequired = true, EmitDefaultValue = true)] + public string Index { get; set; } + + /// + /// List of object identifiers for items of an Algolia index. + /// + /// List of object identifiers for items of an Algolia index. + [DataMember(Name = "objectIDs", IsRequired = true, EmitDefaultValue = true)] + public List ObjectIDs { get; set; } + + /// + /// Position of the clicked objects in the search results. The first search result has a position of 1 (not 0). You must provide 1 `position` for each `objectID`. + /// + /// Position of the clicked objects in the search results. The first search result has a position of 1 (not 0). You must provide 1 `position` for each `objectID`. + [DataMember(Name = "positions", IsRequired = true, EmitDefaultValue = true)] + public List Positions { get; set; } + + /// + /// Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. + /// + /// Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. + [DataMember(Name = "queryID", IsRequired = true, EmitDefaultValue = true)] + public string QueryID { get; set; } + + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + [DataMember(Name = "userToken", IsRequired = true, EmitDefaultValue = true)] + public string UserToken { get; set; } + + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + [DataMember(Name = "timestamp", EmitDefaultValue = false)] + public long Timestamp { get; set; } + + /// + /// User token for authenticated users. + /// + /// User token for authenticated users. + [DataMember(Name = "authenticatedUserToken", EmitDefaultValue = false)] + public string AuthenticatedUserToken { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ClickedObjectIDsAfterSearch {\n"); + sb.Append(" EventName: ").Append(EventName).Append("\n"); + sb.Append(" EventType: ").Append(EventType).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" ObjectIDs: ").Append(ObjectIDs).Append("\n"); + sb.Append(" Positions: ").Append(Positions).Append("\n"); + sb.Append(" QueryID: ").Append(QueryID).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" AuthenticatedUserToken: ").Append(AuthenticatedUserToken).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ClickedObjectIDsAfterSearch); + } + + /// + /// Returns true if ClickedObjectIDsAfterSearch instances are equal + /// + /// Instance of ClickedObjectIDsAfterSearch to be compared + /// Boolean + public bool Equals(ClickedObjectIDsAfterSearch input) + { + if (input == null) + { + return false; + } + return + ( + this.EventName == input.EventName || + (this.EventName != null && + this.EventName.Equals(input.EventName)) + ) && + ( + this.EventType == input.EventType || + this.EventType.Equals(input.EventType) + ) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.ObjectIDs == input.ObjectIDs || + this.ObjectIDs != null && + input.ObjectIDs != null && + this.ObjectIDs.SequenceEqual(input.ObjectIDs) + ) && + ( + this.Positions == input.Positions || + this.Positions != null && + input.Positions != null && + this.Positions.SequenceEqual(input.Positions) + ) && + ( + this.QueryID == input.QueryID || + (this.QueryID != null && + this.QueryID.Equals(input.QueryID)) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.Timestamp == input.Timestamp || + this.Timestamp.Equals(input.Timestamp) + ) && + ( + this.AuthenticatedUserToken == input.AuthenticatedUserToken || + (this.AuthenticatedUserToken != null && + this.AuthenticatedUserToken.Equals(input.AuthenticatedUserToken)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EventName != null) + { + hashCode = (hashCode * 59) + this.EventName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EventType.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.ObjectIDs != null) + { + hashCode = (hashCode * 59) + this.ObjectIDs.GetHashCode(); + } + if (this.Positions != null) + { + hashCode = (hashCode * 59) + this.Positions.GetHashCode(); + } + if (this.QueryID != null) + { + hashCode = (hashCode * 59) + this.QueryID.GetHashCode(); + } + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + if (this.AuthenticatedUserToken != null) + { + hashCode = (hashCode * 59) + this.AuthenticatedUserToken.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // EventName (string) maxLength + if (this.EventName != null && this.EventName.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be less than 64.", new[] { "EventName" }); + } + + // EventName (string) minLength + if (this.EventName != null && this.EventName.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be greater than 1.", new[] { "EventName" }); + } + + if (this.EventName != null) + { + // EventName (string) pattern + Regex regexEventName = new Regex(@"[\x20-\x7E]{1,64}", RegexOptions.CultureInvariant); + if (!regexEventName.Match(this.EventName).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, must match a pattern of " + regexEventName, new[] { "EventName" }); + } + } + + // QueryID (string) maxLength + if (this.QueryID != null && this.QueryID.Length > 32) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for QueryID, length must be less than 32.", new[] { "QueryID" }); + } + + // QueryID (string) minLength + if (this.QueryID != null && this.QueryID.Length < 32) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for QueryID, length must be greater than 32.", new[] { "QueryID" }); + } + + if (this.QueryID != null) + { + // QueryID (string) pattern + Regex regexQueryID = new Regex(@"[0-9a-f]{32}", RegexOptions.CultureInvariant); + if (!regexQueryID.Match(this.QueryID).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for QueryID, must match a pattern of " + regexQueryID, new[] { "QueryID" }); + } + } + + // UserToken (string) maxLength + if (this.UserToken != null && this.UserToken.Length > 129) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be less than 129.", new[] { "UserToken" }); + } + + // UserToken (string) minLength + if (this.UserToken != null && this.UserToken.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be greater than 1.", new[] { "UserToken" }); + } + + if (this.UserToken != null) + { + // UserToken (string) pattern + Regex regexUserToken = new Regex(@"[a-zA-Z0-9_=/+-]{1,129}", RegexOptions.CultureInvariant); + if (!regexUserToken.Match(this.UserToken).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, must match a pattern of " + regexUserToken, new[] { "UserToken" }); + } + } + + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Models/ConversionEvent.cs b/algoliasearch/Insights/Models/ConversionEvent.cs new file mode 100644 index 000000000..7b13567ee --- /dev/null +++ b/algoliasearch/Insights/Models/ConversionEvent.cs @@ -0,0 +1,36 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Defines ConversionEvent + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ConversionEvent + { + /// + /// Enum Conversion for value: conversion + /// + [EnumMember(Value = "conversion")] + Conversion = 1 + } + +} diff --git a/algoliasearch/Insights/Models/ConvertedFilters.cs b/algoliasearch/Insights/Models/ConvertedFilters.cs new file mode 100644 index 000000000..582a8cb5d --- /dev/null +++ b/algoliasearch/Insights/Models/ConvertedFilters.cs @@ -0,0 +1,299 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// ConvertedFilters + /// + [DataContract(Name = "ConvertedFilters")] + public partial class ConvertedFilters : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets EventType + /// + [DataMember(Name = "eventType", IsRequired = true, EmitDefaultValue = true)] + public ConversionEvent EventType { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ConvertedFilters() { } + /// + /// Initializes a new instance of the class. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. (required). + /// eventType (required). + /// Name of the Algolia index. (required). + /// Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`. (required). + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. (required). + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. . + /// User token for authenticated users.. + public ConvertedFilters(string eventName = default(string), ConversionEvent eventType = default(ConversionEvent), string index = default(string), List filters = default(List), string userToken = default(string), long timestamp = default(long), string authenticatedUserToken = default(string)) + { + // to ensure "eventName" is required (not null) + if (eventName == null) + { + throw new ArgumentNullException("eventName is a required property for ConvertedFilters and cannot be null"); + } + this.EventName = eventName; + this.EventType = eventType; + // to ensure "index" is required (not null) + if (index == null) + { + throw new ArgumentNullException("index is a required property for ConvertedFilters and cannot be null"); + } + this.Index = index; + // to ensure "filters" is required (not null) + if (filters == null) + { + throw new ArgumentNullException("filters is a required property for ConvertedFilters and cannot be null"); + } + this.Filters = filters; + // to ensure "userToken" is required (not null) + if (userToken == null) + { + throw new ArgumentNullException("userToken is a required property for ConvertedFilters and cannot be null"); + } + this.UserToken = userToken; + this.Timestamp = timestamp; + this.AuthenticatedUserToken = authenticatedUserToken; + } + + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + [DataMember(Name = "eventName", IsRequired = true, EmitDefaultValue = true)] + public string EventName { get; set; } + + /// + /// Name of the Algolia index. + /// + /// Name of the Algolia index. + [DataMember(Name = "index", IsRequired = true, EmitDefaultValue = true)] + public string Index { get; set; } + + /// + /// Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`. + /// + /// Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`. + [DataMember(Name = "filters", IsRequired = true, EmitDefaultValue = true)] + public List Filters { get; set; } + + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + [DataMember(Name = "userToken", IsRequired = true, EmitDefaultValue = true)] + public string UserToken { get; set; } + + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + [DataMember(Name = "timestamp", EmitDefaultValue = false)] + public long Timestamp { get; set; } + + /// + /// User token for authenticated users. + /// + /// User token for authenticated users. + [DataMember(Name = "authenticatedUserToken", EmitDefaultValue = false)] + public string AuthenticatedUserToken { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ConvertedFilters {\n"); + sb.Append(" EventName: ").Append(EventName).Append("\n"); + sb.Append(" EventType: ").Append(EventType).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" AuthenticatedUserToken: ").Append(AuthenticatedUserToken).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ConvertedFilters); + } + + /// + /// Returns true if ConvertedFilters instances are equal + /// + /// Instance of ConvertedFilters to be compared + /// Boolean + public bool Equals(ConvertedFilters input) + { + if (input == null) + { + return false; + } + return + ( + this.EventName == input.EventName || + (this.EventName != null && + this.EventName.Equals(input.EventName)) + ) && + ( + this.EventType == input.EventType || + this.EventType.Equals(input.EventType) + ) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.Filters == input.Filters || + this.Filters != null && + input.Filters != null && + this.Filters.SequenceEqual(input.Filters) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.Timestamp == input.Timestamp || + this.Timestamp.Equals(input.Timestamp) + ) && + ( + this.AuthenticatedUserToken == input.AuthenticatedUserToken || + (this.AuthenticatedUserToken != null && + this.AuthenticatedUserToken.Equals(input.AuthenticatedUserToken)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EventName != null) + { + hashCode = (hashCode * 59) + this.EventName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EventType.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + if (this.AuthenticatedUserToken != null) + { + hashCode = (hashCode * 59) + this.AuthenticatedUserToken.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // EventName (string) maxLength + if (this.EventName != null && this.EventName.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be less than 64.", new[] { "EventName" }); + } + + // EventName (string) minLength + if (this.EventName != null && this.EventName.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be greater than 1.", new[] { "EventName" }); + } + + if (this.EventName != null) + { + // EventName (string) pattern + Regex regexEventName = new Regex(@"[\x20-\x7E]{1,64}", RegexOptions.CultureInvariant); + if (!regexEventName.Match(this.EventName).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, must match a pattern of " + regexEventName, new[] { "EventName" }); + } + } + + // UserToken (string) maxLength + if (this.UserToken != null && this.UserToken.Length > 129) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be less than 129.", new[] { "UserToken" }); + } + + // UserToken (string) minLength + if (this.UserToken != null && this.UserToken.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be greater than 1.", new[] { "UserToken" }); + } + + if (this.UserToken != null) + { + // UserToken (string) pattern + Regex regexUserToken = new Regex(@"[a-zA-Z0-9_=/+-]{1,129}", RegexOptions.CultureInvariant); + if (!regexUserToken.Match(this.UserToken).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, must match a pattern of " + regexUserToken, new[] { "UserToken" }); + } + } + + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Models/ConvertedObjectIDs.cs b/algoliasearch/Insights/Models/ConvertedObjectIDs.cs new file mode 100644 index 000000000..6ce300a20 --- /dev/null +++ b/algoliasearch/Insights/Models/ConvertedObjectIDs.cs @@ -0,0 +1,299 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Use this event to track when users convert on items unrelated to a previous Algolia request. For example, if you don't use Algolia to build your category pages, use this event. To track conversion events related to Algolia requests, use the \"Converted object IDs after search\" event. + /// + [DataContract(Name = "ConvertedObjectIDs")] + public partial class ConvertedObjectIDs : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets EventType + /// + [DataMember(Name = "eventType", IsRequired = true, EmitDefaultValue = true)] + public ConversionEvent EventType { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ConvertedObjectIDs() { } + /// + /// Initializes a new instance of the class. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. (required). + /// eventType (required). + /// Name of the Algolia index. (required). + /// List of object identifiers for items of an Algolia index. (required). + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. (required). + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. . + /// User token for authenticated users.. + public ConvertedObjectIDs(string eventName = default(string), ConversionEvent eventType = default(ConversionEvent), string index = default(string), List objectIDs = default(List), string userToken = default(string), long timestamp = default(long), string authenticatedUserToken = default(string)) + { + // to ensure "eventName" is required (not null) + if (eventName == null) + { + throw new ArgumentNullException("eventName is a required property for ConvertedObjectIDs and cannot be null"); + } + this.EventName = eventName; + this.EventType = eventType; + // to ensure "index" is required (not null) + if (index == null) + { + throw new ArgumentNullException("index is a required property for ConvertedObjectIDs and cannot be null"); + } + this.Index = index; + // to ensure "objectIDs" is required (not null) + if (objectIDs == null) + { + throw new ArgumentNullException("objectIDs is a required property for ConvertedObjectIDs and cannot be null"); + } + this.ObjectIDs = objectIDs; + // to ensure "userToken" is required (not null) + if (userToken == null) + { + throw new ArgumentNullException("userToken is a required property for ConvertedObjectIDs and cannot be null"); + } + this.UserToken = userToken; + this.Timestamp = timestamp; + this.AuthenticatedUserToken = authenticatedUserToken; + } + + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + [DataMember(Name = "eventName", IsRequired = true, EmitDefaultValue = true)] + public string EventName { get; set; } + + /// + /// Name of the Algolia index. + /// + /// Name of the Algolia index. + [DataMember(Name = "index", IsRequired = true, EmitDefaultValue = true)] + public string Index { get; set; } + + /// + /// List of object identifiers for items of an Algolia index. + /// + /// List of object identifiers for items of an Algolia index. + [DataMember(Name = "objectIDs", IsRequired = true, EmitDefaultValue = true)] + public List ObjectIDs { get; set; } + + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + [DataMember(Name = "userToken", IsRequired = true, EmitDefaultValue = true)] + public string UserToken { get; set; } + + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + [DataMember(Name = "timestamp", EmitDefaultValue = false)] + public long Timestamp { get; set; } + + /// + /// User token for authenticated users. + /// + /// User token for authenticated users. + [DataMember(Name = "authenticatedUserToken", EmitDefaultValue = false)] + public string AuthenticatedUserToken { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ConvertedObjectIDs {\n"); + sb.Append(" EventName: ").Append(EventName).Append("\n"); + sb.Append(" EventType: ").Append(EventType).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" ObjectIDs: ").Append(ObjectIDs).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" AuthenticatedUserToken: ").Append(AuthenticatedUserToken).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ConvertedObjectIDs); + } + + /// + /// Returns true if ConvertedObjectIDs instances are equal + /// + /// Instance of ConvertedObjectIDs to be compared + /// Boolean + public bool Equals(ConvertedObjectIDs input) + { + if (input == null) + { + return false; + } + return + ( + this.EventName == input.EventName || + (this.EventName != null && + this.EventName.Equals(input.EventName)) + ) && + ( + this.EventType == input.EventType || + this.EventType.Equals(input.EventType) + ) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.ObjectIDs == input.ObjectIDs || + this.ObjectIDs != null && + input.ObjectIDs != null && + this.ObjectIDs.SequenceEqual(input.ObjectIDs) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.Timestamp == input.Timestamp || + this.Timestamp.Equals(input.Timestamp) + ) && + ( + this.AuthenticatedUserToken == input.AuthenticatedUserToken || + (this.AuthenticatedUserToken != null && + this.AuthenticatedUserToken.Equals(input.AuthenticatedUserToken)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EventName != null) + { + hashCode = (hashCode * 59) + this.EventName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EventType.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.ObjectIDs != null) + { + hashCode = (hashCode * 59) + this.ObjectIDs.GetHashCode(); + } + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + if (this.AuthenticatedUserToken != null) + { + hashCode = (hashCode * 59) + this.AuthenticatedUserToken.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // EventName (string) maxLength + if (this.EventName != null && this.EventName.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be less than 64.", new[] { "EventName" }); + } + + // EventName (string) minLength + if (this.EventName != null && this.EventName.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be greater than 1.", new[] { "EventName" }); + } + + if (this.EventName != null) + { + // EventName (string) pattern + Regex regexEventName = new Regex(@"[\x20-\x7E]{1,64}", RegexOptions.CultureInvariant); + if (!regexEventName.Match(this.EventName).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, must match a pattern of " + regexEventName, new[] { "EventName" }); + } + } + + // UserToken (string) maxLength + if (this.UserToken != null && this.UserToken.Length > 129) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be less than 129.", new[] { "UserToken" }); + } + + // UserToken (string) minLength + if (this.UserToken != null && this.UserToken.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be greater than 1.", new[] { "UserToken" }); + } + + if (this.UserToken != null) + { + // UserToken (string) pattern + Regex regexUserToken = new Regex(@"[a-zA-Z0-9_=/+-]{1,129}", RegexOptions.CultureInvariant); + if (!regexUserToken.Match(this.UserToken).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, must match a pattern of " + regexUserToken, new[] { "UserToken" }); + } + } + + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Models/ConvertedObjectIDsAfterSearch.cs b/algoliasearch/Insights/Models/ConvertedObjectIDsAfterSearch.cs new file mode 100644 index 000000000..67ee2acb3 --- /dev/null +++ b/algoliasearch/Insights/Models/ConvertedObjectIDsAfterSearch.cs @@ -0,0 +1,345 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Use this event to track when users convert after a previous Algolia request. For example, a user clicks on an item in the search results to view the product detail page. Then, the user adds the item to their shopping cart. If you're building your category pages with Algolia, you'll also use this event. + /// + [DataContract(Name = "ConvertedObjectIDsAfterSearch")] + public partial class ConvertedObjectIDsAfterSearch : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets EventType + /// + [DataMember(Name = "eventType", IsRequired = true, EmitDefaultValue = true)] + public ConversionEvent EventType { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ConvertedObjectIDsAfterSearch() { } + /// + /// Initializes a new instance of the class. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. (required). + /// eventType (required). + /// Name of the Algolia index. (required). + /// List of object identifiers for items of an Algolia index. (required). + /// Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. (required). + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. (required). + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. . + /// User token for authenticated users.. + public ConvertedObjectIDsAfterSearch(string eventName = default(string), ConversionEvent eventType = default(ConversionEvent), string index = default(string), List objectIDs = default(List), string queryID = default(string), string userToken = default(string), long timestamp = default(long), string authenticatedUserToken = default(string)) + { + // to ensure "eventName" is required (not null) + if (eventName == null) + { + throw new ArgumentNullException("eventName is a required property for ConvertedObjectIDsAfterSearch and cannot be null"); + } + this.EventName = eventName; + this.EventType = eventType; + // to ensure "index" is required (not null) + if (index == null) + { + throw new ArgumentNullException("index is a required property for ConvertedObjectIDsAfterSearch and cannot be null"); + } + this.Index = index; + // to ensure "objectIDs" is required (not null) + if (objectIDs == null) + { + throw new ArgumentNullException("objectIDs is a required property for ConvertedObjectIDsAfterSearch and cannot be null"); + } + this.ObjectIDs = objectIDs; + // to ensure "queryID" is required (not null) + if (queryID == null) + { + throw new ArgumentNullException("queryID is a required property for ConvertedObjectIDsAfterSearch and cannot be null"); + } + this.QueryID = queryID; + // to ensure "userToken" is required (not null) + if (userToken == null) + { + throw new ArgumentNullException("userToken is a required property for ConvertedObjectIDsAfterSearch and cannot be null"); + } + this.UserToken = userToken; + this.Timestamp = timestamp; + this.AuthenticatedUserToken = authenticatedUserToken; + } + + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + [DataMember(Name = "eventName", IsRequired = true, EmitDefaultValue = true)] + public string EventName { get; set; } + + /// + /// Name of the Algolia index. + /// + /// Name of the Algolia index. + [DataMember(Name = "index", IsRequired = true, EmitDefaultValue = true)] + public string Index { get; set; } + + /// + /// List of object identifiers for items of an Algolia index. + /// + /// List of object identifiers for items of an Algolia index. + [DataMember(Name = "objectIDs", IsRequired = true, EmitDefaultValue = true)] + public List ObjectIDs { get; set; } + + /// + /// Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. + /// + /// Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. + [DataMember(Name = "queryID", IsRequired = true, EmitDefaultValue = true)] + public string QueryID { get; set; } + + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + [DataMember(Name = "userToken", IsRequired = true, EmitDefaultValue = true)] + public string UserToken { get; set; } + + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + [DataMember(Name = "timestamp", EmitDefaultValue = false)] + public long Timestamp { get; set; } + + /// + /// User token for authenticated users. + /// + /// User token for authenticated users. + [DataMember(Name = "authenticatedUserToken", EmitDefaultValue = false)] + public string AuthenticatedUserToken { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ConvertedObjectIDsAfterSearch {\n"); + sb.Append(" EventName: ").Append(EventName).Append("\n"); + sb.Append(" EventType: ").Append(EventType).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" ObjectIDs: ").Append(ObjectIDs).Append("\n"); + sb.Append(" QueryID: ").Append(QueryID).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" AuthenticatedUserToken: ").Append(AuthenticatedUserToken).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ConvertedObjectIDsAfterSearch); + } + + /// + /// Returns true if ConvertedObjectIDsAfterSearch instances are equal + /// + /// Instance of ConvertedObjectIDsAfterSearch to be compared + /// Boolean + public bool Equals(ConvertedObjectIDsAfterSearch input) + { + if (input == null) + { + return false; + } + return + ( + this.EventName == input.EventName || + (this.EventName != null && + this.EventName.Equals(input.EventName)) + ) && + ( + this.EventType == input.EventType || + this.EventType.Equals(input.EventType) + ) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.ObjectIDs == input.ObjectIDs || + this.ObjectIDs != null && + input.ObjectIDs != null && + this.ObjectIDs.SequenceEqual(input.ObjectIDs) + ) && + ( + this.QueryID == input.QueryID || + (this.QueryID != null && + this.QueryID.Equals(input.QueryID)) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.Timestamp == input.Timestamp || + this.Timestamp.Equals(input.Timestamp) + ) && + ( + this.AuthenticatedUserToken == input.AuthenticatedUserToken || + (this.AuthenticatedUserToken != null && + this.AuthenticatedUserToken.Equals(input.AuthenticatedUserToken)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EventName != null) + { + hashCode = (hashCode * 59) + this.EventName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EventType.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.ObjectIDs != null) + { + hashCode = (hashCode * 59) + this.ObjectIDs.GetHashCode(); + } + if (this.QueryID != null) + { + hashCode = (hashCode * 59) + this.QueryID.GetHashCode(); + } + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + if (this.AuthenticatedUserToken != null) + { + hashCode = (hashCode * 59) + this.AuthenticatedUserToken.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // EventName (string) maxLength + if (this.EventName != null && this.EventName.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be less than 64.", new[] { "EventName" }); + } + + // EventName (string) minLength + if (this.EventName != null && this.EventName.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be greater than 1.", new[] { "EventName" }); + } + + if (this.EventName != null) + { + // EventName (string) pattern + Regex regexEventName = new Regex(@"[\x20-\x7E]{1,64}", RegexOptions.CultureInvariant); + if (!regexEventName.Match(this.EventName).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, must match a pattern of " + regexEventName, new[] { "EventName" }); + } + } + + // QueryID (string) maxLength + if (this.QueryID != null && this.QueryID.Length > 32) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for QueryID, length must be less than 32.", new[] { "QueryID" }); + } + + // QueryID (string) minLength + if (this.QueryID != null && this.QueryID.Length < 32) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for QueryID, length must be greater than 32.", new[] { "QueryID" }); + } + + if (this.QueryID != null) + { + // QueryID (string) pattern + Regex regexQueryID = new Regex(@"[0-9a-f]{32}", RegexOptions.CultureInvariant); + if (!regexQueryID.Match(this.QueryID).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for QueryID, must match a pattern of " + regexQueryID, new[] { "QueryID" }); + } + } + + // UserToken (string) maxLength + if (this.UserToken != null && this.UserToken.Length > 129) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be less than 129.", new[] { "UserToken" }); + } + + // UserToken (string) minLength + if (this.UserToken != null && this.UserToken.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be greater than 1.", new[] { "UserToken" }); + } + + if (this.UserToken != null) + { + // UserToken (string) pattern + Regex regexUserToken = new Regex(@"[a-zA-Z0-9_=/+-]{1,129}", RegexOptions.CultureInvariant); + if (!regexUserToken.Match(this.UserToken).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, must match a pattern of " + regexUserToken, new[] { "UserToken" }); + } + } + + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Models/Discount.cs b/algoliasearch/Insights/Models/Discount.cs new file mode 100644 index 000000000..cdb76be32 --- /dev/null +++ b/algoliasearch/Insights/Models/Discount.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Absolute value of the discount in effect for this object, measured in `currency`. + /// + [JsonConverter(typeof(DiscountJsonConverter))] + [DataContract(Name = "discount")] + public partial class Discount : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of double. + public Discount(double actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public Discount(string actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(double)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: double, string"); + } + } + } + + /// + /// Get the actual instance of `double`. If the actual instance is not `double`, + /// the InvalidClassException will be thrown + /// + /// An instance of double + public double GetterDouble() + { + return (double)this.ActualInstance; + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Discount {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, Discount.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of Discount + /// + /// JSON string + /// An instance of Discount + public static Discount FromJson(string jsonString) + { + Discount newDiscount = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newDiscount; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(double).GetProperty("AdditionalProperties") == null) + { + newDiscount = new Discount(JsonConvert.DeserializeObject(jsonString, Discount.SerializerSettings)); + } + else + { + newDiscount = new Discount(JsonConvert.DeserializeObject(jsonString, Discount.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("double"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into double: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newDiscount = new Discount(JsonConvert.DeserializeObject(jsonString, Discount.SerializerSettings)); + } + else + { + newDiscount = new Discount(JsonConvert.DeserializeObject(jsonString, Discount.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newDiscount; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Discount); + } + + /// + /// Returns true if Discount instances are equal + /// + /// Instance of Discount to be compared + /// Boolean + public bool Equals(Discount input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for Discount + /// + public class DiscountJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(Discount).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return Discount.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Insights/Models/ErrorBase.cs b/algoliasearch/Insights/Models/ErrorBase.cs new file mode 100644 index 000000000..af105ac66 --- /dev/null +++ b/algoliasearch/Insights/Models/ErrorBase.cs @@ -0,0 +1,147 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Error. + /// + [DataContract(Name = "ErrorBase")] + public partial class ErrorBase : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// message. + public ErrorBase(string message = default(string)) : base() + { + this.Message = message; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Message + /// + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ErrorBase {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ErrorBase); + } + + /// + /// Returns true if ErrorBase instances are equal + /// + /// Instance of ErrorBase to be compared + /// Boolean + public bool Equals(ErrorBase input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Models/EventsItems.cs b/algoliasearch/Insights/Models/EventsItems.cs new file mode 100644 index 000000000..ca09940df --- /dev/null +++ b/algoliasearch/Insights/Models/EventsItems.cs @@ -0,0 +1,748 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Insights.Models +{ + /// + /// EventsItems + /// + [JsonConverter(typeof(EventsItemsJsonConverter))] + [DataContract(Name = "EventsItems")] + public partial class EventsItems : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of ClickedObjectIDsAfterSearch. + public EventsItems(ClickedObjectIDsAfterSearch actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of ConvertedObjectIDsAfterSearch. + public EventsItems(ConvertedObjectIDsAfterSearch actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of ClickedObjectIDs. + public EventsItems(ClickedObjectIDs actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of ConvertedObjectIDs. + public EventsItems(ConvertedObjectIDs actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of ClickedFilters. + public EventsItems(ClickedFilters actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of ConvertedFilters. + public EventsItems(ConvertedFilters actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of ViewedObjectIDs. + public EventsItems(ViewedObjectIDs actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of ViewedFilters. + public EventsItems(ViewedFilters actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of AddedToCartObjectIDsAfterSearch. + public EventsItems(AddedToCartObjectIDsAfterSearch actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of AddedToCartObjectIDs. + public EventsItems(AddedToCartObjectIDs actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of PurchasedObjectIDs. + public EventsItems(PurchasedObjectIDs actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of PurchasedObjectIDsAfterSearch. + public EventsItems(PurchasedObjectIDsAfterSearch actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(AddedToCartObjectIDs)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(AddedToCartObjectIDsAfterSearch)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(ClickedFilters)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(ClickedObjectIDs)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(ClickedObjectIDsAfterSearch)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(ConvertedFilters)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(ConvertedObjectIDs)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(ConvertedObjectIDsAfterSearch)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(PurchasedObjectIDs)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(PurchasedObjectIDsAfterSearch)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(ViewedFilters)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(ViewedObjectIDs)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: AddedToCartObjectIDs, AddedToCartObjectIDsAfterSearch, ClickedFilters, ClickedObjectIDs, ClickedObjectIDsAfterSearch, ConvertedFilters, ConvertedObjectIDs, ConvertedObjectIDsAfterSearch, PurchasedObjectIDs, PurchasedObjectIDsAfterSearch, ViewedFilters, ViewedObjectIDs"); + } + } + } + + /// + /// Get the actual instance of `ClickedObjectIDsAfterSearch`. If the actual instance is not `ClickedObjectIDsAfterSearch`, + /// the InvalidClassException will be thrown + /// + /// An instance of ClickedObjectIDsAfterSearch + public ClickedObjectIDsAfterSearch GetterClickedObjectIDsAfterSearch() + { + return (ClickedObjectIDsAfterSearch)this.ActualInstance; + } + + /// + /// Get the actual instance of `ConvertedObjectIDsAfterSearch`. If the actual instance is not `ConvertedObjectIDsAfterSearch`, + /// the InvalidClassException will be thrown + /// + /// An instance of ConvertedObjectIDsAfterSearch + public ConvertedObjectIDsAfterSearch GetterConvertedObjectIDsAfterSearch() + { + return (ConvertedObjectIDsAfterSearch)this.ActualInstance; + } + + /// + /// Get the actual instance of `ClickedObjectIDs`. If the actual instance is not `ClickedObjectIDs`, + /// the InvalidClassException will be thrown + /// + /// An instance of ClickedObjectIDs + public ClickedObjectIDs GetterClickedObjectIDs() + { + return (ClickedObjectIDs)this.ActualInstance; + } + + /// + /// Get the actual instance of `ConvertedObjectIDs`. If the actual instance is not `ConvertedObjectIDs`, + /// the InvalidClassException will be thrown + /// + /// An instance of ConvertedObjectIDs + public ConvertedObjectIDs GetterConvertedObjectIDs() + { + return (ConvertedObjectIDs)this.ActualInstance; + } + + /// + /// Get the actual instance of `ClickedFilters`. If the actual instance is not `ClickedFilters`, + /// the InvalidClassException will be thrown + /// + /// An instance of ClickedFilters + public ClickedFilters GetterClickedFilters() + { + return (ClickedFilters)this.ActualInstance; + } + + /// + /// Get the actual instance of `ConvertedFilters`. If the actual instance is not `ConvertedFilters`, + /// the InvalidClassException will be thrown + /// + /// An instance of ConvertedFilters + public ConvertedFilters GetterConvertedFilters() + { + return (ConvertedFilters)this.ActualInstance; + } + + /// + /// Get the actual instance of `ViewedObjectIDs`. If the actual instance is not `ViewedObjectIDs`, + /// the InvalidClassException will be thrown + /// + /// An instance of ViewedObjectIDs + public ViewedObjectIDs GetterViewedObjectIDs() + { + return (ViewedObjectIDs)this.ActualInstance; + } + + /// + /// Get the actual instance of `ViewedFilters`. If the actual instance is not `ViewedFilters`, + /// the InvalidClassException will be thrown + /// + /// An instance of ViewedFilters + public ViewedFilters GetterViewedFilters() + { + return (ViewedFilters)this.ActualInstance; + } + + /// + /// Get the actual instance of `AddedToCartObjectIDsAfterSearch`. If the actual instance is not `AddedToCartObjectIDsAfterSearch`, + /// the InvalidClassException will be thrown + /// + /// An instance of AddedToCartObjectIDsAfterSearch + public AddedToCartObjectIDsAfterSearch GetterAddedToCartObjectIDsAfterSearch() + { + return (AddedToCartObjectIDsAfterSearch)this.ActualInstance; + } + + /// + /// Get the actual instance of `AddedToCartObjectIDs`. If the actual instance is not `AddedToCartObjectIDs`, + /// the InvalidClassException will be thrown + /// + /// An instance of AddedToCartObjectIDs + public AddedToCartObjectIDs GetterAddedToCartObjectIDs() + { + return (AddedToCartObjectIDs)this.ActualInstance; + } + + /// + /// Get the actual instance of `PurchasedObjectIDs`. If the actual instance is not `PurchasedObjectIDs`, + /// the InvalidClassException will be thrown + /// + /// An instance of PurchasedObjectIDs + public PurchasedObjectIDs GetterPurchasedObjectIDs() + { + return (PurchasedObjectIDs)this.ActualInstance; + } + + /// + /// Get the actual instance of `PurchasedObjectIDsAfterSearch`. If the actual instance is not `PurchasedObjectIDsAfterSearch`, + /// the InvalidClassException will be thrown + /// + /// An instance of PurchasedObjectIDsAfterSearch + public PurchasedObjectIDsAfterSearch GetterPurchasedObjectIDsAfterSearch() + { + return (PurchasedObjectIDsAfterSearch)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class EventsItems {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, EventsItems.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of EventsItems + /// + /// JSON string + /// An instance of EventsItems + public static EventsItems FromJson(string jsonString) + { + EventsItems newEventsItems = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newEventsItems; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(AddedToCartObjectIDs).GetProperty("AdditionalProperties") == null) + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.SerializerSettings)); + } + else + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("AddedToCartObjectIDs"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into AddedToCartObjectIDs: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(AddedToCartObjectIDsAfterSearch).GetProperty("AdditionalProperties") == null) + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.SerializerSettings)); + } + else + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("AddedToCartObjectIDsAfterSearch"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into AddedToCartObjectIDsAfterSearch: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(ClickedFilters).GetProperty("AdditionalProperties") == null) + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.SerializerSettings)); + } + else + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("ClickedFilters"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into ClickedFilters: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(ClickedObjectIDs).GetProperty("AdditionalProperties") == null) + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.SerializerSettings)); + } + else + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("ClickedObjectIDs"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into ClickedObjectIDs: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(ClickedObjectIDsAfterSearch).GetProperty("AdditionalProperties") == null) + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.SerializerSettings)); + } + else + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("ClickedObjectIDsAfterSearch"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into ClickedObjectIDsAfterSearch: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(ConvertedFilters).GetProperty("AdditionalProperties") == null) + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.SerializerSettings)); + } + else + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("ConvertedFilters"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into ConvertedFilters: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(ConvertedObjectIDs).GetProperty("AdditionalProperties") == null) + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.SerializerSettings)); + } + else + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("ConvertedObjectIDs"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into ConvertedObjectIDs: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(ConvertedObjectIDsAfterSearch).GetProperty("AdditionalProperties") == null) + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.SerializerSettings)); + } + else + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("ConvertedObjectIDsAfterSearch"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into ConvertedObjectIDsAfterSearch: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(PurchasedObjectIDs).GetProperty("AdditionalProperties") == null) + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.SerializerSettings)); + } + else + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("PurchasedObjectIDs"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PurchasedObjectIDs: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(PurchasedObjectIDsAfterSearch).GetProperty("AdditionalProperties") == null) + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.SerializerSettings)); + } + else + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("PurchasedObjectIDsAfterSearch"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PurchasedObjectIDsAfterSearch: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(ViewedFilters).GetProperty("AdditionalProperties") == null) + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.SerializerSettings)); + } + else + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("ViewedFilters"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into ViewedFilters: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(ViewedObjectIDs).GetProperty("AdditionalProperties") == null) + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.SerializerSettings)); + } + else + { + newEventsItems = new EventsItems(JsonConvert.DeserializeObject(jsonString, EventsItems.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("ViewedObjectIDs"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into ViewedObjectIDs: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newEventsItems; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as EventsItems); + } + + /// + /// Returns true if EventsItems instances are equal + /// + /// Instance of EventsItems to be compared + /// Boolean + public bool Equals(EventsItems input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for EventsItems + /// + public class EventsItemsJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(EventsItems).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return EventsItems.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Insights/Models/EventsResponse.cs b/algoliasearch/Insights/Models/EventsResponse.cs new file mode 100644 index 000000000..14b1541ae --- /dev/null +++ b/algoliasearch/Insights/Models/EventsResponse.cs @@ -0,0 +1,139 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// The response of the Insights API. + /// + [DataContract(Name = "EventsResponse")] + public partial class EventsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Details about the response, such as error messages.. + /// The HTTP status code of the response.. + public EventsResponse(string message = default(string), int status = default(int)) + { + this.Message = message; + this.Status = status; + } + + /// + /// Details about the response, such as error messages. + /// + /// Details about the response, such as error messages. + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// The HTTP status code of the response. + /// + /// The HTTP status code of the response. + [DataMember(Name = "status", EmitDefaultValue = false)] + public int Status { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EventsResponse {\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as EventsResponse); + } + + /// + /// Returns true if EventsResponse instances are equal + /// + /// Instance of EventsResponse to be compared + /// Boolean + public bool Equals(EventsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) && + ( + this.Status == input.Status || + this.Status.Equals(input.Status) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Status.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Models/InsightsEvents.cs b/algoliasearch/Insights/Models/InsightsEvents.cs new file mode 100644 index 000000000..8abe44b6c --- /dev/null +++ b/algoliasearch/Insights/Models/InsightsEvents.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// InsightsEvents + /// + [DataContract(Name = "InsightsEvents")] + public partial class InsightsEvents : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected InsightsEvents() { } + /// + /// Initializes a new instance of the class. + /// + /// List of click and conversion events. An event is an object representing a user interaction. Events have attributes that describe the interaction, such as an event name, a type, or a user token. Some attributes require other attributes to be declared, and some attributes can't be declared at the same time. **All** events must be valid, otherwise the API returns an error. (required). + public InsightsEvents(List events = default(List)) + { + // to ensure "events" is required (not null) + if (events == null) + { + throw new ArgumentNullException("events is a required property for InsightsEvents and cannot be null"); + } + this.Events = events; + } + + /// + /// List of click and conversion events. An event is an object representing a user interaction. Events have attributes that describe the interaction, such as an event name, a type, or a user token. Some attributes require other attributes to be declared, and some attributes can't be declared at the same time. **All** events must be valid, otherwise the API returns an error. + /// + /// List of click and conversion events. An event is an object representing a user interaction. Events have attributes that describe the interaction, such as an event name, a type, or a user token. Some attributes require other attributes to be declared, and some attributes can't be declared at the same time. **All** events must be valid, otherwise the API returns an error. + [DataMember(Name = "events", IsRequired = true, EmitDefaultValue = true)] + public List Events { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class InsightsEvents {\n"); + sb.Append(" Events: ").Append(Events).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InsightsEvents); + } + + /// + /// Returns true if InsightsEvents instances are equal + /// + /// Instance of InsightsEvents to be compared + /// Boolean + public bool Equals(InsightsEvents input) + { + if (input == null) + { + return false; + } + return + ( + this.Events == input.Events || + this.Events != null && + input.Events != null && + this.Events.SequenceEqual(input.Events) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Events != null) + { + hashCode = (hashCode * 59) + this.Events.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Models/ObjectData.cs b/algoliasearch/Insights/Models/ObjectData.cs new file mode 100644 index 000000000..bdaef6132 --- /dev/null +++ b/algoliasearch/Insights/Models/ObjectData.cs @@ -0,0 +1,156 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// ObjectData + /// + [DataContract(Name = "objectData")] + public partial class ObjectData : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// price. + /// The quantity of the purchased or added-to-cart item. The total value of a purchase is the sum of `quantity` multiplied with the `price` for each purchased item.. + /// discount. + public ObjectData(Price price = default(Price), int quantity = default(int), Discount discount = default(Discount)) + { + this.Price = price; + this.Quantity = quantity; + this.Discount = discount; + } + + /// + /// Gets or Sets Price + /// + [DataMember(Name = "price", EmitDefaultValue = false)] + public Price Price { get; set; } + + /// + /// The quantity of the purchased or added-to-cart item. The total value of a purchase is the sum of `quantity` multiplied with the `price` for each purchased item. + /// + /// The quantity of the purchased or added-to-cart item. The total value of a purchase is the sum of `quantity` multiplied with the `price` for each purchased item. + [DataMember(Name = "quantity", EmitDefaultValue = false)] + public int Quantity { get; set; } + + /// + /// Gets or Sets Discount + /// + [DataMember(Name = "discount", EmitDefaultValue = false)] + public Discount Discount { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ObjectData {\n"); + sb.Append(" Price: ").Append(Price).Append("\n"); + sb.Append(" Quantity: ").Append(Quantity).Append("\n"); + sb.Append(" Discount: ").Append(Discount).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ObjectData); + } + + /// + /// Returns true if ObjectData instances are equal + /// + /// Instance of ObjectData to be compared + /// Boolean + public bool Equals(ObjectData input) + { + if (input == null) + { + return false; + } + return + ( + this.Price == input.Price || + (this.Price != null && + this.Price.Equals(input.Price)) + ) && + ( + this.Quantity == input.Quantity || + this.Quantity.Equals(input.Quantity) + ) && + ( + this.Discount == input.Discount || + (this.Discount != null && + this.Discount.Equals(input.Discount)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Price != null) + { + hashCode = (hashCode * 59) + this.Price.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Quantity.GetHashCode(); + if (this.Discount != null) + { + hashCode = (hashCode * 59) + this.Discount.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Models/ObjectDataAfterSearch.cs b/algoliasearch/Insights/Models/ObjectDataAfterSearch.cs new file mode 100644 index 000000000..792b4a12d --- /dev/null +++ b/algoliasearch/Insights/Models/ObjectDataAfterSearch.cs @@ -0,0 +1,175 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// ObjectDataAfterSearch + /// + [DataContract(Name = "objectDataAfterSearch")] + public partial class ObjectDataAfterSearch : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// ID of the query that this specific record is attributable to. Used to track purchase events with multiple items originating from different searches.. + /// price. + /// The quantity of the purchased or added-to-cart item. The total value of a purchase is the sum of `quantity` multiplied with the `price` for each purchased item.. + /// discount. + public ObjectDataAfterSearch(string queryID = default(string), Price price = default(Price), int quantity = default(int), Discount discount = default(Discount)) + { + this.QueryID = queryID; + this.Price = price; + this.Quantity = quantity; + this.Discount = discount; + } + + /// + /// ID of the query that this specific record is attributable to. Used to track purchase events with multiple items originating from different searches. + /// + /// ID of the query that this specific record is attributable to. Used to track purchase events with multiple items originating from different searches. + [DataMember(Name = "queryID", EmitDefaultValue = false)] + public string QueryID { get; set; } + + /// + /// Gets or Sets Price + /// + [DataMember(Name = "price", EmitDefaultValue = false)] + public Price Price { get; set; } + + /// + /// The quantity of the purchased or added-to-cart item. The total value of a purchase is the sum of `quantity` multiplied with the `price` for each purchased item. + /// + /// The quantity of the purchased or added-to-cart item. The total value of a purchase is the sum of `quantity` multiplied with the `price` for each purchased item. + [DataMember(Name = "quantity", EmitDefaultValue = false)] + public int Quantity { get; set; } + + /// + /// Gets or Sets Discount + /// + [DataMember(Name = "discount", EmitDefaultValue = false)] + public Discount Discount { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ObjectDataAfterSearch {\n"); + sb.Append(" QueryID: ").Append(QueryID).Append("\n"); + sb.Append(" Price: ").Append(Price).Append("\n"); + sb.Append(" Quantity: ").Append(Quantity).Append("\n"); + sb.Append(" Discount: ").Append(Discount).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ObjectDataAfterSearch); + } + + /// + /// Returns true if ObjectDataAfterSearch instances are equal + /// + /// Instance of ObjectDataAfterSearch to be compared + /// Boolean + public bool Equals(ObjectDataAfterSearch input) + { + if (input == null) + { + return false; + } + return + ( + this.QueryID == input.QueryID || + (this.QueryID != null && + this.QueryID.Equals(input.QueryID)) + ) && + ( + this.Price == input.Price || + (this.Price != null && + this.Price.Equals(input.Price)) + ) && + ( + this.Quantity == input.Quantity || + this.Quantity.Equals(input.Quantity) + ) && + ( + this.Discount == input.Discount || + (this.Discount != null && + this.Discount.Equals(input.Discount)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.QueryID != null) + { + hashCode = (hashCode * 59) + this.QueryID.GetHashCode(); + } + if (this.Price != null) + { + hashCode = (hashCode * 59) + this.Price.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Quantity.GetHashCode(); + if (this.Discount != null) + { + hashCode = (hashCode * 59) + this.Discount.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Models/Price.cs b/algoliasearch/Insights/Models/Price.cs new file mode 100644 index 000000000..63d74fca8 --- /dev/null +++ b/algoliasearch/Insights/Models/Price.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Insights.Models +{ + /// + /// The price of the item. This should be the final price, inclusive of any discounts in effect. + /// + [JsonConverter(typeof(PriceJsonConverter))] + [DataContract(Name = "price")] + public partial class Price : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of double. + public Price(double actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public Price(string actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(double)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: double, string"); + } + } + } + + /// + /// Get the actual instance of `double`. If the actual instance is not `double`, + /// the InvalidClassException will be thrown + /// + /// An instance of double + public double GetterDouble() + { + return (double)this.ActualInstance; + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Price {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, Price.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of Price + /// + /// JSON string + /// An instance of Price + public static Price FromJson(string jsonString) + { + Price newPrice = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newPrice; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(double).GetProperty("AdditionalProperties") == null) + { + newPrice = new Price(JsonConvert.DeserializeObject(jsonString, Price.SerializerSettings)); + } + else + { + newPrice = new Price(JsonConvert.DeserializeObject(jsonString, Price.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("double"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into double: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newPrice = new Price(JsonConvert.DeserializeObject(jsonString, Price.SerializerSettings)); + } + else + { + newPrice = new Price(JsonConvert.DeserializeObject(jsonString, Price.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newPrice; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Price); + } + + /// + /// Returns true if Price instances are equal + /// + /// Instance of Price to be compared + /// Boolean + public bool Equals(Price input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for Price + /// + public class PriceJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(Price).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return Price.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Insights/Models/PurchaseEvent.cs b/algoliasearch/Insights/Models/PurchaseEvent.cs new file mode 100644 index 000000000..183ae2c90 --- /dev/null +++ b/algoliasearch/Insights/Models/PurchaseEvent.cs @@ -0,0 +1,36 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Defines PurchaseEvent + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum PurchaseEvent + { + /// + /// Enum Purchase for value: purchase + /// + [EnumMember(Value = "purchase")] + Purchase = 1 + } + +} diff --git a/algoliasearch/Insights/Models/PurchasedObjectIDs.cs b/algoliasearch/Insights/Models/PurchasedObjectIDs.cs new file mode 100644 index 000000000..0534dbc5c --- /dev/null +++ b/algoliasearch/Insights/Models/PurchasedObjectIDs.cs @@ -0,0 +1,352 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Use this event to track when users make a purchase unrelated to a previous Algolia request. For example, if you don't use Algolia to build your category pages, use this event. To track purchase events related to Algolia requests, use the \"Purchased object IDs after search\" event. + /// + [DataContract(Name = "PurchasedObjectIDs")] + public partial class PurchasedObjectIDs : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets EventType + /// + [DataMember(Name = "eventType", IsRequired = true, EmitDefaultValue = true)] + public ConversionEvent EventType { get; set; } + + /// + /// Gets or Sets EventSubtype + /// + [DataMember(Name = "eventSubtype", IsRequired = true, EmitDefaultValue = true)] + public PurchaseEvent EventSubtype { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PurchasedObjectIDs() { } + /// + /// Initializes a new instance of the class. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. (required). + /// eventType (required). + /// eventSubtype (required). + /// Name of the Algolia index. (required). + /// List of object identifiers for items of an Algolia index. (required). + /// Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. . + /// If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR.. + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. (required). + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. . + /// User token for authenticated users.. + public PurchasedObjectIDs(string eventName = default(string), ConversionEvent eventType = default(ConversionEvent), PurchaseEvent eventSubtype = default(PurchaseEvent), string index = default(string), List objectIDs = default(List), List objectData = default(List), string currency = default(string), string userToken = default(string), long timestamp = default(long), string authenticatedUserToken = default(string)) + { + // to ensure "eventName" is required (not null) + if (eventName == null) + { + throw new ArgumentNullException("eventName is a required property for PurchasedObjectIDs and cannot be null"); + } + this.EventName = eventName; + this.EventType = eventType; + this.EventSubtype = eventSubtype; + // to ensure "index" is required (not null) + if (index == null) + { + throw new ArgumentNullException("index is a required property for PurchasedObjectIDs and cannot be null"); + } + this.Index = index; + // to ensure "objectIDs" is required (not null) + if (objectIDs == null) + { + throw new ArgumentNullException("objectIDs is a required property for PurchasedObjectIDs and cannot be null"); + } + this.ObjectIDs = objectIDs; + // to ensure "userToken" is required (not null) + if (userToken == null) + { + throw new ArgumentNullException("userToken is a required property for PurchasedObjectIDs and cannot be null"); + } + this.UserToken = userToken; + this.ObjectData = objectData; + this.Currency = currency; + this.Timestamp = timestamp; + this.AuthenticatedUserToken = authenticatedUserToken; + } + + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + [DataMember(Name = "eventName", IsRequired = true, EmitDefaultValue = true)] + public string EventName { get; set; } + + /// + /// Name of the Algolia index. + /// + /// Name of the Algolia index. + [DataMember(Name = "index", IsRequired = true, EmitDefaultValue = true)] + public string Index { get; set; } + + /// + /// List of object identifiers for items of an Algolia index. + /// + /// List of object identifiers for items of an Algolia index. + [DataMember(Name = "objectIDs", IsRequired = true, EmitDefaultValue = true)] + public List ObjectIDs { get; set; } + + /// + /// Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. + /// + /// Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. + [DataMember(Name = "objectData", EmitDefaultValue = false)] + public List ObjectData { get; set; } + + /// + /// If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. + /// + /// If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. + [DataMember(Name = "currency", EmitDefaultValue = false)] + public string Currency { get; set; } + + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + [DataMember(Name = "userToken", IsRequired = true, EmitDefaultValue = true)] + public string UserToken { get; set; } + + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + [DataMember(Name = "timestamp", EmitDefaultValue = false)] + public long Timestamp { get; set; } + + /// + /// User token for authenticated users. + /// + /// User token for authenticated users. + [DataMember(Name = "authenticatedUserToken", EmitDefaultValue = false)] + public string AuthenticatedUserToken { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PurchasedObjectIDs {\n"); + sb.Append(" EventName: ").Append(EventName).Append("\n"); + sb.Append(" EventType: ").Append(EventType).Append("\n"); + sb.Append(" EventSubtype: ").Append(EventSubtype).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" ObjectIDs: ").Append(ObjectIDs).Append("\n"); + sb.Append(" ObjectData: ").Append(ObjectData).Append("\n"); + sb.Append(" Currency: ").Append(Currency).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" AuthenticatedUserToken: ").Append(AuthenticatedUserToken).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as PurchasedObjectIDs); + } + + /// + /// Returns true if PurchasedObjectIDs instances are equal + /// + /// Instance of PurchasedObjectIDs to be compared + /// Boolean + public bool Equals(PurchasedObjectIDs input) + { + if (input == null) + { + return false; + } + return + ( + this.EventName == input.EventName || + (this.EventName != null && + this.EventName.Equals(input.EventName)) + ) && + ( + this.EventType == input.EventType || + this.EventType.Equals(input.EventType) + ) && + ( + this.EventSubtype == input.EventSubtype || + this.EventSubtype.Equals(input.EventSubtype) + ) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.ObjectIDs == input.ObjectIDs || + this.ObjectIDs != null && + input.ObjectIDs != null && + this.ObjectIDs.SequenceEqual(input.ObjectIDs) + ) && + ( + this.ObjectData == input.ObjectData || + this.ObjectData != null && + input.ObjectData != null && + this.ObjectData.SequenceEqual(input.ObjectData) + ) && + ( + this.Currency == input.Currency || + (this.Currency != null && + this.Currency.Equals(input.Currency)) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.Timestamp == input.Timestamp || + this.Timestamp.Equals(input.Timestamp) + ) && + ( + this.AuthenticatedUserToken == input.AuthenticatedUserToken || + (this.AuthenticatedUserToken != null && + this.AuthenticatedUserToken.Equals(input.AuthenticatedUserToken)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EventName != null) + { + hashCode = (hashCode * 59) + this.EventName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EventType.GetHashCode(); + hashCode = (hashCode * 59) + this.EventSubtype.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.ObjectIDs != null) + { + hashCode = (hashCode * 59) + this.ObjectIDs.GetHashCode(); + } + if (this.ObjectData != null) + { + hashCode = (hashCode * 59) + this.ObjectData.GetHashCode(); + } + if (this.Currency != null) + { + hashCode = (hashCode * 59) + this.Currency.GetHashCode(); + } + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + if (this.AuthenticatedUserToken != null) + { + hashCode = (hashCode * 59) + this.AuthenticatedUserToken.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // EventName (string) maxLength + if (this.EventName != null && this.EventName.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be less than 64.", new[] { "EventName" }); + } + + // EventName (string) minLength + if (this.EventName != null && this.EventName.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be greater than 1.", new[] { "EventName" }); + } + + if (this.EventName != null) + { + // EventName (string) pattern + Regex regexEventName = new Regex(@"[\x20-\x7E]{1,64}", RegexOptions.CultureInvariant); + if (!regexEventName.Match(this.EventName).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, must match a pattern of " + regexEventName, new[] { "EventName" }); + } + } + + // UserToken (string) maxLength + if (this.UserToken != null && this.UserToken.Length > 129) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be less than 129.", new[] { "UserToken" }); + } + + // UserToken (string) minLength + if (this.UserToken != null && this.UserToken.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be greater than 1.", new[] { "UserToken" }); + } + + if (this.UserToken != null) + { + // UserToken (string) pattern + Regex regexUserToken = new Regex(@"[a-zA-Z0-9_=/+-]{1,129}", RegexOptions.CultureInvariant); + if (!regexUserToken.Match(this.UserToken).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, must match a pattern of " + regexUserToken, new[] { "UserToken" }); + } + } + + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Models/PurchasedObjectIDsAfterSearch.cs b/algoliasearch/Insights/Models/PurchasedObjectIDsAfterSearch.cs new file mode 100644 index 000000000..3cbc77cfa --- /dev/null +++ b/algoliasearch/Insights/Models/PurchasedObjectIDsAfterSearch.cs @@ -0,0 +1,398 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Use this event to track when users make a purchase after a previous Algolia request. If you're building your category pages with Algolia, you'll also use this event. + /// + [DataContract(Name = "PurchasedObjectIDsAfterSearch")] + public partial class PurchasedObjectIDsAfterSearch : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets EventType + /// + [DataMember(Name = "eventType", IsRequired = true, EmitDefaultValue = true)] + public ConversionEvent EventType { get; set; } + + /// + /// Gets or Sets EventSubtype + /// + [DataMember(Name = "eventSubtype", IsRequired = true, EmitDefaultValue = true)] + public PurchaseEvent EventSubtype { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PurchasedObjectIDsAfterSearch() { } + /// + /// Initializes a new instance of the class. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. (required). + /// eventType (required). + /// eventSubtype (required). + /// Name of the Algolia index. (required). + /// Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. (required). + /// List of object identifiers for items of an Algolia index. (required). + /// Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. . + /// If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR.. + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. (required). + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. . + /// User token for authenticated users.. + public PurchasedObjectIDsAfterSearch(string eventName = default(string), ConversionEvent eventType = default(ConversionEvent), PurchaseEvent eventSubtype = default(PurchaseEvent), string index = default(string), string queryID = default(string), List objectIDs = default(List), List objectData = default(List), string currency = default(string), string userToken = default(string), long timestamp = default(long), string authenticatedUserToken = default(string)) + { + // to ensure "eventName" is required (not null) + if (eventName == null) + { + throw new ArgumentNullException("eventName is a required property for PurchasedObjectIDsAfterSearch and cannot be null"); + } + this.EventName = eventName; + this.EventType = eventType; + this.EventSubtype = eventSubtype; + // to ensure "index" is required (not null) + if (index == null) + { + throw new ArgumentNullException("index is a required property for PurchasedObjectIDsAfterSearch and cannot be null"); + } + this.Index = index; + // to ensure "queryID" is required (not null) + if (queryID == null) + { + throw new ArgumentNullException("queryID is a required property for PurchasedObjectIDsAfterSearch and cannot be null"); + } + this.QueryID = queryID; + // to ensure "objectIDs" is required (not null) + if (objectIDs == null) + { + throw new ArgumentNullException("objectIDs is a required property for PurchasedObjectIDsAfterSearch and cannot be null"); + } + this.ObjectIDs = objectIDs; + // to ensure "userToken" is required (not null) + if (userToken == null) + { + throw new ArgumentNullException("userToken is a required property for PurchasedObjectIDsAfterSearch and cannot be null"); + } + this.UserToken = userToken; + this.ObjectData = objectData; + this.Currency = currency; + this.Timestamp = timestamp; + this.AuthenticatedUserToken = authenticatedUserToken; + } + + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + [DataMember(Name = "eventName", IsRequired = true, EmitDefaultValue = true)] + public string EventName { get; set; } + + /// + /// Name of the Algolia index. + /// + /// Name of the Algolia index. + [DataMember(Name = "index", IsRequired = true, EmitDefaultValue = true)] + public string Index { get; set; } + + /// + /// Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. + /// + /// Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response. + [DataMember(Name = "queryID", IsRequired = true, EmitDefaultValue = true)] + public string QueryID { get; set; } + + /// + /// List of object identifiers for items of an Algolia index. + /// + /// List of object identifiers for items of an Algolia index. + [DataMember(Name = "objectIDs", IsRequired = true, EmitDefaultValue = true)] + public List ObjectIDs { get; set; } + + /// + /// Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. + /// + /// Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`. + [DataMember(Name = "objectData", EmitDefaultValue = false)] + public List ObjectData { get; set; } + + /// + /// If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. + /// + /// If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR. + [DataMember(Name = "currency", EmitDefaultValue = false)] + public string Currency { get; set; } + + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + [DataMember(Name = "userToken", IsRequired = true, EmitDefaultValue = true)] + public string UserToken { get; set; } + + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + [DataMember(Name = "timestamp", EmitDefaultValue = false)] + public long Timestamp { get; set; } + + /// + /// User token for authenticated users. + /// + /// User token for authenticated users. + [DataMember(Name = "authenticatedUserToken", EmitDefaultValue = false)] + public string AuthenticatedUserToken { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PurchasedObjectIDsAfterSearch {\n"); + sb.Append(" EventName: ").Append(EventName).Append("\n"); + sb.Append(" EventType: ").Append(EventType).Append("\n"); + sb.Append(" EventSubtype: ").Append(EventSubtype).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" QueryID: ").Append(QueryID).Append("\n"); + sb.Append(" ObjectIDs: ").Append(ObjectIDs).Append("\n"); + sb.Append(" ObjectData: ").Append(ObjectData).Append("\n"); + sb.Append(" Currency: ").Append(Currency).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" AuthenticatedUserToken: ").Append(AuthenticatedUserToken).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as PurchasedObjectIDsAfterSearch); + } + + /// + /// Returns true if PurchasedObjectIDsAfterSearch instances are equal + /// + /// Instance of PurchasedObjectIDsAfterSearch to be compared + /// Boolean + public bool Equals(PurchasedObjectIDsAfterSearch input) + { + if (input == null) + { + return false; + } + return + ( + this.EventName == input.EventName || + (this.EventName != null && + this.EventName.Equals(input.EventName)) + ) && + ( + this.EventType == input.EventType || + this.EventType.Equals(input.EventType) + ) && + ( + this.EventSubtype == input.EventSubtype || + this.EventSubtype.Equals(input.EventSubtype) + ) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.QueryID == input.QueryID || + (this.QueryID != null && + this.QueryID.Equals(input.QueryID)) + ) && + ( + this.ObjectIDs == input.ObjectIDs || + this.ObjectIDs != null && + input.ObjectIDs != null && + this.ObjectIDs.SequenceEqual(input.ObjectIDs) + ) && + ( + this.ObjectData == input.ObjectData || + this.ObjectData != null && + input.ObjectData != null && + this.ObjectData.SequenceEqual(input.ObjectData) + ) && + ( + this.Currency == input.Currency || + (this.Currency != null && + this.Currency.Equals(input.Currency)) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.Timestamp == input.Timestamp || + this.Timestamp.Equals(input.Timestamp) + ) && + ( + this.AuthenticatedUserToken == input.AuthenticatedUserToken || + (this.AuthenticatedUserToken != null && + this.AuthenticatedUserToken.Equals(input.AuthenticatedUserToken)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EventName != null) + { + hashCode = (hashCode * 59) + this.EventName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EventType.GetHashCode(); + hashCode = (hashCode * 59) + this.EventSubtype.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.QueryID != null) + { + hashCode = (hashCode * 59) + this.QueryID.GetHashCode(); + } + if (this.ObjectIDs != null) + { + hashCode = (hashCode * 59) + this.ObjectIDs.GetHashCode(); + } + if (this.ObjectData != null) + { + hashCode = (hashCode * 59) + this.ObjectData.GetHashCode(); + } + if (this.Currency != null) + { + hashCode = (hashCode * 59) + this.Currency.GetHashCode(); + } + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + if (this.AuthenticatedUserToken != null) + { + hashCode = (hashCode * 59) + this.AuthenticatedUserToken.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // EventName (string) maxLength + if (this.EventName != null && this.EventName.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be less than 64.", new[] { "EventName" }); + } + + // EventName (string) minLength + if (this.EventName != null && this.EventName.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be greater than 1.", new[] { "EventName" }); + } + + if (this.EventName != null) + { + // EventName (string) pattern + Regex regexEventName = new Regex(@"[\x20-\x7E]{1,64}", RegexOptions.CultureInvariant); + if (!regexEventName.Match(this.EventName).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, must match a pattern of " + regexEventName, new[] { "EventName" }); + } + } + + // QueryID (string) maxLength + if (this.QueryID != null && this.QueryID.Length > 32) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for QueryID, length must be less than 32.", new[] { "QueryID" }); + } + + // QueryID (string) minLength + if (this.QueryID != null && this.QueryID.Length < 32) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for QueryID, length must be greater than 32.", new[] { "QueryID" }); + } + + if (this.QueryID != null) + { + // QueryID (string) pattern + Regex regexQueryID = new Regex(@"[0-9a-f]{32}", RegexOptions.CultureInvariant); + if (!regexQueryID.Match(this.QueryID).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for QueryID, must match a pattern of " + regexQueryID, new[] { "QueryID" }); + } + } + + // UserToken (string) maxLength + if (this.UserToken != null && this.UserToken.Length > 129) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be less than 129.", new[] { "UserToken" }); + } + + // UserToken (string) minLength + if (this.UserToken != null && this.UserToken.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be greater than 1.", new[] { "UserToken" }); + } + + if (this.UserToken != null) + { + // UserToken (string) pattern + Regex regexUserToken = new Regex(@"[a-zA-Z0-9_=/+-]{1,129}", RegexOptions.CultureInvariant); + if (!regexUserToken.Match(this.UserToken).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, must match a pattern of " + regexUserToken, new[] { "UserToken" }); + } + } + + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Models/ViewEvent.cs b/algoliasearch/Insights/Models/ViewEvent.cs new file mode 100644 index 000000000..7babb43d5 --- /dev/null +++ b/algoliasearch/Insights/Models/ViewEvent.cs @@ -0,0 +1,36 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Defines ViewEvent + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ViewEvent + { + /// + /// Enum View for value: view + /// + [EnumMember(Value = "view")] + View = 1 + } + +} diff --git a/algoliasearch/Insights/Models/ViewedFilters.cs b/algoliasearch/Insights/Models/ViewedFilters.cs new file mode 100644 index 000000000..b5d491448 --- /dev/null +++ b/algoliasearch/Insights/Models/ViewedFilters.cs @@ -0,0 +1,299 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Use this method to capture active filters. For example, when browsing a category page, users see content filtered on that specific category. + /// + [DataContract(Name = "ViewedFilters")] + public partial class ViewedFilters : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets EventType + /// + [DataMember(Name = "eventType", IsRequired = true, EmitDefaultValue = true)] + public ViewEvent EventType { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ViewedFilters() { } + /// + /// Initializes a new instance of the class. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. (required). + /// eventType (required). + /// Name of the Algolia index. (required). + /// Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`. (required). + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. (required). + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. . + /// User token for authenticated users.. + public ViewedFilters(string eventName = default(string), ViewEvent eventType = default(ViewEvent), string index = default(string), List filters = default(List), string userToken = default(string), long timestamp = default(long), string authenticatedUserToken = default(string)) + { + // to ensure "eventName" is required (not null) + if (eventName == null) + { + throw new ArgumentNullException("eventName is a required property for ViewedFilters and cannot be null"); + } + this.EventName = eventName; + this.EventType = eventType; + // to ensure "index" is required (not null) + if (index == null) + { + throw new ArgumentNullException("index is a required property for ViewedFilters and cannot be null"); + } + this.Index = index; + // to ensure "filters" is required (not null) + if (filters == null) + { + throw new ArgumentNullException("filters is a required property for ViewedFilters and cannot be null"); + } + this.Filters = filters; + // to ensure "userToken" is required (not null) + if (userToken == null) + { + throw new ArgumentNullException("userToken is a required property for ViewedFilters and cannot be null"); + } + this.UserToken = userToken; + this.Timestamp = timestamp; + this.AuthenticatedUserToken = authenticatedUserToken; + } + + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + [DataMember(Name = "eventName", IsRequired = true, EmitDefaultValue = true)] + public string EventName { get; set; } + + /// + /// Name of the Algolia index. + /// + /// Name of the Algolia index. + [DataMember(Name = "index", IsRequired = true, EmitDefaultValue = true)] + public string Index { get; set; } + + /// + /// Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`. + /// + /// Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`. + [DataMember(Name = "filters", IsRequired = true, EmitDefaultValue = true)] + public List Filters { get; set; } + + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + [DataMember(Name = "userToken", IsRequired = true, EmitDefaultValue = true)] + public string UserToken { get; set; } + + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + [DataMember(Name = "timestamp", EmitDefaultValue = false)] + public long Timestamp { get; set; } + + /// + /// User token for authenticated users. + /// + /// User token for authenticated users. + [DataMember(Name = "authenticatedUserToken", EmitDefaultValue = false)] + public string AuthenticatedUserToken { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ViewedFilters {\n"); + sb.Append(" EventName: ").Append(EventName).Append("\n"); + sb.Append(" EventType: ").Append(EventType).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" AuthenticatedUserToken: ").Append(AuthenticatedUserToken).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ViewedFilters); + } + + /// + /// Returns true if ViewedFilters instances are equal + /// + /// Instance of ViewedFilters to be compared + /// Boolean + public bool Equals(ViewedFilters input) + { + if (input == null) + { + return false; + } + return + ( + this.EventName == input.EventName || + (this.EventName != null && + this.EventName.Equals(input.EventName)) + ) && + ( + this.EventType == input.EventType || + this.EventType.Equals(input.EventType) + ) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.Filters == input.Filters || + this.Filters != null && + input.Filters != null && + this.Filters.SequenceEqual(input.Filters) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.Timestamp == input.Timestamp || + this.Timestamp.Equals(input.Timestamp) + ) && + ( + this.AuthenticatedUserToken == input.AuthenticatedUserToken || + (this.AuthenticatedUserToken != null && + this.AuthenticatedUserToken.Equals(input.AuthenticatedUserToken)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EventName != null) + { + hashCode = (hashCode * 59) + this.EventName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EventType.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + if (this.AuthenticatedUserToken != null) + { + hashCode = (hashCode * 59) + this.AuthenticatedUserToken.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // EventName (string) maxLength + if (this.EventName != null && this.EventName.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be less than 64.", new[] { "EventName" }); + } + + // EventName (string) minLength + if (this.EventName != null && this.EventName.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be greater than 1.", new[] { "EventName" }); + } + + if (this.EventName != null) + { + // EventName (string) pattern + Regex regexEventName = new Regex(@"[\x20-\x7E]{1,64}", RegexOptions.CultureInvariant); + if (!regexEventName.Match(this.EventName).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, must match a pattern of " + regexEventName, new[] { "EventName" }); + } + } + + // UserToken (string) maxLength + if (this.UserToken != null && this.UserToken.Length > 129) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be less than 129.", new[] { "UserToken" }); + } + + // UserToken (string) minLength + if (this.UserToken != null && this.UserToken.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be greater than 1.", new[] { "UserToken" }); + } + + if (this.UserToken != null) + { + // UserToken (string) pattern + Regex regexUserToken = new Regex(@"[a-zA-Z0-9_=/+-]{1,129}", RegexOptions.CultureInvariant); + if (!regexUserToken.Match(this.UserToken).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, must match a pattern of " + regexUserToken, new[] { "UserToken" }); + } + } + + yield break; + } + } + +} diff --git a/algoliasearch/Insights/Models/ViewedObjectIDs.cs b/algoliasearch/Insights/Models/ViewedObjectIDs.cs new file mode 100644 index 000000000..57f973ed4 --- /dev/null +++ b/algoliasearch/Insights/Models/ViewedObjectIDs.cs @@ -0,0 +1,299 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Insights.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Insights.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Insights.Models +{ + /// + /// Use this event to track when users viewed items in the search results. + /// + [DataContract(Name = "ViewedObjectIDs")] + public partial class ViewedObjectIDs : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets EventType + /// + [DataMember(Name = "eventType", IsRequired = true, EmitDefaultValue = true)] + public ViewEvent EventType { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ViewedObjectIDs() { } + /// + /// Initializes a new instance of the class. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. (required). + /// eventType (required). + /// Name of the Algolia index. (required). + /// List of object identifiers for items of an Algolia index. (required). + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. (required). + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. . + /// User token for authenticated users.. + public ViewedObjectIDs(string eventName = default(string), ViewEvent eventType = default(ViewEvent), string index = default(string), List objectIDs = default(List), string userToken = default(string), long timestamp = default(long), string authenticatedUserToken = default(string)) + { + // to ensure "eventName" is required (not null) + if (eventName == null) + { + throw new ArgumentNullException("eventName is a required property for ViewedObjectIDs and cannot be null"); + } + this.EventName = eventName; + this.EventType = eventType; + // to ensure "index" is required (not null) + if (index == null) + { + throw new ArgumentNullException("index is a required property for ViewedObjectIDs and cannot be null"); + } + this.Index = index; + // to ensure "objectIDs" is required (not null) + if (objectIDs == null) + { + throw new ArgumentNullException("objectIDs is a required property for ViewedObjectIDs and cannot be null"); + } + this.ObjectIDs = objectIDs; + // to ensure "userToken" is required (not null) + if (userToken == null) + { + throw new ArgumentNullException("userToken is a required property for ViewedObjectIDs and cannot be null"); + } + this.UserToken = userToken; + this.Timestamp = timestamp; + this.AuthenticatedUserToken = authenticatedUserToken; + } + + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + /// + /// Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework. + [DataMember(Name = "eventName", IsRequired = true, EmitDefaultValue = true)] + public string EventName { get; set; } + + /// + /// Name of the Algolia index. + /// + /// Name of the Algolia index. + [DataMember(Name = "index", IsRequired = true, EmitDefaultValue = true)] + public string Index { get; set; } + + /// + /// List of object identifiers for items of an Algolia index. + /// + /// List of object identifiers for items of an Algolia index. + [DataMember(Name = "objectIDs", IsRequired = true, EmitDefaultValue = true)] + public List ObjectIDs { get; set; } + + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + /// + /// Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens. + [DataMember(Name = "userToken", IsRequired = true, EmitDefaultValue = true)] + public string UserToken { get; set; } + + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + /// + /// Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp. + [DataMember(Name = "timestamp", EmitDefaultValue = false)] + public long Timestamp { get; set; } + + /// + /// User token for authenticated users. + /// + /// User token for authenticated users. + [DataMember(Name = "authenticatedUserToken", EmitDefaultValue = false)] + public string AuthenticatedUserToken { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ViewedObjectIDs {\n"); + sb.Append(" EventName: ").Append(EventName).Append("\n"); + sb.Append(" EventType: ").Append(EventType).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" ObjectIDs: ").Append(ObjectIDs).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" AuthenticatedUserToken: ").Append(AuthenticatedUserToken).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ViewedObjectIDs); + } + + /// + /// Returns true if ViewedObjectIDs instances are equal + /// + /// Instance of ViewedObjectIDs to be compared + /// Boolean + public bool Equals(ViewedObjectIDs input) + { + if (input == null) + { + return false; + } + return + ( + this.EventName == input.EventName || + (this.EventName != null && + this.EventName.Equals(input.EventName)) + ) && + ( + this.EventType == input.EventType || + this.EventType.Equals(input.EventType) + ) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.ObjectIDs == input.ObjectIDs || + this.ObjectIDs != null && + input.ObjectIDs != null && + this.ObjectIDs.SequenceEqual(input.ObjectIDs) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.Timestamp == input.Timestamp || + this.Timestamp.Equals(input.Timestamp) + ) && + ( + this.AuthenticatedUserToken == input.AuthenticatedUserToken || + (this.AuthenticatedUserToken != null && + this.AuthenticatedUserToken.Equals(input.AuthenticatedUserToken)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EventName != null) + { + hashCode = (hashCode * 59) + this.EventName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EventType.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.ObjectIDs != null) + { + hashCode = (hashCode * 59) + this.ObjectIDs.GetHashCode(); + } + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + if (this.AuthenticatedUserToken != null) + { + hashCode = (hashCode * 59) + this.AuthenticatedUserToken.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // EventName (string) maxLength + if (this.EventName != null && this.EventName.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be less than 64.", new[] { "EventName" }); + } + + // EventName (string) minLength + if (this.EventName != null && this.EventName.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, length must be greater than 1.", new[] { "EventName" }); + } + + if (this.EventName != null) + { + // EventName (string) pattern + Regex regexEventName = new Regex(@"[\x20-\x7E]{1,64}", RegexOptions.CultureInvariant); + if (!regexEventName.Match(this.EventName).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for EventName, must match a pattern of " + regexEventName, new[] { "EventName" }); + } + } + + // UserToken (string) maxLength + if (this.UserToken != null && this.UserToken.Length > 129) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be less than 129.", new[] { "UserToken" }); + } + + // UserToken (string) minLength + if (this.UserToken != null && this.UserToken.Length < 1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, length must be greater than 1.", new[] { "UserToken" }); + } + + if (this.UserToken != null) + { + // UserToken (string) pattern + Regex regexUserToken = new Regex(@"[a-zA-Z0-9_=/+-]{1,129}", RegexOptions.CultureInvariant); + if (!regexUserToken.Match(this.UserToken).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserToken, must match a pattern of " + regexUserToken, new[] { "UserToken" }); + } + } + + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Api/MonitoringClient.cs b/algoliasearch/Monitoring/Api/MonitoringClient.cs new file mode 100644 index 000000000..5c8825572 --- /dev/null +++ b/algoliasearch/Monitoring/Api/MonitoringClient.cs @@ -0,0 +1,2123 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Mime; +using Algolia.Search.Monitoring.Client; +using Algolia.Search.Monitoring.Models; + +namespace Algolia.Search.Monitoring.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IMonitoringClient + { + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// List incidents for selected clusters. + /// + /// + /// List known incidents for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of IncidentsResponse + System.Threading.Tasks.Task GetClusterIncidentsAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List incidents for selected clusters. + /// + /// + /// List known incidents for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (IncidentsResponse) + System.Threading.Tasks.Task> GetClusterIncidentsWithHttpInfoAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// List statuses of selected clusters. + /// + /// + /// Report whether a cluster is operational. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of StatusResponse + System.Threading.Tasks.Task GetClusterStatusAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List statuses of selected clusters. + /// + /// + /// Report whether a cluster is operational. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (StatusResponse) + System.Threading.Tasks.Task> GetClusterStatusWithHttpInfoAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// List incidents. + /// + /// + /// List known incidents for all clusters. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of IncidentsResponse + System.Threading.Tasks.Task GetIncidentsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List incidents. + /// + /// + /// List known incidents for all clusters. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (IncidentsResponse) + System.Threading.Tasks.Task> GetIncidentsWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get indexing times. + /// + /// + /// List the average times for indexing operations for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of IndexingTimeResponse + System.Threading.Tasks.Task GetIndexingTimeAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get indexing times. + /// + /// + /// List the average times for indexing operations for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (IndexingTimeResponse) + System.Threading.Tasks.Task> GetIndexingTimeWithHttpInfoAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// List servers. + /// + /// + /// List the servers belonging to clusters. The response depends on whether you authenticate your API request: - With authentication, the response lists the servers assigned to your Algolia application's cluster. - Without authentication, the response lists the servers for all Algolia clusters. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of InventoryResponse + System.Threading.Tasks.Task GetInventoryAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List servers. + /// + /// + /// List the servers belonging to clusters. The response depends on whether you authenticate your API request: - With authentication, the response lists the servers assigned to your Algolia application's cluster. - Without authentication, the response lists the servers for all Algolia clusters. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (InventoryResponse) + System.Threading.Tasks.Task> GetInventoryWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get search latency times. + /// + /// + /// List the average latency for search requests for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of LatencyResponse + System.Threading.Tasks.Task GetLatencyAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get search latency times. + /// + /// + /// List the average latency for search requests for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (LatencyResponse) + System.Threading.Tasks.Task> GetLatencyWithHttpInfoAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get metrics for a given period. + /// + /// + /// Report the aggregate value of a metric for a selected period of time. + /// + /// Thrown when fails to make API call + /// Metric to report. For more information about the individual metrics, see the response. To include all metrics, use `*` as the parameter. + /// Period over which to aggregate the metrics: - `minute`. Aggregate the last minute. 1 data point per 10 seconds. - `hour`. Aggregate the last hour. 1 data point per minute. - `day`. Aggregate the last day. 1 data point per 10 minutes. - `week`. Aggregate the last week. 1 data point per hour. - `month`. Aggregate the last month. 1 data point per day. + /// Cancellation Token to cancel the request. + /// Task of InfrastructureResponse + System.Threading.Tasks.Task GetMetricsAsync(Metric metric, Period period, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get metrics for a given period. + /// + /// + /// Report the aggregate value of a metric for a selected period of time. + /// + /// Thrown when fails to make API call + /// Metric to report. For more information about the individual metrics, see the response. To include all metrics, use `*` as the parameter. + /// Period over which to aggregate the metrics: - `minute`. Aggregate the last minute. 1 data point per 10 seconds. - `hour`. Aggregate the last hour. 1 data point per minute. - `day`. Aggregate the last day. 1 data point per 10 minutes. - `week`. Aggregate the last week. 1 data point per hour. - `month`. Aggregate the last month. 1 data point per day. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (InfrastructureResponse) + System.Threading.Tasks.Task> GetMetricsWithHttpInfoAsync(Metric metric, Period period, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Test the reachability of clusters. + /// + /// + /// Test whether clusters are reachable or not. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of Dictionary<string, Dictionary<string, bool>> + System.Threading.Tasks.Task>> GetReachabilityAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Test the reachability of clusters. + /// + /// + /// Test whether clusters are reachable or not. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Dictionary<string, Dictionary<string, bool>>) + System.Threading.Tasks.Task>>> GetReachabilityWithHttpInfoAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// List cluster statuses. + /// + /// + /// Report whether clusters are operational. The response depends on whether you authenticate your API request. - With authentication, the response includes the status of the cluster assigned to your Algolia application. - Without authentication, the response lists the statuses of all public Algolia clusters. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of StatusResponse + System.Threading.Tasks.Task GetStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List cluster statuses. + /// + /// + /// Report whether clusters are operational. The response depends on whether you authenticate your API request. - With authentication, the response includes the status of the cluster assigned to your Algolia application. - Without authentication, the response lists the statuses of all public Algolia clusters. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (StatusResponse) + System.Threading.Tasks.Task> GetStatusWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } + + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class MonitoringClient : IDisposable, IMonitoringClient + { + private Algolia.Search.Monitoring.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// + public MonitoringClient() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + /// + public MonitoringClient(string basePath) + { + this.Configuration = Algolia.Search.Monitoring.Client.Configuration.MergeConfigurations( + Algolia.Search.Monitoring.Client.GlobalConfiguration.Instance, + new Algolia.Search.Monitoring.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.Monitoring.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.Monitoring.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// An instance of Configuration. + /// + /// + public MonitoringClient(Algolia.Search.Monitoring.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Algolia.Search.Monitoring.Client.Configuration.MergeConfigurations( + Algolia.Search.Monitoring.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.Monitoring.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.Monitoring.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public MonitoringClient(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public MonitoringClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.Monitoring.Client.Configuration.MergeConfigurations( + Algolia.Search.Monitoring.Client.GlobalConfiguration.Instance, + new Algolia.Search.Monitoring.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.Monitoring.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.Monitoring.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// + /// An instance of HttpClient. + /// An instance of Configuration. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public MonitoringClient(HttpClient client, Algolia.Search.Monitoring.Client.Configuration configuration, HttpClientHandler handler = null) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.Monitoring.Client.Configuration.MergeConfigurations( + Algolia.Search.Monitoring.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.Monitoring.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.Monitoring.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + /// + public MonitoringClient(Algolia.Search.Monitoring.Client.ISynchronousClient client, Algolia.Search.Monitoring.Client.IAsynchronousClient asyncClient, Algolia.Search.Monitoring.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Algolia.Search.Monitoring.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + this.ApiClient?.Dispose(); + } + + /// + /// Holds the ApiClient if created + /// + public Algolia.Search.Monitoring.Client.ApiClient ApiClient { get; set; } = null; + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Algolia.Search.Monitoring.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Algolia.Search.Monitoring.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Algolia.Search.Monitoring.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Algolia.Search.Monitoring.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Del(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = DelWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.Monitoring.Client.ApiResponse DelWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'path' when calling MonitoringClient->Del"); + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Monitoring.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = await DelWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'path' when calling MonitoringClient->Del"); + + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Monitoring.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Get(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = GetWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.Monitoring.Client.ApiResponse GetWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'path' when calling MonitoringClient->Get"); + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Monitoring.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = await GetWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'path' when calling MonitoringClient->Get"); + + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Monitoring.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List incidents for selected clusters. List known incidents for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// IncidentsResponse + public IncidentsResponse GetClusterIncidents(string clusters) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = GetClusterIncidentsWithHttpInfo(clusters); + return localVarResponse.Data; + } + + /// + /// List incidents for selected clusters. List known incidents for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// ApiResponse of IncidentsResponse + public Algolia.Search.Monitoring.Client.ApiResponse GetClusterIncidentsWithHttpInfo(string clusters) + { + // verify the required parameter 'clusters' is set + if (clusters == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'clusters' when calling MonitoringClient->GetClusterIncidents"); + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json", + "text/plain" + }; + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("clusters", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(clusters)); // path parameter + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/incidents/{clusters}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetClusterIncidents", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List incidents for selected clusters. List known incidents for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of IncidentsResponse + public async System.Threading.Tasks.Task GetClusterIncidentsAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = await GetClusterIncidentsWithHttpInfoAsync(clusters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// List incidents for selected clusters. List known incidents for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (IncidentsResponse) + public async System.Threading.Tasks.Task> GetClusterIncidentsWithHttpInfoAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'clusters' is set + if (clusters == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'clusters' when calling MonitoringClient->GetClusterIncidents"); + + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json", + "text/plain" + }; + + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("clusters", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(clusters)); // path parameter + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/incidents/{clusters}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetClusterIncidents", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List statuses of selected clusters. Report whether a cluster is operational. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// StatusResponse + public StatusResponse GetClusterStatus(string clusters) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = GetClusterStatusWithHttpInfo(clusters); + return localVarResponse.Data; + } + + /// + /// List statuses of selected clusters. Report whether a cluster is operational. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// ApiResponse of StatusResponse + public Algolia.Search.Monitoring.Client.ApiResponse GetClusterStatusWithHttpInfo(string clusters) + { + // verify the required parameter 'clusters' is set + if (clusters == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'clusters' when calling MonitoringClient->GetClusterStatus"); + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json", + "text/plain" + }; + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("clusters", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(clusters)); // path parameter + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/status/{clusters}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetClusterStatus", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List statuses of selected clusters. Report whether a cluster is operational. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of StatusResponse + public async System.Threading.Tasks.Task GetClusterStatusAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = await GetClusterStatusWithHttpInfoAsync(clusters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// List statuses of selected clusters. Report whether a cluster is operational. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (StatusResponse) + public async System.Threading.Tasks.Task> GetClusterStatusWithHttpInfoAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'clusters' is set + if (clusters == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'clusters' when calling MonitoringClient->GetClusterStatus"); + + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json", + "text/plain" + }; + + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("clusters", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(clusters)); // path parameter + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/status/{clusters}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetClusterStatus", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List incidents. List known incidents for all clusters. + /// + /// Thrown when fails to make API call + /// IncidentsResponse + public IncidentsResponse GetIncidents() + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = GetIncidentsWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// List incidents. List known incidents for all clusters. + /// + /// Thrown when fails to make API call + /// ApiResponse of IncidentsResponse + public Algolia.Search.Monitoring.Client.ApiResponse GetIncidentsWithHttpInfo() + { + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json", + "text/plain" + }; + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/incidents", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetIncidents", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List incidents. List known incidents for all clusters. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of IncidentsResponse + public async System.Threading.Tasks.Task GetIncidentsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = await GetIncidentsWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// List incidents. List known incidents for all clusters. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (IncidentsResponse) + public async System.Threading.Tasks.Task> GetIncidentsWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json", + "text/plain" + }; + + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/incidents", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetIncidents", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get indexing times. List the average times for indexing operations for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// IndexingTimeResponse + public IndexingTimeResponse GetIndexingTime(string clusters) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = GetIndexingTimeWithHttpInfo(clusters); + return localVarResponse.Data; + } + + /// + /// Get indexing times. List the average times for indexing operations for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// ApiResponse of IndexingTimeResponse + public Algolia.Search.Monitoring.Client.ApiResponse GetIndexingTimeWithHttpInfo(string clusters) + { + // verify the required parameter 'clusters' is set + if (clusters == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'clusters' when calling MonitoringClient->GetIndexingTime"); + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("clusters", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(clusters)); // path parameter + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/indexing/{clusters}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetIndexingTime", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get indexing times. List the average times for indexing operations for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of IndexingTimeResponse + public async System.Threading.Tasks.Task GetIndexingTimeAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = await GetIndexingTimeWithHttpInfoAsync(clusters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get indexing times. List the average times for indexing operations for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (IndexingTimeResponse) + public async System.Threading.Tasks.Task> GetIndexingTimeWithHttpInfoAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'clusters' is set + if (clusters == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'clusters' when calling MonitoringClient->GetIndexingTime"); + + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("clusters", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(clusters)); // path parameter + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/indexing/{clusters}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetIndexingTime", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List servers. List the servers belonging to clusters. The response depends on whether you authenticate your API request: - With authentication, the response lists the servers assigned to your Algolia application's cluster. - Without authentication, the response lists the servers for all Algolia clusters. + /// + /// Thrown when fails to make API call + /// InventoryResponse + public InventoryResponse GetInventory() + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = GetInventoryWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// List servers. List the servers belonging to clusters. The response depends on whether you authenticate your API request: - With authentication, the response lists the servers assigned to your Algolia application's cluster. - Without authentication, the response lists the servers for all Algolia clusters. + /// + /// Thrown when fails to make API call + /// ApiResponse of InventoryResponse + public Algolia.Search.Monitoring.Client.ApiResponse GetInventoryWithHttpInfo() + { + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/inventory/servers", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetInventory", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List servers. List the servers belonging to clusters. The response depends on whether you authenticate your API request: - With authentication, the response lists the servers assigned to your Algolia application's cluster. - Without authentication, the response lists the servers for all Algolia clusters. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of InventoryResponse + public async System.Threading.Tasks.Task GetInventoryAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = await GetInventoryWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// List servers. List the servers belonging to clusters. The response depends on whether you authenticate your API request: - With authentication, the response lists the servers assigned to your Algolia application's cluster. - Without authentication, the response lists the servers for all Algolia clusters. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (InventoryResponse) + public async System.Threading.Tasks.Task> GetInventoryWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/inventory/servers", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetInventory", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get search latency times. List the average latency for search requests for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// LatencyResponse + public LatencyResponse GetLatency(string clusters) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = GetLatencyWithHttpInfo(clusters); + return localVarResponse.Data; + } + + /// + /// Get search latency times. List the average latency for search requests for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// ApiResponse of LatencyResponse + public Algolia.Search.Monitoring.Client.ApiResponse GetLatencyWithHttpInfo(string clusters) + { + // verify the required parameter 'clusters' is set + if (clusters == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'clusters' when calling MonitoringClient->GetLatency"); + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("clusters", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(clusters)); // path parameter + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/latency/{clusters}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetLatency", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get search latency times. List the average latency for search requests for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of LatencyResponse + public async System.Threading.Tasks.Task GetLatencyAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = await GetLatencyWithHttpInfoAsync(clusters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get search latency times. List the average latency for search requests for selected clusters. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (LatencyResponse) + public async System.Threading.Tasks.Task> GetLatencyWithHttpInfoAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'clusters' is set + if (clusters == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'clusters' when calling MonitoringClient->GetLatency"); + + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("clusters", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(clusters)); // path parameter + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/latency/{clusters}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetLatency", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get metrics for a given period. Report the aggregate value of a metric for a selected period of time. + /// + /// Thrown when fails to make API call + /// Metric to report. For more information about the individual metrics, see the response. To include all metrics, use `*` as the parameter. + /// Period over which to aggregate the metrics: - `minute`. Aggregate the last minute. 1 data point per 10 seconds. - `hour`. Aggregate the last hour. 1 data point per minute. - `day`. Aggregate the last day. 1 data point per 10 minutes. - `week`. Aggregate the last week. 1 data point per hour. - `month`. Aggregate the last month. 1 data point per day. + /// InfrastructureResponse + public InfrastructureResponse GetMetrics(Metric metric, Period period) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = GetMetricsWithHttpInfo(metric, period); + return localVarResponse.Data; + } + + /// + /// Get metrics for a given period. Report the aggregate value of a metric for a selected period of time. + /// + /// Thrown when fails to make API call + /// Metric to report. For more information about the individual metrics, see the response. To include all metrics, use `*` as the parameter. + /// Period over which to aggregate the metrics: - `minute`. Aggregate the last minute. 1 data point per 10 seconds. - `hour`. Aggregate the last hour. 1 data point per minute. - `day`. Aggregate the last day. 1 data point per 10 minutes. - `week`. Aggregate the last week. 1 data point per hour. - `month`. Aggregate the last month. 1 data point per day. + /// ApiResponse of InfrastructureResponse + public Algolia.Search.Monitoring.Client.ApiResponse GetMetricsWithHttpInfo(Metric metric, Period period) + { + // verify the required parameter 'metric' is set + if (metric == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'metric' when calling MonitoringClient->GetMetrics"); + + // verify the required parameter 'period' is set + if (period == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'period' when calling MonitoringClient->GetMetrics"); + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("metric", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(metric)); // path parameter + localVarRequestOptions.PathParameters.Add("period", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(period)); // path parameter + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/infrastructure/{metric}/period/{period}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetMetrics", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get metrics for a given period. Report the aggregate value of a metric for a selected period of time. + /// + /// Thrown when fails to make API call + /// Metric to report. For more information about the individual metrics, see the response. To include all metrics, use `*` as the parameter. + /// Period over which to aggregate the metrics: - `minute`. Aggregate the last minute. 1 data point per 10 seconds. - `hour`. Aggregate the last hour. 1 data point per minute. - `day`. Aggregate the last day. 1 data point per 10 minutes. - `week`. Aggregate the last week. 1 data point per hour. - `month`. Aggregate the last month. 1 data point per day. + /// Cancellation Token to cancel the request. + /// Task of InfrastructureResponse + public async System.Threading.Tasks.Task GetMetricsAsync(Metric metric, Period period, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = await GetMetricsWithHttpInfoAsync(metric, period, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get metrics for a given period. Report the aggregate value of a metric for a selected period of time. + /// + /// Thrown when fails to make API call + /// Metric to report. For more information about the individual metrics, see the response. To include all metrics, use `*` as the parameter. + /// Period over which to aggregate the metrics: - `minute`. Aggregate the last minute. 1 data point per 10 seconds. - `hour`. Aggregate the last hour. 1 data point per minute. - `day`. Aggregate the last day. 1 data point per 10 minutes. - `week`. Aggregate the last week. 1 data point per hour. - `month`. Aggregate the last month. 1 data point per day. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (InfrastructureResponse) + public async System.Threading.Tasks.Task> GetMetricsWithHttpInfoAsync(Metric metric, Period period, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'metric' is set + if (metric == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'metric' when calling MonitoringClient->GetMetrics"); + + // verify the required parameter 'period' is set + if (period == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'period' when calling MonitoringClient->GetMetrics"); + + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("metric", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(metric)); // path parameter + localVarRequestOptions.PathParameters.Add("period", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(period)); // path parameter + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/infrastructure/{metric}/period/{period}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetMetrics", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Test the reachability of clusters. Test whether clusters are reachable or not. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Dictionary<string, Dictionary<string, bool>> + public Dictionary> GetReachability(string clusters) + { + Algolia.Search.Monitoring.Client.ApiResponse>> localVarResponse = GetReachabilityWithHttpInfo(clusters); + return localVarResponse.Data; + } + + /// + /// Test the reachability of clusters. Test whether clusters are reachable or not. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// ApiResponse of Dictionary<string, Dictionary<string, bool>> + public Algolia.Search.Monitoring.Client.ApiResponse>> GetReachabilityWithHttpInfo(string clusters) + { + // verify the required parameter 'clusters' is set + if (clusters == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'clusters' when calling MonitoringClient->GetReachability"); + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("clusters", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(clusters)); // path parameter + + + // make the HTTP request + var localVarResponse = this.Client.Get>>("/1/reachability/{clusters}/probes", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetReachability", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Test the reachability of clusters. Test whether clusters are reachable or not. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of Dictionary<string, Dictionary<string, bool>> + public async System.Threading.Tasks.Task>> GetReachabilityAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Monitoring.Client.ApiResponse>> localVarResponse = await GetReachabilityWithHttpInfoAsync(clusters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Test the reachability of clusters. Test whether clusters are reachable or not. + /// + /// Thrown when fails to make API call + /// Subset of clusters, separated by comma. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Dictionary<string, Dictionary<string, bool>>) + public async System.Threading.Tasks.Task>>> GetReachabilityWithHttpInfoAsync(string clusters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'clusters' is set + if (clusters == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'clusters' when calling MonitoringClient->GetReachability"); + + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("clusters", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(clusters)); // path parameter + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync>>("/1/reachability/{clusters}/probes", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetReachability", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List cluster statuses. Report whether clusters are operational. The response depends on whether you authenticate your API request. - With authentication, the response includes the status of the cluster assigned to your Algolia application. - Without authentication, the response lists the statuses of all public Algolia clusters. + /// + /// Thrown when fails to make API call + /// StatusResponse + public StatusResponse GetStatus() + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = GetStatusWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// List cluster statuses. Report whether clusters are operational. The response depends on whether you authenticate your API request. - With authentication, the response includes the status of the cluster assigned to your Algolia application. - Without authentication, the response lists the statuses of all public Algolia clusters. + /// + /// Thrown when fails to make API call + /// ApiResponse of StatusResponse + public Algolia.Search.Monitoring.Client.ApiResponse GetStatusWithHttpInfo() + { + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json", + "text/plain" + }; + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/status", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetStatus", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List cluster statuses. Report whether clusters are operational. The response depends on whether you authenticate your API request. - With authentication, the response includes the status of the cluster assigned to your Algolia application. - Without authentication, the response lists the statuses of all public Algolia clusters. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of StatusResponse + public async System.Threading.Tasks.Task GetStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = await GetStatusWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// List cluster statuses. Report whether clusters are operational. The response depends on whether you authenticate your API request. - With authentication, the response includes the status of the cluster assigned to your Algolia application. - Without authentication, the response lists the statuses of all public Algolia clusters. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (StatusResponse) + public async System.Threading.Tasks.Task> GetStatusWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json", + "text/plain" + }; + + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/status", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetStatus", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Post(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = PostWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.Monitoring.Client.ApiResponse PostWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'path' when calling MonitoringClient->Post"); + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Monitoring.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = await PostWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'path' when calling MonitoringClient->Post"); + + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Monitoring.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Put(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = PutWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.Monitoring.Client.ApiResponse PutWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'path' when calling MonitoringClient->Put"); + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Monitoring.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Monitoring.Client.ApiResponse localVarResponse = await PutWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Monitoring.Client.ApiException(400, "Missing required parameter 'path' when calling MonitoringClient->Put"); + + + Algolia.Search.Monitoring.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Monitoring.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Monitoring.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Monitoring.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Monitoring.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + } +} diff --git a/algoliasearch/Monitoring/Client/ApiClient.cs b/algoliasearch/Monitoring/Client/ApiClient.cs new file mode 100644 index 000000000..8e6544687 --- /dev/null +++ b/algoliasearch/Monitoring/Client/ApiClient.cs @@ -0,0 +1,736 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs; +using System.Net.Http; +using System.Net.Http.Headers; + +namespace Algolia.Search.Monitoring.Client +{ + /// + /// To Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec + { + private readonly IReadableConfiguration _configuration; + private static readonly string _contentType = "application/json"; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is Algolia.Search.Monitoring.Models.AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((Algolia.Search.Monitoring.Models.AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public async Task Deserialize(HttpResponseMessage response) + { + var result = (T)await Deserialize(response, typeof(T)).ConfigureAwait(false); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal async Task Deserialize(HttpResponseMessage response, Type type) + { + IList headers = response.Headers.Select(x => x.Key + "=" + x.Value).ToList(); + + if (type == typeof(byte[])) // return byte array + { + return await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + } + else if (type == typeof(FileParameter)) + { + return new FileParameter(await response.Content.ReadAsStreamAsync().ConfigureAwait(false)); + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + if (headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + File.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(await response.Content.ReadAsStringAsync().ConfigureAwait(false), null, System.Globalization.DateTimeStyles.RoundtripKind); + } + + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public string RootElement { get; set; } + public string Namespace { get; set; } + public string DateFormat { get; set; } + + public string ContentType + { + get { return _contentType; } + set { throw new InvalidOperationException("Not allowed to set content type."); } + } + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + /// + /// The Dispose method will manage the HttpClient lifecycle when not passed by constructor. + /// + public partial class ApiClient : IDisposable, ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + + private readonly HttpClientHandler _httpClientHandler; + private readonly HttpClient _httpClient; + private readonly bool _disposeClient; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + public ApiClient() : + this(Algolia.Search.Monitoring.Client.GlobalConfiguration.Instance.BasePath) + { + } + + /// + /// Initializes a new instance of the . + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = new HttpClientHandler(); + _httpClient = new HttpClient(_httpClientHandler, true); + _disposeClient = true; + _baseUrl = basePath; + } + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, HttpClientHandler handler = null) : + this(client, Algolia.Search.Monitoring.Client.GlobalConfiguration.Instance.BasePath, handler) + { + } + + /// + /// Initializes a new instance of the . + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client cannot be null"); + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = handler; + _httpClient = client; + _baseUrl = basePath; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + if (_disposeClient) + { + _httpClient.Dispose(); + } + } + + /// Prepares multipart/form-data content + HttpContent PrepareMultipartFormDataContent(RequestOptions options) + { + string boundary = "---------" + Guid.NewGuid().ToString().ToUpperInvariant(); + var multipartContent = new MultipartFormDataContent(boundary); + foreach (var formParameter in options.FormParameters) + { + multipartContent.Add(new StringContent(formParameter.Value), formParameter.Key); + } + + if (options.FileParameters != null && options.FileParameters.Count > 0) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var content = new StreamContent(file.Content); + content.Headers.ContentType = new MediaTypeHeaderValue(file.ContentType); + multipartContent.Add(content, fileParam.Key, file.Name); + } + } + } + return multipartContent; + } + + /// + /// Provides all logic for constructing a new HttpRequestMessage. + /// At this point, all information for querying the service is known. Here, it is simply + /// mapped into the a HttpRequestMessage. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// [private] A new HttpRequestMessage instance. + /// + private HttpRequestMessage NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + WebRequestPathBuilder builder = new WebRequestPathBuilder(_baseUrl, path); + + builder.AddPathParameters(options.PathParameters); + + builder.AddQueryParameters(options.QueryParameters); + + HttpRequestMessage request = new HttpRequestMessage(method, builder.GetFullUri()); + + if (configuration.UserAgent != null) + { + request.Headers.TryAddWithoutValidation("User-Agent", configuration.UserAgent); + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.Headers.Add(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + // Todo make content headers actually content headers + request.Headers.TryAddWithoutValidation(headerParam.Key, value); + } + } + } + + List> contentList = new List>(); + + string contentType = null; + if (options.HeaderParameters != null && options.HeaderParameters.ContainsKey("Content-Type")) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes.FirstOrDefault(); + } + + if (contentType == "multipart/form-data") + { + request.Content = PrepareMultipartFormDataContent(options); + } + else if (contentType == "application/x-www-form-urlencoded") + { + request.Content = new FormUrlEncodedContent(options.FormParameters); + } + else + { + if (options.Data != null) + { + if (options.Data is FileParameter fp) + { + contentType = contentType ?? "application/octet-stream"; + + var streamContent = new StreamContent(fp.Content); + streamContent.Headers.ContentType = new MediaTypeHeaderValue(contentType); + request.Content = streamContent; + } + else + { + var serializer = new CustomJsonCodec(SerializerSettings, configuration); + request.Content = new StringContent(serializer.Serialize(options.Data), new UTF8Encoding(), + "application/json"); + } + } + } + + + + // TODO provide an alternative that allows cookies per request instead of per API client + if (options.Cookies != null && options.Cookies.Count > 0) + { + request.Properties["CookieContainer"] = options.Cookies; + } + + return request; + } + + partial void InterceptRequest(HttpRequestMessage req); + partial void InterceptResponse(HttpRequestMessage req, HttpResponseMessage response); + + private async Task> ToApiResponse(HttpResponseMessage response, object responseData, Uri uri) + { + T result = (T)responseData; + string rawContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ReasonPhrase, + Cookies = new List() + }; + + // process response headers, e.g. Access-Control-Allow-Methods + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + // process response content headers, e.g. Content-Type + if (response.Content.Headers != null) + { + foreach (var responseHeader in response.Content.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (_httpClientHandler != null && response != null) + { + try + { + foreach (Cookie cookie in _httpClientHandler.CookieContainer.GetCookies(uri)) + { + transformed.Cookies.Add(cookie); + } + } + catch (PlatformNotSupportedException) { } + } + + return transformed; + } + + private ApiResponse Exec(HttpRequestMessage req, IReadableConfiguration configuration) + { + return ExecAsync(req, configuration).GetAwaiter().GetResult(); + } + + private async Task> ExecAsync(HttpRequestMessage req, + IReadableConfiguration configuration, + System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + CancellationTokenSource timeoutTokenSource = null; + CancellationTokenSource finalTokenSource = null; + var deserializer = new CustomJsonCodec(SerializerSettings, configuration); + var finalToken = cancellationToken; + + try + { + if (configuration.Timeout > 0) + { + timeoutTokenSource = new CancellationTokenSource(configuration.Timeout); + finalTokenSource = CancellationTokenSource.CreateLinkedTokenSource(finalToken, timeoutTokenSource.Token); + finalToken = finalTokenSource.Token; + } + + if (configuration.Proxy != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Configuration `Proxy` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + _httpClientHandler.Proxy = configuration.Proxy; + } + + var cookieContainer = req.Properties.ContainsKey("CookieContainer") ? req.Properties["CookieContainer"] as List : null; + + if (cookieContainer != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Request property `CookieContainer` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + foreach (var cookie in cookieContainer) + { + _httpClientHandler.CookieContainer.Add(cookie); + } + } + + InterceptRequest(req); + + HttpResponseMessage response; + response = await _httpClient.SendAsync(req, finalToken).ConfigureAwait(false); + + if (!response.IsSuccessStatusCode) + { + return await ToApiResponse(response, default(T), req.RequestUri).ConfigureAwait(false); + } + + object responseData = await deserializer.Deserialize(response).ConfigureAwait(false); + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(Algolia.Search.Monitoring.Models.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + responseData = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + else if (typeof(T).Name == "Stream") // for binary response + { + responseData = (T)(object)await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + } + + InterceptResponse(req, response); + + return await ToApiResponse(response, responseData, req.RequestUri).ConfigureAwait(false); + } + catch (OperationCanceledException original) + { + if (timeoutTokenSource != null && timeoutTokenSource.IsCancellationRequested) + { + throw new TaskCanceledException($"[{req.Method}] {req.RequestUri} was timeout.", + new TimeoutException(original.Message, original)); + } + throw; + } + finally + { + if (timeoutTokenSource != null) + { + timeoutTokenSource.Dispose(); + } + + if (finalTokenSource != null) + { + finalTokenSource.Dispose(); + } + } + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(new HttpMethod("PATCH"), path, options, config), config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(new HttpMethod("PATCH"), path, options, config), config); + } + #endregion ISynchronousClient + } +} diff --git a/algoliasearch/Monitoring/Client/ApiException.cs b/algoliasearch/Monitoring/Client/ApiException.cs new file mode 100644 index 000000000..5d7f68331 --- /dev/null +++ b/algoliasearch/Monitoring/Client/ApiException.cs @@ -0,0 +1,62 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.Monitoring.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// Gets or sets the error code (HTTP status code) + /// + /// The error code (HTTP status code). + public int ErrorCode { get; set; } + + /// + /// Gets or sets the error content (body json object) + /// + /// The error content (Http response body). + public object ErrorContent { get; private set; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public ApiException() { } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + public ApiException(int errorCode, string message) : base(message) + { + this.ErrorCode = errorCode; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + /// Error content. + /// HTTP Headers. + public ApiException(int errorCode, string message, object errorContent = null, Multimap headers = null) : base(message) + { + this.ErrorCode = errorCode; + this.ErrorContent = errorContent; + this.Headers = headers; + } + } + +} diff --git a/algoliasearch/Monitoring/Client/ApiResponse.cs b/algoliasearch/Monitoring/Client/ApiResponse.cs new file mode 100644 index 000000000..5625dc7c2 --- /dev/null +++ b/algoliasearch/Monitoring/Client/ApiResponse.cs @@ -0,0 +1,160 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; + +namespace Algolia.Search.Monitoring.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public interface IApiResponse + { + /// + /// The data type of + /// + Type ResponseType { get; } + + /// + /// The content of this response + /// + Object Content { get; } + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + Multimap Headers { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + List Cookies { get; set; } + + /// + /// The raw content of this response + /// + string RawContent { get; } + } + + /// + /// API Response + /// + public class ApiResponse : IApiResponse + { + #region Properties + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; } + + /// + /// Gets or sets the data (parsed HTTP body) + /// + /// The data. + public T Data { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + public string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + public List Cookies { get; set; } + + /// + /// The content of this response + /// + public Type ResponseType + { + get { return typeof(T); } + } + + /// + /// The data type of + /// + public object Content + { + get { return Data; } + } + + /// + /// The raw content + /// + public string RawContent { get; } + + #endregion Properties + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data, string rawContent) + { + StatusCode = statusCode; + Headers = headers; + Data = data; + RawContent = rawContent; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) : this(statusCode, headers, data, null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null) + { + } + + #endregion Constructors + } +} diff --git a/algoliasearch/Monitoring/Client/ClientUtils.cs b/algoliasearch/Monitoring/Client/ClientUtils.cs new file mode 100644 index 000000000..a88d6a4e1 --- /dev/null +++ b/algoliasearch/Monitoring/Client/ClientUtils.cs @@ -0,0 +1,244 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; + +namespace Algolia.Search.Monitoring.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// Convert params to key/value pairs. + /// Use collectionFormat to properly format lists and collections. + /// + /// The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi + /// Key name. + /// Value object. + /// A multimap of keys with 1..n associated values. + public static Multimap ParameterToMultiMap(string collectionFormat, string name, object value) + { + var parameters = new Multimap(); + + if (value is ICollection collection && collectionFormat == "multi") + { + foreach (var item in collection) + { + parameters.Add(name, ParameterToString(item)); + } + } + else if (value is IDictionary dictionary) + { + if (collectionFormat == "deepObject") + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value)); + } + } + else + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value)); + } + } + } + else + { + parameters.Add(name, ParameterToString(value)); + } + + return parameters; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// An optional configuration instance, providing formatting options used in processing. + /// Formatted string. + public static string ParameterToString(object obj, IReadableConfiguration configuration = null) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is bool boolean) + return boolean ? "true" : "false"; + if (obj is ICollection collection) + { + List entries = new List(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry, configuration)); + return string.Join(",", entries); + } + if (obj is Enum && HasEnumMemberAttrValue(obj)) + return GetEnumMemberAttrValue(obj); + + return Convert.ToString(obj, CultureInfo.InvariantCulture); + } + + /// + /// Serializes the given object when not null. Otherwise return null. + /// + /// The object to serialize. + /// Serialized string. + public static string Serialize(object obj) + { + return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null; + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Is the Enum decorated with EnumMember Attribute + /// + /// + /// true if found + private static bool HasEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) return true; + return false; + } + + /// + /// Get the EnumMember value + /// + /// + /// EnumMember value as string otherwise null + private static string GetEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) + { + return attr.Value; + } + return null; + } + } +} diff --git a/algoliasearch/Monitoring/Client/Configuration.cs b/algoliasearch/Monitoring/Client/Configuration.cs new file mode 100644 index 000000000..93802e02f --- /dev/null +++ b/algoliasearch/Monitoring/Client/Configuration.cs @@ -0,0 +1,571 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Net.Http; +using System.Net.Security; + +namespace Algolia.Search.Monitoring.Client +{ + /// + /// Represents a set of configuration settings + /// + public class Configuration : IReadableConfiguration + { + #region Constants + + /// + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.RawContent), + response.RawContent, response.Headers); + } + return null; + }; + + #endregion Static Members + + #region Private Members + + /// + /// Defines the base path of the target API server. + /// Example: http://localhost:3000/v1/ + /// + private string _basePath; + + private bool _useDefaultCredentials = false; + + /// + /// Gets or sets the API key based on the authentication name. + /// This is the key and value comprising the "secret" for accessing an API. + /// + /// The API key. + private IDictionary _apiKey; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + /// + /// Gets or sets the servers defined in the OpenAPI spec. + /// + /// The servers + private IList> _servers; + + /// + /// Gets or sets the operation servers defined in the OpenAPI spec. + /// + /// The operation servers + private IReadOnlyDictionary>> _operationServers; + + #endregion Private Members + + #region Constructors + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration() + { + Proxy = null; + UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + BasePath = "https://status.algolia.com"; + DefaultHeaders = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + Servers = new List>() + { + { + new Dictionary { + {"url", "https://status.algolia.com"}, + {"description", "No description provided"}, + } + } + }; + OperationServers = new Dictionary>>() + { + }; + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration( + IDictionary defaultHeaders, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "https://status.algolia.com") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeaders == null) + throw new ArgumentNullException("defaultHeaders"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeaders) + { + DefaultHeaders.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + #endregion Constructors + + #region Properties + + /// + /// Gets or sets the base path for API access. + /// + public virtual string BasePath + { + get { return _basePath; } + set { _basePath = value; } + } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + public virtual bool UseDefaultCredentials + { + get { return _useDefaultCredentials; } + set { _useDefaultCredentials = value; } + } + + /// + /// Gets or sets the default header. + /// + [Obsolete("Use DefaultHeaders instead.")] + public virtual IDictionary DefaultHeader + { + get + { + return DefaultHeaders; + } + set + { + DefaultHeaders = value; + } + } + + /// + /// Gets or sets the default headers. + /// + public virtual IDictionary DefaultHeaders { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { get; set; } + + /// + /// Gets or sets the proxy + /// + /// Proxy. + public virtual WebProxy Proxy { get; set; } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix(string apiKeyIdentifier) + { + string apiKeyValue; + ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue); + string apiKeyPrefix; + if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) + { + return apiKeyPrefix + " " + apiKeyValue; + } + + return apiKeyValue; + } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } + + set + { + if (string.IsNullOrEmpty(value)) + { + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } + } + } + + /// + /// Gets or sets the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// Whatever you set here will be prepended to the value defined in AddApiKey. + /// + /// An example invocation here might be: + /// + /// ApiKeyPrefix["Authorization"] = "Bearer"; + /// + /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// + /// + /// OAuth2 workflows should set tokens via AccessToken. + /// + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + /// + /// Gets or sets the servers. + /// + /// The servers. + public virtual IList> Servers + { + get { return _servers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Servers may not be null."); + } + _servers = value; + } + } + + /// + /// Gets or sets the operation servers. + /// + /// The operation servers. + public virtual IReadOnlyDictionary>> OperationServers + { + get { return _operationServers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Operation servers may not be null."); + } + _operationServers = value; + } + } + + /// + /// Returns URL based on server settings without providing values + /// for the variables + /// + /// Array index of the server settings. + /// The server URL. + public string GetServerUrl(int index) + { + return GetServerUrl(Servers, index, null); + } + + /// + /// Returns URL based on server settings. + /// + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + public string GetServerUrl(int index, Dictionary inputVariables) + { + return GetServerUrl(Servers, index, inputVariables); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index) + { + return GetOperationServerUrl(operation, index, null); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables) + { + if (operation != null && OperationServers.TryGetValue(operation, out var operationServer)) + { + return GetServerUrl(operationServer, index, inputVariables); + } + + return null; + } + + /// + /// Returns URL based on server settings. + /// + /// Dictionary of server settings. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + private string GetServerUrl(IList> servers, int index, Dictionary inputVariables) + { + if (index < 0 || index >= servers.Count) + { + throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}."); + } + + if (inputVariables == null) + { + inputVariables = new Dictionary(); + } + + IReadOnlyDictionary server = servers[index]; + string url = (string)server["url"]; + + if (server.ContainsKey("variables")) + { + // go through each variable and assign a value + foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"]) + { + + IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value); + + if (inputVariables.ContainsKey(variable.Key)) + { + if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + { + url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); + } + else + { + throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}"); + } + } + else + { + // use default value + url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]); + } + } + } + + return url; + } + + /// + /// Gets and Sets the RemoteCertificateValidationCallback + /// + public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; } + + #endregion Properties + + #region Methods + + /// + /// Returns a string with essential information for debugging. + /// + public static string ToDebugReport() + { + string report = "C# SDK (Algolia.Search.Monitoring) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: 1.0.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; + } + + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey(string key, string value) + { + ApiKey[key] = value; + } + + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix(string key, string value) + { + ApiKeyPrefix[key] = value; + } + + #endregion Methods + + #region Static Members + /// + /// Merge configurations. + /// + /// First configuration. + /// Second configuration. + /// Merged configuration. + public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) + { + if (second == null) return first ?? GlobalConfiguration.Instance; + + Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; + foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; + foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value; + + var config = new Configuration + { + ApiKey = apiKey, + ApiKeyPrefix = apiKeyPrefix, + DefaultHeaders = defaultHeaders, + BasePath = second.BasePath ?? first.BasePath, + Timeout = second.Timeout, + Proxy = second.Proxy ?? first.Proxy, + UserAgent = second.UserAgent ?? first.UserAgent, + TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, + DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat, + UseDefaultCredentials = second.UseDefaultCredentials, + RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback, + }; + return config; + } + #endregion Static Members + } +} diff --git a/algoliasearch/Monitoring/Client/ExceptionFactory.cs b/algoliasearch/Monitoring/Client/ExceptionFactory.cs new file mode 100644 index 000000000..0661bc418 --- /dev/null +++ b/algoliasearch/Monitoring/Client/ExceptionFactory.cs @@ -0,0 +1,16 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.Monitoring.Client +{ + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions + public delegate Exception ExceptionFactory(string methodName, IApiResponse response); +} diff --git a/algoliasearch/Monitoring/Client/FileParameter.cs b/algoliasearch/Monitoring/Client/FileParameter.cs new file mode 100644 index 000000000..50a7a0fb0 --- /dev/null +++ b/algoliasearch/Monitoring/Client/FileParameter.cs @@ -0,0 +1,74 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.IO; + +namespace Algolia.Search.Monitoring.Client +{ + + /// + /// Represents a File passed to the API as a Parameter, allows using different backends for files + /// + public class FileParameter + { + /// + /// The filename + /// + public string Name { get; set; } = "no_name_provided"; + + /// + /// The content type of the file + /// + public string ContentType { get; set; } = "application/octet-stream"; + + /// + /// The content of the file + /// + public Stream Content { get; set; } + + /// + /// Construct a FileParameter just from the contents, will extract the filename from a filestream + /// + /// The file content + public FileParameter(Stream content) + { + if (content is FileStream fs) + { + Name = fs.Name; + } + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The file content + public FileParameter(string filename, Stream content) + { + Name = filename; + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The content type of the file + /// The file content + public FileParameter(string filename, string contentType, Stream content) + { + Name = filename; + ContentType = contentType; + Content = content; + } + + /// + /// Implicit conversion of stream to file parameter. Useful for backwards compatibility. + /// + /// Stream to convert + /// FileParameter + public static implicit operator FileParameter(Stream s) => new FileParameter(s); + } +} diff --git a/algoliasearch/Monitoring/Client/GlobalConfiguration.cs b/algoliasearch/Monitoring/Client/GlobalConfiguration.cs new file mode 100644 index 000000000..c4d495a7c --- /dev/null +++ b/algoliasearch/Monitoring/Client/GlobalConfiguration.cs @@ -0,0 +1,61 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.Collections.Generic; + +namespace Algolia.Search.Monitoring.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .openapi-generator-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + #region Private Members + + private static readonly object GlobalConfigSync = new { }; + private static IReadableConfiguration _globalConfiguration; + + #endregion Private Members + + #region Constructors + + /// + private GlobalConfiguration() + { + } + + /// + public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath) + { + } + + static GlobalConfiguration() + { + Instance = new GlobalConfiguration(); + } + + #endregion Constructors + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static IReadableConfiguration Instance + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + } +} diff --git a/algoliasearch/Monitoring/Client/IAsynchronousClient.cs b/algoliasearch/Monitoring/Client/IAsynchronousClient.cs new file mode 100644 index 000000000..d421db1ce --- /dev/null +++ b/algoliasearch/Monitoring/Client/IAsynchronousClient.cs @@ -0,0 +1,94 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Threading.Tasks; + +namespace Algolia.Search.Monitoring.Client +{ + /// + /// Contract for Asynchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface IAsynchronousClient + { + /// + /// Executes a non-blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } +} diff --git a/algoliasearch/Monitoring/Client/IReadableConfiguration.cs b/algoliasearch/Monitoring/Client/IReadableConfiguration.cs new file mode 100644 index 000000000..d15c72401 --- /dev/null +++ b/algoliasearch/Monitoring/Client/IReadableConfiguration.cs @@ -0,0 +1,111 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; + +namespace Algolia.Search.Monitoring.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + /// + /// Gets the API key. + /// + /// API key. + IDictionary ApiKey { get; } + + /// + /// Gets the API key prefix. + /// + /// API key prefix. + IDictionary ApiKeyPrefix { get; } + + /// + /// Gets the base path. + /// + /// Base path. + string BasePath { get; } + + /// + /// Gets the date time format. + /// + /// Date time format. + string DateTimeFormat { get; } + + /// + /// Gets the default header. + /// + /// Default header. + [Obsolete("Use DefaultHeaders instead.")] + IDictionary DefaultHeader { get; } + + /// + /// Gets the default headers. + /// + /// Default headers. + IDictionary DefaultHeaders { get; } + + /// + /// Gets the temp folder path. + /// + /// Temp folder path. + string TempFolderPath { get; } + + /// + /// Gets the HTTP connection timeout (in milliseconds) + /// + /// HTTP connection timeout. + int Timeout { get; } + + /// + /// Gets the proxy. + /// + /// Proxy. + WebProxy Proxy { get; } + + /// + /// Gets the user agent. + /// + /// User agent. + string UserAgent { get; } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + bool UseDefaultCredentials { get; } + + /// + /// Get the servers associated with the operation. + /// + /// Operation servers. + IReadOnlyDictionary>> OperationServers { get; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + string GetApiKeyWithPrefix(string apiKeyIdentifier); + + /// + /// Gets the Operation server url at the provided index. + /// + /// Operation server name. + /// Index of the operation server settings. + /// + string GetOperationServerUrl(string operation, int index); + + /// + /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and + /// overriding certificate errors in the scope of a request. + /// + RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; } + } +} diff --git a/algoliasearch/Monitoring/Client/ISynchronousClient.cs b/algoliasearch/Monitoring/Client/ISynchronousClient.cs new file mode 100644 index 000000000..b7e39d5f7 --- /dev/null +++ b/algoliasearch/Monitoring/Client/ISynchronousClient.cs @@ -0,0 +1,87 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.IO; + +namespace Algolia.Search.Monitoring.Client +{ + /// + /// Contract for Synchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface ISynchronousClient + { + /// + /// Executes a blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null); + } +} diff --git a/algoliasearch/Monitoring/Client/Multimap.cs b/algoliasearch/Monitoring/Client/Multimap.cs new file mode 100644 index 000000000..59aef963c --- /dev/null +++ b/algoliasearch/Monitoring/Client/Multimap.cs @@ -0,0 +1,289 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Algolia.Search.Monitoring.Client +{ + /// + /// A dictionary in which one key has many associated values. + /// + /// The type of the key + /// The type of the value associated with the key. + public class Multimap : IDictionary> + { + #region Private Fields + + private readonly Dictionary> _dictionary; + + #endregion Private Fields + + #region Constructors + + /// + /// Empty Constructor. + /// + public Multimap() + { + _dictionary = new Dictionary>(); + } + + /// + /// Constructor with comparer. + /// + /// + public Multimap(IEqualityComparer comparer) + { + _dictionary = new Dictionary>(comparer); + } + + #endregion Constructors + + #region Enumerators + + /// + /// To get the enumerator. + /// + /// Enumerator + public IEnumerator>> GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + /// + /// To get the enumerator. + /// + /// Enumerator + IEnumerator IEnumerable.GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + #endregion Enumerators + + #region Public Members + /// + /// Add values to Multimap + /// + /// Key value pair + public void Add(KeyValuePair> item) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + + /// + /// Add Multimap to Multimap + /// + /// Multimap + public void Add(Multimap multimap) + { + foreach (var item in multimap) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + + /// + /// Clear Multimap + /// + public void Clear() + { + _dictionary.Clear(); + } + + /// + /// Determines whether Multimap contains the specified item. + /// + /// Key value pair + /// Method needs to be implemented + /// true if the Multimap contains the item; otherwise, false. + public bool Contains(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Copy items of the Multimap to an array, + /// starting at a particular array index. + /// + /// The array that is the destination of the items copied + /// from Multimap. The array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + /// Method needs to be implemented + public void CopyTo(KeyValuePair>[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + /// + /// Removes the specified item from the Multimap. + /// + /// Key value pair + /// true if the item is successfully removed; otherwise, false. + /// Method needs to be implemented + public bool Remove(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Gets the number of items contained in the Multimap. + /// + public int Count => _dictionary.Count; + + /// + /// Gets a value indicating whether the Multimap is read-only. + /// + public bool IsReadOnly => false; + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add the value to Multimap. + public void Add(TKey key, IList value) + { + if (value != null && value.Count > 0) + { + if (_dictionary.TryGetValue(key, out var list)) + { + foreach (var k in value) list.Add(k); + } + else + { + list = new List(value); + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + } + + /// + /// Determines whether the Multimap contains an item with the specified key. + /// + /// The key to locate in the Multimap. + /// true if the Multimap contains an item with + /// the key; otherwise, false. + public bool ContainsKey(TKey key) + { + return _dictionary.ContainsKey(key); + } + + /// + /// Removes item with the specified key from the Multimap. + /// + /// The key to locate in the Multimap. + /// true if the item is successfully removed; otherwise, false. + public bool Remove(TKey key) + { + return TryRemove(key, out var _); + } + + /// + /// Gets the value associated with the specified key. + /// + /// The key whose value to get. + /// When this method returns, the value associated with the specified key, if the + /// key is found; otherwise, the default value for the type of the value parameter. + /// This parameter is passed uninitialized. + /// true if the object that implements Multimap contains + /// an item with the specified key; otherwise, false. + public bool TryGetValue(TKey key, out IList value) + { + return _dictionary.TryGetValue(key, out value); + } + + /// + /// Gets or sets the item with the specified key. + /// + /// The key of the item to get or set. + /// The value of the specified key. + public IList this[TKey key] + { + get => _dictionary[key]; + set => _dictionary[key] = value; + } + + /// + /// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap. + /// + public ICollection Keys => _dictionary.Keys; + + /// + /// Gets a System.Collections.Generic.ICollection containing the values of the Multimap. + /// + public ICollection> Values => _dictionary.Values; + + /// + /// Copy the items of the Multimap to an System.Array, + /// starting at a particular System.Array index. + /// + /// The one-dimensional System.Array that is the destination of the items copied + /// from Multimap. The System.Array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + public void CopyTo(Array array, int index) + { + ((ICollection)_dictionary).CopyTo(array, index); + } + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add value to Multimap. + public void Add(TKey key, TValue value) + { + if (value != null) + { + if (_dictionary.TryGetValue(key, out var list)) + { + list.Add(value); + } + else + { + list = new List { value }; + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add value to Multimap."); + } + } + } + + #endregion Public Members + + #region Private Members + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryRemove(TKey key, out IList value) + { + _dictionary.TryGetValue(key, out value); + return _dictionary.Remove(key); + } + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryAdd(TKey key, IList value) + { + try + { + _dictionary.Add(key, value); + } + catch (ArgumentException) + { + return false; + } + + return true; + } + #endregion Private Members + } +} diff --git a/algoliasearch/Monitoring/Client/OpenAPIDateConverter.cs b/algoliasearch/Monitoring/Client/OpenAPIDateConverter.cs new file mode 100644 index 000000000..5ba83d01c --- /dev/null +++ b/algoliasearch/Monitoring/Client/OpenAPIDateConverter.cs @@ -0,0 +1,23 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using Newtonsoft.Json.Converters; + +namespace Algolia.Search.Monitoring.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class OpenAPIDateConverter : IsoDateTimeConverter + { + /// + /// Initializes a new instance of the class. + /// + public OpenAPIDateConverter() + { + // full-date = date-fullyear "-" date-month "-" date-mday + DateTimeFormat = "yyyy-MM-dd"; + } + } +} diff --git a/algoliasearch/Monitoring/Client/RequestOptions.cs b/algoliasearch/Monitoring/Client/RequestOptions.cs new file mode 100644 index 000000000..673336bfc --- /dev/null +++ b/algoliasearch/Monitoring/Client/RequestOptions.cs @@ -0,0 +1,68 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; + +namespace Algolia.Search.Monitoring.Client +{ + /// + /// A container for generalized request inputs. This type allows consumers to extend the request functionality + /// by abstracting away from the default (built-in) request framework (e.g. RestSharp). + /// + public class RequestOptions + { + /// + /// Parameters to be bound to path parts of the Request's URL + /// + public Dictionary PathParameters { get; set; } + + /// + /// Query parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap QueryParameters { get; set; } + + /// + /// Header parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap HeaderParameters { get; set; } + + /// + /// Form parameters to be sent along with the request. + /// + public Dictionary FormParameters { get; set; } + + /// + /// File parameters to be sent along with the request. + /// + public Multimap FileParameters { get; set; } + + /// + /// Cookies to be sent along with the request. + /// + public List Cookies { get; set; } + + /// + /// Any data associated with a request body. + /// + public Object Data { get; set; } + + /// + /// Constructs a new instance of + /// + public RequestOptions() + { + PathParameters = new Dictionary(); + QueryParameters = new Multimap(); + HeaderParameters = new Multimap(); + FormParameters = new Dictionary(); + FileParameters = new Multimap(); + Cookies = new List(); + } + } +} diff --git a/algoliasearch/Monitoring/Client/WebRequestPathBuilder.cs b/algoliasearch/Monitoring/Client/WebRequestPathBuilder.cs new file mode 100644 index 000000000..99d95e995 --- /dev/null +++ b/algoliasearch/Monitoring/Client/WebRequestPathBuilder.cs @@ -0,0 +1,47 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using System; +using System.Collections.Generic; + +namespace Algolia.Search.Monitoring.Client +{ + /// + /// A URI builder + /// + class WebRequestPathBuilder + { + private string _baseUrl; + private string _path; + private string _query = "?"; + public WebRequestPathBuilder(string baseUrl, string path) + { + _baseUrl = baseUrl; + _path = path; + } + + public void AddPathParameters(Dictionary parameters) + { + foreach (var parameter in parameters) + { + _path = _path.Replace("{" + parameter.Key + "}", Uri.EscapeDataString(parameter.Value)); + } + } + + public void AddQueryParameters(Multimap parameters) + { + foreach (var parameter in parameters) + { + foreach (var value in parameter.Value) + { + _query = _query + parameter.Key + "=" + Uri.EscapeDataString(value) + "&"; + } + } + } + + public string GetFullUri() + { + return _baseUrl + _path + _query.Substring(0, _query.Length - 1); + } + } +} diff --git a/algoliasearch/Monitoring/Models/AbstractOpenAPISchema.cs b/algoliasearch/Monitoring/Models/AbstractOpenAPISchema.cs new file mode 100644 index 000000000..bfb0551e0 --- /dev/null +++ b/algoliasearch/Monitoring/Models/AbstractOpenAPISchema.cs @@ -0,0 +1,70 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification + /// + public abstract partial class AbstractOpenAPISchema + { + /// + /// Custom JSON serializer + /// + static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Error, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Custom JSON serializer for objects with additional properties + /// + static public readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Ignore, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Gets or Sets the actual instance + /// + public abstract Object ActualInstance { get; set; } + + /// + /// Gets or Sets IsNullable to indicate whether the instance is nullable + /// + public bool IsNullable { get; protected set; } + + /// + /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf` + /// + public string SchemaType { get; protected set; } + + /// + /// Converts the instance into JSON string. + /// + public abstract string ToJson(); + } +} diff --git a/algoliasearch/Monitoring/Models/ErrorBase.cs b/algoliasearch/Monitoring/Models/ErrorBase.cs new file mode 100644 index 000000000..b1a60fb25 --- /dev/null +++ b/algoliasearch/Monitoring/Models/ErrorBase.cs @@ -0,0 +1,147 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// Error. + /// + [DataContract(Name = "ErrorBase")] + public partial class ErrorBase : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// message. + public ErrorBase(string message = default(string)) : base() + { + this.Message = message; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Message + /// + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ErrorBase {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ErrorBase); + } + + /// + /// Returns true if ErrorBase instances are equal + /// + /// Instance of ErrorBase to be compared + /// Boolean + public bool Equals(ErrorBase input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Models/GetInventory403Response.cs b/algoliasearch/Monitoring/Models/GetInventory403Response.cs new file mode 100644 index 000000000..164793ffd --- /dev/null +++ b/algoliasearch/Monitoring/Models/GetInventory403Response.cs @@ -0,0 +1,123 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// GetInventory403Response + /// + [DataContract(Name = "getInventory_403_response")] + public partial class GetInventory403Response : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// reason. + public GetInventory403Response(string reason = default(string)) + { + this.Reason = reason; + } + + /// + /// Gets or Sets Reason + /// + [DataMember(Name = "reason", EmitDefaultValue = false)] + public string Reason { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetInventory403Response {\n"); + sb.Append(" Reason: ").Append(Reason).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetInventory403Response); + } + + /// + /// Returns true if GetInventory403Response instances are equal + /// + /// Instance of GetInventory403Response to be compared + /// Boolean + public bool Equals(GetInventory403Response input) + { + if (input == null) + { + return false; + } + return + ( + this.Reason == input.Reason || + (this.Reason != null && + this.Reason.Equals(input.Reason)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Reason != null) + { + hashCode = (hashCode * 59) + this.Reason.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Models/Incident.cs b/algoliasearch/Monitoring/Models/Incident.cs new file mode 100644 index 000000000..e8e1a3df6 --- /dev/null +++ b/algoliasearch/Monitoring/Models/Incident.cs @@ -0,0 +1,138 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// Incident details. + /// + [DataContract(Name = "Incident")] + public partial class Incident : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Status + /// + [DataMember(Name = "status", EmitDefaultValue = false)] + public Status? Status { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Description of the incident.. + /// status. + public Incident(string title = default(string), Status? status = default(Status?)) + { + this.Title = title; + this.Status = status; + } + + /// + /// Description of the incident. + /// + /// Description of the incident. + [DataMember(Name = "title", EmitDefaultValue = false)] + public string Title { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Incident {\n"); + sb.Append(" Title: ").Append(Title).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Incident); + } + + /// + /// Returns true if Incident instances are equal + /// + /// Instance of Incident to be compared + /// Boolean + public bool Equals(Incident input) + { + if (input == null) + { + return false; + } + return + ( + this.Title == input.Title || + (this.Title != null && + this.Title.Equals(input.Title)) + ) && + ( + this.Status == input.Status || + this.Status.Equals(input.Status) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Title != null) + { + hashCode = (hashCode * 59) + this.Title.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Status.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Models/IncidentsInner.cs b/algoliasearch/Monitoring/Models/IncidentsInner.cs new file mode 100644 index 000000000..c1ecd65fb --- /dev/null +++ b/algoliasearch/Monitoring/Models/IncidentsInner.cs @@ -0,0 +1,138 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// IncidentsInner + /// + [DataContract(Name = "Incidents_inner")] + public partial class IncidentsInner : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Timestamp in [Unix epoch time](https://wikipedia.org/wiki/Unix_time) in milliseconds.. + /// v. + public IncidentsInner(long t = default(long), Incident v = default(Incident)) + { + this.T = t; + this.V = v; + } + + /// + /// Timestamp in [Unix epoch time](https://wikipedia.org/wiki/Unix_time) in milliseconds. + /// + /// Timestamp in [Unix epoch time](https://wikipedia.org/wiki/Unix_time) in milliseconds. + [DataMember(Name = "t", EmitDefaultValue = false)] + public long T { get; set; } + + /// + /// Gets or Sets V + /// + [DataMember(Name = "v", EmitDefaultValue = false)] + public Incident V { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class IncidentsInner {\n"); + sb.Append(" T: ").Append(T).Append("\n"); + sb.Append(" V: ").Append(V).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as IncidentsInner); + } + + /// + /// Returns true if IncidentsInner instances are equal + /// + /// Instance of IncidentsInner to be compared + /// Boolean + public bool Equals(IncidentsInner input) + { + if (input == null) + { + return false; + } + return + ( + this.T == input.T || + this.T.Equals(input.T) + ) && + ( + this.V == input.V || + (this.V != null && + this.V.Equals(input.V)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.T.GetHashCode(); + if (this.V != null) + { + hashCode = (hashCode * 59) + this.V.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Models/IncidentsResponse.cs b/algoliasearch/Monitoring/Models/IncidentsResponse.cs new file mode 100644 index 000000000..5d65d0d06 --- /dev/null +++ b/algoliasearch/Monitoring/Models/IncidentsResponse.cs @@ -0,0 +1,124 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// IncidentsResponse + /// + [DataContract(Name = "IncidentsResponse")] + public partial class IncidentsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// incidents. + public IncidentsResponse(Dictionary> incidents = default(Dictionary>)) + { + this.Incidents = incidents; + } + + /// + /// Gets or Sets Incidents + /// + [DataMember(Name = "incidents", EmitDefaultValue = false)] + public Dictionary> Incidents { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class IncidentsResponse {\n"); + sb.Append(" Incidents: ").Append(Incidents).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as IncidentsResponse); + } + + /// + /// Returns true if IncidentsResponse instances are equal + /// + /// Instance of IncidentsResponse to be compared + /// Boolean + public bool Equals(IncidentsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Incidents == input.Incidents || + this.Incidents != null && + input.Incidents != null && + this.Incidents.SequenceEqual(input.Incidents) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Incidents != null) + { + hashCode = (hashCode * 59) + this.Incidents.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Models/IndexingTimeResponse.cs b/algoliasearch/Monitoring/Models/IndexingTimeResponse.cs new file mode 100644 index 000000000..be7f1a0fe --- /dev/null +++ b/algoliasearch/Monitoring/Models/IndexingTimeResponse.cs @@ -0,0 +1,123 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// IndexingTimeResponse + /// + [DataContract(Name = "IndexingTimeResponse")] + public partial class IndexingTimeResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// metrics. + public IndexingTimeResponse(IndexingTimeResponseMetrics metrics = default(IndexingTimeResponseMetrics)) + { + this.Metrics = metrics; + } + + /// + /// Gets or Sets Metrics + /// + [DataMember(Name = "metrics", EmitDefaultValue = false)] + public IndexingTimeResponseMetrics Metrics { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class IndexingTimeResponse {\n"); + sb.Append(" Metrics: ").Append(Metrics).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as IndexingTimeResponse); + } + + /// + /// Returns true if IndexingTimeResponse instances are equal + /// + /// Instance of IndexingTimeResponse to be compared + /// Boolean + public bool Equals(IndexingTimeResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Metrics == input.Metrics || + (this.Metrics != null && + this.Metrics.Equals(input.Metrics)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Metrics != null) + { + hashCode = (hashCode * 59) + this.Metrics.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Models/IndexingTimeResponseMetrics.cs b/algoliasearch/Monitoring/Models/IndexingTimeResponseMetrics.cs new file mode 100644 index 000000000..800f88cd2 --- /dev/null +++ b/algoliasearch/Monitoring/Models/IndexingTimeResponseMetrics.cs @@ -0,0 +1,124 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// IndexingTimeResponseMetrics + /// + [DataContract(Name = "IndexingTimeResponse_metrics")] + public partial class IndexingTimeResponseMetrics : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// indexing. + public IndexingTimeResponseMetrics(Dictionary> indexing = default(Dictionary>)) + { + this.Indexing = indexing; + } + + /// + /// Gets or Sets Indexing + /// + [DataMember(Name = "indexing", EmitDefaultValue = false)] + public Dictionary> Indexing { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class IndexingTimeResponseMetrics {\n"); + sb.Append(" Indexing: ").Append(Indexing).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as IndexingTimeResponseMetrics); + } + + /// + /// Returns true if IndexingTimeResponseMetrics instances are equal + /// + /// Instance of IndexingTimeResponseMetrics to be compared + /// Boolean + public bool Equals(IndexingTimeResponseMetrics input) + { + if (input == null) + { + return false; + } + return + ( + this.Indexing == input.Indexing || + this.Indexing != null && + input.Indexing != null && + this.Indexing.SequenceEqual(input.Indexing) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Indexing != null) + { + hashCode = (hashCode * 59) + this.Indexing.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Models/InfrastructureResponse.cs b/algoliasearch/Monitoring/Models/InfrastructureResponse.cs new file mode 100644 index 000000000..d629b0d71 --- /dev/null +++ b/algoliasearch/Monitoring/Models/InfrastructureResponse.cs @@ -0,0 +1,123 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// InfrastructureResponse + /// + [DataContract(Name = "InfrastructureResponse")] + public partial class InfrastructureResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// metrics. + public InfrastructureResponse(InfrastructureResponseMetrics metrics = default(InfrastructureResponseMetrics)) + { + this.Metrics = metrics; + } + + /// + /// Gets or Sets Metrics + /// + [DataMember(Name = "metrics", EmitDefaultValue = false)] + public InfrastructureResponseMetrics Metrics { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class InfrastructureResponse {\n"); + sb.Append(" Metrics: ").Append(Metrics).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InfrastructureResponse); + } + + /// + /// Returns true if InfrastructureResponse instances are equal + /// + /// Instance of InfrastructureResponse to be compared + /// Boolean + public bool Equals(InfrastructureResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Metrics == input.Metrics || + (this.Metrics != null && + this.Metrics.Equals(input.Metrics)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Metrics != null) + { + hashCode = (hashCode * 59) + this.Metrics.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Models/InfrastructureResponseMetrics.cs b/algoliasearch/Monitoring/Models/InfrastructureResponseMetrics.cs new file mode 100644 index 000000000..bff68b9b9 --- /dev/null +++ b/algoliasearch/Monitoring/Models/InfrastructureResponseMetrics.cs @@ -0,0 +1,205 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// InfrastructureResponseMetrics + /// + [DataContract(Name = "InfrastructureResponse_metrics")] + public partial class InfrastructureResponseMetrics : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// CPU idleness in %.. + /// RAM used for indexing in MB.. + /// RAM used for search in MB.. + /// Solid-state disk (SSD) usage expressed as % of RAM. 0% means no SSD usage. A value of 50% indicates 32&nbsp;GB SSD usage for a machine with 64&nbsp;RAM. . + /// Average build time of the indices in seconds.. + public InfrastructureResponseMetrics(Dictionary> cpuUsage = default(Dictionary>), Dictionary> ramIndexingUsage = default(Dictionary>), Dictionary> ramSearchUsage = default(Dictionary>), Dictionary> ssdUsage = default(Dictionary>), Dictionary> avgBuildTime = default(Dictionary>)) + { + this.CpuUsage = cpuUsage; + this.RamIndexingUsage = ramIndexingUsage; + this.RamSearchUsage = ramSearchUsage; + this.SsdUsage = ssdUsage; + this.AvgBuildTime = avgBuildTime; + } + + /// + /// CPU idleness in %. + /// + /// CPU idleness in %. + [DataMember(Name = "cpu_usage", EmitDefaultValue = false)] + public Dictionary> CpuUsage { get; set; } + + /// + /// RAM used for indexing in MB. + /// + /// RAM used for indexing in MB. + [DataMember(Name = "ram_indexing_usage", EmitDefaultValue = false)] + public Dictionary> RamIndexingUsage { get; set; } + + /// + /// RAM used for search in MB. + /// + /// RAM used for search in MB. + [DataMember(Name = "ram_search_usage", EmitDefaultValue = false)] + public Dictionary> RamSearchUsage { get; set; } + + /// + /// Solid-state disk (SSD) usage expressed as % of RAM. 0% means no SSD usage. A value of 50% indicates 32&nbsp;GB SSD usage for a machine with 64&nbsp;RAM. + /// + /// Solid-state disk (SSD) usage expressed as % of RAM. 0% means no SSD usage. A value of 50% indicates 32&nbsp;GB SSD usage for a machine with 64&nbsp;RAM. + [DataMember(Name = "ssd_usage", EmitDefaultValue = false)] + public Dictionary> SsdUsage { get; set; } + + /// + /// Average build time of the indices in seconds. + /// + /// Average build time of the indices in seconds. + [DataMember(Name = "avg_build_time", EmitDefaultValue = false)] + public Dictionary> AvgBuildTime { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class InfrastructureResponseMetrics {\n"); + sb.Append(" CpuUsage: ").Append(CpuUsage).Append("\n"); + sb.Append(" RamIndexingUsage: ").Append(RamIndexingUsage).Append("\n"); + sb.Append(" RamSearchUsage: ").Append(RamSearchUsage).Append("\n"); + sb.Append(" SsdUsage: ").Append(SsdUsage).Append("\n"); + sb.Append(" AvgBuildTime: ").Append(AvgBuildTime).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InfrastructureResponseMetrics); + } + + /// + /// Returns true if InfrastructureResponseMetrics instances are equal + /// + /// Instance of InfrastructureResponseMetrics to be compared + /// Boolean + public bool Equals(InfrastructureResponseMetrics input) + { + if (input == null) + { + return false; + } + return + ( + this.CpuUsage == input.CpuUsage || + this.CpuUsage != null && + input.CpuUsage != null && + this.CpuUsage.SequenceEqual(input.CpuUsage) + ) && + ( + this.RamIndexingUsage == input.RamIndexingUsage || + this.RamIndexingUsage != null && + input.RamIndexingUsage != null && + this.RamIndexingUsage.SequenceEqual(input.RamIndexingUsage) + ) && + ( + this.RamSearchUsage == input.RamSearchUsage || + this.RamSearchUsage != null && + input.RamSearchUsage != null && + this.RamSearchUsage.SequenceEqual(input.RamSearchUsage) + ) && + ( + this.SsdUsage == input.SsdUsage || + this.SsdUsage != null && + input.SsdUsage != null && + this.SsdUsage.SequenceEqual(input.SsdUsage) + ) && + ( + this.AvgBuildTime == input.AvgBuildTime || + this.AvgBuildTime != null && + input.AvgBuildTime != null && + this.AvgBuildTime.SequenceEqual(input.AvgBuildTime) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.CpuUsage != null) + { + hashCode = (hashCode * 59) + this.CpuUsage.GetHashCode(); + } + if (this.RamIndexingUsage != null) + { + hashCode = (hashCode * 59) + this.RamIndexingUsage.GetHashCode(); + } + if (this.RamSearchUsage != null) + { + hashCode = (hashCode * 59) + this.RamSearchUsage.GetHashCode(); + } + if (this.SsdUsage != null) + { + hashCode = (hashCode * 59) + this.SsdUsage.GetHashCode(); + } + if (this.AvgBuildTime != null) + { + hashCode = (hashCode * 59) + this.AvgBuildTime.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Models/InventoryResponse.cs b/algoliasearch/Monitoring/Models/InventoryResponse.cs new file mode 100644 index 000000000..265d83a25 --- /dev/null +++ b/algoliasearch/Monitoring/Models/InventoryResponse.cs @@ -0,0 +1,124 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// InventoryResponse + /// + [DataContract(Name = "InventoryResponse")] + public partial class InventoryResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// inventory. + public InventoryResponse(List inventory = default(List)) + { + this.Inventory = inventory; + } + + /// + /// Gets or Sets Inventory + /// + [DataMember(Name = "inventory", EmitDefaultValue = false)] + public List Inventory { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class InventoryResponse {\n"); + sb.Append(" Inventory: ").Append(Inventory).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as InventoryResponse); + } + + /// + /// Returns true if InventoryResponse instances are equal + /// + /// Instance of InventoryResponse to be compared + /// Boolean + public bool Equals(InventoryResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Inventory == input.Inventory || + this.Inventory != null && + input.Inventory != null && + this.Inventory.SequenceEqual(input.Inventory) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Inventory != null) + { + hashCode = (hashCode * 59) + this.Inventory.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Models/LatencyResponse.cs b/algoliasearch/Monitoring/Models/LatencyResponse.cs new file mode 100644 index 000000000..cbf42dcad --- /dev/null +++ b/algoliasearch/Monitoring/Models/LatencyResponse.cs @@ -0,0 +1,123 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// LatencyResponse + /// + [DataContract(Name = "LatencyResponse")] + public partial class LatencyResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// metrics. + public LatencyResponse(LatencyResponseMetrics metrics = default(LatencyResponseMetrics)) + { + this.Metrics = metrics; + } + + /// + /// Gets or Sets Metrics + /// + [DataMember(Name = "metrics", EmitDefaultValue = false)] + public LatencyResponseMetrics Metrics { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LatencyResponse {\n"); + sb.Append(" Metrics: ").Append(Metrics).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as LatencyResponse); + } + + /// + /// Returns true if LatencyResponse instances are equal + /// + /// Instance of LatencyResponse to be compared + /// Boolean + public bool Equals(LatencyResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Metrics == input.Metrics || + (this.Metrics != null && + this.Metrics.Equals(input.Metrics)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Metrics != null) + { + hashCode = (hashCode * 59) + this.Metrics.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Models/LatencyResponseMetrics.cs b/algoliasearch/Monitoring/Models/LatencyResponseMetrics.cs new file mode 100644 index 000000000..41901bd63 --- /dev/null +++ b/algoliasearch/Monitoring/Models/LatencyResponseMetrics.cs @@ -0,0 +1,124 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// LatencyResponseMetrics + /// + [DataContract(Name = "LatencyResponse_metrics")] + public partial class LatencyResponseMetrics : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// latency. + public LatencyResponseMetrics(Dictionary> latency = default(Dictionary>)) + { + this.Latency = latency; + } + + /// + /// Gets or Sets Latency + /// + [DataMember(Name = "latency", EmitDefaultValue = false)] + public Dictionary> Latency { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LatencyResponseMetrics {\n"); + sb.Append(" Latency: ").Append(Latency).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as LatencyResponseMetrics); + } + + /// + /// Returns true if LatencyResponseMetrics instances are equal + /// + /// Instance of LatencyResponseMetrics to be compared + /// Boolean + public bool Equals(LatencyResponseMetrics input) + { + if (input == null) + { + return false; + } + return + ( + this.Latency == input.Latency || + this.Latency != null && + input.Latency != null && + this.Latency.SequenceEqual(input.Latency) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Latency != null) + { + hashCode = (hashCode * 59) + this.Latency.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Models/Metric.cs b/algoliasearch/Monitoring/Models/Metric.cs new file mode 100644 index 000000000..aa7d01f08 --- /dev/null +++ b/algoliasearch/Monitoring/Models/Metric.cs @@ -0,0 +1,66 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// Defines Metric + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum Metric + { + /// + /// Enum AvgBuildTime for value: avg_build_time + /// + [EnumMember(Value = "avg_build_time")] + AvgBuildTime = 1, + + /// + /// Enum SsdUsage for value: ssd_usage + /// + [EnumMember(Value = "ssd_usage")] + SsdUsage = 2, + + /// + /// Enum RamSearchUsage for value: ram_search_usage + /// + [EnumMember(Value = "ram_search_usage")] + RamSearchUsage = 3, + + /// + /// Enum RamIndexingUsage for value: ram_indexing_usage + /// + [EnumMember(Value = "ram_indexing_usage")] + RamIndexingUsage = 4, + + /// + /// Enum CpuUsage for value: cpu_usage + /// + [EnumMember(Value = "cpu_usage")] + CpuUsage = 5, + + /// + /// Enum Star for value: * + /// + [EnumMember(Value = "*")] + Star = 6 + } + +} diff --git a/algoliasearch/Monitoring/Models/Period.cs b/algoliasearch/Monitoring/Models/Period.cs new file mode 100644 index 000000000..e337bffc4 --- /dev/null +++ b/algoliasearch/Monitoring/Models/Period.cs @@ -0,0 +1,60 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// Defines Period + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum Period + { + /// + /// Enum Minute for value: minute + /// + [EnumMember(Value = "minute")] + Minute = 1, + + /// + /// Enum Hour for value: hour + /// + [EnumMember(Value = "hour")] + Hour = 2, + + /// + /// Enum Day for value: day + /// + [EnumMember(Value = "day")] + Day = 3, + + /// + /// Enum Week for value: week + /// + [EnumMember(Value = "week")] + Week = 4, + + /// + /// Enum Month for value: month + /// + [EnumMember(Value = "month")] + Month = 5 + } + +} diff --git a/algoliasearch/Monitoring/Models/ProbesMetric.cs b/algoliasearch/Monitoring/Models/ProbesMetric.cs new file mode 100644 index 000000000..b735d63e0 --- /dev/null +++ b/algoliasearch/Monitoring/Models/ProbesMetric.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// ProbesMetric + /// + [DataContract(Name = "ProbesMetric")] + public partial class ProbesMetric : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Timestamp in [Unix epoch time](https://wikipedia.org/wiki/Unix_time) in milliseconds.. + /// Value of the metric.. + public ProbesMetric(long t = default(long), int v = default(int)) + { + this.T = t; + this.V = v; + } + + /// + /// Timestamp in [Unix epoch time](https://wikipedia.org/wiki/Unix_time) in milliseconds. + /// + /// Timestamp in [Unix epoch time](https://wikipedia.org/wiki/Unix_time) in milliseconds. + [DataMember(Name = "t", EmitDefaultValue = false)] + public long T { get; set; } + + /// + /// Value of the metric. + /// + /// Value of the metric. + [DataMember(Name = "v", EmitDefaultValue = false)] + public int V { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ProbesMetric {\n"); + sb.Append(" T: ").Append(T).Append("\n"); + sb.Append(" V: ").Append(V).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ProbesMetric); + } + + /// + /// Returns true if ProbesMetric instances are equal + /// + /// Instance of ProbesMetric to be compared + /// Boolean + public bool Equals(ProbesMetric input) + { + if (input == null) + { + return false; + } + return + ( + this.T == input.T || + this.T.Equals(input.T) + ) && + ( + this.V == input.V || + this.V.Equals(input.V) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.T.GetHashCode(); + hashCode = (hashCode * 59) + this.V.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Models/Region.cs b/algoliasearch/Monitoring/Models/Region.cs new file mode 100644 index 000000000..d8bff3e9f --- /dev/null +++ b/algoliasearch/Monitoring/Models/Region.cs @@ -0,0 +1,121 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// The region where the cluster is located. + /// + /// The region where the cluster is located. + [JsonConverter(typeof(StringEnumConverter))] + public enum Region + { + /// + /// Enum Au for value: au + /// + [EnumMember(Value = "au")] + Au = 1, + + /// + /// Enum Br for value: br + /// + [EnumMember(Value = "br")] + Br = 2, + + /// + /// Enum Ca for value: ca + /// + [EnumMember(Value = "ca")] + Ca = 3, + + /// + /// Enum De for value: de + /// + [EnumMember(Value = "de")] + De = 4, + + /// + /// Enum Eu for value: eu + /// + [EnumMember(Value = "eu")] + Eu = 5, + + /// + /// Enum Hk for value: hk + /// + [EnumMember(Value = "hk")] + Hk = 6, + + /// + /// Enum In for value: in + /// + [EnumMember(Value = "in")] + In = 7, + + /// + /// Enum Jp for value: jp + /// + [EnumMember(Value = "jp")] + Jp = 8, + + /// + /// Enum Sg for value: sg + /// + [EnumMember(Value = "sg")] + Sg = 9, + + /// + /// Enum Uae for value: uae + /// + [EnumMember(Value = "uae")] + Uae = 10, + + /// + /// Enum Uk for value: uk + /// + [EnumMember(Value = "uk")] + Uk = 11, + + /// + /// Enum Usc for value: usc + /// + [EnumMember(Value = "usc")] + Usc = 12, + + /// + /// Enum Use for value: use + /// + [EnumMember(Value = "use")] + Use = 13, + + /// + /// Enum Usw for value: usw + /// + [EnumMember(Value = "usw")] + Usw = 14, + + /// + /// Enum Za for value: za + /// + [EnumMember(Value = "za")] + Za = 15 + } + +} diff --git a/algoliasearch/Monitoring/Models/Server.cs b/algoliasearch/Monitoring/Models/Server.cs new file mode 100644 index 000000000..84cfcedf9 --- /dev/null +++ b/algoliasearch/Monitoring/Models/Server.cs @@ -0,0 +1,216 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// Server + /// + [DataContract(Name = "Server")] + public partial class Server : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Region + /// + [DataMember(Name = "region", EmitDefaultValue = false)] + public Region? Region { get; set; } + + /// + /// Gets or Sets Status + /// + [DataMember(Name = "status", EmitDefaultValue = false)] + public ServerStatus? Status { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", EmitDefaultValue = false)] + public Type? Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Server name.. + /// region. + /// Included to support legacy applications. Do not rely on this attribute being present in the response. Use `is_replica` instead. (default to false). + /// Indicates whether this server is a replica of another server. (default to false). + /// Name of the cluster to which this server belongs.. + /// status. + /// type. + public Server(string name = default(string), Region? region = default(Region?), bool isSlave = false, bool isReplica = false, string cluster = default(string), ServerStatus? status = default(ServerStatus?), Type? type = default(Type?)) + { + this.Name = name; + this.Region = region; + this.IsSlave = isSlave; + this.IsReplica = isReplica; + this.Cluster = cluster; + this.Status = status; + this.Type = type; + } + + /// + /// Server name. + /// + /// Server name. + [DataMember(Name = "name", EmitDefaultValue = false)] + public string Name { get; set; } + + /// + /// Included to support legacy applications. Do not rely on this attribute being present in the response. Use `is_replica` instead. + /// + /// Included to support legacy applications. Do not rely on this attribute being present in the response. Use `is_replica` instead. + [DataMember(Name = "is_slave", EmitDefaultValue = true)] + [Obsolete] + public bool IsSlave { get; set; } + + /// + /// Indicates whether this server is a replica of another server. + /// + /// Indicates whether this server is a replica of another server. + [DataMember(Name = "is_replica", EmitDefaultValue = true)] + public bool IsReplica { get; set; } + + /// + /// Name of the cluster to which this server belongs. + /// + /// Name of the cluster to which this server belongs. + [DataMember(Name = "cluster", EmitDefaultValue = false)] + public string Cluster { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Server {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Region: ").Append(Region).Append("\n"); + sb.Append(" IsSlave: ").Append(IsSlave).Append("\n"); + sb.Append(" IsReplica: ").Append(IsReplica).Append("\n"); + sb.Append(" Cluster: ").Append(Cluster).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Server); + } + + /// + /// Returns true if Server instances are equal + /// + /// Instance of Server to be compared + /// Boolean + public bool Equals(Server input) + { + if (input == null) + { + return false; + } + return + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.Region == input.Region || + this.Region.Equals(input.Region) + ) && + ( + this.IsSlave == input.IsSlave || + this.IsSlave.Equals(input.IsSlave) + ) && + ( + this.IsReplica == input.IsReplica || + this.IsReplica.Equals(input.IsReplica) + ) && + ( + this.Cluster == input.Cluster || + (this.Cluster != null && + this.Cluster.Equals(input.Cluster)) + ) && + ( + this.Status == input.Status || + this.Status.Equals(input.Status) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Region.GetHashCode(); + hashCode = (hashCode * 59) + this.IsSlave.GetHashCode(); + hashCode = (hashCode * 59) + this.IsReplica.GetHashCode(); + if (this.Cluster != null) + { + hashCode = (hashCode * 59) + this.Cluster.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Status.GetHashCode(); + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Models/ServerStatus.cs b/algoliasearch/Monitoring/Models/ServerStatus.cs new file mode 100644 index 000000000..6c4854cd4 --- /dev/null +++ b/algoliasearch/Monitoring/Models/ServerStatus.cs @@ -0,0 +1,36 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// Defines ServerStatus + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ServerStatus + { + /// + /// Enum PRODUCTION for value: PRODUCTION + /// + [EnumMember(Value = "PRODUCTION")] + PRODUCTION = 1 + } + +} diff --git a/algoliasearch/Monitoring/Models/Status.cs b/algoliasearch/Monitoring/Models/Status.cs new file mode 100644 index 000000000..ea8079d4e --- /dev/null +++ b/algoliasearch/Monitoring/Models/Status.cs @@ -0,0 +1,55 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// Status of the cluster. + /// + /// Status of the cluster. + [JsonConverter(typeof(StringEnumConverter))] + public enum Status + { + /// + /// Enum Operational for value: operational + /// + [EnumMember(Value = "operational")] + Operational = 1, + + /// + /// Enum DegradedPerformance for value: degraded_performance + /// + [EnumMember(Value = "degraded_performance")] + DegradedPerformance = 2, + + /// + /// Enum PartialOutage for value: partial_outage + /// + [EnumMember(Value = "partial_outage")] + PartialOutage = 3, + + /// + /// Enum MajorOutage for value: major_outage + /// + [EnumMember(Value = "major_outage")] + MajorOutage = 4 + } + +} diff --git a/algoliasearch/Monitoring/Models/StatusResponse.cs b/algoliasearch/Monitoring/Models/StatusResponse.cs new file mode 100644 index 000000000..49b1211e3 --- /dev/null +++ b/algoliasearch/Monitoring/Models/StatusResponse.cs @@ -0,0 +1,124 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// StatusResponse + /// + [DataContract(Name = "StatusResponse")] + public partial class StatusResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// status. + public StatusResponse(Dictionary status = default(Dictionary)) + { + this.Status = status; + } + + /// + /// Gets or Sets Status + /// + [DataMember(Name = "status", EmitDefaultValue = false)] + public Dictionary Status { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class StatusResponse {\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as StatusResponse); + } + + /// + /// Returns true if StatusResponse instances are equal + /// + /// Instance of StatusResponse to be compared + /// Boolean + public bool Equals(StatusResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Status == input.Status || + this.Status != null && + input.Status != null && + this.Status.SequenceEqual(input.Status) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Status != null) + { + hashCode = (hashCode * 59) + this.Status.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Models/TimeInner.cs b/algoliasearch/Monitoring/Models/TimeInner.cs new file mode 100644 index 000000000..c8335b626 --- /dev/null +++ b/algoliasearch/Monitoring/Models/TimeInner.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// TimeInner + /// + [DataContract(Name = "Time_inner")] + public partial class TimeInner : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Timestamp in [Unix epoch time](https://wikipedia.org/wiki/Unix_time) in milliseconds.. + /// Time in ms.. + public TimeInner(long t = default(long), int v = default(int)) + { + this.T = t; + this.V = v; + } + + /// + /// Timestamp in [Unix epoch time](https://wikipedia.org/wiki/Unix_time) in milliseconds. + /// + /// Timestamp in [Unix epoch time](https://wikipedia.org/wiki/Unix_time) in milliseconds. + [DataMember(Name = "t", EmitDefaultValue = false)] + public long T { get; set; } + + /// + /// Time in ms. + /// + /// Time in ms. + [DataMember(Name = "v", EmitDefaultValue = false)] + public int V { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TimeInner {\n"); + sb.Append(" T: ").Append(T).Append("\n"); + sb.Append(" V: ").Append(V).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TimeInner); + } + + /// + /// Returns true if TimeInner instances are equal + /// + /// Instance of TimeInner to be compared + /// Boolean + public bool Equals(TimeInner input) + { + if (input == null) + { + return false; + } + return + ( + this.T == input.T || + this.T.Equals(input.T) + ) && + ( + this.V == input.V || + this.V.Equals(input.V) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.T.GetHashCode(); + hashCode = (hashCode * 59) + this.V.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Monitoring/Models/Type.cs b/algoliasearch/Monitoring/Models/Type.cs new file mode 100644 index 000000000..43fb08a4a --- /dev/null +++ b/algoliasearch/Monitoring/Models/Type.cs @@ -0,0 +1,36 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Monitoring.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Monitoring.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Monitoring.Models +{ + /// + /// Defines Type + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum Type + { + /// + /// Enum Cluster for value: cluster + /// + [EnumMember(Value = "cluster")] + Cluster = 1 + } + +} diff --git a/algoliasearch/Personalization/Api/PersonalizationClient.cs b/algoliasearch/Personalization/Api/PersonalizationClient.cs new file mode 100644 index 000000000..92f54fd25 --- /dev/null +++ b/algoliasearch/Personalization/Api/PersonalizationClient.cs @@ -0,0 +1,1587 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Mime; +using Algolia.Search.Personalization.Client; +using Algolia.Search.Personalization.Models; + +namespace Algolia.Search.Personalization.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IPersonalizationClient + { + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete a user profile. + /// + /// + /// Delete the user profile and all its associated data. Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile. It might take a couple hours for the deletion request to be fully processed. + /// + /// Thrown when fails to make API call + /// userToken representing the user for which to fetch the Personalization profile. + /// Cancellation Token to cancel the request. + /// Task of DeleteUserProfileResponse + System.Threading.Tasks.Task DeleteUserProfileAsync(string userToken, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete a user profile. + /// + /// + /// Delete the user profile and all its associated data. Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile. It might take a couple hours for the deletion request to be fully processed. + /// + /// Thrown when fails to make API call + /// userToken representing the user for which to fetch the Personalization profile. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeleteUserProfileResponse) + System.Threading.Tasks.Task> DeleteUserProfileWithHttpInfoAsync(string userToken, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get the current strategy. + /// + /// + /// The strategy contains information on the events and facets that impact user profiles and personalized search results. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of PersonalizationStrategyParams + System.Threading.Tasks.Task GetPersonalizationStrategyAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get the current strategy. + /// + /// + /// The strategy contains information on the events and facets that impact user profiles and personalized search results. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (PersonalizationStrategyParams) + System.Threading.Tasks.Task> GetPersonalizationStrategyWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a user profile. + /// + /// + /// Get the user profile built from Personalization strategy. The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes. + /// + /// Thrown when fails to make API call + /// userToken representing the user for which to fetch the Personalization profile. + /// Cancellation Token to cancel the request. + /// Task of GetUserTokenResponse + System.Threading.Tasks.Task GetUserTokenProfileAsync(string userToken, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a user profile. + /// + /// + /// Get the user profile built from Personalization strategy. The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes. + /// + /// Thrown when fails to make API call + /// userToken representing the user for which to fetch the Personalization profile. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetUserTokenResponse) + System.Threading.Tasks.Task> GetUserTokenProfileWithHttpInfoAsync(string userToken, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Set a new strategy. + /// + /// + /// A strategy defines the events and facets that impact user profiles and personalized search results. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of SetPersonalizationStrategyResponse + System.Threading.Tasks.Task SetPersonalizationStrategyAsync(PersonalizationStrategyParams personalizationStrategyParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Set a new strategy. + /// + /// + /// A strategy defines the events and facets that impact user profiles and personalized search results. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SetPersonalizationStrategyResponse) + System.Threading.Tasks.Task> SetPersonalizationStrategyWithHttpInfoAsync(PersonalizationStrategyParams personalizationStrategyParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } + + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class PersonalizationClient : IDisposable, IPersonalizationClient + { + private Algolia.Search.Personalization.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// + public PersonalizationClient() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + /// + public PersonalizationClient(string basePath) + { + this.Configuration = Algolia.Search.Personalization.Client.Configuration.MergeConfigurations( + Algolia.Search.Personalization.Client.GlobalConfiguration.Instance, + new Algolia.Search.Personalization.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.Personalization.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.Personalization.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// An instance of Configuration. + /// + /// + public PersonalizationClient(Algolia.Search.Personalization.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Algolia.Search.Personalization.Client.Configuration.MergeConfigurations( + Algolia.Search.Personalization.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.Personalization.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.Personalization.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public PersonalizationClient(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public PersonalizationClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.Personalization.Client.Configuration.MergeConfigurations( + Algolia.Search.Personalization.Client.GlobalConfiguration.Instance, + new Algolia.Search.Personalization.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.Personalization.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.Personalization.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// + /// An instance of HttpClient. + /// An instance of Configuration. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public PersonalizationClient(HttpClient client, Algolia.Search.Personalization.Client.Configuration configuration, HttpClientHandler handler = null) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.Personalization.Client.Configuration.MergeConfigurations( + Algolia.Search.Personalization.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.Personalization.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.Personalization.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + /// + public PersonalizationClient(Algolia.Search.Personalization.Client.ISynchronousClient client, Algolia.Search.Personalization.Client.IAsynchronousClient asyncClient, Algolia.Search.Personalization.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Algolia.Search.Personalization.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + this.ApiClient?.Dispose(); + } + + /// + /// Holds the ApiClient if created + /// + public Algolia.Search.Personalization.Client.ApiClient ApiClient { get; set; } = null; + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Algolia.Search.Personalization.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Algolia.Search.Personalization.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Algolia.Search.Personalization.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Algolia.Search.Personalization.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Del(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.Personalization.Client.ApiResponse localVarResponse = DelWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.Personalization.Client.ApiResponse DelWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Personalization.Client.ApiException(400, "Missing required parameter 'path' when calling PersonalizationClient->Del"); + + Algolia.Search.Personalization.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Personalization.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Personalization.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Personalization.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Personalization.Client.ApiResponse localVarResponse = await DelWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Personalization.Client.ApiException(400, "Missing required parameter 'path' when calling PersonalizationClient->Del"); + + + Algolia.Search.Personalization.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Personalization.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Personalization.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Personalization.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a user profile. Delete the user profile and all its associated data. Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile. It might take a couple hours for the deletion request to be fully processed. + /// + /// Thrown when fails to make API call + /// userToken representing the user for which to fetch the Personalization profile. + /// DeleteUserProfileResponse + public DeleteUserProfileResponse DeleteUserProfile(string userToken) + { + Algolia.Search.Personalization.Client.ApiResponse localVarResponse = DeleteUserProfileWithHttpInfo(userToken); + return localVarResponse.Data; + } + + /// + /// Delete a user profile. Delete the user profile and all its associated data. Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile. It might take a couple hours for the deletion request to be fully processed. + /// + /// Thrown when fails to make API call + /// userToken representing the user for which to fetch the Personalization profile. + /// ApiResponse of DeleteUserProfileResponse + public Algolia.Search.Personalization.Client.ApiResponse DeleteUserProfileWithHttpInfo(string userToken) + { + // verify the required parameter 'userToken' is set + if (userToken == null) + throw new Algolia.Search.Personalization.Client.ApiException(400, "Missing required parameter 'userToken' when calling PersonalizationClient->DeleteUserProfile"); + + Algolia.Search.Personalization.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Personalization.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("userToken", Algolia.Search.Personalization.Client.ClientUtils.ParameterToString(userToken)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1/profiles/{userToken}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteUserProfile", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a user profile. Delete the user profile and all its associated data. Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile. It might take a couple hours for the deletion request to be fully processed. + /// + /// Thrown when fails to make API call + /// userToken representing the user for which to fetch the Personalization profile. + /// Cancellation Token to cancel the request. + /// Task of DeleteUserProfileResponse + public async System.Threading.Tasks.Task DeleteUserProfileAsync(string userToken, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Personalization.Client.ApiResponse localVarResponse = await DeleteUserProfileWithHttpInfoAsync(userToken, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete a user profile. Delete the user profile and all its associated data. Returns, as part of the response, a date until which the data can safely be considered as deleted for the given user. This means if you send events for the given user before this date, they will be ignored. Any data received after the deletedUntil date will start building a new user profile. It might take a couple hours for the deletion request to be fully processed. + /// + /// Thrown when fails to make API call + /// userToken representing the user for which to fetch the Personalization profile. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeleteUserProfileResponse) + public async System.Threading.Tasks.Task> DeleteUserProfileWithHttpInfoAsync(string userToken, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'userToken' is set + if (userToken == null) + throw new Algolia.Search.Personalization.Client.ApiException(400, "Missing required parameter 'userToken' when calling PersonalizationClient->DeleteUserProfile"); + + + Algolia.Search.Personalization.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Personalization.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("userToken", Algolia.Search.Personalization.Client.ClientUtils.ParameterToString(userToken)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1/profiles/{userToken}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteUserProfile", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Get(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.Personalization.Client.ApiResponse localVarResponse = GetWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.Personalization.Client.ApiResponse GetWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Personalization.Client.ApiException(400, "Missing required parameter 'path' when calling PersonalizationClient->Get"); + + Algolia.Search.Personalization.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Personalization.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Personalization.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Personalization.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Personalization.Client.ApiResponse localVarResponse = await GetWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Personalization.Client.ApiException(400, "Missing required parameter 'path' when calling PersonalizationClient->Get"); + + + Algolia.Search.Personalization.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Personalization.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Personalization.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Personalization.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get the current strategy. The strategy contains information on the events and facets that impact user profiles and personalized search results. + /// + /// Thrown when fails to make API call + /// PersonalizationStrategyParams + public PersonalizationStrategyParams GetPersonalizationStrategy() + { + Algolia.Search.Personalization.Client.ApiResponse localVarResponse = GetPersonalizationStrategyWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Get the current strategy. The strategy contains information on the events and facets that impact user profiles and personalized search results. + /// + /// Thrown when fails to make API call + /// ApiResponse of PersonalizationStrategyParams + public Algolia.Search.Personalization.Client.ApiResponse GetPersonalizationStrategyWithHttpInfo() + { + Algolia.Search.Personalization.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Personalization.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/strategies/personalization", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetPersonalizationStrategy", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get the current strategy. The strategy contains information on the events and facets that impact user profiles and personalized search results. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of PersonalizationStrategyParams + public async System.Threading.Tasks.Task GetPersonalizationStrategyAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Personalization.Client.ApiResponse localVarResponse = await GetPersonalizationStrategyWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get the current strategy. The strategy contains information on the events and facets that impact user profiles and personalized search results. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (PersonalizationStrategyParams) + public async System.Threading.Tasks.Task> GetPersonalizationStrategyWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Personalization.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Personalization.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/strategies/personalization", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetPersonalizationStrategy", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a user profile. Get the user profile built from Personalization strategy. The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes. + /// + /// Thrown when fails to make API call + /// userToken representing the user for which to fetch the Personalization profile. + /// GetUserTokenResponse + public GetUserTokenResponse GetUserTokenProfile(string userToken) + { + Algolia.Search.Personalization.Client.ApiResponse localVarResponse = GetUserTokenProfileWithHttpInfo(userToken); + return localVarResponse.Data; + } + + /// + /// Get a user profile. Get the user profile built from Personalization strategy. The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes. + /// + /// Thrown when fails to make API call + /// userToken representing the user for which to fetch the Personalization profile. + /// ApiResponse of GetUserTokenResponse + public Algolia.Search.Personalization.Client.ApiResponse GetUserTokenProfileWithHttpInfo(string userToken) + { + // verify the required parameter 'userToken' is set + if (userToken == null) + throw new Algolia.Search.Personalization.Client.ApiException(400, "Missing required parameter 'userToken' when calling PersonalizationClient->GetUserTokenProfile"); + + Algolia.Search.Personalization.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Personalization.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("userToken", Algolia.Search.Personalization.Client.ClientUtils.ParameterToString(userToken)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/profiles/personalization/{userToken}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetUserTokenProfile", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a user profile. Get the user profile built from Personalization strategy. The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes. + /// + /// Thrown when fails to make API call + /// userToken representing the user for which to fetch the Personalization profile. + /// Cancellation Token to cancel the request. + /// Task of GetUserTokenResponse + public async System.Threading.Tasks.Task GetUserTokenProfileAsync(string userToken, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Personalization.Client.ApiResponse localVarResponse = await GetUserTokenProfileWithHttpInfoAsync(userToken, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a user profile. Get the user profile built from Personalization strategy. The profile is structured by facet name used in the strategy. Each facet value is mapped to its score. Each score represents the user affinity for a specific facet value given the userToken past events and the Personalization strategy defined. Scores are bounded to 20. The last processed event timestamp is provided using the ISO 8601 format for debugging purposes. + /// + /// Thrown when fails to make API call + /// userToken representing the user for which to fetch the Personalization profile. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetUserTokenResponse) + public async System.Threading.Tasks.Task> GetUserTokenProfileWithHttpInfoAsync(string userToken, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'userToken' is set + if (userToken == null) + throw new Algolia.Search.Personalization.Client.ApiException(400, "Missing required parameter 'userToken' when calling PersonalizationClient->GetUserTokenProfile"); + + + Algolia.Search.Personalization.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Personalization.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("userToken", Algolia.Search.Personalization.Client.ClientUtils.ParameterToString(userToken)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/profiles/personalization/{userToken}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetUserTokenProfile", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Post(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.Personalization.Client.ApiResponse localVarResponse = PostWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.Personalization.Client.ApiResponse PostWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Personalization.Client.ApiException(400, "Missing required parameter 'path' when calling PersonalizationClient->Post"); + + Algolia.Search.Personalization.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Personalization.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Personalization.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Personalization.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Personalization.Client.ApiResponse localVarResponse = await PostWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Personalization.Client.ApiException(400, "Missing required parameter 'path' when calling PersonalizationClient->Post"); + + + Algolia.Search.Personalization.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Personalization.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Personalization.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Personalization.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Put(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.Personalization.Client.ApiResponse localVarResponse = PutWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.Personalization.Client.ApiResponse PutWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Personalization.Client.ApiException(400, "Missing required parameter 'path' when calling PersonalizationClient->Put"); + + Algolia.Search.Personalization.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Personalization.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Personalization.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Personalization.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Personalization.Client.ApiResponse localVarResponse = await PutWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Personalization.Client.ApiException(400, "Missing required parameter 'path' when calling PersonalizationClient->Put"); + + + Algolia.Search.Personalization.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Personalization.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Personalization.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Personalization.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Set a new strategy. A strategy defines the events and facets that impact user profiles and personalized search results. + /// + /// Thrown when fails to make API call + /// + /// SetPersonalizationStrategyResponse + public SetPersonalizationStrategyResponse SetPersonalizationStrategy(PersonalizationStrategyParams personalizationStrategyParams) + { + Algolia.Search.Personalization.Client.ApiResponse localVarResponse = SetPersonalizationStrategyWithHttpInfo(personalizationStrategyParams); + return localVarResponse.Data; + } + + /// + /// Set a new strategy. A strategy defines the events and facets that impact user profiles and personalized search results. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of SetPersonalizationStrategyResponse + public Algolia.Search.Personalization.Client.ApiResponse SetPersonalizationStrategyWithHttpInfo(PersonalizationStrategyParams personalizationStrategyParams) + { + // verify the required parameter 'personalizationStrategyParams' is set + if (personalizationStrategyParams == null) + throw new Algolia.Search.Personalization.Client.ApiException(400, "Missing required parameter 'personalizationStrategyParams' when calling PersonalizationClient->SetPersonalizationStrategy"); + + Algolia.Search.Personalization.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Personalization.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = personalizationStrategyParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/strategies/personalization", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SetPersonalizationStrategy", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Set a new strategy. A strategy defines the events and facets that impact user profiles and personalized search results. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of SetPersonalizationStrategyResponse + public async System.Threading.Tasks.Task SetPersonalizationStrategyAsync(PersonalizationStrategyParams personalizationStrategyParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Personalization.Client.ApiResponse localVarResponse = await SetPersonalizationStrategyWithHttpInfoAsync(personalizationStrategyParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Set a new strategy. A strategy defines the events and facets that impact user profiles and personalized search results. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SetPersonalizationStrategyResponse) + public async System.Threading.Tasks.Task> SetPersonalizationStrategyWithHttpInfoAsync(PersonalizationStrategyParams personalizationStrategyParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'personalizationStrategyParams' is set + if (personalizationStrategyParams == null) + throw new Algolia.Search.Personalization.Client.ApiException(400, "Missing required parameter 'personalizationStrategyParams' when calling PersonalizationClient->SetPersonalizationStrategy"); + + + Algolia.Search.Personalization.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Personalization.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Personalization.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = personalizationStrategyParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/strategies/personalization", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SetPersonalizationStrategy", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + } +} diff --git a/algoliasearch/Personalization/Client/ApiClient.cs b/algoliasearch/Personalization/Client/ApiClient.cs new file mode 100644 index 000000000..64993bf46 --- /dev/null +++ b/algoliasearch/Personalization/Client/ApiClient.cs @@ -0,0 +1,736 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs; +using System.Net.Http; +using System.Net.Http.Headers; + +namespace Algolia.Search.Personalization.Client +{ + /// + /// To Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec + { + private readonly IReadableConfiguration _configuration; + private static readonly string _contentType = "application/json"; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is Algolia.Search.Personalization.Models.AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((Algolia.Search.Personalization.Models.AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public async Task Deserialize(HttpResponseMessage response) + { + var result = (T)await Deserialize(response, typeof(T)).ConfigureAwait(false); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal async Task Deserialize(HttpResponseMessage response, Type type) + { + IList headers = response.Headers.Select(x => x.Key + "=" + x.Value).ToList(); + + if (type == typeof(byte[])) // return byte array + { + return await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + } + else if (type == typeof(FileParameter)) + { + return new FileParameter(await response.Content.ReadAsStreamAsync().ConfigureAwait(false)); + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + if (headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + File.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(await response.Content.ReadAsStringAsync().ConfigureAwait(false), null, System.Globalization.DateTimeStyles.RoundtripKind); + } + + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public string RootElement { get; set; } + public string Namespace { get; set; } + public string DateFormat { get; set; } + + public string ContentType + { + get { return _contentType; } + set { throw new InvalidOperationException("Not allowed to set content type."); } + } + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + /// + /// The Dispose method will manage the HttpClient lifecycle when not passed by constructor. + /// + public partial class ApiClient : IDisposable, ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + + private readonly HttpClientHandler _httpClientHandler; + private readonly HttpClient _httpClient; + private readonly bool _disposeClient; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + public ApiClient() : + this(Algolia.Search.Personalization.Client.GlobalConfiguration.Instance.BasePath) + { + } + + /// + /// Initializes a new instance of the . + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = new HttpClientHandler(); + _httpClient = new HttpClient(_httpClientHandler, true); + _disposeClient = true; + _baseUrl = basePath; + } + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, HttpClientHandler handler = null) : + this(client, Algolia.Search.Personalization.Client.GlobalConfiguration.Instance.BasePath, handler) + { + } + + /// + /// Initializes a new instance of the . + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client cannot be null"); + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = handler; + _httpClient = client; + _baseUrl = basePath; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + if (_disposeClient) + { + _httpClient.Dispose(); + } + } + + /// Prepares multipart/form-data content + HttpContent PrepareMultipartFormDataContent(RequestOptions options) + { + string boundary = "---------" + Guid.NewGuid().ToString().ToUpperInvariant(); + var multipartContent = new MultipartFormDataContent(boundary); + foreach (var formParameter in options.FormParameters) + { + multipartContent.Add(new StringContent(formParameter.Value), formParameter.Key); + } + + if (options.FileParameters != null && options.FileParameters.Count > 0) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var content = new StreamContent(file.Content); + content.Headers.ContentType = new MediaTypeHeaderValue(file.ContentType); + multipartContent.Add(content, fileParam.Key, file.Name); + } + } + } + return multipartContent; + } + + /// + /// Provides all logic for constructing a new HttpRequestMessage. + /// At this point, all information for querying the service is known. Here, it is simply + /// mapped into the a HttpRequestMessage. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// [private] A new HttpRequestMessage instance. + /// + private HttpRequestMessage NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + WebRequestPathBuilder builder = new WebRequestPathBuilder(_baseUrl, path); + + builder.AddPathParameters(options.PathParameters); + + builder.AddQueryParameters(options.QueryParameters); + + HttpRequestMessage request = new HttpRequestMessage(method, builder.GetFullUri()); + + if (configuration.UserAgent != null) + { + request.Headers.TryAddWithoutValidation("User-Agent", configuration.UserAgent); + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.Headers.Add(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + // Todo make content headers actually content headers + request.Headers.TryAddWithoutValidation(headerParam.Key, value); + } + } + } + + List> contentList = new List>(); + + string contentType = null; + if (options.HeaderParameters != null && options.HeaderParameters.ContainsKey("Content-Type")) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes.FirstOrDefault(); + } + + if (contentType == "multipart/form-data") + { + request.Content = PrepareMultipartFormDataContent(options); + } + else if (contentType == "application/x-www-form-urlencoded") + { + request.Content = new FormUrlEncodedContent(options.FormParameters); + } + else + { + if (options.Data != null) + { + if (options.Data is FileParameter fp) + { + contentType = contentType ?? "application/octet-stream"; + + var streamContent = new StreamContent(fp.Content); + streamContent.Headers.ContentType = new MediaTypeHeaderValue(contentType); + request.Content = streamContent; + } + else + { + var serializer = new CustomJsonCodec(SerializerSettings, configuration); + request.Content = new StringContent(serializer.Serialize(options.Data), new UTF8Encoding(), + "application/json"); + } + } + } + + + + // TODO provide an alternative that allows cookies per request instead of per API client + if (options.Cookies != null && options.Cookies.Count > 0) + { + request.Properties["CookieContainer"] = options.Cookies; + } + + return request; + } + + partial void InterceptRequest(HttpRequestMessage req); + partial void InterceptResponse(HttpRequestMessage req, HttpResponseMessage response); + + private async Task> ToApiResponse(HttpResponseMessage response, object responseData, Uri uri) + { + T result = (T)responseData; + string rawContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ReasonPhrase, + Cookies = new List() + }; + + // process response headers, e.g. Access-Control-Allow-Methods + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + // process response content headers, e.g. Content-Type + if (response.Content.Headers != null) + { + foreach (var responseHeader in response.Content.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (_httpClientHandler != null && response != null) + { + try + { + foreach (Cookie cookie in _httpClientHandler.CookieContainer.GetCookies(uri)) + { + transformed.Cookies.Add(cookie); + } + } + catch (PlatformNotSupportedException) { } + } + + return transformed; + } + + private ApiResponse Exec(HttpRequestMessage req, IReadableConfiguration configuration) + { + return ExecAsync(req, configuration).GetAwaiter().GetResult(); + } + + private async Task> ExecAsync(HttpRequestMessage req, + IReadableConfiguration configuration, + System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + CancellationTokenSource timeoutTokenSource = null; + CancellationTokenSource finalTokenSource = null; + var deserializer = new CustomJsonCodec(SerializerSettings, configuration); + var finalToken = cancellationToken; + + try + { + if (configuration.Timeout > 0) + { + timeoutTokenSource = new CancellationTokenSource(configuration.Timeout); + finalTokenSource = CancellationTokenSource.CreateLinkedTokenSource(finalToken, timeoutTokenSource.Token); + finalToken = finalTokenSource.Token; + } + + if (configuration.Proxy != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Configuration `Proxy` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + _httpClientHandler.Proxy = configuration.Proxy; + } + + var cookieContainer = req.Properties.ContainsKey("CookieContainer") ? req.Properties["CookieContainer"] as List : null; + + if (cookieContainer != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Request property `CookieContainer` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + foreach (var cookie in cookieContainer) + { + _httpClientHandler.CookieContainer.Add(cookie); + } + } + + InterceptRequest(req); + + HttpResponseMessage response; + response = await _httpClient.SendAsync(req, finalToken).ConfigureAwait(false); + + if (!response.IsSuccessStatusCode) + { + return await ToApiResponse(response, default(T), req.RequestUri).ConfigureAwait(false); + } + + object responseData = await deserializer.Deserialize(response).ConfigureAwait(false); + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(Algolia.Search.Personalization.Models.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + responseData = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + else if (typeof(T).Name == "Stream") // for binary response + { + responseData = (T)(object)await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + } + + InterceptResponse(req, response); + + return await ToApiResponse(response, responseData, req.RequestUri).ConfigureAwait(false); + } + catch (OperationCanceledException original) + { + if (timeoutTokenSource != null && timeoutTokenSource.IsCancellationRequested) + { + throw new TaskCanceledException($"[{req.Method}] {req.RequestUri} was timeout.", + new TimeoutException(original.Message, original)); + } + throw; + } + finally + { + if (timeoutTokenSource != null) + { + timeoutTokenSource.Dispose(); + } + + if (finalTokenSource != null) + { + finalTokenSource.Dispose(); + } + } + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(new HttpMethod("PATCH"), path, options, config), config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(new HttpMethod("PATCH"), path, options, config), config); + } + #endregion ISynchronousClient + } +} diff --git a/algoliasearch/Personalization/Client/ApiException.cs b/algoliasearch/Personalization/Client/ApiException.cs new file mode 100644 index 000000000..9fcbc9134 --- /dev/null +++ b/algoliasearch/Personalization/Client/ApiException.cs @@ -0,0 +1,62 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.Personalization.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// Gets or sets the error code (HTTP status code) + /// + /// The error code (HTTP status code). + public int ErrorCode { get; set; } + + /// + /// Gets or sets the error content (body json object) + /// + /// The error content (Http response body). + public object ErrorContent { get; private set; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public ApiException() { } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + public ApiException(int errorCode, string message) : base(message) + { + this.ErrorCode = errorCode; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + /// Error content. + /// HTTP Headers. + public ApiException(int errorCode, string message, object errorContent = null, Multimap headers = null) : base(message) + { + this.ErrorCode = errorCode; + this.ErrorContent = errorContent; + this.Headers = headers; + } + } + +} diff --git a/algoliasearch/Personalization/Client/ApiResponse.cs b/algoliasearch/Personalization/Client/ApiResponse.cs new file mode 100644 index 000000000..47598c45d --- /dev/null +++ b/algoliasearch/Personalization/Client/ApiResponse.cs @@ -0,0 +1,160 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; + +namespace Algolia.Search.Personalization.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public interface IApiResponse + { + /// + /// The data type of + /// + Type ResponseType { get; } + + /// + /// The content of this response + /// + Object Content { get; } + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + Multimap Headers { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + List Cookies { get; set; } + + /// + /// The raw content of this response + /// + string RawContent { get; } + } + + /// + /// API Response + /// + public class ApiResponse : IApiResponse + { + #region Properties + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; } + + /// + /// Gets or sets the data (parsed HTTP body) + /// + /// The data. + public T Data { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + public string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + public List Cookies { get; set; } + + /// + /// The content of this response + /// + public Type ResponseType + { + get { return typeof(T); } + } + + /// + /// The data type of + /// + public object Content + { + get { return Data; } + } + + /// + /// The raw content + /// + public string RawContent { get; } + + #endregion Properties + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data, string rawContent) + { + StatusCode = statusCode; + Headers = headers; + Data = data; + RawContent = rawContent; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) : this(statusCode, headers, data, null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null) + { + } + + #endregion Constructors + } +} diff --git a/algoliasearch/Personalization/Client/ClientUtils.cs b/algoliasearch/Personalization/Client/ClientUtils.cs new file mode 100644 index 000000000..d4a13c3c7 --- /dev/null +++ b/algoliasearch/Personalization/Client/ClientUtils.cs @@ -0,0 +1,244 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; + +namespace Algolia.Search.Personalization.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// Convert params to key/value pairs. + /// Use collectionFormat to properly format lists and collections. + /// + /// The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi + /// Key name. + /// Value object. + /// A multimap of keys with 1..n associated values. + public static Multimap ParameterToMultiMap(string collectionFormat, string name, object value) + { + var parameters = new Multimap(); + + if (value is ICollection collection && collectionFormat == "multi") + { + foreach (var item in collection) + { + parameters.Add(name, ParameterToString(item)); + } + } + else if (value is IDictionary dictionary) + { + if (collectionFormat == "deepObject") + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value)); + } + } + else + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value)); + } + } + } + else + { + parameters.Add(name, ParameterToString(value)); + } + + return parameters; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// An optional configuration instance, providing formatting options used in processing. + /// Formatted string. + public static string ParameterToString(object obj, IReadableConfiguration configuration = null) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is bool boolean) + return boolean ? "true" : "false"; + if (obj is ICollection collection) + { + List entries = new List(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry, configuration)); + return string.Join(",", entries); + } + if (obj is Enum && HasEnumMemberAttrValue(obj)) + return GetEnumMemberAttrValue(obj); + + return Convert.ToString(obj, CultureInfo.InvariantCulture); + } + + /// + /// Serializes the given object when not null. Otherwise return null. + /// + /// The object to serialize. + /// Serialized string. + public static string Serialize(object obj) + { + return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null; + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Is the Enum decorated with EnumMember Attribute + /// + /// + /// true if found + private static bool HasEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) return true; + return false; + } + + /// + /// Get the EnumMember value + /// + /// + /// EnumMember value as string otherwise null + private static string GetEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) + { + return attr.Value; + } + return null; + } + } +} diff --git a/algoliasearch/Personalization/Client/Configuration.cs b/algoliasearch/Personalization/Client/Configuration.cs new file mode 100644 index 000000000..7b78b7ede --- /dev/null +++ b/algoliasearch/Personalization/Client/Configuration.cs @@ -0,0 +1,587 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Net.Http; +using System.Net.Security; + +namespace Algolia.Search.Personalization.Client +{ + /// + /// Represents a set of configuration settings + /// + public class Configuration : IReadableConfiguration + { + #region Constants + + /// + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.RawContent), + response.RawContent, response.Headers); + } + return null; + }; + + #endregion Static Members + + #region Private Members + + /// + /// Defines the base path of the target API server. + /// Example: http://localhost:3000/v1/ + /// + private string _basePath; + + private bool _useDefaultCredentials = false; + + /// + /// Gets or sets the API key based on the authentication name. + /// This is the key and value comprising the "secret" for accessing an API. + /// + /// The API key. + private IDictionary _apiKey; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + /// + /// Gets or sets the servers defined in the OpenAPI spec. + /// + /// The servers + private IList> _servers; + + /// + /// Gets or sets the operation servers defined in the OpenAPI spec. + /// + /// The operation servers + private IReadOnlyDictionary>> _operationServers; + + #endregion Private Members + + #region Constructors + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration() + { + Proxy = null; + UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + BasePath = "https://personalization.us.algolia.com"; + DefaultHeaders = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + Servers = new List>() + { + { + new Dictionary { + {"url", "https://personalization.{region}.algolia.com"}, + {"description", "No description provided"}, + { + "variables", new Dictionary { + { + "region", new Dictionary { + {"description", "No description provided"}, + {"default_value", "us"}, + { + "enum_values", new List() { + "us", + "eu" + } + } + } + } + } + } + } + } + }; + OperationServers = new Dictionary>>() + { + }; + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration( + IDictionary defaultHeaders, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "https://personalization.us.algolia.com") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeaders == null) + throw new ArgumentNullException("defaultHeaders"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeaders) + { + DefaultHeaders.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + #endregion Constructors + + #region Properties + + /// + /// Gets or sets the base path for API access. + /// + public virtual string BasePath + { + get { return _basePath; } + set { _basePath = value; } + } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + public virtual bool UseDefaultCredentials + { + get { return _useDefaultCredentials; } + set { _useDefaultCredentials = value; } + } + + /// + /// Gets or sets the default header. + /// + [Obsolete("Use DefaultHeaders instead.")] + public virtual IDictionary DefaultHeader + { + get + { + return DefaultHeaders; + } + set + { + DefaultHeaders = value; + } + } + + /// + /// Gets or sets the default headers. + /// + public virtual IDictionary DefaultHeaders { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { get; set; } + + /// + /// Gets or sets the proxy + /// + /// Proxy. + public virtual WebProxy Proxy { get; set; } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix(string apiKeyIdentifier) + { + string apiKeyValue; + ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue); + string apiKeyPrefix; + if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) + { + return apiKeyPrefix + " " + apiKeyValue; + } + + return apiKeyValue; + } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } + + set + { + if (string.IsNullOrEmpty(value)) + { + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } + } + } + + /// + /// Gets or sets the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// Whatever you set here will be prepended to the value defined in AddApiKey. + /// + /// An example invocation here might be: + /// + /// ApiKeyPrefix["Authorization"] = "Bearer"; + /// + /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// + /// + /// OAuth2 workflows should set tokens via AccessToken. + /// + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + /// + /// Gets or sets the servers. + /// + /// The servers. + public virtual IList> Servers + { + get { return _servers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Servers may not be null."); + } + _servers = value; + } + } + + /// + /// Gets or sets the operation servers. + /// + /// The operation servers. + public virtual IReadOnlyDictionary>> OperationServers + { + get { return _operationServers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Operation servers may not be null."); + } + _operationServers = value; + } + } + + /// + /// Returns URL based on server settings without providing values + /// for the variables + /// + /// Array index of the server settings. + /// The server URL. + public string GetServerUrl(int index) + { + return GetServerUrl(Servers, index, null); + } + + /// + /// Returns URL based on server settings. + /// + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + public string GetServerUrl(int index, Dictionary inputVariables) + { + return GetServerUrl(Servers, index, inputVariables); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index) + { + return GetOperationServerUrl(operation, index, null); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables) + { + if (operation != null && OperationServers.TryGetValue(operation, out var operationServer)) + { + return GetServerUrl(operationServer, index, inputVariables); + } + + return null; + } + + /// + /// Returns URL based on server settings. + /// + /// Dictionary of server settings. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + private string GetServerUrl(IList> servers, int index, Dictionary inputVariables) + { + if (index < 0 || index >= servers.Count) + { + throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}."); + } + + if (inputVariables == null) + { + inputVariables = new Dictionary(); + } + + IReadOnlyDictionary server = servers[index]; + string url = (string)server["url"]; + + if (server.ContainsKey("variables")) + { + // go through each variable and assign a value + foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"]) + { + + IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value); + + if (inputVariables.ContainsKey(variable.Key)) + { + if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + { + url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); + } + else + { + throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}"); + } + } + else + { + // use default value + url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]); + } + } + } + + return url; + } + + /// + /// Gets and Sets the RemoteCertificateValidationCallback + /// + public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; } + + #endregion Properties + + #region Methods + + /// + /// Returns a string with essential information for debugging. + /// + public static string ToDebugReport() + { + string report = "C# SDK (Algolia.Search.Personalization) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: 1.0.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; + } + + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey(string key, string value) + { + ApiKey[key] = value; + } + + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix(string key, string value) + { + ApiKeyPrefix[key] = value; + } + + #endregion Methods + + #region Static Members + /// + /// Merge configurations. + /// + /// First configuration. + /// Second configuration. + /// Merged configuration. + public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) + { + if (second == null) return first ?? GlobalConfiguration.Instance; + + Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; + foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; + foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value; + + var config = new Configuration + { + ApiKey = apiKey, + ApiKeyPrefix = apiKeyPrefix, + DefaultHeaders = defaultHeaders, + BasePath = second.BasePath ?? first.BasePath, + Timeout = second.Timeout, + Proxy = second.Proxy ?? first.Proxy, + UserAgent = second.UserAgent ?? first.UserAgent, + TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, + DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat, + UseDefaultCredentials = second.UseDefaultCredentials, + RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback, + }; + return config; + } + #endregion Static Members + } +} diff --git a/algoliasearch/Personalization/Client/ExceptionFactory.cs b/algoliasearch/Personalization/Client/ExceptionFactory.cs new file mode 100644 index 000000000..d8f6a9d9b --- /dev/null +++ b/algoliasearch/Personalization/Client/ExceptionFactory.cs @@ -0,0 +1,16 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.Personalization.Client +{ + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions + public delegate Exception ExceptionFactory(string methodName, IApiResponse response); +} diff --git a/algoliasearch/Personalization/Client/FileParameter.cs b/algoliasearch/Personalization/Client/FileParameter.cs new file mode 100644 index 000000000..9fd0e62f3 --- /dev/null +++ b/algoliasearch/Personalization/Client/FileParameter.cs @@ -0,0 +1,74 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.IO; + +namespace Algolia.Search.Personalization.Client +{ + + /// + /// Represents a File passed to the API as a Parameter, allows using different backends for files + /// + public class FileParameter + { + /// + /// The filename + /// + public string Name { get; set; } = "no_name_provided"; + + /// + /// The content type of the file + /// + public string ContentType { get; set; } = "application/octet-stream"; + + /// + /// The content of the file + /// + public Stream Content { get; set; } + + /// + /// Construct a FileParameter just from the contents, will extract the filename from a filestream + /// + /// The file content + public FileParameter(Stream content) + { + if (content is FileStream fs) + { + Name = fs.Name; + } + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The file content + public FileParameter(string filename, Stream content) + { + Name = filename; + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The content type of the file + /// The file content + public FileParameter(string filename, string contentType, Stream content) + { + Name = filename; + ContentType = contentType; + Content = content; + } + + /// + /// Implicit conversion of stream to file parameter. Useful for backwards compatibility. + /// + /// Stream to convert + /// FileParameter + public static implicit operator FileParameter(Stream s) => new FileParameter(s); + } +} diff --git a/algoliasearch/Personalization/Client/GlobalConfiguration.cs b/algoliasearch/Personalization/Client/GlobalConfiguration.cs new file mode 100644 index 000000000..cc5abd944 --- /dev/null +++ b/algoliasearch/Personalization/Client/GlobalConfiguration.cs @@ -0,0 +1,61 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.Collections.Generic; + +namespace Algolia.Search.Personalization.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .openapi-generator-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + #region Private Members + + private static readonly object GlobalConfigSync = new { }; + private static IReadableConfiguration _globalConfiguration; + + #endregion Private Members + + #region Constructors + + /// + private GlobalConfiguration() + { + } + + /// + public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath) + { + } + + static GlobalConfiguration() + { + Instance = new GlobalConfiguration(); + } + + #endregion Constructors + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static IReadableConfiguration Instance + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + } +} diff --git a/algoliasearch/Personalization/Client/IAsynchronousClient.cs b/algoliasearch/Personalization/Client/IAsynchronousClient.cs new file mode 100644 index 000000000..e147d31df --- /dev/null +++ b/algoliasearch/Personalization/Client/IAsynchronousClient.cs @@ -0,0 +1,94 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Threading.Tasks; + +namespace Algolia.Search.Personalization.Client +{ + /// + /// Contract for Asynchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface IAsynchronousClient + { + /// + /// Executes a non-blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } +} diff --git a/algoliasearch/Personalization/Client/IReadableConfiguration.cs b/algoliasearch/Personalization/Client/IReadableConfiguration.cs new file mode 100644 index 000000000..63124c38d --- /dev/null +++ b/algoliasearch/Personalization/Client/IReadableConfiguration.cs @@ -0,0 +1,111 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; + +namespace Algolia.Search.Personalization.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + /// + /// Gets the API key. + /// + /// API key. + IDictionary ApiKey { get; } + + /// + /// Gets the API key prefix. + /// + /// API key prefix. + IDictionary ApiKeyPrefix { get; } + + /// + /// Gets the base path. + /// + /// Base path. + string BasePath { get; } + + /// + /// Gets the date time format. + /// + /// Date time format. + string DateTimeFormat { get; } + + /// + /// Gets the default header. + /// + /// Default header. + [Obsolete("Use DefaultHeaders instead.")] + IDictionary DefaultHeader { get; } + + /// + /// Gets the default headers. + /// + /// Default headers. + IDictionary DefaultHeaders { get; } + + /// + /// Gets the temp folder path. + /// + /// Temp folder path. + string TempFolderPath { get; } + + /// + /// Gets the HTTP connection timeout (in milliseconds) + /// + /// HTTP connection timeout. + int Timeout { get; } + + /// + /// Gets the proxy. + /// + /// Proxy. + WebProxy Proxy { get; } + + /// + /// Gets the user agent. + /// + /// User agent. + string UserAgent { get; } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + bool UseDefaultCredentials { get; } + + /// + /// Get the servers associated with the operation. + /// + /// Operation servers. + IReadOnlyDictionary>> OperationServers { get; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + string GetApiKeyWithPrefix(string apiKeyIdentifier); + + /// + /// Gets the Operation server url at the provided index. + /// + /// Operation server name. + /// Index of the operation server settings. + /// + string GetOperationServerUrl(string operation, int index); + + /// + /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and + /// overriding certificate errors in the scope of a request. + /// + RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; } + } +} diff --git a/algoliasearch/Personalization/Client/ISynchronousClient.cs b/algoliasearch/Personalization/Client/ISynchronousClient.cs new file mode 100644 index 000000000..e4d51e627 --- /dev/null +++ b/algoliasearch/Personalization/Client/ISynchronousClient.cs @@ -0,0 +1,87 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.IO; + +namespace Algolia.Search.Personalization.Client +{ + /// + /// Contract for Synchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface ISynchronousClient + { + /// + /// Executes a blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null); + } +} diff --git a/algoliasearch/Personalization/Client/Multimap.cs b/algoliasearch/Personalization/Client/Multimap.cs new file mode 100644 index 000000000..a1ce892a1 --- /dev/null +++ b/algoliasearch/Personalization/Client/Multimap.cs @@ -0,0 +1,289 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Algolia.Search.Personalization.Client +{ + /// + /// A dictionary in which one key has many associated values. + /// + /// The type of the key + /// The type of the value associated with the key. + public class Multimap : IDictionary> + { + #region Private Fields + + private readonly Dictionary> _dictionary; + + #endregion Private Fields + + #region Constructors + + /// + /// Empty Constructor. + /// + public Multimap() + { + _dictionary = new Dictionary>(); + } + + /// + /// Constructor with comparer. + /// + /// + public Multimap(IEqualityComparer comparer) + { + _dictionary = new Dictionary>(comparer); + } + + #endregion Constructors + + #region Enumerators + + /// + /// To get the enumerator. + /// + /// Enumerator + public IEnumerator>> GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + /// + /// To get the enumerator. + /// + /// Enumerator + IEnumerator IEnumerable.GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + #endregion Enumerators + + #region Public Members + /// + /// Add values to Multimap + /// + /// Key value pair + public void Add(KeyValuePair> item) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + + /// + /// Add Multimap to Multimap + /// + /// Multimap + public void Add(Multimap multimap) + { + foreach (var item in multimap) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + + /// + /// Clear Multimap + /// + public void Clear() + { + _dictionary.Clear(); + } + + /// + /// Determines whether Multimap contains the specified item. + /// + /// Key value pair + /// Method needs to be implemented + /// true if the Multimap contains the item; otherwise, false. + public bool Contains(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Copy items of the Multimap to an array, + /// starting at a particular array index. + /// + /// The array that is the destination of the items copied + /// from Multimap. The array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + /// Method needs to be implemented + public void CopyTo(KeyValuePair>[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + /// + /// Removes the specified item from the Multimap. + /// + /// Key value pair + /// true if the item is successfully removed; otherwise, false. + /// Method needs to be implemented + public bool Remove(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Gets the number of items contained in the Multimap. + /// + public int Count => _dictionary.Count; + + /// + /// Gets a value indicating whether the Multimap is read-only. + /// + public bool IsReadOnly => false; + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add the value to Multimap. + public void Add(TKey key, IList value) + { + if (value != null && value.Count > 0) + { + if (_dictionary.TryGetValue(key, out var list)) + { + foreach (var k in value) list.Add(k); + } + else + { + list = new List(value); + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + } + + /// + /// Determines whether the Multimap contains an item with the specified key. + /// + /// The key to locate in the Multimap. + /// true if the Multimap contains an item with + /// the key; otherwise, false. + public bool ContainsKey(TKey key) + { + return _dictionary.ContainsKey(key); + } + + /// + /// Removes item with the specified key from the Multimap. + /// + /// The key to locate in the Multimap. + /// true if the item is successfully removed; otherwise, false. + public bool Remove(TKey key) + { + return TryRemove(key, out var _); + } + + /// + /// Gets the value associated with the specified key. + /// + /// The key whose value to get. + /// When this method returns, the value associated with the specified key, if the + /// key is found; otherwise, the default value for the type of the value parameter. + /// This parameter is passed uninitialized. + /// true if the object that implements Multimap contains + /// an item with the specified key; otherwise, false. + public bool TryGetValue(TKey key, out IList value) + { + return _dictionary.TryGetValue(key, out value); + } + + /// + /// Gets or sets the item with the specified key. + /// + /// The key of the item to get or set. + /// The value of the specified key. + public IList this[TKey key] + { + get => _dictionary[key]; + set => _dictionary[key] = value; + } + + /// + /// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap. + /// + public ICollection Keys => _dictionary.Keys; + + /// + /// Gets a System.Collections.Generic.ICollection containing the values of the Multimap. + /// + public ICollection> Values => _dictionary.Values; + + /// + /// Copy the items of the Multimap to an System.Array, + /// starting at a particular System.Array index. + /// + /// The one-dimensional System.Array that is the destination of the items copied + /// from Multimap. The System.Array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + public void CopyTo(Array array, int index) + { + ((ICollection)_dictionary).CopyTo(array, index); + } + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add value to Multimap. + public void Add(TKey key, TValue value) + { + if (value != null) + { + if (_dictionary.TryGetValue(key, out var list)) + { + list.Add(value); + } + else + { + list = new List { value }; + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add value to Multimap."); + } + } + } + + #endregion Public Members + + #region Private Members + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryRemove(TKey key, out IList value) + { + _dictionary.TryGetValue(key, out value); + return _dictionary.Remove(key); + } + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryAdd(TKey key, IList value) + { + try + { + _dictionary.Add(key, value); + } + catch (ArgumentException) + { + return false; + } + + return true; + } + #endregion Private Members + } +} diff --git a/algoliasearch/Personalization/Client/OpenAPIDateConverter.cs b/algoliasearch/Personalization/Client/OpenAPIDateConverter.cs new file mode 100644 index 000000000..2de8f67cc --- /dev/null +++ b/algoliasearch/Personalization/Client/OpenAPIDateConverter.cs @@ -0,0 +1,23 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using Newtonsoft.Json.Converters; + +namespace Algolia.Search.Personalization.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class OpenAPIDateConverter : IsoDateTimeConverter + { + /// + /// Initializes a new instance of the class. + /// + public OpenAPIDateConverter() + { + // full-date = date-fullyear "-" date-month "-" date-mday + DateTimeFormat = "yyyy-MM-dd"; + } + } +} diff --git a/algoliasearch/Personalization/Client/RequestOptions.cs b/algoliasearch/Personalization/Client/RequestOptions.cs new file mode 100644 index 000000000..82c0f5da3 --- /dev/null +++ b/algoliasearch/Personalization/Client/RequestOptions.cs @@ -0,0 +1,68 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; + +namespace Algolia.Search.Personalization.Client +{ + /// + /// A container for generalized request inputs. This type allows consumers to extend the request functionality + /// by abstracting away from the default (built-in) request framework (e.g. RestSharp). + /// + public class RequestOptions + { + /// + /// Parameters to be bound to path parts of the Request's URL + /// + public Dictionary PathParameters { get; set; } + + /// + /// Query parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap QueryParameters { get; set; } + + /// + /// Header parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap HeaderParameters { get; set; } + + /// + /// Form parameters to be sent along with the request. + /// + public Dictionary FormParameters { get; set; } + + /// + /// File parameters to be sent along with the request. + /// + public Multimap FileParameters { get; set; } + + /// + /// Cookies to be sent along with the request. + /// + public List Cookies { get; set; } + + /// + /// Any data associated with a request body. + /// + public Object Data { get; set; } + + /// + /// Constructs a new instance of + /// + public RequestOptions() + { + PathParameters = new Dictionary(); + QueryParameters = new Multimap(); + HeaderParameters = new Multimap(); + FormParameters = new Dictionary(); + FileParameters = new Multimap(); + Cookies = new List(); + } + } +} diff --git a/algoliasearch/Personalization/Client/WebRequestPathBuilder.cs b/algoliasearch/Personalization/Client/WebRequestPathBuilder.cs new file mode 100644 index 000000000..5db72cc44 --- /dev/null +++ b/algoliasearch/Personalization/Client/WebRequestPathBuilder.cs @@ -0,0 +1,47 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using System; +using System.Collections.Generic; + +namespace Algolia.Search.Personalization.Client +{ + /// + /// A URI builder + /// + class WebRequestPathBuilder + { + private string _baseUrl; + private string _path; + private string _query = "?"; + public WebRequestPathBuilder(string baseUrl, string path) + { + _baseUrl = baseUrl; + _path = path; + } + + public void AddPathParameters(Dictionary parameters) + { + foreach (var parameter in parameters) + { + _path = _path.Replace("{" + parameter.Key + "}", Uri.EscapeDataString(parameter.Value)); + } + } + + public void AddQueryParameters(Multimap parameters) + { + foreach (var parameter in parameters) + { + foreach (var value in parameter.Value) + { + _query = _query + parameter.Key + "=" + Uri.EscapeDataString(value) + "&"; + } + } + } + + public string GetFullUri() + { + return _baseUrl + _path + _query.Substring(0, _query.Length - 1); + } + } +} diff --git a/algoliasearch/Personalization/Models/AbstractOpenAPISchema.cs b/algoliasearch/Personalization/Models/AbstractOpenAPISchema.cs new file mode 100644 index 000000000..71b4efd7e --- /dev/null +++ b/algoliasearch/Personalization/Models/AbstractOpenAPISchema.cs @@ -0,0 +1,70 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace Algolia.Search.Personalization.Models +{ + /// + /// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification + /// + public abstract partial class AbstractOpenAPISchema + { + /// + /// Custom JSON serializer + /// + static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Error, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Custom JSON serializer for objects with additional properties + /// + static public readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Ignore, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Gets or Sets the actual instance + /// + public abstract Object ActualInstance { get; set; } + + /// + /// Gets or Sets IsNullable to indicate whether the instance is nullable + /// + public bool IsNullable { get; protected set; } + + /// + /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf` + /// + public string SchemaType { get; protected set; } + + /// + /// Converts the instance into JSON string. + /// + public abstract string ToJson(); + } +} diff --git a/algoliasearch/Personalization/Models/DeleteUserProfileResponse.cs b/algoliasearch/Personalization/Models/DeleteUserProfileResponse.cs new file mode 100644 index 000000000..9b8e48dcd --- /dev/null +++ b/algoliasearch/Personalization/Models/DeleteUserProfileResponse.cs @@ -0,0 +1,158 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Personalization.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Personalization.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Personalization.Models +{ + /// + /// DeleteUserProfileResponse + /// + [DataContract(Name = "deleteUserProfileResponse")] + public partial class DeleteUserProfileResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DeleteUserProfileResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// userToken representing the user for which to fetch the Personalization profile. (required). + /// A date until which the data can safely be considered as deleted for the given user. Any data received after the `deletedUntil` date will start building a new user profile. (required). + public DeleteUserProfileResponse(string userToken = default(string), string deletedUntil = default(string)) + { + // to ensure "userToken" is required (not null) + if (userToken == null) + { + throw new ArgumentNullException("userToken is a required property for DeleteUserProfileResponse and cannot be null"); + } + this.UserToken = userToken; + // to ensure "deletedUntil" is required (not null) + if (deletedUntil == null) + { + throw new ArgumentNullException("deletedUntil is a required property for DeleteUserProfileResponse and cannot be null"); + } + this.DeletedUntil = deletedUntil; + } + + /// + /// userToken representing the user for which to fetch the Personalization profile. + /// + /// userToken representing the user for which to fetch the Personalization profile. + [DataMember(Name = "userToken", IsRequired = true, EmitDefaultValue = true)] + public string UserToken { get; set; } + + /// + /// A date until which the data can safely be considered as deleted for the given user. Any data received after the `deletedUntil` date will start building a new user profile. + /// + /// A date until which the data can safely be considered as deleted for the given user. Any data received after the `deletedUntil` date will start building a new user profile. + [DataMember(Name = "deletedUntil", IsRequired = true, EmitDefaultValue = true)] + public string DeletedUntil { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DeleteUserProfileResponse {\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" DeletedUntil: ").Append(DeletedUntil).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DeleteUserProfileResponse); + } + + /// + /// Returns true if DeleteUserProfileResponse instances are equal + /// + /// Instance of DeleteUserProfileResponse to be compared + /// Boolean + public bool Equals(DeleteUserProfileResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.DeletedUntil == input.DeletedUntil || + (this.DeletedUntil != null && + this.DeletedUntil.Equals(input.DeletedUntil)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + if (this.DeletedUntil != null) + { + hashCode = (hashCode * 59) + this.DeletedUntil.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Personalization/Models/ErrorBase.cs b/algoliasearch/Personalization/Models/ErrorBase.cs new file mode 100644 index 000000000..8e90b31ff --- /dev/null +++ b/algoliasearch/Personalization/Models/ErrorBase.cs @@ -0,0 +1,147 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Personalization.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Personalization.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Personalization.Models +{ + /// + /// Error. + /// + [DataContract(Name = "ErrorBase")] + public partial class ErrorBase : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// message. + public ErrorBase(string message = default(string)) : base() + { + this.Message = message; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Message + /// + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ErrorBase {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ErrorBase); + } + + /// + /// Returns true if ErrorBase instances are equal + /// + /// Instance of ErrorBase to be compared + /// Boolean + public bool Equals(ErrorBase input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Personalization/Models/EventScoring.cs b/algoliasearch/Personalization/Models/EventScoring.cs new file mode 100644 index 000000000..03ac3f0aa --- /dev/null +++ b/algoliasearch/Personalization/Models/EventScoring.cs @@ -0,0 +1,173 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Personalization.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Personalization.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Personalization.Models +{ + /// + /// EventScoring + /// + [DataContract(Name = "eventScoring")] + public partial class EventScoring : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected EventScoring() { } + /// + /// Initializes a new instance of the class. + /// + /// The score for the event. (required). + /// The name of the event. (required). + /// The type of the event. (required). + public EventScoring(int score = default(int), string eventName = default(string), string eventType = default(string)) + { + this.Score = score; + // to ensure "eventName" is required (not null) + if (eventName == null) + { + throw new ArgumentNullException("eventName is a required property for EventScoring and cannot be null"); + } + this.EventName = eventName; + // to ensure "eventType" is required (not null) + if (eventType == null) + { + throw new ArgumentNullException("eventType is a required property for EventScoring and cannot be null"); + } + this.EventType = eventType; + } + + /// + /// The score for the event. + /// + /// The score for the event. + [DataMember(Name = "score", IsRequired = true, EmitDefaultValue = true)] + public int Score { get; set; } + + /// + /// The name of the event. + /// + /// The name of the event. + [DataMember(Name = "eventName", IsRequired = true, EmitDefaultValue = true)] + public string EventName { get; set; } + + /// + /// The type of the event. + /// + /// The type of the event. + [DataMember(Name = "eventType", IsRequired = true, EmitDefaultValue = true)] + public string EventType { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EventScoring {\n"); + sb.Append(" Score: ").Append(Score).Append("\n"); + sb.Append(" EventName: ").Append(EventName).Append("\n"); + sb.Append(" EventType: ").Append(EventType).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as EventScoring); + } + + /// + /// Returns true if EventScoring instances are equal + /// + /// Instance of EventScoring to be compared + /// Boolean + public bool Equals(EventScoring input) + { + if (input == null) + { + return false; + } + return + ( + this.Score == input.Score || + this.Score.Equals(input.Score) + ) && + ( + this.EventName == input.EventName || + (this.EventName != null && + this.EventName.Equals(input.EventName)) + ) && + ( + this.EventType == input.EventType || + (this.EventType != null && + this.EventType.Equals(input.EventType)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Score.GetHashCode(); + if (this.EventName != null) + { + hashCode = (hashCode * 59) + this.EventName.GetHashCode(); + } + if (this.EventType != null) + { + hashCode = (hashCode * 59) + this.EventType.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Personalization/Models/FacetScoring.cs b/algoliasearch/Personalization/Models/FacetScoring.cs new file mode 100644 index 000000000..15a021542 --- /dev/null +++ b/algoliasearch/Personalization/Models/FacetScoring.cs @@ -0,0 +1,149 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Personalization.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Personalization.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Personalization.Models +{ + /// + /// FacetScoring + /// + [DataContract(Name = "facetScoring")] + public partial class FacetScoring : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected FacetScoring() { } + /// + /// Initializes a new instance of the class. + /// + /// The score for the event. (required). + /// The name of the facet. (required). + public FacetScoring(int score = default(int), string facetName = default(string)) + { + this.Score = score; + // to ensure "facetName" is required (not null) + if (facetName == null) + { + throw new ArgumentNullException("facetName is a required property for FacetScoring and cannot be null"); + } + this.FacetName = facetName; + } + + /// + /// The score for the event. + /// + /// The score for the event. + [DataMember(Name = "score", IsRequired = true, EmitDefaultValue = true)] + public int Score { get; set; } + + /// + /// The name of the facet. + /// + /// The name of the facet. + [DataMember(Name = "facetName", IsRequired = true, EmitDefaultValue = true)] + public string FacetName { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FacetScoring {\n"); + sb.Append(" Score: ").Append(Score).Append("\n"); + sb.Append(" FacetName: ").Append(FacetName).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FacetScoring); + } + + /// + /// Returns true if FacetScoring instances are equal + /// + /// Instance of FacetScoring to be compared + /// Boolean + public bool Equals(FacetScoring input) + { + if (input == null) + { + return false; + } + return + ( + this.Score == input.Score || + this.Score.Equals(input.Score) + ) && + ( + this.FacetName == input.FacetName || + (this.FacetName != null && + this.FacetName.Equals(input.FacetName)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Score.GetHashCode(); + if (this.FacetName != null) + { + hashCode = (hashCode * 59) + this.FacetName.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Personalization/Models/GetUserTokenResponse.cs b/algoliasearch/Personalization/Models/GetUserTokenResponse.cs new file mode 100644 index 000000000..597acda28 --- /dev/null +++ b/algoliasearch/Personalization/Models/GetUserTokenResponse.cs @@ -0,0 +1,182 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Personalization.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Personalization.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Personalization.Models +{ + /// + /// GetUserTokenResponse + /// + [DataContract(Name = "getUserTokenResponse")] + public partial class GetUserTokenResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetUserTokenResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// userToken representing the user for which to fetch the Personalization profile. (required). + /// Date of last event update. (ISO-8601 format). (required). + /// The userToken scores. (required). + public GetUserTokenResponse(string userToken = default(string), string lastEventAt = default(string), Object scores = default(Object)) + { + // to ensure "userToken" is required (not null) + if (userToken == null) + { + throw new ArgumentNullException("userToken is a required property for GetUserTokenResponse and cannot be null"); + } + this.UserToken = userToken; + // to ensure "lastEventAt" is required (not null) + if (lastEventAt == null) + { + throw new ArgumentNullException("lastEventAt is a required property for GetUserTokenResponse and cannot be null"); + } + this.LastEventAt = lastEventAt; + // to ensure "scores" is required (not null) + if (scores == null) + { + throw new ArgumentNullException("scores is a required property for GetUserTokenResponse and cannot be null"); + } + this.Scores = scores; + } + + /// + /// userToken representing the user for which to fetch the Personalization profile. + /// + /// userToken representing the user for which to fetch the Personalization profile. + [DataMember(Name = "userToken", IsRequired = true, EmitDefaultValue = true)] + public string UserToken { get; set; } + + /// + /// Date of last event update. (ISO-8601 format). + /// + /// Date of last event update. (ISO-8601 format). + [DataMember(Name = "lastEventAt", IsRequired = true, EmitDefaultValue = true)] + public string LastEventAt { get; set; } + + /// + /// The userToken scores. + /// + /// The userToken scores. + [DataMember(Name = "scores", IsRequired = true, EmitDefaultValue = true)] + public Object Scores { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetUserTokenResponse {\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" LastEventAt: ").Append(LastEventAt).Append("\n"); + sb.Append(" Scores: ").Append(Scores).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetUserTokenResponse); + } + + /// + /// Returns true if GetUserTokenResponse instances are equal + /// + /// Instance of GetUserTokenResponse to be compared + /// Boolean + public bool Equals(GetUserTokenResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.LastEventAt == input.LastEventAt || + (this.LastEventAt != null && + this.LastEventAt.Equals(input.LastEventAt)) + ) && + ( + this.Scores == input.Scores || + (this.Scores != null && + this.Scores.Equals(input.Scores)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + if (this.LastEventAt != null) + { + hashCode = (hashCode * 59) + this.LastEventAt.GetHashCode(); + } + if (this.Scores != null) + { + hashCode = (hashCode * 59) + this.Scores.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Personalization/Models/PersonalizationStrategyParams.cs b/algoliasearch/Personalization/Models/PersonalizationStrategyParams.cs new file mode 100644 index 000000000..54b4739a7 --- /dev/null +++ b/algoliasearch/Personalization/Models/PersonalizationStrategyParams.cs @@ -0,0 +1,175 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Personalization.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Personalization.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Personalization.Models +{ + /// + /// PersonalizationStrategyParams + /// + [DataContract(Name = "personalizationStrategyParams")] + public partial class PersonalizationStrategyParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PersonalizationStrategyParams() { } + /// + /// Initializes a new instance of the class. + /// + /// Scores associated with the events. (required). + /// Scores associated with the facets. (required). + /// The impact that personalization has on search results: a number between 0 (personalization disabled) and 100 (personalization fully enabled). (required). + public PersonalizationStrategyParams(List eventScoring = default(List), List facetScoring = default(List), int personalizationImpact = default(int)) + { + // to ensure "eventScoring" is required (not null) + if (eventScoring == null) + { + throw new ArgumentNullException("eventScoring is a required property for PersonalizationStrategyParams and cannot be null"); + } + this.EventScoring = eventScoring; + // to ensure "facetScoring" is required (not null) + if (facetScoring == null) + { + throw new ArgumentNullException("facetScoring is a required property for PersonalizationStrategyParams and cannot be null"); + } + this.FacetScoring = facetScoring; + this.PersonalizationImpact = personalizationImpact; + } + + /// + /// Scores associated with the events. + /// + /// Scores associated with the events. + [DataMember(Name = "eventScoring", IsRequired = true, EmitDefaultValue = true)] + public List EventScoring { get; set; } + + /// + /// Scores associated with the facets. + /// + /// Scores associated with the facets. + [DataMember(Name = "facetScoring", IsRequired = true, EmitDefaultValue = true)] + public List FacetScoring { get; set; } + + /// + /// The impact that personalization has on search results: a number between 0 (personalization disabled) and 100 (personalization fully enabled). + /// + /// The impact that personalization has on search results: a number between 0 (personalization disabled) and 100 (personalization fully enabled). + [DataMember(Name = "personalizationImpact", IsRequired = true, EmitDefaultValue = true)] + public int PersonalizationImpact { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PersonalizationStrategyParams {\n"); + sb.Append(" EventScoring: ").Append(EventScoring).Append("\n"); + sb.Append(" FacetScoring: ").Append(FacetScoring).Append("\n"); + sb.Append(" PersonalizationImpact: ").Append(PersonalizationImpact).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as PersonalizationStrategyParams); + } + + /// + /// Returns true if PersonalizationStrategyParams instances are equal + /// + /// Instance of PersonalizationStrategyParams to be compared + /// Boolean + public bool Equals(PersonalizationStrategyParams input) + { + if (input == null) + { + return false; + } + return + ( + this.EventScoring == input.EventScoring || + this.EventScoring != null && + input.EventScoring != null && + this.EventScoring.SequenceEqual(input.EventScoring) + ) && + ( + this.FacetScoring == input.FacetScoring || + this.FacetScoring != null && + input.FacetScoring != null && + this.FacetScoring.SequenceEqual(input.FacetScoring) + ) && + ( + this.PersonalizationImpact == input.PersonalizationImpact || + this.PersonalizationImpact.Equals(input.PersonalizationImpact) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EventScoring != null) + { + hashCode = (hashCode * 59) + this.EventScoring.GetHashCode(); + } + if (this.FacetScoring != null) + { + hashCode = (hashCode * 59) + this.FacetScoring.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PersonalizationImpact.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Personalization/Models/SetPersonalizationStrategyResponse.cs b/algoliasearch/Personalization/Models/SetPersonalizationStrategyResponse.cs new file mode 100644 index 000000000..d6ca084bb --- /dev/null +++ b/algoliasearch/Personalization/Models/SetPersonalizationStrategyResponse.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Personalization.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Personalization.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Personalization.Models +{ + /// + /// SetPersonalizationStrategyResponse + /// + [DataContract(Name = "setPersonalizationStrategyResponse")] + public partial class SetPersonalizationStrategyResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SetPersonalizationStrategyResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// A message confirming the strategy update. (required). + public SetPersonalizationStrategyResponse(string message = default(string)) + { + // to ensure "message" is required (not null) + if (message == null) + { + throw new ArgumentNullException("message is a required property for SetPersonalizationStrategyResponse and cannot be null"); + } + this.Message = message; + } + + /// + /// A message confirming the strategy update. + /// + /// A message confirming the strategy update. + [DataMember(Name = "message", IsRequired = true, EmitDefaultValue = true)] + public string Message { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SetPersonalizationStrategyResponse {\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SetPersonalizationStrategyResponse); + } + + /// + /// Returns true if SetPersonalizationStrategyResponse instances are equal + /// + /// Instance of SetPersonalizationStrategyResponse to be compared + /// Boolean + public bool Equals(SetPersonalizationStrategyResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/QuerySuggestions/Api/QuerySuggestionsClient.cs b/algoliasearch/QuerySuggestions/Api/QuerySuggestionsClient.cs new file mode 100644 index 000000000..1d4d2f6c8 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Api/QuerySuggestionsClient.cs @@ -0,0 +1,2091 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Mime; +using Algolia.Search.QuerySuggestions.Client; +using Algolia.Search.QuerySuggestions.Models; + +namespace Algolia.Search.QuerySuggestions.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IQuerySuggestionsClient + { + /// + /// Create a configuration. + /// + /// + /// Create a new Query Suggestions configuration. You can have up to 100 configurations per Algolia application. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of BaseResponse + System.Threading.Tasks.Task CreateConfigAsync(QuerySuggestionsConfigurationWithIndex querySuggestionsConfigurationWithIndex, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create a configuration. + /// + /// + /// Create a new Query Suggestions configuration. You can have up to 100 configurations per Algolia application. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (BaseResponse) + System.Threading.Tasks.Task> CreateConfigWithHttpInfoAsync(QuerySuggestionsConfigurationWithIndex querySuggestionsConfigurationWithIndex, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete a configuration. + /// + /// + /// Delete a Query Suggestions configuration. Deleting only removes the configuration and stops updates to the Query Suggestions index. The Query Suggestions index itself is not deleted. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// Cancellation Token to cancel the request. + /// Task of BaseResponse + System.Threading.Tasks.Task DeleteConfigAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete a configuration. + /// + /// + /// Delete a Query Suggestions configuration. Deleting only removes the configuration and stops updates to the Query Suggestions index. The Query Suggestions index itself is not deleted. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (BaseResponse) + System.Threading.Tasks.Task> DeleteConfigWithHttpInfoAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// List configurations. + /// + /// + /// List all Query Suggestions configurations of your Algolia application. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of List<QuerySuggestionsConfigurationResponse> + System.Threading.Tasks.Task> GetAllConfigsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List configurations. + /// + /// + /// List all Query Suggestions configurations of your Algolia application. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<QuerySuggestionsConfigurationResponse>) + System.Threading.Tasks.Task>> GetAllConfigsWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a configuration. + /// + /// + /// Get a single Query Suggestions configuration. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// Cancellation Token to cancel the request. + /// Task of QuerySuggestionsConfigurationResponse + System.Threading.Tasks.Task GetConfigAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a configuration. + /// + /// + /// Get a single Query Suggestions configuration. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (QuerySuggestionsConfigurationResponse) + System.Threading.Tasks.Task> GetConfigWithHttpInfoAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get configuration status. + /// + /// + /// Report the status of a Query Suggestions index. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// Cancellation Token to cancel the request. + /// Task of GetConfigStatus200Response + System.Threading.Tasks.Task GetConfigStatusAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get configuration status. + /// + /// + /// Report the status of a Query Suggestions index. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetConfigStatus200Response) + System.Threading.Tasks.Task> GetConfigStatusWithHttpInfoAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get logs. + /// + /// + /// Get the logs for a single Query Suggestions index. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// Cancellation Token to cancel the request. + /// Task of GetLogFile200Response + System.Threading.Tasks.Task GetLogFileAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get logs. + /// + /// + /// Get the logs for a single Query Suggestions index. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetLogFile200Response) + System.Threading.Tasks.Task> GetLogFileWithHttpInfoAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Update a configuration. + /// + /// + /// Update a QuerySuggestions configuration. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// + /// Cancellation Token to cancel the request. + /// Task of BaseResponse + System.Threading.Tasks.Task UpdateConfigAsync(string indexName, QuerySuggestionsConfiguration querySuggestionsConfiguration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Update a configuration. + /// + /// + /// Update a QuerySuggestions configuration. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (BaseResponse) + System.Threading.Tasks.Task> UpdateConfigWithHttpInfoAsync(string indexName, QuerySuggestionsConfiguration querySuggestionsConfiguration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } + + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class QuerySuggestionsClient : IDisposable, IQuerySuggestionsClient + { + private Algolia.Search.QuerySuggestions.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// + public QuerySuggestionsClient() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + /// + public QuerySuggestionsClient(string basePath) + { + this.Configuration = Algolia.Search.QuerySuggestions.Client.Configuration.MergeConfigurations( + Algolia.Search.QuerySuggestions.Client.GlobalConfiguration.Instance, + new Algolia.Search.QuerySuggestions.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.QuerySuggestions.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.QuerySuggestions.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// An instance of Configuration. + /// + /// + public QuerySuggestionsClient(Algolia.Search.QuerySuggestions.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Algolia.Search.QuerySuggestions.Client.Configuration.MergeConfigurations( + Algolia.Search.QuerySuggestions.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.QuerySuggestions.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.QuerySuggestions.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public QuerySuggestionsClient(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public QuerySuggestionsClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.QuerySuggestions.Client.Configuration.MergeConfigurations( + Algolia.Search.QuerySuggestions.Client.GlobalConfiguration.Instance, + new Algolia.Search.QuerySuggestions.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.QuerySuggestions.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.QuerySuggestions.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// + /// An instance of HttpClient. + /// An instance of Configuration. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public QuerySuggestionsClient(HttpClient client, Algolia.Search.QuerySuggestions.Client.Configuration configuration, HttpClientHandler handler = null) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.QuerySuggestions.Client.Configuration.MergeConfigurations( + Algolia.Search.QuerySuggestions.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.QuerySuggestions.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.QuerySuggestions.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + /// + public QuerySuggestionsClient(Algolia.Search.QuerySuggestions.Client.ISynchronousClient client, Algolia.Search.QuerySuggestions.Client.IAsynchronousClient asyncClient, Algolia.Search.QuerySuggestions.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Algolia.Search.QuerySuggestions.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + this.ApiClient?.Dispose(); + } + + /// + /// Holds the ApiClient if created + /// + public Algolia.Search.QuerySuggestions.Client.ApiClient ApiClient { get; set; } = null; + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Algolia.Search.QuerySuggestions.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Algolia.Search.QuerySuggestions.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Algolia.Search.QuerySuggestions.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Algolia.Search.QuerySuggestions.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Create a configuration. Create a new Query Suggestions configuration. You can have up to 100 configurations per Algolia application. + /// + /// Thrown when fails to make API call + /// + /// BaseResponse + public BaseResponse CreateConfig(QuerySuggestionsConfigurationWithIndex querySuggestionsConfigurationWithIndex) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = CreateConfigWithHttpInfo(querySuggestionsConfigurationWithIndex); + return localVarResponse.Data; + } + + /// + /// Create a configuration. Create a new Query Suggestions configuration. You can have up to 100 configurations per Algolia application. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of BaseResponse + public Algolia.Search.QuerySuggestions.Client.ApiResponse CreateConfigWithHttpInfo(QuerySuggestionsConfigurationWithIndex querySuggestionsConfigurationWithIndex) + { + // verify the required parameter 'querySuggestionsConfigurationWithIndex' is set + if (querySuggestionsConfigurationWithIndex == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'querySuggestionsConfigurationWithIndex' when calling QuerySuggestionsClient->CreateConfig"); + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = querySuggestionsConfigurationWithIndex; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/configs", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateConfig", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Create a configuration. Create a new Query Suggestions configuration. You can have up to 100 configurations per Algolia application. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of BaseResponse + public async System.Threading.Tasks.Task CreateConfigAsync(QuerySuggestionsConfigurationWithIndex querySuggestionsConfigurationWithIndex, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = await CreateConfigWithHttpInfoAsync(querySuggestionsConfigurationWithIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Create a configuration. Create a new Query Suggestions configuration. You can have up to 100 configurations per Algolia application. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (BaseResponse) + public async System.Threading.Tasks.Task> CreateConfigWithHttpInfoAsync(QuerySuggestionsConfigurationWithIndex querySuggestionsConfigurationWithIndex, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'querySuggestionsConfigurationWithIndex' is set + if (querySuggestionsConfigurationWithIndex == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'querySuggestionsConfigurationWithIndex' when calling QuerySuggestionsClient->CreateConfig"); + + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = querySuggestionsConfigurationWithIndex; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/configs", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateConfig", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Del(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = DelWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.QuerySuggestions.Client.ApiResponse DelWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'path' when calling QuerySuggestionsClient->Del"); + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = await DelWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'path' when calling QuerySuggestionsClient->Del"); + + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a configuration. Delete a Query Suggestions configuration. Deleting only removes the configuration and stops updates to the Query Suggestions index. The Query Suggestions index itself is not deleted. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// BaseResponse + public BaseResponse DeleteConfig(string indexName) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = DeleteConfigWithHttpInfo(indexName); + return localVarResponse.Data; + } + + /// + /// Delete a configuration. Delete a Query Suggestions configuration. Deleting only removes the configuration and stops updates to the Query Suggestions index. The Query Suggestions index itself is not deleted. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// ApiResponse of BaseResponse + public Algolia.Search.QuerySuggestions.Client.ApiResponse DeleteConfigWithHttpInfo(string indexName) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'indexName' when calling QuerySuggestionsClient->DeleteConfig"); + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(indexName)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1/configs/{indexName}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteConfig", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a configuration. Delete a Query Suggestions configuration. Deleting only removes the configuration and stops updates to the Query Suggestions index. The Query Suggestions index itself is not deleted. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// Cancellation Token to cancel the request. + /// Task of BaseResponse + public async System.Threading.Tasks.Task DeleteConfigAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = await DeleteConfigWithHttpInfoAsync(indexName, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete a configuration. Delete a Query Suggestions configuration. Deleting only removes the configuration and stops updates to the Query Suggestions index. The Query Suggestions index itself is not deleted. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (BaseResponse) + public async System.Threading.Tasks.Task> DeleteConfigWithHttpInfoAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'indexName' when calling QuerySuggestionsClient->DeleteConfig"); + + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(indexName)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1/configs/{indexName}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteConfig", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Get(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = GetWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.QuerySuggestions.Client.ApiResponse GetWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'path' when calling QuerySuggestionsClient->Get"); + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = await GetWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'path' when calling QuerySuggestionsClient->Get"); + + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List configurations. List all Query Suggestions configurations of your Algolia application. + /// + /// Thrown when fails to make API call + /// List<QuerySuggestionsConfigurationResponse> + public List GetAllConfigs() + { + Algolia.Search.QuerySuggestions.Client.ApiResponse> localVarResponse = GetAllConfigsWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// List configurations. List all Query Suggestions configurations of your Algolia application. + /// + /// Thrown when fails to make API call + /// ApiResponse of List<QuerySuggestionsConfigurationResponse> + public Algolia.Search.QuerySuggestions.Client.ApiResponse> GetAllConfigsWithHttpInfo() + { + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get>("/1/configs", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetAllConfigs", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List configurations. List all Query Suggestions configurations of your Algolia application. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of List<QuerySuggestionsConfigurationResponse> + public async System.Threading.Tasks.Task> GetAllConfigsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse> localVarResponse = await GetAllConfigsWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// List configurations. List all Query Suggestions configurations of your Algolia application. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<QuerySuggestionsConfigurationResponse>) + public async System.Threading.Tasks.Task>> GetAllConfigsWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync>("/1/configs", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetAllConfigs", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a configuration. Get a single Query Suggestions configuration. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// QuerySuggestionsConfigurationResponse + public QuerySuggestionsConfigurationResponse GetConfig(string indexName) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = GetConfigWithHttpInfo(indexName); + return localVarResponse.Data; + } + + /// + /// Get a configuration. Get a single Query Suggestions configuration. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// ApiResponse of QuerySuggestionsConfigurationResponse + public Algolia.Search.QuerySuggestions.Client.ApiResponse GetConfigWithHttpInfo(string indexName) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'indexName' when calling QuerySuggestionsClient->GetConfig"); + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(indexName)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/configs/{indexName}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetConfig", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a configuration. Get a single Query Suggestions configuration. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// Cancellation Token to cancel the request. + /// Task of QuerySuggestionsConfigurationResponse + public async System.Threading.Tasks.Task GetConfigAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = await GetConfigWithHttpInfoAsync(indexName, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a configuration. Get a single Query Suggestions configuration. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (QuerySuggestionsConfigurationResponse) + public async System.Threading.Tasks.Task> GetConfigWithHttpInfoAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'indexName' when calling QuerySuggestionsClient->GetConfig"); + + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(indexName)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/configs/{indexName}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetConfig", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get configuration status. Report the status of a Query Suggestions index. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// GetConfigStatus200Response + public GetConfigStatus200Response GetConfigStatus(string indexName) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = GetConfigStatusWithHttpInfo(indexName); + return localVarResponse.Data; + } + + /// + /// Get configuration status. Report the status of a Query Suggestions index. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// ApiResponse of GetConfigStatus200Response + public Algolia.Search.QuerySuggestions.Client.ApiResponse GetConfigStatusWithHttpInfo(string indexName) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'indexName' when calling QuerySuggestionsClient->GetConfigStatus"); + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(indexName)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/configs/{indexName}/status", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetConfigStatus", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get configuration status. Report the status of a Query Suggestions index. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// Cancellation Token to cancel the request. + /// Task of GetConfigStatus200Response + public async System.Threading.Tasks.Task GetConfigStatusAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = await GetConfigStatusWithHttpInfoAsync(indexName, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get configuration status. Report the status of a Query Suggestions index. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetConfigStatus200Response) + public async System.Threading.Tasks.Task> GetConfigStatusWithHttpInfoAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'indexName' when calling QuerySuggestionsClient->GetConfigStatus"); + + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(indexName)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/configs/{indexName}/status", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetConfigStatus", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get logs. Get the logs for a single Query Suggestions index. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// GetLogFile200Response + public GetLogFile200Response GetLogFile(string indexName) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = GetLogFileWithHttpInfo(indexName); + return localVarResponse.Data; + } + + /// + /// Get logs. Get the logs for a single Query Suggestions index. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// ApiResponse of GetLogFile200Response + public Algolia.Search.QuerySuggestions.Client.ApiResponse GetLogFileWithHttpInfo(string indexName) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'indexName' when calling QuerySuggestionsClient->GetLogFile"); + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(indexName)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/logs/{indexName}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetLogFile", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get logs. Get the logs for a single Query Suggestions index. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// Cancellation Token to cancel the request. + /// Task of GetLogFile200Response + public async System.Threading.Tasks.Task GetLogFileAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = await GetLogFileWithHttpInfoAsync(indexName, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get logs. Get the logs for a single Query Suggestions index. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetLogFile200Response) + public async System.Threading.Tasks.Task> GetLogFileWithHttpInfoAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'indexName' when calling QuerySuggestionsClient->GetLogFile"); + + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(indexName)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/logs/{indexName}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetLogFile", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Post(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = PostWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.QuerySuggestions.Client.ApiResponse PostWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'path' when calling QuerySuggestionsClient->Post"); + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = await PostWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'path' when calling QuerySuggestionsClient->Post"); + + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Put(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = PutWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.QuerySuggestions.Client.ApiResponse PutWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'path' when calling QuerySuggestionsClient->Put"); + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = await PutWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'path' when calling QuerySuggestionsClient->Put"); + + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update a configuration. Update a QuerySuggestions configuration. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// + /// BaseResponse + public BaseResponse UpdateConfig(string indexName, QuerySuggestionsConfiguration querySuggestionsConfiguration) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = UpdateConfigWithHttpInfo(indexName, querySuggestionsConfiguration); + return localVarResponse.Data; + } + + /// + /// Update a configuration. Update a QuerySuggestions configuration. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// + /// ApiResponse of BaseResponse + public Algolia.Search.QuerySuggestions.Client.ApiResponse UpdateConfigWithHttpInfo(string indexName, QuerySuggestionsConfiguration querySuggestionsConfiguration) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'indexName' when calling QuerySuggestionsClient->UpdateConfig"); + + // verify the required parameter 'querySuggestionsConfiguration' is set + if (querySuggestionsConfiguration == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'querySuggestionsConfiguration' when calling QuerySuggestionsClient->UpdateConfig"); + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.Data = querySuggestionsConfiguration; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1/configs/{indexName}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateConfig", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update a configuration. Update a QuerySuggestions configuration. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// + /// Cancellation Token to cancel the request. + /// Task of BaseResponse + public async System.Threading.Tasks.Task UpdateConfigAsync(string indexName, QuerySuggestionsConfiguration querySuggestionsConfiguration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.QuerySuggestions.Client.ApiResponse localVarResponse = await UpdateConfigWithHttpInfoAsync(indexName, querySuggestionsConfiguration, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Update a configuration. Update a QuerySuggestions configuration. + /// + /// Thrown when fails to make API call + /// Query Suggestions index name. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (BaseResponse) + public async System.Threading.Tasks.Task> UpdateConfigWithHttpInfoAsync(string indexName, QuerySuggestionsConfiguration querySuggestionsConfiguration, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'indexName' when calling QuerySuggestionsClient->UpdateConfig"); + + // verify the required parameter 'querySuggestionsConfiguration' is set + if (querySuggestionsConfiguration == null) + throw new Algolia.Search.QuerySuggestions.Client.ApiException(400, "Missing required parameter 'querySuggestionsConfiguration' when calling QuerySuggestionsClient->UpdateConfig"); + + + Algolia.Search.QuerySuggestions.Client.RequestOptions localVarRequestOptions = new Algolia.Search.QuerySuggestions.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.QuerySuggestions.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.QuerySuggestions.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.Data = querySuggestionsConfiguration; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1/configs/{indexName}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateConfig", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + } +} diff --git a/algoliasearch/QuerySuggestions/Client/ApiClient.cs b/algoliasearch/QuerySuggestions/Client/ApiClient.cs new file mode 100644 index 000000000..03b3765ff --- /dev/null +++ b/algoliasearch/QuerySuggestions/Client/ApiClient.cs @@ -0,0 +1,736 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs; +using System.Net.Http; +using System.Net.Http.Headers; + +namespace Algolia.Search.QuerySuggestions.Client +{ + /// + /// To Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec + { + private readonly IReadableConfiguration _configuration; + private static readonly string _contentType = "application/json"; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is Algolia.Search.QuerySuggestions.Models.AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((Algolia.Search.QuerySuggestions.Models.AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public async Task Deserialize(HttpResponseMessage response) + { + var result = (T)await Deserialize(response, typeof(T)).ConfigureAwait(false); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal async Task Deserialize(HttpResponseMessage response, Type type) + { + IList headers = response.Headers.Select(x => x.Key + "=" + x.Value).ToList(); + + if (type == typeof(byte[])) // return byte array + { + return await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + } + else if (type == typeof(FileParameter)) + { + return new FileParameter(await response.Content.ReadAsStreamAsync().ConfigureAwait(false)); + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + if (headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + File.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(await response.Content.ReadAsStringAsync().ConfigureAwait(false), null, System.Globalization.DateTimeStyles.RoundtripKind); + } + + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public string RootElement { get; set; } + public string Namespace { get; set; } + public string DateFormat { get; set; } + + public string ContentType + { + get { return _contentType; } + set { throw new InvalidOperationException("Not allowed to set content type."); } + } + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + /// + /// The Dispose method will manage the HttpClient lifecycle when not passed by constructor. + /// + public partial class ApiClient : IDisposable, ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + + private readonly HttpClientHandler _httpClientHandler; + private readonly HttpClient _httpClient; + private readonly bool _disposeClient; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + public ApiClient() : + this(Algolia.Search.QuerySuggestions.Client.GlobalConfiguration.Instance.BasePath) + { + } + + /// + /// Initializes a new instance of the . + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = new HttpClientHandler(); + _httpClient = new HttpClient(_httpClientHandler, true); + _disposeClient = true; + _baseUrl = basePath; + } + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, HttpClientHandler handler = null) : + this(client, Algolia.Search.QuerySuggestions.Client.GlobalConfiguration.Instance.BasePath, handler) + { + } + + /// + /// Initializes a new instance of the . + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client cannot be null"); + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = handler; + _httpClient = client; + _baseUrl = basePath; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + if (_disposeClient) + { + _httpClient.Dispose(); + } + } + + /// Prepares multipart/form-data content + HttpContent PrepareMultipartFormDataContent(RequestOptions options) + { + string boundary = "---------" + Guid.NewGuid().ToString().ToUpperInvariant(); + var multipartContent = new MultipartFormDataContent(boundary); + foreach (var formParameter in options.FormParameters) + { + multipartContent.Add(new StringContent(formParameter.Value), formParameter.Key); + } + + if (options.FileParameters != null && options.FileParameters.Count > 0) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var content = new StreamContent(file.Content); + content.Headers.ContentType = new MediaTypeHeaderValue(file.ContentType); + multipartContent.Add(content, fileParam.Key, file.Name); + } + } + } + return multipartContent; + } + + /// + /// Provides all logic for constructing a new HttpRequestMessage. + /// At this point, all information for querying the service is known. Here, it is simply + /// mapped into the a HttpRequestMessage. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// [private] A new HttpRequestMessage instance. + /// + private HttpRequestMessage NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + WebRequestPathBuilder builder = new WebRequestPathBuilder(_baseUrl, path); + + builder.AddPathParameters(options.PathParameters); + + builder.AddQueryParameters(options.QueryParameters); + + HttpRequestMessage request = new HttpRequestMessage(method, builder.GetFullUri()); + + if (configuration.UserAgent != null) + { + request.Headers.TryAddWithoutValidation("User-Agent", configuration.UserAgent); + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.Headers.Add(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + // Todo make content headers actually content headers + request.Headers.TryAddWithoutValidation(headerParam.Key, value); + } + } + } + + List> contentList = new List>(); + + string contentType = null; + if (options.HeaderParameters != null && options.HeaderParameters.ContainsKey("Content-Type")) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes.FirstOrDefault(); + } + + if (contentType == "multipart/form-data") + { + request.Content = PrepareMultipartFormDataContent(options); + } + else if (contentType == "application/x-www-form-urlencoded") + { + request.Content = new FormUrlEncodedContent(options.FormParameters); + } + else + { + if (options.Data != null) + { + if (options.Data is FileParameter fp) + { + contentType = contentType ?? "application/octet-stream"; + + var streamContent = new StreamContent(fp.Content); + streamContent.Headers.ContentType = new MediaTypeHeaderValue(contentType); + request.Content = streamContent; + } + else + { + var serializer = new CustomJsonCodec(SerializerSettings, configuration); + request.Content = new StringContent(serializer.Serialize(options.Data), new UTF8Encoding(), + "application/json"); + } + } + } + + + + // TODO provide an alternative that allows cookies per request instead of per API client + if (options.Cookies != null && options.Cookies.Count > 0) + { + request.Properties["CookieContainer"] = options.Cookies; + } + + return request; + } + + partial void InterceptRequest(HttpRequestMessage req); + partial void InterceptResponse(HttpRequestMessage req, HttpResponseMessage response); + + private async Task> ToApiResponse(HttpResponseMessage response, object responseData, Uri uri) + { + T result = (T)responseData; + string rawContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ReasonPhrase, + Cookies = new List() + }; + + // process response headers, e.g. Access-Control-Allow-Methods + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + // process response content headers, e.g. Content-Type + if (response.Content.Headers != null) + { + foreach (var responseHeader in response.Content.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (_httpClientHandler != null && response != null) + { + try + { + foreach (Cookie cookie in _httpClientHandler.CookieContainer.GetCookies(uri)) + { + transformed.Cookies.Add(cookie); + } + } + catch (PlatformNotSupportedException) { } + } + + return transformed; + } + + private ApiResponse Exec(HttpRequestMessage req, IReadableConfiguration configuration) + { + return ExecAsync(req, configuration).GetAwaiter().GetResult(); + } + + private async Task> ExecAsync(HttpRequestMessage req, + IReadableConfiguration configuration, + System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + CancellationTokenSource timeoutTokenSource = null; + CancellationTokenSource finalTokenSource = null; + var deserializer = new CustomJsonCodec(SerializerSettings, configuration); + var finalToken = cancellationToken; + + try + { + if (configuration.Timeout > 0) + { + timeoutTokenSource = new CancellationTokenSource(configuration.Timeout); + finalTokenSource = CancellationTokenSource.CreateLinkedTokenSource(finalToken, timeoutTokenSource.Token); + finalToken = finalTokenSource.Token; + } + + if (configuration.Proxy != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Configuration `Proxy` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + _httpClientHandler.Proxy = configuration.Proxy; + } + + var cookieContainer = req.Properties.ContainsKey("CookieContainer") ? req.Properties["CookieContainer"] as List : null; + + if (cookieContainer != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Request property `CookieContainer` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + foreach (var cookie in cookieContainer) + { + _httpClientHandler.CookieContainer.Add(cookie); + } + } + + InterceptRequest(req); + + HttpResponseMessage response; + response = await _httpClient.SendAsync(req, finalToken).ConfigureAwait(false); + + if (!response.IsSuccessStatusCode) + { + return await ToApiResponse(response, default(T), req.RequestUri).ConfigureAwait(false); + } + + object responseData = await deserializer.Deserialize(response).ConfigureAwait(false); + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(Algolia.Search.QuerySuggestions.Models.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + responseData = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + else if (typeof(T).Name == "Stream") // for binary response + { + responseData = (T)(object)await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + } + + InterceptResponse(req, response); + + return await ToApiResponse(response, responseData, req.RequestUri).ConfigureAwait(false); + } + catch (OperationCanceledException original) + { + if (timeoutTokenSource != null && timeoutTokenSource.IsCancellationRequested) + { + throw new TaskCanceledException($"[{req.Method}] {req.RequestUri} was timeout.", + new TimeoutException(original.Message, original)); + } + throw; + } + finally + { + if (timeoutTokenSource != null) + { + timeoutTokenSource.Dispose(); + } + + if (finalTokenSource != null) + { + finalTokenSource.Dispose(); + } + } + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(new HttpMethod("PATCH"), path, options, config), config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(new HttpMethod("PATCH"), path, options, config), config); + } + #endregion ISynchronousClient + } +} diff --git a/algoliasearch/QuerySuggestions/Client/ApiException.cs b/algoliasearch/QuerySuggestions/Client/ApiException.cs new file mode 100644 index 000000000..255a865ee --- /dev/null +++ b/algoliasearch/QuerySuggestions/Client/ApiException.cs @@ -0,0 +1,62 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.QuerySuggestions.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// Gets or sets the error code (HTTP status code) + /// + /// The error code (HTTP status code). + public int ErrorCode { get; set; } + + /// + /// Gets or sets the error content (body json object) + /// + /// The error content (Http response body). + public object ErrorContent { get; private set; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public ApiException() { } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + public ApiException(int errorCode, string message) : base(message) + { + this.ErrorCode = errorCode; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + /// Error content. + /// HTTP Headers. + public ApiException(int errorCode, string message, object errorContent = null, Multimap headers = null) : base(message) + { + this.ErrorCode = errorCode; + this.ErrorContent = errorContent; + this.Headers = headers; + } + } + +} diff --git a/algoliasearch/QuerySuggestions/Client/ApiResponse.cs b/algoliasearch/QuerySuggestions/Client/ApiResponse.cs new file mode 100644 index 000000000..b410e6283 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Client/ApiResponse.cs @@ -0,0 +1,160 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; + +namespace Algolia.Search.QuerySuggestions.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public interface IApiResponse + { + /// + /// The data type of + /// + Type ResponseType { get; } + + /// + /// The content of this response + /// + Object Content { get; } + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + Multimap Headers { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + List Cookies { get; set; } + + /// + /// The raw content of this response + /// + string RawContent { get; } + } + + /// + /// API Response + /// + public class ApiResponse : IApiResponse + { + #region Properties + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; } + + /// + /// Gets or sets the data (parsed HTTP body) + /// + /// The data. + public T Data { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + public string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + public List Cookies { get; set; } + + /// + /// The content of this response + /// + public Type ResponseType + { + get { return typeof(T); } + } + + /// + /// The data type of + /// + public object Content + { + get { return Data; } + } + + /// + /// The raw content + /// + public string RawContent { get; } + + #endregion Properties + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data, string rawContent) + { + StatusCode = statusCode; + Headers = headers; + Data = data; + RawContent = rawContent; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) : this(statusCode, headers, data, null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null) + { + } + + #endregion Constructors + } +} diff --git a/algoliasearch/QuerySuggestions/Client/ClientUtils.cs b/algoliasearch/QuerySuggestions/Client/ClientUtils.cs new file mode 100644 index 000000000..f6501c080 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Client/ClientUtils.cs @@ -0,0 +1,244 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; + +namespace Algolia.Search.QuerySuggestions.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// Convert params to key/value pairs. + /// Use collectionFormat to properly format lists and collections. + /// + /// The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi + /// Key name. + /// Value object. + /// A multimap of keys with 1..n associated values. + public static Multimap ParameterToMultiMap(string collectionFormat, string name, object value) + { + var parameters = new Multimap(); + + if (value is ICollection collection && collectionFormat == "multi") + { + foreach (var item in collection) + { + parameters.Add(name, ParameterToString(item)); + } + } + else if (value is IDictionary dictionary) + { + if (collectionFormat == "deepObject") + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value)); + } + } + else + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value)); + } + } + } + else + { + parameters.Add(name, ParameterToString(value)); + } + + return parameters; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// An optional configuration instance, providing formatting options used in processing. + /// Formatted string. + public static string ParameterToString(object obj, IReadableConfiguration configuration = null) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is bool boolean) + return boolean ? "true" : "false"; + if (obj is ICollection collection) + { + List entries = new List(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry, configuration)); + return string.Join(",", entries); + } + if (obj is Enum && HasEnumMemberAttrValue(obj)) + return GetEnumMemberAttrValue(obj); + + return Convert.ToString(obj, CultureInfo.InvariantCulture); + } + + /// + /// Serializes the given object when not null. Otherwise return null. + /// + /// The object to serialize. + /// Serialized string. + public static string Serialize(object obj) + { + return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null; + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Is the Enum decorated with EnumMember Attribute + /// + /// + /// true if found + private static bool HasEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) return true; + return false; + } + + /// + /// Get the EnumMember value + /// + /// + /// EnumMember value as string otherwise null + private static string GetEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) + { + return attr.Value; + } + return null; + } + } +} diff --git a/algoliasearch/QuerySuggestions/Client/Configuration.cs b/algoliasearch/QuerySuggestions/Client/Configuration.cs new file mode 100644 index 000000000..1c3dd8a4d --- /dev/null +++ b/algoliasearch/QuerySuggestions/Client/Configuration.cs @@ -0,0 +1,587 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Net.Http; +using System.Net.Security; + +namespace Algolia.Search.QuerySuggestions.Client +{ + /// + /// Represents a set of configuration settings + /// + public class Configuration : IReadableConfiguration + { + #region Constants + + /// + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.RawContent), + response.RawContent, response.Headers); + } + return null; + }; + + #endregion Static Members + + #region Private Members + + /// + /// Defines the base path of the target API server. + /// Example: http://localhost:3000/v1/ + /// + private string _basePath; + + private bool _useDefaultCredentials = false; + + /// + /// Gets or sets the API key based on the authentication name. + /// This is the key and value comprising the "secret" for accessing an API. + /// + /// The API key. + private IDictionary _apiKey; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + /// + /// Gets or sets the servers defined in the OpenAPI spec. + /// + /// The servers + private IList> _servers; + + /// + /// Gets or sets the operation servers defined in the OpenAPI spec. + /// + /// The operation servers + private IReadOnlyDictionary>> _operationServers; + + #endregion Private Members + + #region Constructors + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration() + { + Proxy = null; + UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + BasePath = "https://query-suggestions.us.algolia.com"; + DefaultHeaders = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + Servers = new List>() + { + { + new Dictionary { + {"url", "https://query-suggestions.{region}.algolia.com"}, + {"description", "You can check the region for your application in the [Algolia dashboard](https://dashboard.algolia.com/account/infrastructure/analytics). If you connect to the wrong region, the API returns an error with the status `401` and the message: \"The log processing region does not match\". "}, + { + "variables", new Dictionary { + { + "region", new Dictionary { + {"description", "No description provided"}, + {"default_value", "us"}, + { + "enum_values", new List() { + "us", + "eu" + } + } + } + } + } + } + } + } + }; + OperationServers = new Dictionary>>() + { + }; + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration( + IDictionary defaultHeaders, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "https://query-suggestions.us.algolia.com") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeaders == null) + throw new ArgumentNullException("defaultHeaders"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeaders) + { + DefaultHeaders.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + #endregion Constructors + + #region Properties + + /// + /// Gets or sets the base path for API access. + /// + public virtual string BasePath + { + get { return _basePath; } + set { _basePath = value; } + } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + public virtual bool UseDefaultCredentials + { + get { return _useDefaultCredentials; } + set { _useDefaultCredentials = value; } + } + + /// + /// Gets or sets the default header. + /// + [Obsolete("Use DefaultHeaders instead.")] + public virtual IDictionary DefaultHeader + { + get + { + return DefaultHeaders; + } + set + { + DefaultHeaders = value; + } + } + + /// + /// Gets or sets the default headers. + /// + public virtual IDictionary DefaultHeaders { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { get; set; } + + /// + /// Gets or sets the proxy + /// + /// Proxy. + public virtual WebProxy Proxy { get; set; } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix(string apiKeyIdentifier) + { + string apiKeyValue; + ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue); + string apiKeyPrefix; + if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) + { + return apiKeyPrefix + " " + apiKeyValue; + } + + return apiKeyValue; + } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } + + set + { + if (string.IsNullOrEmpty(value)) + { + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } + } + } + + /// + /// Gets or sets the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// Whatever you set here will be prepended to the value defined in AddApiKey. + /// + /// An example invocation here might be: + /// + /// ApiKeyPrefix["Authorization"] = "Bearer"; + /// + /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// + /// + /// OAuth2 workflows should set tokens via AccessToken. + /// + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + /// + /// Gets or sets the servers. + /// + /// The servers. + public virtual IList> Servers + { + get { return _servers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Servers may not be null."); + } + _servers = value; + } + } + + /// + /// Gets or sets the operation servers. + /// + /// The operation servers. + public virtual IReadOnlyDictionary>> OperationServers + { + get { return _operationServers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Operation servers may not be null."); + } + _operationServers = value; + } + } + + /// + /// Returns URL based on server settings without providing values + /// for the variables + /// + /// Array index of the server settings. + /// The server URL. + public string GetServerUrl(int index) + { + return GetServerUrl(Servers, index, null); + } + + /// + /// Returns URL based on server settings. + /// + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + public string GetServerUrl(int index, Dictionary inputVariables) + { + return GetServerUrl(Servers, index, inputVariables); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index) + { + return GetOperationServerUrl(operation, index, null); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables) + { + if (operation != null && OperationServers.TryGetValue(operation, out var operationServer)) + { + return GetServerUrl(operationServer, index, inputVariables); + } + + return null; + } + + /// + /// Returns URL based on server settings. + /// + /// Dictionary of server settings. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + private string GetServerUrl(IList> servers, int index, Dictionary inputVariables) + { + if (index < 0 || index >= servers.Count) + { + throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}."); + } + + if (inputVariables == null) + { + inputVariables = new Dictionary(); + } + + IReadOnlyDictionary server = servers[index]; + string url = (string)server["url"]; + + if (server.ContainsKey("variables")) + { + // go through each variable and assign a value + foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"]) + { + + IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value); + + if (inputVariables.ContainsKey(variable.Key)) + { + if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + { + url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); + } + else + { + throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}"); + } + } + else + { + // use default value + url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]); + } + } + } + + return url; + } + + /// + /// Gets and Sets the RemoteCertificateValidationCallback + /// + public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; } + + #endregion Properties + + #region Methods + + /// + /// Returns a string with essential information for debugging. + /// + public static string ToDebugReport() + { + string report = "C# SDK (Algolia.Search.QuerySuggestions) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: 1.0.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; + } + + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey(string key, string value) + { + ApiKey[key] = value; + } + + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix(string key, string value) + { + ApiKeyPrefix[key] = value; + } + + #endregion Methods + + #region Static Members + /// + /// Merge configurations. + /// + /// First configuration. + /// Second configuration. + /// Merged configuration. + public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) + { + if (second == null) return first ?? GlobalConfiguration.Instance; + + Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; + foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; + foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value; + + var config = new Configuration + { + ApiKey = apiKey, + ApiKeyPrefix = apiKeyPrefix, + DefaultHeaders = defaultHeaders, + BasePath = second.BasePath ?? first.BasePath, + Timeout = second.Timeout, + Proxy = second.Proxy ?? first.Proxy, + UserAgent = second.UserAgent ?? first.UserAgent, + TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, + DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat, + UseDefaultCredentials = second.UseDefaultCredentials, + RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback, + }; + return config; + } + #endregion Static Members + } +} diff --git a/algoliasearch/QuerySuggestions/Client/ExceptionFactory.cs b/algoliasearch/QuerySuggestions/Client/ExceptionFactory.cs new file mode 100644 index 000000000..1c0542d4d --- /dev/null +++ b/algoliasearch/QuerySuggestions/Client/ExceptionFactory.cs @@ -0,0 +1,16 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.QuerySuggestions.Client +{ + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions + public delegate Exception ExceptionFactory(string methodName, IApiResponse response); +} diff --git a/algoliasearch/QuerySuggestions/Client/FileParameter.cs b/algoliasearch/QuerySuggestions/Client/FileParameter.cs new file mode 100644 index 000000000..8c4b47b11 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Client/FileParameter.cs @@ -0,0 +1,74 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.IO; + +namespace Algolia.Search.QuerySuggestions.Client +{ + + /// + /// Represents a File passed to the API as a Parameter, allows using different backends for files + /// + public class FileParameter + { + /// + /// The filename + /// + public string Name { get; set; } = "no_name_provided"; + + /// + /// The content type of the file + /// + public string ContentType { get; set; } = "application/octet-stream"; + + /// + /// The content of the file + /// + public Stream Content { get; set; } + + /// + /// Construct a FileParameter just from the contents, will extract the filename from a filestream + /// + /// The file content + public FileParameter(Stream content) + { + if (content is FileStream fs) + { + Name = fs.Name; + } + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The file content + public FileParameter(string filename, Stream content) + { + Name = filename; + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The content type of the file + /// The file content + public FileParameter(string filename, string contentType, Stream content) + { + Name = filename; + ContentType = contentType; + Content = content; + } + + /// + /// Implicit conversion of stream to file parameter. Useful for backwards compatibility. + /// + /// Stream to convert + /// FileParameter + public static implicit operator FileParameter(Stream s) => new FileParameter(s); + } +} diff --git a/algoliasearch/QuerySuggestions/Client/GlobalConfiguration.cs b/algoliasearch/QuerySuggestions/Client/GlobalConfiguration.cs new file mode 100644 index 000000000..784ce5d31 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Client/GlobalConfiguration.cs @@ -0,0 +1,61 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.Collections.Generic; + +namespace Algolia.Search.QuerySuggestions.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .openapi-generator-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + #region Private Members + + private static readonly object GlobalConfigSync = new { }; + private static IReadableConfiguration _globalConfiguration; + + #endregion Private Members + + #region Constructors + + /// + private GlobalConfiguration() + { + } + + /// + public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath) + { + } + + static GlobalConfiguration() + { + Instance = new GlobalConfiguration(); + } + + #endregion Constructors + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static IReadableConfiguration Instance + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + } +} diff --git a/algoliasearch/QuerySuggestions/Client/IAsynchronousClient.cs b/algoliasearch/QuerySuggestions/Client/IAsynchronousClient.cs new file mode 100644 index 000000000..a4334a810 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Client/IAsynchronousClient.cs @@ -0,0 +1,94 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Threading.Tasks; + +namespace Algolia.Search.QuerySuggestions.Client +{ + /// + /// Contract for Asynchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface IAsynchronousClient + { + /// + /// Executes a non-blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } +} diff --git a/algoliasearch/QuerySuggestions/Client/IReadableConfiguration.cs b/algoliasearch/QuerySuggestions/Client/IReadableConfiguration.cs new file mode 100644 index 000000000..dd00baed0 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Client/IReadableConfiguration.cs @@ -0,0 +1,111 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; + +namespace Algolia.Search.QuerySuggestions.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + /// + /// Gets the API key. + /// + /// API key. + IDictionary ApiKey { get; } + + /// + /// Gets the API key prefix. + /// + /// API key prefix. + IDictionary ApiKeyPrefix { get; } + + /// + /// Gets the base path. + /// + /// Base path. + string BasePath { get; } + + /// + /// Gets the date time format. + /// + /// Date time format. + string DateTimeFormat { get; } + + /// + /// Gets the default header. + /// + /// Default header. + [Obsolete("Use DefaultHeaders instead.")] + IDictionary DefaultHeader { get; } + + /// + /// Gets the default headers. + /// + /// Default headers. + IDictionary DefaultHeaders { get; } + + /// + /// Gets the temp folder path. + /// + /// Temp folder path. + string TempFolderPath { get; } + + /// + /// Gets the HTTP connection timeout (in milliseconds) + /// + /// HTTP connection timeout. + int Timeout { get; } + + /// + /// Gets the proxy. + /// + /// Proxy. + WebProxy Proxy { get; } + + /// + /// Gets the user agent. + /// + /// User agent. + string UserAgent { get; } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + bool UseDefaultCredentials { get; } + + /// + /// Get the servers associated with the operation. + /// + /// Operation servers. + IReadOnlyDictionary>> OperationServers { get; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + string GetApiKeyWithPrefix(string apiKeyIdentifier); + + /// + /// Gets the Operation server url at the provided index. + /// + /// Operation server name. + /// Index of the operation server settings. + /// + string GetOperationServerUrl(string operation, int index); + + /// + /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and + /// overriding certificate errors in the scope of a request. + /// + RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; } + } +} diff --git a/algoliasearch/QuerySuggestions/Client/ISynchronousClient.cs b/algoliasearch/QuerySuggestions/Client/ISynchronousClient.cs new file mode 100644 index 000000000..bc9fecedc --- /dev/null +++ b/algoliasearch/QuerySuggestions/Client/ISynchronousClient.cs @@ -0,0 +1,87 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.IO; + +namespace Algolia.Search.QuerySuggestions.Client +{ + /// + /// Contract for Synchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface ISynchronousClient + { + /// + /// Executes a blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null); + } +} diff --git a/algoliasearch/QuerySuggestions/Client/Multimap.cs b/algoliasearch/QuerySuggestions/Client/Multimap.cs new file mode 100644 index 000000000..6e6c8a59a --- /dev/null +++ b/algoliasearch/QuerySuggestions/Client/Multimap.cs @@ -0,0 +1,289 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Algolia.Search.QuerySuggestions.Client +{ + /// + /// A dictionary in which one key has many associated values. + /// + /// The type of the key + /// The type of the value associated with the key. + public class Multimap : IDictionary> + { + #region Private Fields + + private readonly Dictionary> _dictionary; + + #endregion Private Fields + + #region Constructors + + /// + /// Empty Constructor. + /// + public Multimap() + { + _dictionary = new Dictionary>(); + } + + /// + /// Constructor with comparer. + /// + /// + public Multimap(IEqualityComparer comparer) + { + _dictionary = new Dictionary>(comparer); + } + + #endregion Constructors + + #region Enumerators + + /// + /// To get the enumerator. + /// + /// Enumerator + public IEnumerator>> GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + /// + /// To get the enumerator. + /// + /// Enumerator + IEnumerator IEnumerable.GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + #endregion Enumerators + + #region Public Members + /// + /// Add values to Multimap + /// + /// Key value pair + public void Add(KeyValuePair> item) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + + /// + /// Add Multimap to Multimap + /// + /// Multimap + public void Add(Multimap multimap) + { + foreach (var item in multimap) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + + /// + /// Clear Multimap + /// + public void Clear() + { + _dictionary.Clear(); + } + + /// + /// Determines whether Multimap contains the specified item. + /// + /// Key value pair + /// Method needs to be implemented + /// true if the Multimap contains the item; otherwise, false. + public bool Contains(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Copy items of the Multimap to an array, + /// starting at a particular array index. + /// + /// The array that is the destination of the items copied + /// from Multimap. The array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + /// Method needs to be implemented + public void CopyTo(KeyValuePair>[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + /// + /// Removes the specified item from the Multimap. + /// + /// Key value pair + /// true if the item is successfully removed; otherwise, false. + /// Method needs to be implemented + public bool Remove(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Gets the number of items contained in the Multimap. + /// + public int Count => _dictionary.Count; + + /// + /// Gets a value indicating whether the Multimap is read-only. + /// + public bool IsReadOnly => false; + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add the value to Multimap. + public void Add(TKey key, IList value) + { + if (value != null && value.Count > 0) + { + if (_dictionary.TryGetValue(key, out var list)) + { + foreach (var k in value) list.Add(k); + } + else + { + list = new List(value); + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + } + + /// + /// Determines whether the Multimap contains an item with the specified key. + /// + /// The key to locate in the Multimap. + /// true if the Multimap contains an item with + /// the key; otherwise, false. + public bool ContainsKey(TKey key) + { + return _dictionary.ContainsKey(key); + } + + /// + /// Removes item with the specified key from the Multimap. + /// + /// The key to locate in the Multimap. + /// true if the item is successfully removed; otherwise, false. + public bool Remove(TKey key) + { + return TryRemove(key, out var _); + } + + /// + /// Gets the value associated with the specified key. + /// + /// The key whose value to get. + /// When this method returns, the value associated with the specified key, if the + /// key is found; otherwise, the default value for the type of the value parameter. + /// This parameter is passed uninitialized. + /// true if the object that implements Multimap contains + /// an item with the specified key; otherwise, false. + public bool TryGetValue(TKey key, out IList value) + { + return _dictionary.TryGetValue(key, out value); + } + + /// + /// Gets or sets the item with the specified key. + /// + /// The key of the item to get or set. + /// The value of the specified key. + public IList this[TKey key] + { + get => _dictionary[key]; + set => _dictionary[key] = value; + } + + /// + /// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap. + /// + public ICollection Keys => _dictionary.Keys; + + /// + /// Gets a System.Collections.Generic.ICollection containing the values of the Multimap. + /// + public ICollection> Values => _dictionary.Values; + + /// + /// Copy the items of the Multimap to an System.Array, + /// starting at a particular System.Array index. + /// + /// The one-dimensional System.Array that is the destination of the items copied + /// from Multimap. The System.Array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + public void CopyTo(Array array, int index) + { + ((ICollection)_dictionary).CopyTo(array, index); + } + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add value to Multimap. + public void Add(TKey key, TValue value) + { + if (value != null) + { + if (_dictionary.TryGetValue(key, out var list)) + { + list.Add(value); + } + else + { + list = new List { value }; + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add value to Multimap."); + } + } + } + + #endregion Public Members + + #region Private Members + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryRemove(TKey key, out IList value) + { + _dictionary.TryGetValue(key, out value); + return _dictionary.Remove(key); + } + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryAdd(TKey key, IList value) + { + try + { + _dictionary.Add(key, value); + } + catch (ArgumentException) + { + return false; + } + + return true; + } + #endregion Private Members + } +} diff --git a/algoliasearch/QuerySuggestions/Client/OpenAPIDateConverter.cs b/algoliasearch/QuerySuggestions/Client/OpenAPIDateConverter.cs new file mode 100644 index 000000000..40a3efd79 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Client/OpenAPIDateConverter.cs @@ -0,0 +1,23 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using Newtonsoft.Json.Converters; + +namespace Algolia.Search.QuerySuggestions.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class OpenAPIDateConverter : IsoDateTimeConverter + { + /// + /// Initializes a new instance of the class. + /// + public OpenAPIDateConverter() + { + // full-date = date-fullyear "-" date-month "-" date-mday + DateTimeFormat = "yyyy-MM-dd"; + } + } +} diff --git a/algoliasearch/QuerySuggestions/Client/RequestOptions.cs b/algoliasearch/QuerySuggestions/Client/RequestOptions.cs new file mode 100644 index 000000000..9da393862 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Client/RequestOptions.cs @@ -0,0 +1,68 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; + +namespace Algolia.Search.QuerySuggestions.Client +{ + /// + /// A container for generalized request inputs. This type allows consumers to extend the request functionality + /// by abstracting away from the default (built-in) request framework (e.g. RestSharp). + /// + public class RequestOptions + { + /// + /// Parameters to be bound to path parts of the Request's URL + /// + public Dictionary PathParameters { get; set; } + + /// + /// Query parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap QueryParameters { get; set; } + + /// + /// Header parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap HeaderParameters { get; set; } + + /// + /// Form parameters to be sent along with the request. + /// + public Dictionary FormParameters { get; set; } + + /// + /// File parameters to be sent along with the request. + /// + public Multimap FileParameters { get; set; } + + /// + /// Cookies to be sent along with the request. + /// + public List Cookies { get; set; } + + /// + /// Any data associated with a request body. + /// + public Object Data { get; set; } + + /// + /// Constructs a new instance of + /// + public RequestOptions() + { + PathParameters = new Dictionary(); + QueryParameters = new Multimap(); + HeaderParameters = new Multimap(); + FormParameters = new Dictionary(); + FileParameters = new Multimap(); + Cookies = new List(); + } + } +} diff --git a/algoliasearch/QuerySuggestions/Client/WebRequestPathBuilder.cs b/algoliasearch/QuerySuggestions/Client/WebRequestPathBuilder.cs new file mode 100644 index 000000000..35773063a --- /dev/null +++ b/algoliasearch/QuerySuggestions/Client/WebRequestPathBuilder.cs @@ -0,0 +1,47 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using System; +using System.Collections.Generic; + +namespace Algolia.Search.QuerySuggestions.Client +{ + /// + /// A URI builder + /// + class WebRequestPathBuilder + { + private string _baseUrl; + private string _path; + private string _query = "?"; + public WebRequestPathBuilder(string baseUrl, string path) + { + _baseUrl = baseUrl; + _path = path; + } + + public void AddPathParameters(Dictionary parameters) + { + foreach (var parameter in parameters) + { + _path = _path.Replace("{" + parameter.Key + "}", Uri.EscapeDataString(parameter.Value)); + } + } + + public void AddQueryParameters(Multimap parameters) + { + foreach (var parameter in parameters) + { + foreach (var value in parameter.Value) + { + _query = _query + parameter.Key + "=" + Uri.EscapeDataString(value) + "&"; + } + } + } + + public string GetFullUri() + { + return _baseUrl + _path + _query.Substring(0, _query.Length - 1); + } + } +} diff --git a/algoliasearch/QuerySuggestions/Models/AbstractOpenAPISchema.cs b/algoliasearch/QuerySuggestions/Models/AbstractOpenAPISchema.cs new file mode 100644 index 000000000..b58f98a84 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Models/AbstractOpenAPISchema.cs @@ -0,0 +1,70 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace Algolia.Search.QuerySuggestions.Models +{ + /// + /// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification + /// + public abstract partial class AbstractOpenAPISchema + { + /// + /// Custom JSON serializer + /// + static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Error, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Custom JSON serializer for objects with additional properties + /// + static public readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Ignore, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Gets or Sets the actual instance + /// + public abstract Object ActualInstance { get; set; } + + /// + /// Gets or Sets IsNullable to indicate whether the instance is nullable + /// + public bool IsNullable { get; protected set; } + + /// + /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf` + /// + public string SchemaType { get; protected set; } + + /// + /// Converts the instance into JSON string. + /// + public abstract string ToJson(); + } +} diff --git a/algoliasearch/QuerySuggestions/Models/BaseQuerySuggestionsConfigurationResponse.cs b/algoliasearch/QuerySuggestions/Models/BaseQuerySuggestionsConfigurationResponse.cs new file mode 100644 index 000000000..217fb731a --- /dev/null +++ b/algoliasearch/QuerySuggestions/Models/BaseQuerySuggestionsConfigurationResponse.cs @@ -0,0 +1,182 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.QuerySuggestions.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.QuerySuggestions.Client.OpenAPIDateConverter; + +namespace Algolia.Search.QuerySuggestions.Models +{ + /// + /// BaseQuerySuggestionsConfigurationResponse + /// + [DataContract(Name = "baseQuerySuggestionsConfigurationResponse")] + public partial class BaseQuerySuggestionsConfigurationResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Your Algolia application ID.. + /// API key used to read from your source index.. + /// API key used to write and configure your Query Suggestions index.. + /// API key used to read from external Algolia indices. (default to ""). + public BaseQuerySuggestionsConfigurationResponse(string appId = default(string), string sourceIndicesAPIKey = default(string), string suggestionsIndicesAPIKey = default(string), string externalIndicesAPIKey = @"") + { + this.AppId = appId; + this.SourceIndicesAPIKey = sourceIndicesAPIKey; + this.SuggestionsIndicesAPIKey = suggestionsIndicesAPIKey; + // use default value if no "externalIndicesAPIKey" provided + this.ExternalIndicesAPIKey = externalIndicesAPIKey ?? @""; + } + + /// + /// Your Algolia application ID. + /// + /// Your Algolia application ID. + [DataMember(Name = "appId", EmitDefaultValue = false)] + public string AppId { get; set; } + + /// + /// API key used to read from your source index. + /// + /// API key used to read from your source index. + [DataMember(Name = "sourceIndicesAPIKey", EmitDefaultValue = false)] + public string SourceIndicesAPIKey { get; set; } + + /// + /// API key used to write and configure your Query Suggestions index. + /// + /// API key used to write and configure your Query Suggestions index. + [DataMember(Name = "suggestionsIndicesAPIKey", EmitDefaultValue = false)] + public string SuggestionsIndicesAPIKey { get; set; } + + /// + /// API key used to read from external Algolia indices. + /// + /// API key used to read from external Algolia indices. + [DataMember(Name = "externalIndicesAPIKey", EmitDefaultValue = false)] + public string ExternalIndicesAPIKey { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BaseQuerySuggestionsConfigurationResponse {\n"); + sb.Append(" AppId: ").Append(AppId).Append("\n"); + sb.Append(" SourceIndicesAPIKey: ").Append(SourceIndicesAPIKey).Append("\n"); + sb.Append(" SuggestionsIndicesAPIKey: ").Append(SuggestionsIndicesAPIKey).Append("\n"); + sb.Append(" ExternalIndicesAPIKey: ").Append(ExternalIndicesAPIKey).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BaseQuerySuggestionsConfigurationResponse); + } + + /// + /// Returns true if BaseQuerySuggestionsConfigurationResponse instances are equal + /// + /// Instance of BaseQuerySuggestionsConfigurationResponse to be compared + /// Boolean + public bool Equals(BaseQuerySuggestionsConfigurationResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.AppId == input.AppId || + (this.AppId != null && + this.AppId.Equals(input.AppId)) + ) && + ( + this.SourceIndicesAPIKey == input.SourceIndicesAPIKey || + (this.SourceIndicesAPIKey != null && + this.SourceIndicesAPIKey.Equals(input.SourceIndicesAPIKey)) + ) && + ( + this.SuggestionsIndicesAPIKey == input.SuggestionsIndicesAPIKey || + (this.SuggestionsIndicesAPIKey != null && + this.SuggestionsIndicesAPIKey.Equals(input.SuggestionsIndicesAPIKey)) + ) && + ( + this.ExternalIndicesAPIKey == input.ExternalIndicesAPIKey || + (this.ExternalIndicesAPIKey != null && + this.ExternalIndicesAPIKey.Equals(input.ExternalIndicesAPIKey)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AppId != null) + { + hashCode = (hashCode * 59) + this.AppId.GetHashCode(); + } + if (this.SourceIndicesAPIKey != null) + { + hashCode = (hashCode * 59) + this.SourceIndicesAPIKey.GetHashCode(); + } + if (this.SuggestionsIndicesAPIKey != null) + { + hashCode = (hashCode * 59) + this.SuggestionsIndicesAPIKey.GetHashCode(); + } + if (this.ExternalIndicesAPIKey != null) + { + hashCode = (hashCode * 59) + this.ExternalIndicesAPIKey.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/QuerySuggestions/Models/BaseQuerySuggestionsConfigurationWithIndex.cs b/algoliasearch/QuerySuggestions/Models/BaseQuerySuggestionsConfigurationWithIndex.cs new file mode 100644 index 000000000..bb3ab3f9d --- /dev/null +++ b/algoliasearch/QuerySuggestions/Models/BaseQuerySuggestionsConfigurationWithIndex.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.QuerySuggestions.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.QuerySuggestions.Client.OpenAPIDateConverter; + +namespace Algolia.Search.QuerySuggestions.Models +{ + /// + /// BaseQuerySuggestionsConfigurationWithIndex + /// + [DataContract(Name = "baseQuerySuggestionsConfigurationWithIndex")] + public partial class BaseQuerySuggestionsConfigurationWithIndex : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BaseQuerySuggestionsConfigurationWithIndex() { } + /// + /// Initializes a new instance of the class. + /// + /// Query Suggestions index name. (required). + public BaseQuerySuggestionsConfigurationWithIndex(string indexName = default(string)) + { + // to ensure "indexName" is required (not null) + if (indexName == null) + { + throw new ArgumentNullException("indexName is a required property for BaseQuerySuggestionsConfigurationWithIndex and cannot be null"); + } + this.IndexName = indexName; + } + + /// + /// Query Suggestions index name. + /// + /// Query Suggestions index name. + [DataMember(Name = "indexName", IsRequired = true, EmitDefaultValue = true)] + public string IndexName { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BaseQuerySuggestionsConfigurationWithIndex {\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BaseQuerySuggestionsConfigurationWithIndex); + } + + /// + /// Returns true if BaseQuerySuggestionsConfigurationWithIndex instances are equal + /// + /// Instance of BaseQuerySuggestionsConfigurationWithIndex to be compared + /// Boolean + public bool Equals(BaseQuerySuggestionsConfigurationWithIndex input) + { + if (input == null) + { + return false; + } + return + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/QuerySuggestions/Models/BaseResponse.cs b/algoliasearch/QuerySuggestions/Models/BaseResponse.cs new file mode 100644 index 000000000..3f0be06b4 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Models/BaseResponse.cs @@ -0,0 +1,139 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.QuerySuggestions.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.QuerySuggestions.Client.OpenAPIDateConverter; + +namespace Algolia.Search.QuerySuggestions.Models +{ + /// + /// BaseResponse + /// + [DataContract(Name = "BaseResponse")] + public partial class BaseResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code.. + /// Details about the response, such as error messages.. + public BaseResponse(int status = default(int), string message = default(string)) + { + this.Status = status; + this.Message = message; + } + + /// + /// HTTP status code. + /// + /// HTTP status code. + [DataMember(Name = "status", EmitDefaultValue = false)] + public int Status { get; set; } + + /// + /// Details about the response, such as error messages. + /// + /// Details about the response, such as error messages. + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BaseResponse {\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BaseResponse); + } + + /// + /// Returns true if BaseResponse instances are equal + /// + /// Instance of BaseResponse to be compared + /// Boolean + public bool Equals(BaseResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Status == input.Status || + this.Status.Equals(input.Status) + ) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Status.GetHashCode(); + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/QuerySuggestions/Models/ErrorBase.cs b/algoliasearch/QuerySuggestions/Models/ErrorBase.cs new file mode 100644 index 000000000..8c7a1d6f1 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Models/ErrorBase.cs @@ -0,0 +1,147 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.QuerySuggestions.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.QuerySuggestions.Client.OpenAPIDateConverter; + +namespace Algolia.Search.QuerySuggestions.Models +{ + /// + /// Error. + /// + [DataContract(Name = "ErrorBase")] + public partial class ErrorBase : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// message. + public ErrorBase(string message = default(string)) : base() + { + this.Message = message; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Message + /// + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ErrorBase {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ErrorBase); + } + + /// + /// Returns true if ErrorBase instances are equal + /// + /// Instance of ErrorBase to be compared + /// Boolean + public bool Equals(ErrorBase input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/QuerySuggestions/Models/Facet.cs b/algoliasearch/QuerySuggestions/Models/Facet.cs new file mode 100644 index 000000000..190038746 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Models/Facet.cs @@ -0,0 +1,139 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.QuerySuggestions.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.QuerySuggestions.Client.OpenAPIDateConverter; + +namespace Algolia.Search.QuerySuggestions.Models +{ + /// + /// Facet to use as category. + /// + [DataContract(Name = "Facet")] + public partial class Facet : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Facet name.. + /// Number of suggestions.. + public Facet(string attribute = default(string), int amount = default(int)) + { + this.Attribute = attribute; + this.Amount = amount; + } + + /// + /// Facet name. + /// + /// Facet name. + [DataMember(Name = "attribute", EmitDefaultValue = false)] + public string Attribute { get; set; } + + /// + /// Number of suggestions. + /// + /// Number of suggestions. + [DataMember(Name = "amount", EmitDefaultValue = false)] + public int Amount { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Facet {\n"); + sb.Append(" Attribute: ").Append(Attribute).Append("\n"); + sb.Append(" Amount: ").Append(Amount).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Facet); + } + + /// + /// Returns true if Facet instances are equal + /// + /// Instance of Facet to be compared + /// Boolean + public bool Equals(Facet input) + { + if (input == null) + { + return false; + } + return + ( + this.Attribute == input.Attribute || + (this.Attribute != null && + this.Attribute.Equals(input.Attribute)) + ) && + ( + this.Amount == input.Amount || + this.Amount.Equals(input.Amount) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Attribute != null) + { + hashCode = (hashCode * 59) + this.Attribute.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Amount.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/QuerySuggestions/Models/GetConfigStatus200Response.cs b/algoliasearch/QuerySuggestions/Models/GetConfigStatus200Response.cs new file mode 100644 index 000000000..d72275137 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Models/GetConfigStatus200Response.cs @@ -0,0 +1,196 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.QuerySuggestions.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.QuerySuggestions.Client.OpenAPIDateConverter; + +namespace Algolia.Search.QuerySuggestions.Models +{ + /// + /// GetConfigStatus200Response + /// + [DataContract(Name = "getConfigStatus_200_response")] + public partial class GetConfigStatus200Response : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Query Suggestions index name.. + /// Indicates whether the creation or update of the Query Suggestions is in progress.. + /// Timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format when the Query Suggestions index was last built.. + /// Timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format when the Query Suggestions index was last updated successfully.. + /// Duration of the last successful build in seconds.. + public GetConfigStatus200Response(string indexName = default(string), bool isRunning = default(bool), string lastBuiltAt = default(string), string lastSuccessfulBuiltAt = default(string), string lastSuccessfulBuildDuration = default(string)) + { + this.IndexName = indexName; + this.IsRunning = isRunning; + this.LastBuiltAt = lastBuiltAt; + this.LastSuccessfulBuiltAt = lastSuccessfulBuiltAt; + this.LastSuccessfulBuildDuration = lastSuccessfulBuildDuration; + } + + /// + /// Query Suggestions index name. + /// + /// Query Suggestions index name. + [DataMember(Name = "indexName", EmitDefaultValue = false)] + public string IndexName { get; set; } + + /// + /// Indicates whether the creation or update of the Query Suggestions is in progress. + /// + /// Indicates whether the creation or update of the Query Suggestions is in progress. + [DataMember(Name = "isRunning", EmitDefaultValue = true)] + public bool IsRunning { get; set; } + + /// + /// Timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format when the Query Suggestions index was last built. + /// + /// Timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format when the Query Suggestions index was last built. + [DataMember(Name = "lastBuiltAt", EmitDefaultValue = false)] + public string LastBuiltAt { get; set; } + + /// + /// Timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format when the Query Suggestions index was last updated successfully. + /// + /// Timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format when the Query Suggestions index was last updated successfully. + [DataMember(Name = "lastSuccessfulBuiltAt", EmitDefaultValue = false)] + public string LastSuccessfulBuiltAt { get; set; } + + /// + /// Duration of the last successful build in seconds. + /// + /// Duration of the last successful build in seconds. + [DataMember(Name = "lastSuccessfulBuildDuration", EmitDefaultValue = false)] + public string LastSuccessfulBuildDuration { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetConfigStatus200Response {\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append(" IsRunning: ").Append(IsRunning).Append("\n"); + sb.Append(" LastBuiltAt: ").Append(LastBuiltAt).Append("\n"); + sb.Append(" LastSuccessfulBuiltAt: ").Append(LastSuccessfulBuiltAt).Append("\n"); + sb.Append(" LastSuccessfulBuildDuration: ").Append(LastSuccessfulBuildDuration).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetConfigStatus200Response); + } + + /// + /// Returns true if GetConfigStatus200Response instances are equal + /// + /// Instance of GetConfigStatus200Response to be compared + /// Boolean + public bool Equals(GetConfigStatus200Response input) + { + if (input == null) + { + return false; + } + return + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ) && + ( + this.IsRunning == input.IsRunning || + this.IsRunning.Equals(input.IsRunning) + ) && + ( + this.LastBuiltAt == input.LastBuiltAt || + (this.LastBuiltAt != null && + this.LastBuiltAt.Equals(input.LastBuiltAt)) + ) && + ( + this.LastSuccessfulBuiltAt == input.LastSuccessfulBuiltAt || + (this.LastSuccessfulBuiltAt != null && + this.LastSuccessfulBuiltAt.Equals(input.LastSuccessfulBuiltAt)) + ) && + ( + this.LastSuccessfulBuildDuration == input.LastSuccessfulBuildDuration || + (this.LastSuccessfulBuildDuration != null && + this.LastSuccessfulBuildDuration.Equals(input.LastSuccessfulBuildDuration)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.IsRunning.GetHashCode(); + if (this.LastBuiltAt != null) + { + hashCode = (hashCode * 59) + this.LastBuiltAt.GetHashCode(); + } + if (this.LastSuccessfulBuiltAt != null) + { + hashCode = (hashCode * 59) + this.LastSuccessfulBuiltAt.GetHashCode(); + } + if (this.LastSuccessfulBuildDuration != null) + { + hashCode = (hashCode * 59) + this.LastSuccessfulBuildDuration.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/QuerySuggestions/Models/GetLogFile200Response.cs b/algoliasearch/QuerySuggestions/Models/GetLogFile200Response.cs new file mode 100644 index 000000000..6048a6815 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Models/GetLogFile200Response.cs @@ -0,0 +1,172 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.QuerySuggestions.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.QuerySuggestions.Client.OpenAPIDateConverter; + +namespace Algolia.Search.QuerySuggestions.Models +{ + /// + /// GetLogFile200Response + /// + [DataContract(Name = "getLogFile_200_response")] + public partial class GetLogFile200Response : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Level + /// + [DataMember(Name = "level", EmitDefaultValue = false)] + public LogLevel? Level { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format.. + /// level. + /// Details about this log entry.. + /// Level indicating the position of a suggestion in a hierarchy of records. For example, a `contextLevel` of 1 indicates that this suggestion belongs to a previous suggestion with `contextLevel` 0. . + public GetLogFile200Response(string timestamp = default(string), LogLevel? level = default(LogLevel?), string message = default(string), int contextLevel = default(int)) + { + this.Timestamp = timestamp; + this.Level = level; + this.Message = message; + this.ContextLevel = contextLevel; + } + + /// + /// Timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "timestamp", EmitDefaultValue = false)] + public string Timestamp { get; set; } + + /// + /// Details about this log entry. + /// + /// Details about this log entry. + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Level indicating the position of a suggestion in a hierarchy of records. For example, a `contextLevel` of 1 indicates that this suggestion belongs to a previous suggestion with `contextLevel` 0. + /// + /// Level indicating the position of a suggestion in a hierarchy of records. For example, a `contextLevel` of 1 indicates that this suggestion belongs to a previous suggestion with `contextLevel` 0. + [DataMember(Name = "contextLevel", EmitDefaultValue = false)] + public int ContextLevel { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetLogFile200Response {\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" Level: ").Append(Level).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" ContextLevel: ").Append(ContextLevel).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetLogFile200Response); + } + + /// + /// Returns true if GetLogFile200Response instances are equal + /// + /// Instance of GetLogFile200Response to be compared + /// Boolean + public bool Equals(GetLogFile200Response input) + { + if (input == null) + { + return false; + } + return + ( + this.Timestamp == input.Timestamp || + (this.Timestamp != null && + this.Timestamp.Equals(input.Timestamp)) + ) && + ( + this.Level == input.Level || + this.Level.Equals(input.Level) + ) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) && + ( + this.ContextLevel == input.ContextLevel || + this.ContextLevel.Equals(input.ContextLevel) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Timestamp != null) + { + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Level.GetHashCode(); + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ContextLevel.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/QuerySuggestions/Models/Languages.cs b/algoliasearch/QuerySuggestions/Models/Languages.cs new file mode 100644 index 000000000..ea30ab538 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Models/Languages.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.QuerySuggestions.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.QuerySuggestions.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.QuerySuggestions.Models +{ + /// + /// Set the language for deduplicating singular and plural suggestions. If specified, only the more popular form is included. + /// + [JsonConverter(typeof(LanguagesJsonConverter))] + [DataContract(Name = "Languages")] + public partial class Languages : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<string>. + public Languages(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of bool. + public Languages(bool actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(bool)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, bool"); + } + } + } + + /// + /// Get the actual instance of `List<string>`. If the actual instance is not `List<string>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<string> + public List GetterListString() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `bool`. If the actual instance is not `bool`, + /// the InvalidClassException will be thrown + /// + /// An instance of bool + public bool GetterBool() + { + return (bool)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Languages {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, Languages.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of Languages + /// + /// JSON string + /// An instance of Languages + public static Languages FromJson(string jsonString) + { + Languages newLanguages = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newLanguages; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newLanguages = new Languages(JsonConvert.DeserializeObject>(jsonString, Languages.SerializerSettings)); + } + else + { + newLanguages = new Languages(JsonConvert.DeserializeObject>(jsonString, Languages.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(bool).GetProperty("AdditionalProperties") == null) + { + newLanguages = new Languages(JsonConvert.DeserializeObject(jsonString, Languages.SerializerSettings)); + } + else + { + newLanguages = new Languages(JsonConvert.DeserializeObject(jsonString, Languages.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("bool"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into bool: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newLanguages; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Languages); + } + + /// + /// Returns true if Languages instances are equal + /// + /// Instance of Languages to be compared + /// Boolean + public bool Equals(Languages input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for Languages + /// + public class LanguagesJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(Languages).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return Languages.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/QuerySuggestions/Models/LogLevel.cs b/algoliasearch/QuerySuggestions/Models/LogLevel.cs new file mode 100644 index 000000000..37643a24a --- /dev/null +++ b/algoliasearch/QuerySuggestions/Models/LogLevel.cs @@ -0,0 +1,49 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.QuerySuggestions.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.QuerySuggestions.Client.OpenAPIDateConverter; + +namespace Algolia.Search.QuerySuggestions.Models +{ + /// + /// The type of log entry. - `SKIP`. A query is skipped because it doesn't match the conditions for successful inclusion. For example, when a query doesn't generate enough search results. - `INFO`. An informative log entry. - `ERROR`. The Query Suggestions process encountered an error. + /// + /// The type of log entry. - `SKIP`. A query is skipped because it doesn't match the conditions for successful inclusion. For example, when a query doesn't generate enough search results. - `INFO`. An informative log entry. - `ERROR`. The Query Suggestions process encountered an error. + [JsonConverter(typeof(StringEnumConverter))] + public enum LogLevel + { + /// + /// Enum SKIP for value: SKIP + /// + [EnumMember(Value = "SKIP")] + SKIP = 1, + + /// + /// Enum INFO for value: INFO + /// + [EnumMember(Value = "INFO")] + INFO = 2, + + /// + /// Enum ERROR for value: ERROR + /// + [EnumMember(Value = "ERROR")] + ERROR = 3 + } + +} diff --git a/algoliasearch/QuerySuggestions/Models/QuerySuggestionsConfiguration.cs b/algoliasearch/QuerySuggestions/Models/QuerySuggestionsConfiguration.cs new file mode 100644 index 000000000..68ba79b8e --- /dev/null +++ b/algoliasearch/QuerySuggestions/Models/QuerySuggestionsConfiguration.cs @@ -0,0 +1,203 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.QuerySuggestions.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.QuerySuggestions.Client.OpenAPIDateConverter; + +namespace Algolia.Search.QuerySuggestions.Models +{ + /// + /// Query Suggestions configuration. + /// + [DataContract(Name = "QuerySuggestionsConfiguration")] + public partial class QuerySuggestionsConfiguration : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected QuerySuggestionsConfiguration() { } + /// + /// Initializes a new instance of the class. + /// + /// Algolia indices from which to get the popular searches for query suggestions. (required). + /// languages. + /// Patterns to exclude from query suggestions.. + /// Turn on personalized query suggestions. (default to false). + /// Allow suggestions with special characters. (default to false). + public QuerySuggestionsConfiguration(List sourceIndices = default(List), Languages languages = default(Languages), List exclude = default(List), bool enablePersonalization = false, bool allowSpecialCharacters = false) + { + // to ensure "sourceIndices" is required (not null) + if (sourceIndices == null) + { + throw new ArgumentNullException("sourceIndices is a required property for QuerySuggestionsConfiguration and cannot be null"); + } + this.SourceIndices = sourceIndices; + this.Languages = languages; + this.Exclude = exclude; + this.EnablePersonalization = enablePersonalization; + this.AllowSpecialCharacters = allowSpecialCharacters; + } + + /// + /// Algolia indices from which to get the popular searches for query suggestions. + /// + /// Algolia indices from which to get the popular searches for query suggestions. + [DataMember(Name = "sourceIndices", IsRequired = true, EmitDefaultValue = true)] + public List SourceIndices { get; set; } + + /// + /// Gets or Sets Languages + /// + [DataMember(Name = "languages", EmitDefaultValue = false)] + public Languages Languages { get; set; } + + /// + /// Patterns to exclude from query suggestions. + /// + /// Patterns to exclude from query suggestions. + [DataMember(Name = "exclude", EmitDefaultValue = true)] + public List Exclude { get; set; } + + /// + /// Turn on personalized query suggestions. + /// + /// Turn on personalized query suggestions. + [DataMember(Name = "enablePersonalization", EmitDefaultValue = true)] + public bool EnablePersonalization { get; set; } + + /// + /// Allow suggestions with special characters. + /// + /// Allow suggestions with special characters. + [DataMember(Name = "allowSpecialCharacters", EmitDefaultValue = true)] + public bool AllowSpecialCharacters { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class QuerySuggestionsConfiguration {\n"); + sb.Append(" SourceIndices: ").Append(SourceIndices).Append("\n"); + sb.Append(" Languages: ").Append(Languages).Append("\n"); + sb.Append(" Exclude: ").Append(Exclude).Append("\n"); + sb.Append(" EnablePersonalization: ").Append(EnablePersonalization).Append("\n"); + sb.Append(" AllowSpecialCharacters: ").Append(AllowSpecialCharacters).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as QuerySuggestionsConfiguration); + } + + /// + /// Returns true if QuerySuggestionsConfiguration instances are equal + /// + /// Instance of QuerySuggestionsConfiguration to be compared + /// Boolean + public bool Equals(QuerySuggestionsConfiguration input) + { + if (input == null) + { + return false; + } + return + ( + this.SourceIndices == input.SourceIndices || + this.SourceIndices != null && + input.SourceIndices != null && + this.SourceIndices.SequenceEqual(input.SourceIndices) + ) && + ( + this.Languages == input.Languages || + (this.Languages != null && + this.Languages.Equals(input.Languages)) + ) && + ( + this.Exclude == input.Exclude || + this.Exclude != null && + input.Exclude != null && + this.Exclude.SequenceEqual(input.Exclude) + ) && + ( + this.EnablePersonalization == input.EnablePersonalization || + this.EnablePersonalization.Equals(input.EnablePersonalization) + ) && + ( + this.AllowSpecialCharacters == input.AllowSpecialCharacters || + this.AllowSpecialCharacters.Equals(input.AllowSpecialCharacters) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SourceIndices != null) + { + hashCode = (hashCode * 59) + this.SourceIndices.GetHashCode(); + } + if (this.Languages != null) + { + hashCode = (hashCode * 59) + this.Languages.GetHashCode(); + } + if (this.Exclude != null) + { + hashCode = (hashCode * 59) + this.Exclude.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EnablePersonalization.GetHashCode(); + hashCode = (hashCode * 59) + this.AllowSpecialCharacters.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/QuerySuggestions/Models/QuerySuggestionsConfigurationResponse.cs b/algoliasearch/QuerySuggestions/Models/QuerySuggestionsConfigurationResponse.cs new file mode 100644 index 000000000..e7698f923 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Models/QuerySuggestionsConfigurationResponse.cs @@ -0,0 +1,304 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.QuerySuggestions.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.QuerySuggestions.Client.OpenAPIDateConverter; + +namespace Algolia.Search.QuerySuggestions.Models +{ + /// + /// QuerySuggestionsConfigurationResponse + /// + [DataContract(Name = "QuerySuggestionsConfigurationResponse")] + public partial class QuerySuggestionsConfigurationResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected QuerySuggestionsConfigurationResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Your Algolia application ID.. + /// API key used to read from your source index.. + /// API key used to write and configure your Query Suggestions index.. + /// API key used to read from external Algolia indices. (default to ""). + /// Query Suggestions index name. (required). + /// Algolia indices from which to get the popular searches for query suggestions. (required). + /// languages. + /// Patterns to exclude from query suggestions.. + /// Turn on personalized query suggestions. (default to false). + /// Allow suggestions with special characters. (default to false). + public QuerySuggestionsConfigurationResponse(string appId = default(string), string sourceIndicesAPIKey = default(string), string suggestionsIndicesAPIKey = default(string), string externalIndicesAPIKey = @"", string indexName = default(string), List sourceIndices = default(List), Languages languages = default(Languages), List exclude = default(List), bool enablePersonalization = false, bool allowSpecialCharacters = false) + { + // to ensure "indexName" is required (not null) + if (indexName == null) + { + throw new ArgumentNullException("indexName is a required property for QuerySuggestionsConfigurationResponse and cannot be null"); + } + this.IndexName = indexName; + // to ensure "sourceIndices" is required (not null) + if (sourceIndices == null) + { + throw new ArgumentNullException("sourceIndices is a required property for QuerySuggestionsConfigurationResponse and cannot be null"); + } + this.SourceIndices = sourceIndices; + this.AppId = appId; + this.SourceIndicesAPIKey = sourceIndicesAPIKey; + this.SuggestionsIndicesAPIKey = suggestionsIndicesAPIKey; + // use default value if no "externalIndicesAPIKey" provided + this.ExternalIndicesAPIKey = externalIndicesAPIKey ?? @""; + this.Languages = languages; + this.Exclude = exclude; + this.EnablePersonalization = enablePersonalization; + this.AllowSpecialCharacters = allowSpecialCharacters; + } + + /// + /// Your Algolia application ID. + /// + /// Your Algolia application ID. + [DataMember(Name = "appId", EmitDefaultValue = false)] + public string AppId { get; set; } + + /// + /// API key used to read from your source index. + /// + /// API key used to read from your source index. + [DataMember(Name = "sourceIndicesAPIKey", EmitDefaultValue = false)] + public string SourceIndicesAPIKey { get; set; } + + /// + /// API key used to write and configure your Query Suggestions index. + /// + /// API key used to write and configure your Query Suggestions index. + [DataMember(Name = "suggestionsIndicesAPIKey", EmitDefaultValue = false)] + public string SuggestionsIndicesAPIKey { get; set; } + + /// + /// API key used to read from external Algolia indices. + /// + /// API key used to read from external Algolia indices. + [DataMember(Name = "externalIndicesAPIKey", EmitDefaultValue = false)] + public string ExternalIndicesAPIKey { get; set; } + + /// + /// Query Suggestions index name. + /// + /// Query Suggestions index name. + [DataMember(Name = "indexName", IsRequired = true, EmitDefaultValue = true)] + public string IndexName { get; set; } + + /// + /// Algolia indices from which to get the popular searches for query suggestions. + /// + /// Algolia indices from which to get the popular searches for query suggestions. + [DataMember(Name = "sourceIndices", IsRequired = true, EmitDefaultValue = true)] + public List SourceIndices { get; set; } + + /// + /// Gets or Sets Languages + /// + [DataMember(Name = "languages", EmitDefaultValue = false)] + public Languages Languages { get; set; } + + /// + /// Patterns to exclude from query suggestions. + /// + /// Patterns to exclude from query suggestions. + [DataMember(Name = "exclude", EmitDefaultValue = true)] + public List Exclude { get; set; } + + /// + /// Turn on personalized query suggestions. + /// + /// Turn on personalized query suggestions. + [DataMember(Name = "enablePersonalization", EmitDefaultValue = true)] + public bool EnablePersonalization { get; set; } + + /// + /// Allow suggestions with special characters. + /// + /// Allow suggestions with special characters. + [DataMember(Name = "allowSpecialCharacters", EmitDefaultValue = true)] + public bool AllowSpecialCharacters { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class QuerySuggestionsConfigurationResponse {\n"); + sb.Append(" AppId: ").Append(AppId).Append("\n"); + sb.Append(" SourceIndicesAPIKey: ").Append(SourceIndicesAPIKey).Append("\n"); + sb.Append(" SuggestionsIndicesAPIKey: ").Append(SuggestionsIndicesAPIKey).Append("\n"); + sb.Append(" ExternalIndicesAPIKey: ").Append(ExternalIndicesAPIKey).Append("\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append(" SourceIndices: ").Append(SourceIndices).Append("\n"); + sb.Append(" Languages: ").Append(Languages).Append("\n"); + sb.Append(" Exclude: ").Append(Exclude).Append("\n"); + sb.Append(" EnablePersonalization: ").Append(EnablePersonalization).Append("\n"); + sb.Append(" AllowSpecialCharacters: ").Append(AllowSpecialCharacters).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as QuerySuggestionsConfigurationResponse); + } + + /// + /// Returns true if QuerySuggestionsConfigurationResponse instances are equal + /// + /// Instance of QuerySuggestionsConfigurationResponse to be compared + /// Boolean + public bool Equals(QuerySuggestionsConfigurationResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.AppId == input.AppId || + (this.AppId != null && + this.AppId.Equals(input.AppId)) + ) && + ( + this.SourceIndicesAPIKey == input.SourceIndicesAPIKey || + (this.SourceIndicesAPIKey != null && + this.SourceIndicesAPIKey.Equals(input.SourceIndicesAPIKey)) + ) && + ( + this.SuggestionsIndicesAPIKey == input.SuggestionsIndicesAPIKey || + (this.SuggestionsIndicesAPIKey != null && + this.SuggestionsIndicesAPIKey.Equals(input.SuggestionsIndicesAPIKey)) + ) && + ( + this.ExternalIndicesAPIKey == input.ExternalIndicesAPIKey || + (this.ExternalIndicesAPIKey != null && + this.ExternalIndicesAPIKey.Equals(input.ExternalIndicesAPIKey)) + ) && + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ) && + ( + this.SourceIndices == input.SourceIndices || + this.SourceIndices != null && + input.SourceIndices != null && + this.SourceIndices.SequenceEqual(input.SourceIndices) + ) && + ( + this.Languages == input.Languages || + (this.Languages != null && + this.Languages.Equals(input.Languages)) + ) && + ( + this.Exclude == input.Exclude || + this.Exclude != null && + input.Exclude != null && + this.Exclude.SequenceEqual(input.Exclude) + ) && + ( + this.EnablePersonalization == input.EnablePersonalization || + this.EnablePersonalization.Equals(input.EnablePersonalization) + ) && + ( + this.AllowSpecialCharacters == input.AllowSpecialCharacters || + this.AllowSpecialCharacters.Equals(input.AllowSpecialCharacters) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AppId != null) + { + hashCode = (hashCode * 59) + this.AppId.GetHashCode(); + } + if (this.SourceIndicesAPIKey != null) + { + hashCode = (hashCode * 59) + this.SourceIndicesAPIKey.GetHashCode(); + } + if (this.SuggestionsIndicesAPIKey != null) + { + hashCode = (hashCode * 59) + this.SuggestionsIndicesAPIKey.GetHashCode(); + } + if (this.ExternalIndicesAPIKey != null) + { + hashCode = (hashCode * 59) + this.ExternalIndicesAPIKey.GetHashCode(); + } + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + if (this.SourceIndices != null) + { + hashCode = (hashCode * 59) + this.SourceIndices.GetHashCode(); + } + if (this.Languages != null) + { + hashCode = (hashCode * 59) + this.Languages.GetHashCode(); + } + if (this.Exclude != null) + { + hashCode = (hashCode * 59) + this.Exclude.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EnablePersonalization.GetHashCode(); + hashCode = (hashCode * 59) + this.AllowSpecialCharacters.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/QuerySuggestions/Models/QuerySuggestionsConfigurationWithIndex.cs b/algoliasearch/QuerySuggestions/Models/QuerySuggestionsConfigurationWithIndex.cs new file mode 100644 index 000000000..923efc818 --- /dev/null +++ b/algoliasearch/QuerySuggestions/Models/QuerySuggestionsConfigurationWithIndex.cs @@ -0,0 +1,227 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.QuerySuggestions.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.QuerySuggestions.Client.OpenAPIDateConverter; + +namespace Algolia.Search.QuerySuggestions.Models +{ + /// + /// Query Suggestions configuration. + /// + [DataContract(Name = "QuerySuggestionsConfigurationWithIndex")] + public partial class QuerySuggestionsConfigurationWithIndex : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected QuerySuggestionsConfigurationWithIndex() { } + /// + /// Initializes a new instance of the class. + /// + /// Query Suggestions index name. (required). + /// Algolia indices from which to get the popular searches for query suggestions. (required). + /// languages. + /// Patterns to exclude from query suggestions.. + /// Turn on personalized query suggestions. (default to false). + /// Allow suggestions with special characters. (default to false). + public QuerySuggestionsConfigurationWithIndex(string indexName = default(string), List sourceIndices = default(List), Languages languages = default(Languages), List exclude = default(List), bool enablePersonalization = false, bool allowSpecialCharacters = false) + { + // to ensure "indexName" is required (not null) + if (indexName == null) + { + throw new ArgumentNullException("indexName is a required property for QuerySuggestionsConfigurationWithIndex and cannot be null"); + } + this.IndexName = indexName; + // to ensure "sourceIndices" is required (not null) + if (sourceIndices == null) + { + throw new ArgumentNullException("sourceIndices is a required property for QuerySuggestionsConfigurationWithIndex and cannot be null"); + } + this.SourceIndices = sourceIndices; + this.Languages = languages; + this.Exclude = exclude; + this.EnablePersonalization = enablePersonalization; + this.AllowSpecialCharacters = allowSpecialCharacters; + } + + /// + /// Query Suggestions index name. + /// + /// Query Suggestions index name. + [DataMember(Name = "indexName", IsRequired = true, EmitDefaultValue = true)] + public string IndexName { get; set; } + + /// + /// Algolia indices from which to get the popular searches for query suggestions. + /// + /// Algolia indices from which to get the popular searches for query suggestions. + [DataMember(Name = "sourceIndices", IsRequired = true, EmitDefaultValue = true)] + public List SourceIndices { get; set; } + + /// + /// Gets or Sets Languages + /// + [DataMember(Name = "languages", EmitDefaultValue = false)] + public Languages Languages { get; set; } + + /// + /// Patterns to exclude from query suggestions. + /// + /// Patterns to exclude from query suggestions. + [DataMember(Name = "exclude", EmitDefaultValue = true)] + public List Exclude { get; set; } + + /// + /// Turn on personalized query suggestions. + /// + /// Turn on personalized query suggestions. + [DataMember(Name = "enablePersonalization", EmitDefaultValue = true)] + public bool EnablePersonalization { get; set; } + + /// + /// Allow suggestions with special characters. + /// + /// Allow suggestions with special characters. + [DataMember(Name = "allowSpecialCharacters", EmitDefaultValue = true)] + public bool AllowSpecialCharacters { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class QuerySuggestionsConfigurationWithIndex {\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append(" SourceIndices: ").Append(SourceIndices).Append("\n"); + sb.Append(" Languages: ").Append(Languages).Append("\n"); + sb.Append(" Exclude: ").Append(Exclude).Append("\n"); + sb.Append(" EnablePersonalization: ").Append(EnablePersonalization).Append("\n"); + sb.Append(" AllowSpecialCharacters: ").Append(AllowSpecialCharacters).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as QuerySuggestionsConfigurationWithIndex); + } + + /// + /// Returns true if QuerySuggestionsConfigurationWithIndex instances are equal + /// + /// Instance of QuerySuggestionsConfigurationWithIndex to be compared + /// Boolean + public bool Equals(QuerySuggestionsConfigurationWithIndex input) + { + if (input == null) + { + return false; + } + return + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ) && + ( + this.SourceIndices == input.SourceIndices || + this.SourceIndices != null && + input.SourceIndices != null && + this.SourceIndices.SequenceEqual(input.SourceIndices) + ) && + ( + this.Languages == input.Languages || + (this.Languages != null && + this.Languages.Equals(input.Languages)) + ) && + ( + this.Exclude == input.Exclude || + this.Exclude != null && + input.Exclude != null && + this.Exclude.SequenceEqual(input.Exclude) + ) && + ( + this.EnablePersonalization == input.EnablePersonalization || + this.EnablePersonalization.Equals(input.EnablePersonalization) + ) && + ( + this.AllowSpecialCharacters == input.AllowSpecialCharacters || + this.AllowSpecialCharacters.Equals(input.AllowSpecialCharacters) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + if (this.SourceIndices != null) + { + hashCode = (hashCode * 59) + this.SourceIndices.GetHashCode(); + } + if (this.Languages != null) + { + hashCode = (hashCode * 59) + this.Languages.GetHashCode(); + } + if (this.Exclude != null) + { + hashCode = (hashCode * 59) + this.Exclude.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EnablePersonalization.GetHashCode(); + hashCode = (hashCode * 59) + this.AllowSpecialCharacters.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/QuerySuggestions/Models/SourceIndex.cs b/algoliasearch/QuerySuggestions/Models/SourceIndex.cs new file mode 100644 index 000000000..a142fa27e --- /dev/null +++ b/algoliasearch/QuerySuggestions/Models/SourceIndex.cs @@ -0,0 +1,270 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.QuerySuggestions.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.QuerySuggestions.Client.OpenAPIDateConverter; + +namespace Algolia.Search.QuerySuggestions.Models +{ + /// + /// Configuration of an Algolia index for Query Suggestions. + /// + [DataContract(Name = "SourceIndex")] + public partial class SourceIndex : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SourceIndex() { } + /// + /// Initializes a new instance of the class. + /// + /// Name of the Algolia index to use as source for query suggestions. (required). + /// If true, Query Suggestions uses all replicas of the primary index to find popular searches. If false, only the primary index is used. (default to false). + /// [Analytics tags](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) for filtering the popular searches. . + /// Facets to use as top categories with your suggestions. If provided, Query Suggestions adds the top facet values to each suggestion. . + /// Minimum number of hits required to be included as a suggestion. A search query must at least generate `minHits` hits to be included in the Query Suggestions index. (default to 5). + /// Minimum letters required to be included as a suggestion. A search query must be at least `minLetters` long to be included in the Query Suggestions index. (default to 4). + /// generate. + /// Algolia indices with popular searches to use as query suggestions. Records of these indices must have these attributes: - `query`: search query which will be added as a suggestion - `count`: measure of popularity of that search query For example, you can export popular searches from an external analytics tool, such as Google Analytics or Adobe Analytics, and feed this data into an external Algolia index. You can use this external index to generate query suggestions until your Algolia analytics has collected enough data. . + public SourceIndex(string indexName = default(string), bool replicas = false, List analyticsTags = default(List), List facets = default(List), int minHits = 5, int minLetters = 4, List> generate = default(List>), List external = default(List)) + { + // to ensure "indexName" is required (not null) + if (indexName == null) + { + throw new ArgumentNullException("indexName is a required property for SourceIndex and cannot be null"); + } + this.IndexName = indexName; + this.Replicas = replicas; + this.AnalyticsTags = analyticsTags; + this.Facets = facets; + this.MinHits = minHits; + this.MinLetters = minLetters; + this.Generate = generate; + this.External = external; + } + + /// + /// Name of the Algolia index to use as source for query suggestions. + /// + /// Name of the Algolia index to use as source for query suggestions. + [DataMember(Name = "indexName", IsRequired = true, EmitDefaultValue = true)] + public string IndexName { get; set; } + + /// + /// If true, Query Suggestions uses all replicas of the primary index to find popular searches. If false, only the primary index is used. + /// + /// If true, Query Suggestions uses all replicas of the primary index to find popular searches. If false, only the primary index is used. + [DataMember(Name = "replicas", EmitDefaultValue = true)] + public bool Replicas { get; set; } + + /// + /// [Analytics tags](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) for filtering the popular searches. + /// + /// [Analytics tags](https://www.algolia.com/doc/api-reference/api-parameters/analyticsTags/) for filtering the popular searches. + [DataMember(Name = "analyticsTags", EmitDefaultValue = true)] + public List AnalyticsTags { get; set; } + + /// + /// Facets to use as top categories with your suggestions. If provided, Query Suggestions adds the top facet values to each suggestion. + /// + /// Facets to use as top categories with your suggestions. If provided, Query Suggestions adds the top facet values to each suggestion. + [DataMember(Name = "facets", EmitDefaultValue = true)] + public List Facets { get; set; } + + /// + /// Minimum number of hits required to be included as a suggestion. A search query must at least generate `minHits` hits to be included in the Query Suggestions index. + /// + /// Minimum number of hits required to be included as a suggestion. A search query must at least generate `minHits` hits to be included in the Query Suggestions index. + [DataMember(Name = "minHits", EmitDefaultValue = false)] + public int MinHits { get; set; } + + /// + /// Minimum letters required to be included as a suggestion. A search query must be at least `minLetters` long to be included in the Query Suggestions index. + /// + /// Minimum letters required to be included as a suggestion. A search query must be at least `minLetters` long to be included in the Query Suggestions index. + [DataMember(Name = "minLetters", EmitDefaultValue = false)] + public int MinLetters { get; set; } + + /// + /// Gets or Sets Generate + /// + [DataMember(Name = "generate", EmitDefaultValue = false)] + public List> Generate { get; set; } + + /// + /// Algolia indices with popular searches to use as query suggestions. Records of these indices must have these attributes: - `query`: search query which will be added as a suggestion - `count`: measure of popularity of that search query For example, you can export popular searches from an external analytics tool, such as Google Analytics or Adobe Analytics, and feed this data into an external Algolia index. You can use this external index to generate query suggestions until your Algolia analytics has collected enough data. + /// + /// Algolia indices with popular searches to use as query suggestions. Records of these indices must have these attributes: - `query`: search query which will be added as a suggestion - `count`: measure of popularity of that search query For example, you can export popular searches from an external analytics tool, such as Google Analytics or Adobe Analytics, and feed this data into an external Algolia index. You can use this external index to generate query suggestions until your Algolia analytics has collected enough data. + [DataMember(Name = "external", EmitDefaultValue = true)] + public List External { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SourceIndex {\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append(" Replicas: ").Append(Replicas).Append("\n"); + sb.Append(" AnalyticsTags: ").Append(AnalyticsTags).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" MinHits: ").Append(MinHits).Append("\n"); + sb.Append(" MinLetters: ").Append(MinLetters).Append("\n"); + sb.Append(" Generate: ").Append(Generate).Append("\n"); + sb.Append(" External: ").Append(External).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SourceIndex); + } + + /// + /// Returns true if SourceIndex instances are equal + /// + /// Instance of SourceIndex to be compared + /// Boolean + public bool Equals(SourceIndex input) + { + if (input == null) + { + return false; + } + return + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ) && + ( + this.Replicas == input.Replicas || + this.Replicas.Equals(input.Replicas) + ) && + ( + this.AnalyticsTags == input.AnalyticsTags || + this.AnalyticsTags != null && + input.AnalyticsTags != null && + this.AnalyticsTags.SequenceEqual(input.AnalyticsTags) + ) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && + ( + this.MinHits == input.MinHits || + this.MinHits.Equals(input.MinHits) + ) && + ( + this.MinLetters == input.MinLetters || + this.MinLetters.Equals(input.MinLetters) + ) && + ( + this.Generate == input.Generate || + this.Generate != null && + input.Generate != null && + this.Generate.SequenceEqual(input.Generate) + ) && + ( + this.External == input.External || + this.External != null && + input.External != null && + this.External.SequenceEqual(input.External) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Replicas.GetHashCode(); + if (this.AnalyticsTags != null) + { + hashCode = (hashCode * 59) + this.AnalyticsTags.GetHashCode(); + } + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MinHits.GetHashCode(); + hashCode = (hashCode * 59) + this.MinLetters.GetHashCode(); + if (this.Generate != null) + { + hashCode = (hashCode * 59) + this.Generate.GetHashCode(); + } + if (this.External != null) + { + hashCode = (hashCode * 59) + this.External.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // MinHits (int) minimum + if (this.MinHits < (int)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinHits, must be a value greater than or equal to 0.", new[] { "MinHits" }); + } + + // MinLetters (int) minimum + if (this.MinLetters < (int)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinLetters, must be a value greater than or equal to 0.", new[] { "MinLetters" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Api/RecommendClient.cs b/algoliasearch/Recommend/Api/RecommendClient.cs new file mode 100644 index 000000000..38c8fa5ec --- /dev/null +++ b/algoliasearch/Recommend/Api/RecommendClient.cs @@ -0,0 +1,1879 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Mime; +using Algolia.Search.Recommend.Client; +using Algolia.Search.Recommend.Models; + +namespace Algolia.Search.Recommend.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IRecommendClient + { + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete a Recommend rule. + /// + /// + /// Delete a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique record (object) identifier. + /// Cancellation Token to cancel the request. + /// Task of DeletedAtResponse + System.Threading.Tasks.Task DeleteRecommendRuleAsync(string indexName, RecommendModels model, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete a Recommend rule. + /// + /// + /// Delete a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique record (object) identifier. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeletedAtResponse) + System.Threading.Tasks.Task> DeleteRecommendRuleWithHttpInfoAsync(string indexName, RecommendModels model, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a Recommend rule. + /// + /// + /// Return a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique record (object) identifier. + /// Cancellation Token to cancel the request. + /// Task of RuleResponse + System.Threading.Tasks.Task GetRecommendRuleAsync(string indexName, RecommendModels model, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a Recommend rule. + /// + /// + /// Return a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique record (object) identifier. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (RuleResponse) + System.Threading.Tasks.Task> GetRecommendRuleWithHttpInfoAsync(string indexName, RecommendModels model, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a Recommend task's status. + /// + /// + /// Some operations, such as deleting a Recommend rule, will respond with a `taskID` value. Use this value here to check the status of that task. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique identifier of a task. Numeric value (up to 64bits). + /// Cancellation Token to cancel the request. + /// Task of GetRecommendTaskResponse + System.Threading.Tasks.Task GetRecommendStatusAsync(string indexName, RecommendModels model, long taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a Recommend task's status. + /// + /// + /// Some operations, such as deleting a Recommend rule, will respond with a `taskID` value. Use this value here to check the status of that task. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique identifier of a task. Numeric value (up to 64bits). + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetRecommendTaskResponse) + System.Threading.Tasks.Task> GetRecommendStatusWithHttpInfoAsync(string indexName, RecommendModels model, long taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get recommendations and trending items. + /// + /// + /// Returns results from either recommendation or trending models: - **Recommendations** are provided by the [Related Products](https://www.algolia.com/doc/guides/algolia-recommend/overview/#related-products-and-related-content) and [Frequently Bought Together](https://www.algolia.com/doc/guides/algolia-recommend/overview/#frequently-bought-together) models - **Trending** models are [Trending Items and Trending Facet Values](https://www.algolia.com/doc/guides/algolia-recommend/overview/#trending-items-and-trending-facet-values). + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of GetRecommendationsResponse + System.Threading.Tasks.Task GetRecommendationsAsync(GetRecommendationsParams getRecommendationsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get recommendations and trending items. + /// + /// + /// Returns results from either recommendation or trending models: - **Recommendations** are provided by the [Related Products](https://www.algolia.com/doc/guides/algolia-recommend/overview/#related-products-and-related-content) and [Frequently Bought Together](https://www.algolia.com/doc/guides/algolia-recommend/overview/#frequently-bought-together) models - **Trending** models are [Trending Items and Trending Facet Values](https://www.algolia.com/doc/guides/algolia-recommend/overview/#trending-items-and-trending-facet-values). + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetRecommendationsResponse) + System.Threading.Tasks.Task> GetRecommendationsWithHttpInfoAsync(GetRecommendationsParams getRecommendationsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// List Recommend rules. + /// + /// + /// List [Recommend rules](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of SearchRecommendRulesResponse + System.Threading.Tasks.Task SearchRecommendRulesAsync(string indexName, RecommendModels model, SearchRecommendRulesParams searchRecommendRulesParams = default(SearchRecommendRulesParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List Recommend rules. + /// + /// + /// List [Recommend rules](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SearchRecommendRulesResponse) + System.Threading.Tasks.Task> SearchRecommendRulesWithHttpInfoAsync(string indexName, RecommendModels model, SearchRecommendRulesParams searchRecommendRulesParams = default(SearchRecommendRulesParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } + + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class RecommendClient : IDisposable, IRecommendClient + { + private Algolia.Search.Recommend.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// + public RecommendClient() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + /// + public RecommendClient(string basePath) + { + this.Configuration = Algolia.Search.Recommend.Client.Configuration.MergeConfigurations( + Algolia.Search.Recommend.Client.GlobalConfiguration.Instance, + new Algolia.Search.Recommend.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.Recommend.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.Recommend.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// An instance of Configuration. + /// + /// + public RecommendClient(Algolia.Search.Recommend.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Algolia.Search.Recommend.Client.Configuration.MergeConfigurations( + Algolia.Search.Recommend.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.Recommend.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.Recommend.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public RecommendClient(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public RecommendClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.Recommend.Client.Configuration.MergeConfigurations( + Algolia.Search.Recommend.Client.GlobalConfiguration.Instance, + new Algolia.Search.Recommend.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.Recommend.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.Recommend.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// + /// An instance of HttpClient. + /// An instance of Configuration. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public RecommendClient(HttpClient client, Algolia.Search.Recommend.Client.Configuration configuration, HttpClientHandler handler = null) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.Recommend.Client.Configuration.MergeConfigurations( + Algolia.Search.Recommend.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.Recommend.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.Recommend.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + /// + public RecommendClient(Algolia.Search.Recommend.Client.ISynchronousClient client, Algolia.Search.Recommend.Client.IAsynchronousClient asyncClient, Algolia.Search.Recommend.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Algolia.Search.Recommend.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + this.ApiClient?.Dispose(); + } + + /// + /// Holds the ApiClient if created + /// + public Algolia.Search.Recommend.Client.ApiClient ApiClient { get; set; } = null; + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Algolia.Search.Recommend.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Algolia.Search.Recommend.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Algolia.Search.Recommend.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Algolia.Search.Recommend.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Del(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = DelWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.Recommend.Client.ApiResponse DelWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'path' when calling RecommendClient->Del"); + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Recommend.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = await DelWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'path' when calling RecommendClient->Del"); + + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Recommend.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a Recommend rule. Delete a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique record (object) identifier. + /// DeletedAtResponse + public DeletedAtResponse DeleteRecommendRule(string indexName, RecommendModels model, string objectID) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = DeleteRecommendRuleWithHttpInfo(indexName, model, objectID); + return localVarResponse.Data; + } + + /// + /// Delete a Recommend rule. Delete a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique record (object) identifier. + /// ApiResponse of DeletedAtResponse + public Algolia.Search.Recommend.Client.ApiResponse DeleteRecommendRuleWithHttpInfo(string indexName, RecommendModels model, string objectID) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'indexName' when calling RecommendClient->DeleteRecommendRule"); + + // verify the required parameter 'model' is set + if (model == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'model' when calling RecommendClient->DeleteRecommendRule"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'objectID' when calling RecommendClient->DeleteRecommendRule"); + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("model", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(model)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(objectID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1/indexes/{indexName}/{model}/recommend/rules/{objectID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteRecommendRule", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a Recommend rule. Delete a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique record (object) identifier. + /// Cancellation Token to cancel the request. + /// Task of DeletedAtResponse + public async System.Threading.Tasks.Task DeleteRecommendRuleAsync(string indexName, RecommendModels model, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = await DeleteRecommendRuleWithHttpInfoAsync(indexName, model, objectID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete a Recommend rule. Delete a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique record (object) identifier. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeletedAtResponse) + public async System.Threading.Tasks.Task> DeleteRecommendRuleWithHttpInfoAsync(string indexName, RecommendModels model, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'indexName' when calling RecommendClient->DeleteRecommendRule"); + + // verify the required parameter 'model' is set + if (model == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'model' when calling RecommendClient->DeleteRecommendRule"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'objectID' when calling RecommendClient->DeleteRecommendRule"); + + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("model", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(model)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(objectID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1/indexes/{indexName}/{model}/recommend/rules/{objectID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteRecommendRule", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Get(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = GetWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.Recommend.Client.ApiResponse GetWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'path' when calling RecommendClient->Get"); + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Recommend.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = await GetWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'path' when calling RecommendClient->Get"); + + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Recommend.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a Recommend rule. Return a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique record (object) identifier. + /// RuleResponse + public RuleResponse GetRecommendRule(string indexName, RecommendModels model, string objectID) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = GetRecommendRuleWithHttpInfo(indexName, model, objectID); + return localVarResponse.Data; + } + + /// + /// Get a Recommend rule. Return a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique record (object) identifier. + /// ApiResponse of RuleResponse + public Algolia.Search.Recommend.Client.ApiResponse GetRecommendRuleWithHttpInfo(string indexName, RecommendModels model, string objectID) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'indexName' when calling RecommendClient->GetRecommendRule"); + + // verify the required parameter 'model' is set + if (model == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'model' when calling RecommendClient->GetRecommendRule"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'objectID' when calling RecommendClient->GetRecommendRule"); + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("model", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(model)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(objectID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/indexes/{indexName}/{model}/recommend/rules/{objectID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetRecommendRule", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a Recommend rule. Return a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique record (object) identifier. + /// Cancellation Token to cancel the request. + /// Task of RuleResponse + public async System.Threading.Tasks.Task GetRecommendRuleAsync(string indexName, RecommendModels model, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = await GetRecommendRuleWithHttpInfoAsync(indexName, model, objectID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a Recommend rule. Return a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique record (object) identifier. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (RuleResponse) + public async System.Threading.Tasks.Task> GetRecommendRuleWithHttpInfoAsync(string indexName, RecommendModels model, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'indexName' when calling RecommendClient->GetRecommendRule"); + + // verify the required parameter 'model' is set + if (model == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'model' when calling RecommendClient->GetRecommendRule"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'objectID' when calling RecommendClient->GetRecommendRule"); + + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("model", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(model)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(objectID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/indexes/{indexName}/{model}/recommend/rules/{objectID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetRecommendRule", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a Recommend task's status. Some operations, such as deleting a Recommend rule, will respond with a `taskID` value. Use this value here to check the status of that task. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique identifier of a task. Numeric value (up to 64bits). + /// GetRecommendTaskResponse + public GetRecommendTaskResponse GetRecommendStatus(string indexName, RecommendModels model, long taskID) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = GetRecommendStatusWithHttpInfo(indexName, model, taskID); + return localVarResponse.Data; + } + + /// + /// Get a Recommend task's status. Some operations, such as deleting a Recommend rule, will respond with a `taskID` value. Use this value here to check the status of that task. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique identifier of a task. Numeric value (up to 64bits). + /// ApiResponse of GetRecommendTaskResponse + public Algolia.Search.Recommend.Client.ApiResponse GetRecommendStatusWithHttpInfo(string indexName, RecommendModels model, long taskID) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'indexName' when calling RecommendClient->GetRecommendStatus"); + + // verify the required parameter 'model' is set + if (model == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'model' when calling RecommendClient->GetRecommendStatus"); + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("model", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(model)); // path parameter + localVarRequestOptions.PathParameters.Add("taskID", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(taskID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/indexes/{indexName}/{model}/task/{taskID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetRecommendStatus", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a Recommend task's status. Some operations, such as deleting a Recommend rule, will respond with a `taskID` value. Use this value here to check the status of that task. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique identifier of a task. Numeric value (up to 64bits). + /// Cancellation Token to cancel the request. + /// Task of GetRecommendTaskResponse + public async System.Threading.Tasks.Task GetRecommendStatusAsync(string indexName, RecommendModels model, long taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = await GetRecommendStatusWithHttpInfoAsync(indexName, model, taskID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a Recommend task's status. Some operations, such as deleting a Recommend rule, will respond with a `taskID` value. Use this value here to check the status of that task. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// Unique identifier of a task. Numeric value (up to 64bits). + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetRecommendTaskResponse) + public async System.Threading.Tasks.Task> GetRecommendStatusWithHttpInfoAsync(string indexName, RecommendModels model, long taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'indexName' when calling RecommendClient->GetRecommendStatus"); + + // verify the required parameter 'model' is set + if (model == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'model' when calling RecommendClient->GetRecommendStatus"); + + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("model", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(model)); // path parameter + localVarRequestOptions.PathParameters.Add("taskID", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(taskID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/indexes/{indexName}/{model}/task/{taskID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetRecommendStatus", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get recommendations and trending items. Returns results from either recommendation or trending models: - **Recommendations** are provided by the [Related Products](https://www.algolia.com/doc/guides/algolia-recommend/overview/#related-products-and-related-content) and [Frequently Bought Together](https://www.algolia.com/doc/guides/algolia-recommend/overview/#frequently-bought-together) models - **Trending** models are [Trending Items and Trending Facet Values](https://www.algolia.com/doc/guides/algolia-recommend/overview/#trending-items-and-trending-facet-values). + /// + /// Thrown when fails to make API call + /// + /// GetRecommendationsResponse + public GetRecommendationsResponse GetRecommendations(GetRecommendationsParams getRecommendationsParams) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = GetRecommendationsWithHttpInfo(getRecommendationsParams); + return localVarResponse.Data; + } + + /// + /// Get recommendations and trending items. Returns results from either recommendation or trending models: - **Recommendations** are provided by the [Related Products](https://www.algolia.com/doc/guides/algolia-recommend/overview/#related-products-and-related-content) and [Frequently Bought Together](https://www.algolia.com/doc/guides/algolia-recommend/overview/#frequently-bought-together) models - **Trending** models are [Trending Items and Trending Facet Values](https://www.algolia.com/doc/guides/algolia-recommend/overview/#trending-items-and-trending-facet-values). + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of GetRecommendationsResponse + public Algolia.Search.Recommend.Client.ApiResponse GetRecommendationsWithHttpInfo(GetRecommendationsParams getRecommendationsParams) + { + // verify the required parameter 'getRecommendationsParams' is set + if (getRecommendationsParams == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'getRecommendationsParams' when calling RecommendClient->GetRecommendations"); + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = getRecommendationsParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/*/recommendations", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetRecommendations", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get recommendations and trending items. Returns results from either recommendation or trending models: - **Recommendations** are provided by the [Related Products](https://www.algolia.com/doc/guides/algolia-recommend/overview/#related-products-and-related-content) and [Frequently Bought Together](https://www.algolia.com/doc/guides/algolia-recommend/overview/#frequently-bought-together) models - **Trending** models are [Trending Items and Trending Facet Values](https://www.algolia.com/doc/guides/algolia-recommend/overview/#trending-items-and-trending-facet-values). + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of GetRecommendationsResponse + public async System.Threading.Tasks.Task GetRecommendationsAsync(GetRecommendationsParams getRecommendationsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = await GetRecommendationsWithHttpInfoAsync(getRecommendationsParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get recommendations and trending items. Returns results from either recommendation or trending models: - **Recommendations** are provided by the [Related Products](https://www.algolia.com/doc/guides/algolia-recommend/overview/#related-products-and-related-content) and [Frequently Bought Together](https://www.algolia.com/doc/guides/algolia-recommend/overview/#frequently-bought-together) models - **Trending** models are [Trending Items and Trending Facet Values](https://www.algolia.com/doc/guides/algolia-recommend/overview/#trending-items-and-trending-facet-values). + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetRecommendationsResponse) + public async System.Threading.Tasks.Task> GetRecommendationsWithHttpInfoAsync(GetRecommendationsParams getRecommendationsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'getRecommendationsParams' is set + if (getRecommendationsParams == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'getRecommendationsParams' when calling RecommendClient->GetRecommendations"); + + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = getRecommendationsParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/*/recommendations", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetRecommendations", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Post(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = PostWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.Recommend.Client.ApiResponse PostWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'path' when calling RecommendClient->Post"); + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Recommend.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = await PostWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'path' when calling RecommendClient->Post"); + + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Recommend.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Put(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = PutWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.Recommend.Client.ApiResponse PutWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'path' when calling RecommendClient->Put"); + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Recommend.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = await PutWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'path' when calling RecommendClient->Put"); + + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Recommend.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List Recommend rules. List [Recommend rules](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// (optional) + /// SearchRecommendRulesResponse + public SearchRecommendRulesResponse SearchRecommendRules(string indexName, RecommendModels model, SearchRecommendRulesParams searchRecommendRulesParams = default(SearchRecommendRulesParams)) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = SearchRecommendRulesWithHttpInfo(indexName, model, searchRecommendRulesParams); + return localVarResponse.Data; + } + + /// + /// List Recommend rules. List [Recommend rules](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// (optional) + /// ApiResponse of SearchRecommendRulesResponse + public Algolia.Search.Recommend.Client.ApiResponse SearchRecommendRulesWithHttpInfo(string indexName, RecommendModels model, SearchRecommendRulesParams searchRecommendRulesParams = default(SearchRecommendRulesParams)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'indexName' when calling RecommendClient->SearchRecommendRules"); + + // verify the required parameter 'model' is set + if (model == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'model' when calling RecommendClient->SearchRecommendRules"); + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("model", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(model)); // path parameter + localVarRequestOptions.Data = searchRecommendRulesParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/{indexName}/{model}/recommend/rules/search", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchRecommendRules", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List Recommend rules. List [Recommend rules](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of SearchRecommendRulesResponse + public async System.Threading.Tasks.Task SearchRecommendRulesAsync(string indexName, RecommendModels model, SearchRecommendRulesParams searchRecommendRulesParams = default(SearchRecommendRulesParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Recommend.Client.ApiResponse localVarResponse = await SearchRecommendRulesWithHttpInfoAsync(indexName, model, searchRecommendRulesParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// List Recommend rules. List [Recommend rules](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models). + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SearchRecommendRulesResponse) + public async System.Threading.Tasks.Task> SearchRecommendRulesWithHttpInfoAsync(string indexName, RecommendModels model, SearchRecommendRulesParams searchRecommendRulesParams = default(SearchRecommendRulesParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'indexName' when calling RecommendClient->SearchRecommendRules"); + + // verify the required parameter 'model' is set + if (model == null) + throw new Algolia.Search.Recommend.Client.ApiException(400, "Missing required parameter 'model' when calling RecommendClient->SearchRecommendRules"); + + + Algolia.Search.Recommend.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Recommend.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Recommend.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("model", Algolia.Search.Recommend.Client.ClientUtils.ParameterToString(model)); // path parameter + localVarRequestOptions.Data = searchRecommendRulesParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/{indexName}/{model}/recommend/rules/search", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchRecommendRules", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + } +} diff --git a/algoliasearch/Recommend/Client/ApiClient.cs b/algoliasearch/Recommend/Client/ApiClient.cs new file mode 100644 index 000000000..0b2ee9d86 --- /dev/null +++ b/algoliasearch/Recommend/Client/ApiClient.cs @@ -0,0 +1,736 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs; +using System.Net.Http; +using System.Net.Http.Headers; + +namespace Algolia.Search.Recommend.Client +{ + /// + /// To Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec + { + private readonly IReadableConfiguration _configuration; + private static readonly string _contentType = "application/json"; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is Algolia.Search.Recommend.Models.AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((Algolia.Search.Recommend.Models.AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public async Task Deserialize(HttpResponseMessage response) + { + var result = (T)await Deserialize(response, typeof(T)).ConfigureAwait(false); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal async Task Deserialize(HttpResponseMessage response, Type type) + { + IList headers = response.Headers.Select(x => x.Key + "=" + x.Value).ToList(); + + if (type == typeof(byte[])) // return byte array + { + return await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + } + else if (type == typeof(FileParameter)) + { + return new FileParameter(await response.Content.ReadAsStreamAsync().ConfigureAwait(false)); + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + if (headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + File.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(await response.Content.ReadAsStringAsync().ConfigureAwait(false), null, System.Globalization.DateTimeStyles.RoundtripKind); + } + + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public string RootElement { get; set; } + public string Namespace { get; set; } + public string DateFormat { get; set; } + + public string ContentType + { + get { return _contentType; } + set { throw new InvalidOperationException("Not allowed to set content type."); } + } + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + /// + /// The Dispose method will manage the HttpClient lifecycle when not passed by constructor. + /// + public partial class ApiClient : IDisposable, ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + + private readonly HttpClientHandler _httpClientHandler; + private readonly HttpClient _httpClient; + private readonly bool _disposeClient; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + public ApiClient() : + this(Algolia.Search.Recommend.Client.GlobalConfiguration.Instance.BasePath) + { + } + + /// + /// Initializes a new instance of the . + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = new HttpClientHandler(); + _httpClient = new HttpClient(_httpClientHandler, true); + _disposeClient = true; + _baseUrl = basePath; + } + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, HttpClientHandler handler = null) : + this(client, Algolia.Search.Recommend.Client.GlobalConfiguration.Instance.BasePath, handler) + { + } + + /// + /// Initializes a new instance of the . + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client cannot be null"); + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = handler; + _httpClient = client; + _baseUrl = basePath; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + if (_disposeClient) + { + _httpClient.Dispose(); + } + } + + /// Prepares multipart/form-data content + HttpContent PrepareMultipartFormDataContent(RequestOptions options) + { + string boundary = "---------" + Guid.NewGuid().ToString().ToUpperInvariant(); + var multipartContent = new MultipartFormDataContent(boundary); + foreach (var formParameter in options.FormParameters) + { + multipartContent.Add(new StringContent(formParameter.Value), formParameter.Key); + } + + if (options.FileParameters != null && options.FileParameters.Count > 0) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var content = new StreamContent(file.Content); + content.Headers.ContentType = new MediaTypeHeaderValue(file.ContentType); + multipartContent.Add(content, fileParam.Key, file.Name); + } + } + } + return multipartContent; + } + + /// + /// Provides all logic for constructing a new HttpRequestMessage. + /// At this point, all information for querying the service is known. Here, it is simply + /// mapped into the a HttpRequestMessage. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// [private] A new HttpRequestMessage instance. + /// + private HttpRequestMessage NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + WebRequestPathBuilder builder = new WebRequestPathBuilder(_baseUrl, path); + + builder.AddPathParameters(options.PathParameters); + + builder.AddQueryParameters(options.QueryParameters); + + HttpRequestMessage request = new HttpRequestMessage(method, builder.GetFullUri()); + + if (configuration.UserAgent != null) + { + request.Headers.TryAddWithoutValidation("User-Agent", configuration.UserAgent); + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.Headers.Add(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + // Todo make content headers actually content headers + request.Headers.TryAddWithoutValidation(headerParam.Key, value); + } + } + } + + List> contentList = new List>(); + + string contentType = null; + if (options.HeaderParameters != null && options.HeaderParameters.ContainsKey("Content-Type")) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes.FirstOrDefault(); + } + + if (contentType == "multipart/form-data") + { + request.Content = PrepareMultipartFormDataContent(options); + } + else if (contentType == "application/x-www-form-urlencoded") + { + request.Content = new FormUrlEncodedContent(options.FormParameters); + } + else + { + if (options.Data != null) + { + if (options.Data is FileParameter fp) + { + contentType = contentType ?? "application/octet-stream"; + + var streamContent = new StreamContent(fp.Content); + streamContent.Headers.ContentType = new MediaTypeHeaderValue(contentType); + request.Content = streamContent; + } + else + { + var serializer = new CustomJsonCodec(SerializerSettings, configuration); + request.Content = new StringContent(serializer.Serialize(options.Data), new UTF8Encoding(), + "application/json"); + } + } + } + + + + // TODO provide an alternative that allows cookies per request instead of per API client + if (options.Cookies != null && options.Cookies.Count > 0) + { + request.Properties["CookieContainer"] = options.Cookies; + } + + return request; + } + + partial void InterceptRequest(HttpRequestMessage req); + partial void InterceptResponse(HttpRequestMessage req, HttpResponseMessage response); + + private async Task> ToApiResponse(HttpResponseMessage response, object responseData, Uri uri) + { + T result = (T)responseData; + string rawContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ReasonPhrase, + Cookies = new List() + }; + + // process response headers, e.g. Access-Control-Allow-Methods + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + // process response content headers, e.g. Content-Type + if (response.Content.Headers != null) + { + foreach (var responseHeader in response.Content.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (_httpClientHandler != null && response != null) + { + try + { + foreach (Cookie cookie in _httpClientHandler.CookieContainer.GetCookies(uri)) + { + transformed.Cookies.Add(cookie); + } + } + catch (PlatformNotSupportedException) { } + } + + return transformed; + } + + private ApiResponse Exec(HttpRequestMessage req, IReadableConfiguration configuration) + { + return ExecAsync(req, configuration).GetAwaiter().GetResult(); + } + + private async Task> ExecAsync(HttpRequestMessage req, + IReadableConfiguration configuration, + System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + CancellationTokenSource timeoutTokenSource = null; + CancellationTokenSource finalTokenSource = null; + var deserializer = new CustomJsonCodec(SerializerSettings, configuration); + var finalToken = cancellationToken; + + try + { + if (configuration.Timeout > 0) + { + timeoutTokenSource = new CancellationTokenSource(configuration.Timeout); + finalTokenSource = CancellationTokenSource.CreateLinkedTokenSource(finalToken, timeoutTokenSource.Token); + finalToken = finalTokenSource.Token; + } + + if (configuration.Proxy != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Configuration `Proxy` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + _httpClientHandler.Proxy = configuration.Proxy; + } + + var cookieContainer = req.Properties.ContainsKey("CookieContainer") ? req.Properties["CookieContainer"] as List : null; + + if (cookieContainer != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Request property `CookieContainer` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + foreach (var cookie in cookieContainer) + { + _httpClientHandler.CookieContainer.Add(cookie); + } + } + + InterceptRequest(req); + + HttpResponseMessage response; + response = await _httpClient.SendAsync(req, finalToken).ConfigureAwait(false); + + if (!response.IsSuccessStatusCode) + { + return await ToApiResponse(response, default(T), req.RequestUri).ConfigureAwait(false); + } + + object responseData = await deserializer.Deserialize(response).ConfigureAwait(false); + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(Algolia.Search.Recommend.Models.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + responseData = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + else if (typeof(T).Name == "Stream") // for binary response + { + responseData = (T)(object)await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + } + + InterceptResponse(req, response); + + return await ToApiResponse(response, responseData, req.RequestUri).ConfigureAwait(false); + } + catch (OperationCanceledException original) + { + if (timeoutTokenSource != null && timeoutTokenSource.IsCancellationRequested) + { + throw new TaskCanceledException($"[{req.Method}] {req.RequestUri} was timeout.", + new TimeoutException(original.Message, original)); + } + throw; + } + finally + { + if (timeoutTokenSource != null) + { + timeoutTokenSource.Dispose(); + } + + if (finalTokenSource != null) + { + finalTokenSource.Dispose(); + } + } + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(new HttpMethod("PATCH"), path, options, config), config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(new HttpMethod("PATCH"), path, options, config), config); + } + #endregion ISynchronousClient + } +} diff --git a/algoliasearch/Recommend/Client/ApiException.cs b/algoliasearch/Recommend/Client/ApiException.cs new file mode 100644 index 000000000..4ec9c77c4 --- /dev/null +++ b/algoliasearch/Recommend/Client/ApiException.cs @@ -0,0 +1,62 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.Recommend.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// Gets or sets the error code (HTTP status code) + /// + /// The error code (HTTP status code). + public int ErrorCode { get; set; } + + /// + /// Gets or sets the error content (body json object) + /// + /// The error content (Http response body). + public object ErrorContent { get; private set; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public ApiException() { } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + public ApiException(int errorCode, string message) : base(message) + { + this.ErrorCode = errorCode; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + /// Error content. + /// HTTP Headers. + public ApiException(int errorCode, string message, object errorContent = null, Multimap headers = null) : base(message) + { + this.ErrorCode = errorCode; + this.ErrorContent = errorContent; + this.Headers = headers; + } + } + +} diff --git a/algoliasearch/Recommend/Client/ApiResponse.cs b/algoliasearch/Recommend/Client/ApiResponse.cs new file mode 100644 index 000000000..8b0e7ce16 --- /dev/null +++ b/algoliasearch/Recommend/Client/ApiResponse.cs @@ -0,0 +1,160 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; + +namespace Algolia.Search.Recommend.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public interface IApiResponse + { + /// + /// The data type of + /// + Type ResponseType { get; } + + /// + /// The content of this response + /// + Object Content { get; } + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + Multimap Headers { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + List Cookies { get; set; } + + /// + /// The raw content of this response + /// + string RawContent { get; } + } + + /// + /// API Response + /// + public class ApiResponse : IApiResponse + { + #region Properties + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; } + + /// + /// Gets or sets the data (parsed HTTP body) + /// + /// The data. + public T Data { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + public string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + public List Cookies { get; set; } + + /// + /// The content of this response + /// + public Type ResponseType + { + get { return typeof(T); } + } + + /// + /// The data type of + /// + public object Content + { + get { return Data; } + } + + /// + /// The raw content + /// + public string RawContent { get; } + + #endregion Properties + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data, string rawContent) + { + StatusCode = statusCode; + Headers = headers; + Data = data; + RawContent = rawContent; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) : this(statusCode, headers, data, null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null) + { + } + + #endregion Constructors + } +} diff --git a/algoliasearch/Recommend/Client/ClientUtils.cs b/algoliasearch/Recommend/Client/ClientUtils.cs new file mode 100644 index 000000000..7b9974f5a --- /dev/null +++ b/algoliasearch/Recommend/Client/ClientUtils.cs @@ -0,0 +1,244 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; + +namespace Algolia.Search.Recommend.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// Convert params to key/value pairs. + /// Use collectionFormat to properly format lists and collections. + /// + /// The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi + /// Key name. + /// Value object. + /// A multimap of keys with 1..n associated values. + public static Multimap ParameterToMultiMap(string collectionFormat, string name, object value) + { + var parameters = new Multimap(); + + if (value is ICollection collection && collectionFormat == "multi") + { + foreach (var item in collection) + { + parameters.Add(name, ParameterToString(item)); + } + } + else if (value is IDictionary dictionary) + { + if (collectionFormat == "deepObject") + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value)); + } + } + else + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value)); + } + } + } + else + { + parameters.Add(name, ParameterToString(value)); + } + + return parameters; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// An optional configuration instance, providing formatting options used in processing. + /// Formatted string. + public static string ParameterToString(object obj, IReadableConfiguration configuration = null) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is bool boolean) + return boolean ? "true" : "false"; + if (obj is ICollection collection) + { + List entries = new List(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry, configuration)); + return string.Join(",", entries); + } + if (obj is Enum && HasEnumMemberAttrValue(obj)) + return GetEnumMemberAttrValue(obj); + + return Convert.ToString(obj, CultureInfo.InvariantCulture); + } + + /// + /// Serializes the given object when not null. Otherwise return null. + /// + /// The object to serialize. + /// Serialized string. + public static string Serialize(object obj) + { + return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null; + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Is the Enum decorated with EnumMember Attribute + /// + /// + /// true if found + private static bool HasEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) return true; + return false; + } + + /// + /// Get the EnumMember value + /// + /// + /// EnumMember value as string otherwise null + private static string GetEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) + { + return attr.Value; + } + return null; + } + } +} diff --git a/algoliasearch/Recommend/Client/Configuration.cs b/algoliasearch/Recommend/Client/Configuration.cs new file mode 100644 index 000000000..70c1cf495 --- /dev/null +++ b/algoliasearch/Recommend/Client/Configuration.cs @@ -0,0 +1,645 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Net.Http; +using System.Net.Security; + +namespace Algolia.Search.Recommend.Client +{ + /// + /// Represents a set of configuration settings + /// + public class Configuration : IReadableConfiguration + { + #region Constants + + /// + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.RawContent), + response.RawContent, response.Headers); + } + return null; + }; + + #endregion Static Members + + #region Private Members + + /// + /// Defines the base path of the target API server. + /// Example: http://localhost:3000/v1/ + /// + private string _basePath; + + private bool _useDefaultCredentials = false; + + /// + /// Gets or sets the API key based on the authentication name. + /// This is the key and value comprising the "secret" for accessing an API. + /// + /// The API key. + private IDictionary _apiKey; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + /// + /// Gets or sets the servers defined in the OpenAPI spec. + /// + /// The servers + private IList> _servers; + + /// + /// Gets or sets the operation servers defined in the OpenAPI spec. + /// + /// The operation servers + private IReadOnlyDictionary>> _operationServers; + + #endregion Private Members + + #region Constructors + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration() + { + Proxy = null; + UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + BasePath = "https://myAppId.algolianet.com"; + DefaultHeaders = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + Servers = new List>() + { + { + new Dictionary { + {"url", "https://{appId}.algolianet.com"}, + {"description", "No description provided"}, + { + "variables", new Dictionary { + { + "appId", new Dictionary { + {"description", "No description provided"}, + {"default_value", "myAppId"}, + } + } + } + } + } + }, + { + new Dictionary { + {"url", "https://{appId}-1.algolianet.com"}, + {"description", "No description provided"}, + { + "variables", new Dictionary { + { + "appId", new Dictionary { + {"description", "No description provided"}, + {"default_value", "myAppId"}, + } + } + } + } + } + }, + { + new Dictionary { + {"url", "https://{appId}-2.algolianet.com"}, + {"description", "No description provided"}, + { + "variables", new Dictionary { + { + "appId", new Dictionary { + {"description", "No description provided"}, + {"default_value", "myAppId"}, + } + } + } + } + } + }, + { + new Dictionary { + {"url", "https://{appId}-3.algolianet.com"}, + {"description", "No description provided"}, + { + "variables", new Dictionary { + { + "appId", new Dictionary { + {"description", "No description provided"}, + {"default_value", "myAppId"}, + } + } + } + } + } + }, + { + new Dictionary { + {"url", "https://{appId}-dsn.algolianet.com"}, + {"description", "No description provided"}, + { + "variables", new Dictionary { + { + "appId", new Dictionary { + {"description", "No description provided"}, + {"default_value", "myAppId"}, + } + } + } + } + } + } + }; + OperationServers = new Dictionary>>() + { + }; + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration( + IDictionary defaultHeaders, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "https://myAppId.algolianet.com") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeaders == null) + throw new ArgumentNullException("defaultHeaders"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeaders) + { + DefaultHeaders.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + #endregion Constructors + + #region Properties + + /// + /// Gets or sets the base path for API access. + /// + public virtual string BasePath + { + get { return _basePath; } + set { _basePath = value; } + } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + public virtual bool UseDefaultCredentials + { + get { return _useDefaultCredentials; } + set { _useDefaultCredentials = value; } + } + + /// + /// Gets or sets the default header. + /// + [Obsolete("Use DefaultHeaders instead.")] + public virtual IDictionary DefaultHeader + { + get + { + return DefaultHeaders; + } + set + { + DefaultHeaders = value; + } + } + + /// + /// Gets or sets the default headers. + /// + public virtual IDictionary DefaultHeaders { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { get; set; } + + /// + /// Gets or sets the proxy + /// + /// Proxy. + public virtual WebProxy Proxy { get; set; } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix(string apiKeyIdentifier) + { + string apiKeyValue; + ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue); + string apiKeyPrefix; + if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) + { + return apiKeyPrefix + " " + apiKeyValue; + } + + return apiKeyValue; + } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } + + set + { + if (string.IsNullOrEmpty(value)) + { + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } + } + } + + /// + /// Gets or sets the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// Whatever you set here will be prepended to the value defined in AddApiKey. + /// + /// An example invocation here might be: + /// + /// ApiKeyPrefix["Authorization"] = "Bearer"; + /// + /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// + /// + /// OAuth2 workflows should set tokens via AccessToken. + /// + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + /// + /// Gets or sets the servers. + /// + /// The servers. + public virtual IList> Servers + { + get { return _servers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Servers may not be null."); + } + _servers = value; + } + } + + /// + /// Gets or sets the operation servers. + /// + /// The operation servers. + public virtual IReadOnlyDictionary>> OperationServers + { + get { return _operationServers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Operation servers may not be null."); + } + _operationServers = value; + } + } + + /// + /// Returns URL based on server settings without providing values + /// for the variables + /// + /// Array index of the server settings. + /// The server URL. + public string GetServerUrl(int index) + { + return GetServerUrl(Servers, index, null); + } + + /// + /// Returns URL based on server settings. + /// + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + public string GetServerUrl(int index, Dictionary inputVariables) + { + return GetServerUrl(Servers, index, inputVariables); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index) + { + return GetOperationServerUrl(operation, index, null); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables) + { + if (operation != null && OperationServers.TryGetValue(operation, out var operationServer)) + { + return GetServerUrl(operationServer, index, inputVariables); + } + + return null; + } + + /// + /// Returns URL based on server settings. + /// + /// Dictionary of server settings. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + private string GetServerUrl(IList> servers, int index, Dictionary inputVariables) + { + if (index < 0 || index >= servers.Count) + { + throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}."); + } + + if (inputVariables == null) + { + inputVariables = new Dictionary(); + } + + IReadOnlyDictionary server = servers[index]; + string url = (string)server["url"]; + + if (server.ContainsKey("variables")) + { + // go through each variable and assign a value + foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"]) + { + + IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value); + + if (inputVariables.ContainsKey(variable.Key)) + { + if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + { + url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); + } + else + { + throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}"); + } + } + else + { + // use default value + url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]); + } + } + } + + return url; + } + + /// + /// Gets and Sets the RemoteCertificateValidationCallback + /// + public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; } + + #endregion Properties + + #region Methods + + /// + /// Returns a string with essential information for debugging. + /// + public static string ToDebugReport() + { + string report = "C# SDK (Algolia.Search.Recommend) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: 1.0.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; + } + + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey(string key, string value) + { + ApiKey[key] = value; + } + + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix(string key, string value) + { + ApiKeyPrefix[key] = value; + } + + #endregion Methods + + #region Static Members + /// + /// Merge configurations. + /// + /// First configuration. + /// Second configuration. + /// Merged configuration. + public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) + { + if (second == null) return first ?? GlobalConfiguration.Instance; + + Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; + foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; + foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value; + + var config = new Configuration + { + ApiKey = apiKey, + ApiKeyPrefix = apiKeyPrefix, + DefaultHeaders = defaultHeaders, + BasePath = second.BasePath ?? first.BasePath, + Timeout = second.Timeout, + Proxy = second.Proxy ?? first.Proxy, + UserAgent = second.UserAgent ?? first.UserAgent, + TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, + DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat, + UseDefaultCredentials = second.UseDefaultCredentials, + RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback, + }; + return config; + } + #endregion Static Members + } +} diff --git a/algoliasearch/Recommend/Client/ExceptionFactory.cs b/algoliasearch/Recommend/Client/ExceptionFactory.cs new file mode 100644 index 000000000..5d297913b --- /dev/null +++ b/algoliasearch/Recommend/Client/ExceptionFactory.cs @@ -0,0 +1,16 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.Recommend.Client +{ + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions + public delegate Exception ExceptionFactory(string methodName, IApiResponse response); +} diff --git a/algoliasearch/Recommend/Client/FileParameter.cs b/algoliasearch/Recommend/Client/FileParameter.cs new file mode 100644 index 000000000..4430c6054 --- /dev/null +++ b/algoliasearch/Recommend/Client/FileParameter.cs @@ -0,0 +1,74 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.IO; + +namespace Algolia.Search.Recommend.Client +{ + + /// + /// Represents a File passed to the API as a Parameter, allows using different backends for files + /// + public class FileParameter + { + /// + /// The filename + /// + public string Name { get; set; } = "no_name_provided"; + + /// + /// The content type of the file + /// + public string ContentType { get; set; } = "application/octet-stream"; + + /// + /// The content of the file + /// + public Stream Content { get; set; } + + /// + /// Construct a FileParameter just from the contents, will extract the filename from a filestream + /// + /// The file content + public FileParameter(Stream content) + { + if (content is FileStream fs) + { + Name = fs.Name; + } + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The file content + public FileParameter(string filename, Stream content) + { + Name = filename; + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The content type of the file + /// The file content + public FileParameter(string filename, string contentType, Stream content) + { + Name = filename; + ContentType = contentType; + Content = content; + } + + /// + /// Implicit conversion of stream to file parameter. Useful for backwards compatibility. + /// + /// Stream to convert + /// FileParameter + public static implicit operator FileParameter(Stream s) => new FileParameter(s); + } +} diff --git a/algoliasearch/Recommend/Client/GlobalConfiguration.cs b/algoliasearch/Recommend/Client/GlobalConfiguration.cs new file mode 100644 index 000000000..4a8ee3ea7 --- /dev/null +++ b/algoliasearch/Recommend/Client/GlobalConfiguration.cs @@ -0,0 +1,61 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.Collections.Generic; + +namespace Algolia.Search.Recommend.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .openapi-generator-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + #region Private Members + + private static readonly object GlobalConfigSync = new { }; + private static IReadableConfiguration _globalConfiguration; + + #endregion Private Members + + #region Constructors + + /// + private GlobalConfiguration() + { + } + + /// + public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath) + { + } + + static GlobalConfiguration() + { + Instance = new GlobalConfiguration(); + } + + #endregion Constructors + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static IReadableConfiguration Instance + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + } +} diff --git a/algoliasearch/Recommend/Client/IAsynchronousClient.cs b/algoliasearch/Recommend/Client/IAsynchronousClient.cs new file mode 100644 index 000000000..0a9d1a3c8 --- /dev/null +++ b/algoliasearch/Recommend/Client/IAsynchronousClient.cs @@ -0,0 +1,94 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Threading.Tasks; + +namespace Algolia.Search.Recommend.Client +{ + /// + /// Contract for Asynchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface IAsynchronousClient + { + /// + /// Executes a non-blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } +} diff --git a/algoliasearch/Recommend/Client/IReadableConfiguration.cs b/algoliasearch/Recommend/Client/IReadableConfiguration.cs new file mode 100644 index 000000000..ceb9bc8e1 --- /dev/null +++ b/algoliasearch/Recommend/Client/IReadableConfiguration.cs @@ -0,0 +1,111 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; + +namespace Algolia.Search.Recommend.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + /// + /// Gets the API key. + /// + /// API key. + IDictionary ApiKey { get; } + + /// + /// Gets the API key prefix. + /// + /// API key prefix. + IDictionary ApiKeyPrefix { get; } + + /// + /// Gets the base path. + /// + /// Base path. + string BasePath { get; } + + /// + /// Gets the date time format. + /// + /// Date time format. + string DateTimeFormat { get; } + + /// + /// Gets the default header. + /// + /// Default header. + [Obsolete("Use DefaultHeaders instead.")] + IDictionary DefaultHeader { get; } + + /// + /// Gets the default headers. + /// + /// Default headers. + IDictionary DefaultHeaders { get; } + + /// + /// Gets the temp folder path. + /// + /// Temp folder path. + string TempFolderPath { get; } + + /// + /// Gets the HTTP connection timeout (in milliseconds) + /// + /// HTTP connection timeout. + int Timeout { get; } + + /// + /// Gets the proxy. + /// + /// Proxy. + WebProxy Proxy { get; } + + /// + /// Gets the user agent. + /// + /// User agent. + string UserAgent { get; } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + bool UseDefaultCredentials { get; } + + /// + /// Get the servers associated with the operation. + /// + /// Operation servers. + IReadOnlyDictionary>> OperationServers { get; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + string GetApiKeyWithPrefix(string apiKeyIdentifier); + + /// + /// Gets the Operation server url at the provided index. + /// + /// Operation server name. + /// Index of the operation server settings. + /// + string GetOperationServerUrl(string operation, int index); + + /// + /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and + /// overriding certificate errors in the scope of a request. + /// + RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; } + } +} diff --git a/algoliasearch/Recommend/Client/ISynchronousClient.cs b/algoliasearch/Recommend/Client/ISynchronousClient.cs new file mode 100644 index 000000000..a8c2b2cab --- /dev/null +++ b/algoliasearch/Recommend/Client/ISynchronousClient.cs @@ -0,0 +1,87 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.IO; + +namespace Algolia.Search.Recommend.Client +{ + /// + /// Contract for Synchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface ISynchronousClient + { + /// + /// Executes a blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null); + } +} diff --git a/algoliasearch/Recommend/Client/Multimap.cs b/algoliasearch/Recommend/Client/Multimap.cs new file mode 100644 index 000000000..996b8bf48 --- /dev/null +++ b/algoliasearch/Recommend/Client/Multimap.cs @@ -0,0 +1,289 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Algolia.Search.Recommend.Client +{ + /// + /// A dictionary in which one key has many associated values. + /// + /// The type of the key + /// The type of the value associated with the key. + public class Multimap : IDictionary> + { + #region Private Fields + + private readonly Dictionary> _dictionary; + + #endregion Private Fields + + #region Constructors + + /// + /// Empty Constructor. + /// + public Multimap() + { + _dictionary = new Dictionary>(); + } + + /// + /// Constructor with comparer. + /// + /// + public Multimap(IEqualityComparer comparer) + { + _dictionary = new Dictionary>(comparer); + } + + #endregion Constructors + + #region Enumerators + + /// + /// To get the enumerator. + /// + /// Enumerator + public IEnumerator>> GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + /// + /// To get the enumerator. + /// + /// Enumerator + IEnumerator IEnumerable.GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + #endregion Enumerators + + #region Public Members + /// + /// Add values to Multimap + /// + /// Key value pair + public void Add(KeyValuePair> item) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + + /// + /// Add Multimap to Multimap + /// + /// Multimap + public void Add(Multimap multimap) + { + foreach (var item in multimap) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + + /// + /// Clear Multimap + /// + public void Clear() + { + _dictionary.Clear(); + } + + /// + /// Determines whether Multimap contains the specified item. + /// + /// Key value pair + /// Method needs to be implemented + /// true if the Multimap contains the item; otherwise, false. + public bool Contains(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Copy items of the Multimap to an array, + /// starting at a particular array index. + /// + /// The array that is the destination of the items copied + /// from Multimap. The array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + /// Method needs to be implemented + public void CopyTo(KeyValuePair>[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + /// + /// Removes the specified item from the Multimap. + /// + /// Key value pair + /// true if the item is successfully removed; otherwise, false. + /// Method needs to be implemented + public bool Remove(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Gets the number of items contained in the Multimap. + /// + public int Count => _dictionary.Count; + + /// + /// Gets a value indicating whether the Multimap is read-only. + /// + public bool IsReadOnly => false; + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add the value to Multimap. + public void Add(TKey key, IList value) + { + if (value != null && value.Count > 0) + { + if (_dictionary.TryGetValue(key, out var list)) + { + foreach (var k in value) list.Add(k); + } + else + { + list = new List(value); + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + } + + /// + /// Determines whether the Multimap contains an item with the specified key. + /// + /// The key to locate in the Multimap. + /// true if the Multimap contains an item with + /// the key; otherwise, false. + public bool ContainsKey(TKey key) + { + return _dictionary.ContainsKey(key); + } + + /// + /// Removes item with the specified key from the Multimap. + /// + /// The key to locate in the Multimap. + /// true if the item is successfully removed; otherwise, false. + public bool Remove(TKey key) + { + return TryRemove(key, out var _); + } + + /// + /// Gets the value associated with the specified key. + /// + /// The key whose value to get. + /// When this method returns, the value associated with the specified key, if the + /// key is found; otherwise, the default value for the type of the value parameter. + /// This parameter is passed uninitialized. + /// true if the object that implements Multimap contains + /// an item with the specified key; otherwise, false. + public bool TryGetValue(TKey key, out IList value) + { + return _dictionary.TryGetValue(key, out value); + } + + /// + /// Gets or sets the item with the specified key. + /// + /// The key of the item to get or set. + /// The value of the specified key. + public IList this[TKey key] + { + get => _dictionary[key]; + set => _dictionary[key] = value; + } + + /// + /// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap. + /// + public ICollection Keys => _dictionary.Keys; + + /// + /// Gets a System.Collections.Generic.ICollection containing the values of the Multimap. + /// + public ICollection> Values => _dictionary.Values; + + /// + /// Copy the items of the Multimap to an System.Array, + /// starting at a particular System.Array index. + /// + /// The one-dimensional System.Array that is the destination of the items copied + /// from Multimap. The System.Array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + public void CopyTo(Array array, int index) + { + ((ICollection)_dictionary).CopyTo(array, index); + } + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add value to Multimap. + public void Add(TKey key, TValue value) + { + if (value != null) + { + if (_dictionary.TryGetValue(key, out var list)) + { + list.Add(value); + } + else + { + list = new List { value }; + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add value to Multimap."); + } + } + } + + #endregion Public Members + + #region Private Members + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryRemove(TKey key, out IList value) + { + _dictionary.TryGetValue(key, out value); + return _dictionary.Remove(key); + } + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryAdd(TKey key, IList value) + { + try + { + _dictionary.Add(key, value); + } + catch (ArgumentException) + { + return false; + } + + return true; + } + #endregion Private Members + } +} diff --git a/algoliasearch/Recommend/Client/OpenAPIDateConverter.cs b/algoliasearch/Recommend/Client/OpenAPIDateConverter.cs new file mode 100644 index 000000000..ca0cb5522 --- /dev/null +++ b/algoliasearch/Recommend/Client/OpenAPIDateConverter.cs @@ -0,0 +1,23 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using Newtonsoft.Json.Converters; + +namespace Algolia.Search.Recommend.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class OpenAPIDateConverter : IsoDateTimeConverter + { + /// + /// Initializes a new instance of the class. + /// + public OpenAPIDateConverter() + { + // full-date = date-fullyear "-" date-month "-" date-mday + DateTimeFormat = "yyyy-MM-dd"; + } + } +} diff --git a/algoliasearch/Recommend/Client/RequestOptions.cs b/algoliasearch/Recommend/Client/RequestOptions.cs new file mode 100644 index 000000000..510ad5b5b --- /dev/null +++ b/algoliasearch/Recommend/Client/RequestOptions.cs @@ -0,0 +1,68 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; + +namespace Algolia.Search.Recommend.Client +{ + /// + /// A container for generalized request inputs. This type allows consumers to extend the request functionality + /// by abstracting away from the default (built-in) request framework (e.g. RestSharp). + /// + public class RequestOptions + { + /// + /// Parameters to be bound to path parts of the Request's URL + /// + public Dictionary PathParameters { get; set; } + + /// + /// Query parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap QueryParameters { get; set; } + + /// + /// Header parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap HeaderParameters { get; set; } + + /// + /// Form parameters to be sent along with the request. + /// + public Dictionary FormParameters { get; set; } + + /// + /// File parameters to be sent along with the request. + /// + public Multimap FileParameters { get; set; } + + /// + /// Cookies to be sent along with the request. + /// + public List Cookies { get; set; } + + /// + /// Any data associated with a request body. + /// + public Object Data { get; set; } + + /// + /// Constructs a new instance of + /// + public RequestOptions() + { + PathParameters = new Dictionary(); + QueryParameters = new Multimap(); + HeaderParameters = new Multimap(); + FormParameters = new Dictionary(); + FileParameters = new Multimap(); + Cookies = new List(); + } + } +} diff --git a/algoliasearch/Recommend/Client/WebRequestPathBuilder.cs b/algoliasearch/Recommend/Client/WebRequestPathBuilder.cs new file mode 100644 index 000000000..9b204ed94 --- /dev/null +++ b/algoliasearch/Recommend/Client/WebRequestPathBuilder.cs @@ -0,0 +1,47 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using System; +using System.Collections.Generic; + +namespace Algolia.Search.Recommend.Client +{ + /// + /// A URI builder + /// + class WebRequestPathBuilder + { + private string _baseUrl; + private string _path; + private string _query = "?"; + public WebRequestPathBuilder(string baseUrl, string path) + { + _baseUrl = baseUrl; + _path = path; + } + + public void AddPathParameters(Dictionary parameters) + { + foreach (var parameter in parameters) + { + _path = _path.Replace("{" + parameter.Key + "}", Uri.EscapeDataString(parameter.Value)); + } + } + + public void AddQueryParameters(Multimap parameters) + { + foreach (var parameter in parameters) + { + foreach (var value in parameter.Value) + { + _query = _query + parameter.Key + "=" + Uri.EscapeDataString(value) + "&"; + } + } + } + + public string GetFullUri() + { + return _baseUrl + _path + _query.Substring(0, _query.Length - 1); + } + } +} diff --git a/algoliasearch/Recommend/Models/AbstractOpenAPISchema.cs b/algoliasearch/Recommend/Models/AbstractOpenAPISchema.cs new file mode 100644 index 000000000..5426e752a --- /dev/null +++ b/algoliasearch/Recommend/Models/AbstractOpenAPISchema.cs @@ -0,0 +1,70 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification + /// + public abstract partial class AbstractOpenAPISchema + { + /// + /// Custom JSON serializer + /// + static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Error, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Custom JSON serializer for objects with additional properties + /// + static public readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Ignore, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Gets or Sets the actual instance + /// + public abstract Object ActualInstance { get; set; } + + /// + /// Gets or Sets IsNullable to indicate whether the instance is nullable + /// + public bool IsNullable { get; protected set; } + + /// + /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf` + /// + public string SchemaType { get; protected set; } + + /// + /// Converts the instance into JSON string. + /// + public abstract string ToJson(); + } +} diff --git a/algoliasearch/Recommend/Models/AdvancedSyntaxFeatures.cs b/algoliasearch/Recommend/Models/AdvancedSyntaxFeatures.cs new file mode 100644 index 000000000..fd842a5ce --- /dev/null +++ b/algoliasearch/Recommend/Models/AdvancedSyntaxFeatures.cs @@ -0,0 +1,42 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Defines advancedSyntaxFeatures + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AdvancedSyntaxFeatures + { + /// + /// Enum ExactPhrase for value: exactPhrase + /// + [EnumMember(Value = "exactPhrase")] + ExactPhrase = 1, + + /// + /// Enum ExcludeWords for value: excludeWords + /// + [EnumMember(Value = "excludeWords")] + ExcludeWords = 2 + } + +} diff --git a/algoliasearch/Recommend/Models/AlternativesAsExact.cs b/algoliasearch/Recommend/Models/AlternativesAsExact.cs new file mode 100644 index 000000000..3880e7156 --- /dev/null +++ b/algoliasearch/Recommend/Models/AlternativesAsExact.cs @@ -0,0 +1,48 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Defines alternativesAsExact + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AlternativesAsExact + { + /// + /// Enum IgnorePlurals for value: ignorePlurals + /// + [EnumMember(Value = "ignorePlurals")] + IgnorePlurals = 1, + + /// + /// Enum SingleWordSynonym for value: singleWordSynonym + /// + [EnumMember(Value = "singleWordSynonym")] + SingleWordSynonym = 2, + + /// + /// Enum MultiWordsSynonym for value: multiWordsSynonym + /// + [EnumMember(Value = "multiWordsSynonym")] + MultiWordsSynonym = 3 + } + +} diff --git a/algoliasearch/Recommend/Models/Anchoring.cs b/algoliasearch/Recommend/Models/Anchoring.cs new file mode 100644 index 000000000..1a1bbbb07 --- /dev/null +++ b/algoliasearch/Recommend/Models/Anchoring.cs @@ -0,0 +1,55 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Whether the pattern parameter matches the beginning (`startsWith`) or end (`endsWith`) of the query string, is an exact match (`is`), or a partial match (`contains`). + /// + /// Whether the pattern parameter matches the beginning (`startsWith`) or end (`endsWith`) of the query string, is an exact match (`is`), or a partial match (`contains`). + [JsonConverter(typeof(StringEnumConverter))] + public enum Anchoring + { + /// + /// Enum Is for value: is + /// + [EnumMember(Value = "is")] + Is = 1, + + /// + /// Enum StartsWith for value: startsWith + /// + [EnumMember(Value = "startsWith")] + StartsWith = 2, + + /// + /// Enum EndsWith for value: endsWith + /// + [EnumMember(Value = "endsWith")] + EndsWith = 3, + + /// + /// Enum Contains for value: contains + /// + [EnumMember(Value = "contains")] + Contains = 4 + } + +} diff --git a/algoliasearch/Recommend/Models/AroundPrecision.cs b/algoliasearch/Recommend/Models/AroundPrecision.cs new file mode 100644 index 000000000..64ed44448 --- /dev/null +++ b/algoliasearch/Recommend/Models/AroundPrecision.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Precision of a geographical search (in meters), to [group results that are more or less the same distance from a central point](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/in-depth/geo-ranking-precision/). + /// + [JsonConverter(typeof(AroundPrecisionJsonConverter))] + [DataContract(Name = "aroundPrecision")] + public partial class AroundPrecision : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of int. + public AroundPrecision(int actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<AroundPrecisionFromValueInner>. + public AroundPrecision(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(int)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, int"); + } + } + } + + /// + /// Get the actual instance of `int`. If the actual instance is not `int`, + /// the InvalidClassException will be thrown + /// + /// An instance of int + public int GetterInt() + { + return (int)this.ActualInstance; + } + + /// + /// Get the actual instance of `List<AroundPrecisionFromValueInner>`. If the actual instance is not `List<AroundPrecisionFromValueInner>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<AroundPrecisionFromValueInner> + public List GetterList() + { + return (List)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class AroundPrecision {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, AroundPrecision.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of AroundPrecision + /// + /// JSON string + /// An instance of AroundPrecision + public static AroundPrecision FromJson(string jsonString) + { + AroundPrecision newAroundPrecision = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newAroundPrecision; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newAroundPrecision = new AroundPrecision(JsonConvert.DeserializeObject>(jsonString, AroundPrecision.SerializerSettings)); + } + else + { + newAroundPrecision = new AroundPrecision(JsonConvert.DeserializeObject>(jsonString, AroundPrecision.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(int).GetProperty("AdditionalProperties") == null) + { + newAroundPrecision = new AroundPrecision(JsonConvert.DeserializeObject(jsonString, AroundPrecision.SerializerSettings)); + } + else + { + newAroundPrecision = new AroundPrecision(JsonConvert.DeserializeObject(jsonString, AroundPrecision.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("int"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into int: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newAroundPrecision; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AroundPrecision); + } + + /// + /// Returns true if AroundPrecision instances are equal + /// + /// Instance of AroundPrecision to be compared + /// Boolean + public bool Equals(AroundPrecision input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for AroundPrecision + /// + public class AroundPrecisionJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(AroundPrecision).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return AroundPrecision.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/AroundPrecisionFromValueInner.cs b/algoliasearch/Recommend/Models/AroundPrecisionFromValueInner.cs new file mode 100644 index 000000000..76903cee9 --- /dev/null +++ b/algoliasearch/Recommend/Models/AroundPrecisionFromValueInner.cs @@ -0,0 +1,133 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// AroundPrecisionFromValueInner + /// + [DataContract(Name = "aroundPrecisionFromValue_inner")] + public partial class AroundPrecisionFromValueInner : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// from. + /// value. + public AroundPrecisionFromValueInner(int from = default(int), int value = default(int)) + { + this.From = from; + this.Value = value; + } + + /// + /// Gets or Sets From + /// + [DataMember(Name = "from", EmitDefaultValue = false)] + public int From { get; set; } + + /// + /// Gets or Sets Value + /// + [DataMember(Name = "value", EmitDefaultValue = false)] + public int Value { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AroundPrecisionFromValueInner {\n"); + sb.Append(" From: ").Append(From).Append("\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AroundPrecisionFromValueInner); + } + + /// + /// Returns true if AroundPrecisionFromValueInner instances are equal + /// + /// Instance of AroundPrecisionFromValueInner to be compared + /// Boolean + public bool Equals(AroundPrecisionFromValueInner input) + { + if (input == null) + { + return false; + } + return + ( + this.From == input.From || + this.From.Equals(input.From) + ) && + ( + this.Value == input.Value || + this.Value.Equals(input.Value) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.From.GetHashCode(); + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/AroundRadius.cs b/algoliasearch/Recommend/Models/AroundRadius.cs new file mode 100644 index 000000000..02ade8c1a --- /dev/null +++ b/algoliasearch/Recommend/Models/AroundRadius.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// [Maximum radius](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#increase-the-search-radius) for a geographical search (in meters). + /// + [JsonConverter(typeof(AroundRadiusJsonConverter))] + [DataContract(Name = "aroundRadius")] + public partial class AroundRadius : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of int. + public AroundRadius(int actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of AroundRadiusAll. + public AroundRadius(AroundRadiusAll actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(AroundRadiusAll)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(int)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: AroundRadiusAll, int"); + } + } + } + + /// + /// Get the actual instance of `int`. If the actual instance is not `int`, + /// the InvalidClassException will be thrown + /// + /// An instance of int + public int GetterInt() + { + return (int)this.ActualInstance; + } + + /// + /// Get the actual instance of `AroundRadiusAll`. If the actual instance is not `AroundRadiusAll`, + /// the InvalidClassException will be thrown + /// + /// An instance of AroundRadiusAll + public AroundRadiusAll GetterAroundRadiusAll() + { + return (AroundRadiusAll)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class AroundRadius {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, AroundRadius.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of AroundRadius + /// + /// JSON string + /// An instance of AroundRadius + public static AroundRadius FromJson(string jsonString) + { + AroundRadius newAroundRadius = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newAroundRadius; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(AroundRadiusAll).GetProperty("AdditionalProperties") == null) + { + newAroundRadius = new AroundRadius(JsonConvert.DeserializeObject(jsonString, AroundRadius.SerializerSettings)); + } + else + { + newAroundRadius = new AroundRadius(JsonConvert.DeserializeObject(jsonString, AroundRadius.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("AroundRadiusAll"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into AroundRadiusAll: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(int).GetProperty("AdditionalProperties") == null) + { + newAroundRadius = new AroundRadius(JsonConvert.DeserializeObject(jsonString, AroundRadius.SerializerSettings)); + } + else + { + newAroundRadius = new AroundRadius(JsonConvert.DeserializeObject(jsonString, AroundRadius.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("int"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into int: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newAroundRadius; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AroundRadius); + } + + /// + /// Returns true if AroundRadius instances are equal + /// + /// Instance of AroundRadius to be compared + /// Boolean + public bool Equals(AroundRadius input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for AroundRadius + /// + public class AroundRadiusJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(AroundRadius).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return AroundRadius.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/AroundRadiusAll.cs b/algoliasearch/Recommend/Models/AroundRadiusAll.cs new file mode 100644 index 000000000..2e231206a --- /dev/null +++ b/algoliasearch/Recommend/Models/AroundRadiusAll.cs @@ -0,0 +1,36 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Defines aroundRadiusAll + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AroundRadiusAll + { + /// + /// Enum All for value: all + /// + [EnumMember(Value = "all")] + All = 1 + } + +} diff --git a/algoliasearch/Recommend/Models/AutomaticFacetFilter.cs b/algoliasearch/Recommend/Models/AutomaticFacetFilter.cs new file mode 100644 index 000000000..084c9aa5d --- /dev/null +++ b/algoliasearch/Recommend/Models/AutomaticFacetFilter.cs @@ -0,0 +1,164 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Automatic facet Filter. + /// + [DataContract(Name = "automaticFacetFilter")] + public partial class AutomaticFacetFilter : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AutomaticFacetFilter() { } + /// + /// Initializes a new instance of the class. + /// + /// Attribute to filter on. This must match a facet placeholder in the Rule's pattern. (required). + /// Score for the filter. Typically used for optional or disjunctive filters. (default to 1). + /// Whether the filter is disjunctive (true) or conjunctive (false). (default to false). + public AutomaticFacetFilter(string facet = default(string), int score = 1, bool disjunctive = false) + { + // to ensure "facet" is required (not null) + if (facet == null) + { + throw new ArgumentNullException("facet is a required property for AutomaticFacetFilter and cannot be null"); + } + this.Facet = facet; + this.Score = score; + this.Disjunctive = disjunctive; + } + + /// + /// Attribute to filter on. This must match a facet placeholder in the Rule's pattern. + /// + /// Attribute to filter on. This must match a facet placeholder in the Rule's pattern. + [DataMember(Name = "facet", IsRequired = true, EmitDefaultValue = true)] + public string Facet { get; set; } + + /// + /// Score for the filter. Typically used for optional or disjunctive filters. + /// + /// Score for the filter. Typically used for optional or disjunctive filters. + [DataMember(Name = "score", EmitDefaultValue = false)] + public int Score { get; set; } + + /// + /// Whether the filter is disjunctive (true) or conjunctive (false). + /// + /// Whether the filter is disjunctive (true) or conjunctive (false). + [DataMember(Name = "disjunctive", EmitDefaultValue = true)] + public bool Disjunctive { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AutomaticFacetFilter {\n"); + sb.Append(" Facet: ").Append(Facet).Append("\n"); + sb.Append(" Score: ").Append(Score).Append("\n"); + sb.Append(" Disjunctive: ").Append(Disjunctive).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AutomaticFacetFilter); + } + + /// + /// Returns true if AutomaticFacetFilter instances are equal + /// + /// Instance of AutomaticFacetFilter to be compared + /// Boolean + public bool Equals(AutomaticFacetFilter input) + { + if (input == null) + { + return false; + } + return + ( + this.Facet == input.Facet || + (this.Facet != null && + this.Facet.Equals(input.Facet)) + ) && + ( + this.Score == input.Score || + this.Score.Equals(input.Score) + ) && + ( + this.Disjunctive == input.Disjunctive || + this.Disjunctive.Equals(input.Disjunctive) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Facet != null) + { + hashCode = (hashCode * 59) + this.Facet.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Score.GetHashCode(); + hashCode = (hashCode * 59) + this.Disjunctive.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/AutomaticFacetFilters.cs b/algoliasearch/Recommend/Models/AutomaticFacetFilters.cs new file mode 100644 index 000000000..c2f86bc69 --- /dev/null +++ b/algoliasearch/Recommend/Models/AutomaticFacetFilters.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern. + /// + [JsonConverter(typeof(AutomaticFacetFiltersJsonConverter))] + [DataContract(Name = "automaticFacetFilters")] + public partial class AutomaticFacetFilters : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<AutomaticFacetFilter>. + public AutomaticFacetFilters(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<string>. + public AutomaticFacetFilters(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, List"); + } + } + } + + /// + /// Get the actual instance of `List<AutomaticFacetFilter>`. If the actual instance is not `List<AutomaticFacetFilter>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<AutomaticFacetFilter> + public List GetterList() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `List<string>`. If the actual instance is not `List<string>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<string> + public List GetterListString() + { + return (List)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class AutomaticFacetFilters {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, AutomaticFacetFilters.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of AutomaticFacetFilters + /// + /// JSON string + /// An instance of AutomaticFacetFilters + public static AutomaticFacetFilters FromJson(string jsonString) + { + AutomaticFacetFilters newAutomaticFacetFilters = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newAutomaticFacetFilters; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newAutomaticFacetFilters = new AutomaticFacetFilters(JsonConvert.DeserializeObject>(jsonString, AutomaticFacetFilters.SerializerSettings)); + } + else + { + newAutomaticFacetFilters = new AutomaticFacetFilters(JsonConvert.DeserializeObject>(jsonString, AutomaticFacetFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newAutomaticFacetFilters = new AutomaticFacetFilters(JsonConvert.DeserializeObject>(jsonString, AutomaticFacetFilters.SerializerSettings)); + } + else + { + newAutomaticFacetFilters = new AutomaticFacetFilters(JsonConvert.DeserializeObject>(jsonString, AutomaticFacetFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newAutomaticFacetFilters; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AutomaticFacetFilters); + } + + /// + /// Returns true if AutomaticFacetFilters instances are equal + /// + /// Instance of AutomaticFacetFilters to be compared + /// Boolean + public bool Equals(AutomaticFacetFilters input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for AutomaticFacetFilters + /// + public class AutomaticFacetFiltersJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(AutomaticFacetFilters).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return AutomaticFacetFilters.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/BaseRecommendRequest.cs b/algoliasearch/Recommend/Models/BaseRecommendRequest.cs new file mode 100644 index 000000000..bc0bf2628 --- /dev/null +++ b/algoliasearch/Recommend/Models/BaseRecommendRequest.cs @@ -0,0 +1,176 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// BaseRecommendRequest + /// + [DataContract(Name = "baseRecommendRequest")] + public partial class BaseRecommendRequest : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BaseRecommendRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// Algolia index name. (required). + /// Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are. . + /// Maximum number of recommendations to retrieve. If 0, all recommendations will be returned. (default to 0). + public BaseRecommendRequest(string indexName = default(string), int threshold = default(int), int maxRecommendations = 0) + { + // to ensure "indexName" is required (not null) + if (indexName == null) + { + throw new ArgumentNullException("indexName is a required property for BaseRecommendRequest and cannot be null"); + } + this.IndexName = indexName; + this.Threshold = threshold; + this.MaxRecommendations = maxRecommendations; + } + + /// + /// Algolia index name. + /// + /// Algolia index name. + [DataMember(Name = "indexName", IsRequired = true, EmitDefaultValue = true)] + public string IndexName { get; set; } + + /// + /// Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are. + /// + /// Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are. + [DataMember(Name = "threshold", EmitDefaultValue = false)] + public int Threshold { get; set; } + + /// + /// Maximum number of recommendations to retrieve. If 0, all recommendations will be returned. + /// + /// Maximum number of recommendations to retrieve. If 0, all recommendations will be returned. + [DataMember(Name = "maxRecommendations", EmitDefaultValue = false)] + public int MaxRecommendations { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BaseRecommendRequest {\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append(" Threshold: ").Append(Threshold).Append("\n"); + sb.Append(" MaxRecommendations: ").Append(MaxRecommendations).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BaseRecommendRequest); + } + + /// + /// Returns true if BaseRecommendRequest instances are equal + /// + /// Instance of BaseRecommendRequest to be compared + /// Boolean + public bool Equals(BaseRecommendRequest input) + { + if (input == null) + { + return false; + } + return + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ) && + ( + this.Threshold == input.Threshold || + this.Threshold.Equals(input.Threshold) + ) && + ( + this.MaxRecommendations == input.MaxRecommendations || + this.MaxRecommendations.Equals(input.MaxRecommendations) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Threshold.GetHashCode(); + hashCode = (hashCode * 59) + this.MaxRecommendations.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Threshold (int) maximum + if (this.Threshold > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Threshold, must be a value less than or equal to 100.", new[] { "Threshold" }); + } + + // Threshold (int) minimum + if (this.Threshold < (int)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Threshold, must be a value greater than or equal to 0.", new[] { "Threshold" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/BaseRecommendationsQuery.cs b/algoliasearch/Recommend/Models/BaseRecommendationsQuery.cs new file mode 100644 index 000000000..dca9d3ff3 --- /dev/null +++ b/algoliasearch/Recommend/Models/BaseRecommendationsQuery.cs @@ -0,0 +1,184 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// BaseRecommendationsQuery + /// + [DataContract(Name = "baseRecommendationsQuery")] + public partial class BaseRecommendationsQuery : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Model + /// + [DataMember(Name = "model", IsRequired = true, EmitDefaultValue = true)] + public RecommendationModels Model { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BaseRecommendationsQuery() { } + /// + /// Initializes a new instance of the class. + /// + /// model (required). + /// Unique object identifier. (required). + /// queryParameters. + /// fallbackParameters. + public BaseRecommendationsQuery(RecommendationModels model = default(RecommendationModels), string objectID = default(string), SearchParamsObject queryParameters = default(SearchParamsObject), SearchParamsObject fallbackParameters = default(SearchParamsObject)) + { + this.Model = model; + // to ensure "objectID" is required (not null) + if (objectID == null) + { + throw new ArgumentNullException("objectID is a required property for BaseRecommendationsQuery and cannot be null"); + } + this.ObjectID = objectID; + this.QueryParameters = queryParameters; + this.FallbackParameters = fallbackParameters; + } + + /// + /// Unique object identifier. + /// + /// Unique object identifier. + [DataMember(Name = "objectID", IsRequired = true, EmitDefaultValue = true)] + public string ObjectID { get; set; } + + /// + /// Gets or Sets QueryParameters + /// + [DataMember(Name = "queryParameters", EmitDefaultValue = false)] + public SearchParamsObject QueryParameters { get; set; } + + /// + /// Gets or Sets FallbackParameters + /// + [DataMember(Name = "fallbackParameters", EmitDefaultValue = false)] + public SearchParamsObject FallbackParameters { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BaseRecommendationsQuery {\n"); + sb.Append(" Model: ").Append(Model).Append("\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append(" QueryParameters: ").Append(QueryParameters).Append("\n"); + sb.Append(" FallbackParameters: ").Append(FallbackParameters).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BaseRecommendationsQuery); + } + + /// + /// Returns true if BaseRecommendationsQuery instances are equal + /// + /// Instance of BaseRecommendationsQuery to be compared + /// Boolean + public bool Equals(BaseRecommendationsQuery input) + { + if (input == null) + { + return false; + } + return + ( + this.Model == input.Model || + this.Model.Equals(input.Model) + ) && + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ) && + ( + this.QueryParameters == input.QueryParameters || + (this.QueryParameters != null && + this.QueryParameters.Equals(input.QueryParameters)) + ) && + ( + this.FallbackParameters == input.FallbackParameters || + (this.FallbackParameters != null && + this.FallbackParameters.Equals(input.FallbackParameters)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Model.GetHashCode(); + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + if (this.QueryParameters != null) + { + hashCode = (hashCode * 59) + this.QueryParameters.GetHashCode(); + } + if (this.FallbackParameters != null) + { + hashCode = (hashCode * 59) + this.FallbackParameters.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/BaseSearchParams.cs b/algoliasearch/Recommend/Models/BaseSearchParams.cs new file mode 100644 index 000000000..1f49c6779 --- /dev/null +++ b/algoliasearch/Recommend/Models/BaseSearchParams.cs @@ -0,0 +1,700 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// BaseSearchParams + /// + [DataContract(Name = "baseSearchParams")] + public partial class BaseSearchParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Text to search for in an index. (default to ""). + /// Overrides the query parameter and performs a more generic search. (default to ""). + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. (default to ""). + /// facetFilters. + /// optionalFilters. + /// numericFilters. + /// tagFilters. + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. (default to false). + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/).. + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values.. + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. (default to false). + /// Page to retrieve (the first page is `0`, not `1`). (default to 0). + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. (default to ""). + /// Search for entries around a location. The location is automatically computed from the requester's IP address. (default to false). + /// aroundRadius. + /// aroundPrecision. + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set.. + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries.. + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries.. + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). (default to 100). + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search.. + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). (default to false). + /// Enriches the API's response with information about how the query was processed.. + /// Whether to take into account an index's synonyms for a particular search. (default to true). + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). (default to false). + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). (default to true). + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).. + /// Whether to include or exclude a query from the processing-time percentile computation. (default to true). + /// Incidates whether this search will be considered in A/B testing. (default to true). + public BaseSearchParams(string query = @"", string similarQuery = @"", string filters = @"", FacetFilters facetFilters = default(FacetFilters), OptionalFilters optionalFilters = default(OptionalFilters), NumericFilters numericFilters = default(NumericFilters), TagFilters tagFilters = default(TagFilters), bool sumOrFiltersScores = false, List restrictSearchableAttributes = default(List), List facets = default(List), bool facetingAfterDistinct = false, int page = 0, int offset = default(int), int length = default(int), string aroundLatLng = @"", bool aroundLatLngViaIP = false, AroundRadius aroundRadius = default(AroundRadius), AroundPrecision aroundPrecision = default(AroundPrecision), int minimumAroundRadius = default(int), List> insideBoundingBox = default(List>), List> insidePolygon = default(List>), List naturalLanguages = default(List), List ruleContexts = default(List), int personalizationImpact = 100, string userToken = default(string), bool getRankingInfo = false, List explain = default(List), bool synonyms = true, bool clickAnalytics = false, bool analytics = true, List analyticsTags = default(List), bool percentileComputation = true, bool enableABTest = true) + { + // use default value if no "query" provided + this.Query = query ?? @""; + // use default value if no "similarQuery" provided + this.SimilarQuery = similarQuery ?? @""; + // use default value if no "filters" provided + this.Filters = filters ?? @""; + this.FacetFilters = facetFilters; + this.OptionalFilters = optionalFilters; + this.NumericFilters = numericFilters; + this.TagFilters = tagFilters; + this.SumOrFiltersScores = sumOrFiltersScores; + this.RestrictSearchableAttributes = restrictSearchableAttributes; + this.Facets = facets; + this.FacetingAfterDistinct = facetingAfterDistinct; + this.Page = page; + this.Offset = offset; + this.Length = length; + // use default value if no "aroundLatLng" provided + this.AroundLatLng = aroundLatLng ?? @""; + this.AroundLatLngViaIP = aroundLatLngViaIP; + this.AroundRadius = aroundRadius; + this.AroundPrecision = aroundPrecision; + this.MinimumAroundRadius = minimumAroundRadius; + this.InsideBoundingBox = insideBoundingBox; + this.InsidePolygon = insidePolygon; + this.NaturalLanguages = naturalLanguages; + this.RuleContexts = ruleContexts; + this.PersonalizationImpact = personalizationImpact; + this.UserToken = userToken; + this.GetRankingInfo = getRankingInfo; + this.Explain = explain; + this.Synonyms = synonyms; + this.ClickAnalytics = clickAnalytics; + this.Analytics = analytics; + this.AnalyticsTags = analyticsTags; + this.PercentileComputation = percentileComputation; + this.EnableABTest = enableABTest; + } + + /// + /// Text to search for in an index. + /// + /// Text to search for in an index. + [DataMember(Name = "query", EmitDefaultValue = false)] + public string Query { get; set; } + + /// + /// Overrides the query parameter and performs a more generic search. + /// + /// Overrides the query parameter and performs a more generic search. + [DataMember(Name = "similarQuery", EmitDefaultValue = false)] + public string SimilarQuery { get; set; } + + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + [DataMember(Name = "filters", EmitDefaultValue = false)] + public string Filters { get; set; } + + /// + /// Gets or Sets FacetFilters + /// + [DataMember(Name = "facetFilters", EmitDefaultValue = false)] + public FacetFilters FacetFilters { get; set; } + + /// + /// Gets or Sets OptionalFilters + /// + [DataMember(Name = "optionalFilters", EmitDefaultValue = false)] + public OptionalFilters OptionalFilters { get; set; } + + /// + /// Gets or Sets NumericFilters + /// + [DataMember(Name = "numericFilters", EmitDefaultValue = false)] + public NumericFilters NumericFilters { get; set; } + + /// + /// Gets or Sets TagFilters + /// + [DataMember(Name = "tagFilters", EmitDefaultValue = false)] + public TagFilters TagFilters { get; set; } + + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + [DataMember(Name = "sumOrFiltersScores", EmitDefaultValue = true)] + public bool SumOrFiltersScores { get; set; } + + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + [DataMember(Name = "restrictSearchableAttributes", EmitDefaultValue = false)] + public List RestrictSearchableAttributes { get; set; } + + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + [DataMember(Name = "facets", EmitDefaultValue = false)] + public List Facets { get; set; } + + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + [DataMember(Name = "facetingAfterDistinct", EmitDefaultValue = true)] + public bool FacetingAfterDistinct { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", EmitDefaultValue = false)] + public int Page { get; set; } + + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "offset", EmitDefaultValue = false)] + public int Offset { get; set; } + + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "length", EmitDefaultValue = false)] + public int Length { get; set; } + + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + [DataMember(Name = "aroundLatLngViaIP", EmitDefaultValue = true)] + public bool AroundLatLngViaIP { get; set; } + + /// + /// Gets or Sets AroundRadius + /// + [DataMember(Name = "aroundRadius", EmitDefaultValue = false)] + public AroundRadius AroundRadius { get; set; } + + /// + /// Gets or Sets AroundPrecision + /// + [DataMember(Name = "aroundPrecision", EmitDefaultValue = false)] + public AroundPrecision AroundPrecision { get; set; } + + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + [DataMember(Name = "minimumAroundRadius", EmitDefaultValue = false)] + public int MinimumAroundRadius { get; set; } + + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insideBoundingBox", EmitDefaultValue = false)] + public List> InsideBoundingBox { get; set; } + + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insidePolygon", EmitDefaultValue = false)] + public List> InsidePolygon { get; set; } + + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + [DataMember(Name = "naturalLanguages", EmitDefaultValue = false)] + public List NaturalLanguages { get; set; } + + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + [DataMember(Name = "ruleContexts", EmitDefaultValue = false)] + public List RuleContexts { get; set; } + + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + [DataMember(Name = "personalizationImpact", EmitDefaultValue = false)] + public int PersonalizationImpact { get; set; } + + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + [DataMember(Name = "userToken", EmitDefaultValue = false)] + public string UserToken { get; set; } + + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + [DataMember(Name = "getRankingInfo", EmitDefaultValue = true)] + public bool GetRankingInfo { get; set; } + + /// + /// Enriches the API's response with information about how the query was processed. + /// + /// Enriches the API's response with information about how the query was processed. + [DataMember(Name = "explain", EmitDefaultValue = false)] + public List Explain { get; set; } + + /// + /// Whether to take into account an index's synonyms for a particular search. + /// + /// Whether to take into account an index's synonyms for a particular search. + [DataMember(Name = "synonyms", EmitDefaultValue = true)] + public bool Synonyms { get; set; } + + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + [DataMember(Name = "clickAnalytics", EmitDefaultValue = true)] + public bool ClickAnalytics { get; set; } + + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + [DataMember(Name = "analytics", EmitDefaultValue = true)] + public bool Analytics { get; set; } + + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + [DataMember(Name = "analyticsTags", EmitDefaultValue = false)] + public List AnalyticsTags { get; set; } + + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + [DataMember(Name = "percentileComputation", EmitDefaultValue = true)] + public bool PercentileComputation { get; set; } + + /// + /// Incidates whether this search will be considered in A/B testing. + /// + /// Incidates whether this search will be considered in A/B testing. + [DataMember(Name = "enableABTest", EmitDefaultValue = true)] + public bool EnableABTest { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BaseSearchParams {\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" SimilarQuery: ").Append(SimilarQuery).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" FacetFilters: ").Append(FacetFilters).Append("\n"); + sb.Append(" OptionalFilters: ").Append(OptionalFilters).Append("\n"); + sb.Append(" NumericFilters: ").Append(NumericFilters).Append("\n"); + sb.Append(" TagFilters: ").Append(TagFilters).Append("\n"); + sb.Append(" SumOrFiltersScores: ").Append(SumOrFiltersScores).Append("\n"); + sb.Append(" RestrictSearchableAttributes: ").Append(RestrictSearchableAttributes).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" FacetingAfterDistinct: ").Append(FacetingAfterDistinct).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" Offset: ").Append(Offset).Append("\n"); + sb.Append(" Length: ").Append(Length).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AroundLatLngViaIP: ").Append(AroundLatLngViaIP).Append("\n"); + sb.Append(" AroundRadius: ").Append(AroundRadius).Append("\n"); + sb.Append(" AroundPrecision: ").Append(AroundPrecision).Append("\n"); + sb.Append(" MinimumAroundRadius: ").Append(MinimumAroundRadius).Append("\n"); + sb.Append(" InsideBoundingBox: ").Append(InsideBoundingBox).Append("\n"); + sb.Append(" InsidePolygon: ").Append(InsidePolygon).Append("\n"); + sb.Append(" NaturalLanguages: ").Append(NaturalLanguages).Append("\n"); + sb.Append(" RuleContexts: ").Append(RuleContexts).Append("\n"); + sb.Append(" PersonalizationImpact: ").Append(PersonalizationImpact).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" GetRankingInfo: ").Append(GetRankingInfo).Append("\n"); + sb.Append(" Explain: ").Append(Explain).Append("\n"); + sb.Append(" Synonyms: ").Append(Synonyms).Append("\n"); + sb.Append(" ClickAnalytics: ").Append(ClickAnalytics).Append("\n"); + sb.Append(" Analytics: ").Append(Analytics).Append("\n"); + sb.Append(" AnalyticsTags: ").Append(AnalyticsTags).Append("\n"); + sb.Append(" PercentileComputation: ").Append(PercentileComputation).Append("\n"); + sb.Append(" EnableABTest: ").Append(EnableABTest).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BaseSearchParams); + } + + /// + /// Returns true if BaseSearchParams instances are equal + /// + /// Instance of BaseSearchParams to be compared + /// Boolean + public bool Equals(BaseSearchParams input) + { + if (input == null) + { + return false; + } + return + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.SimilarQuery == input.SimilarQuery || + (this.SimilarQuery != null && + this.SimilarQuery.Equals(input.SimilarQuery)) + ) && + ( + this.Filters == input.Filters || + (this.Filters != null && + this.Filters.Equals(input.Filters)) + ) && + ( + this.FacetFilters == input.FacetFilters || + (this.FacetFilters != null && + this.FacetFilters.Equals(input.FacetFilters)) + ) && + ( + this.OptionalFilters == input.OptionalFilters || + (this.OptionalFilters != null && + this.OptionalFilters.Equals(input.OptionalFilters)) + ) && + ( + this.NumericFilters == input.NumericFilters || + (this.NumericFilters != null && + this.NumericFilters.Equals(input.NumericFilters)) + ) && + ( + this.TagFilters == input.TagFilters || + (this.TagFilters != null && + this.TagFilters.Equals(input.TagFilters)) + ) && + ( + this.SumOrFiltersScores == input.SumOrFiltersScores || + this.SumOrFiltersScores.Equals(input.SumOrFiltersScores) + ) && + ( + this.RestrictSearchableAttributes == input.RestrictSearchableAttributes || + this.RestrictSearchableAttributes != null && + input.RestrictSearchableAttributes != null && + this.RestrictSearchableAttributes.SequenceEqual(input.RestrictSearchableAttributes) + ) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && + ( + this.FacetingAfterDistinct == input.FacetingAfterDistinct || + this.FacetingAfterDistinct.Equals(input.FacetingAfterDistinct) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.Offset == input.Offset || + this.Offset.Equals(input.Offset) + ) && + ( + this.Length == input.Length || + this.Length.Equals(input.Length) + ) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && + ( + this.AroundLatLngViaIP == input.AroundLatLngViaIP || + this.AroundLatLngViaIP.Equals(input.AroundLatLngViaIP) + ) && + ( + this.AroundRadius == input.AroundRadius || + (this.AroundRadius != null && + this.AroundRadius.Equals(input.AroundRadius)) + ) && + ( + this.AroundPrecision == input.AroundPrecision || + (this.AroundPrecision != null && + this.AroundPrecision.Equals(input.AroundPrecision)) + ) && + ( + this.MinimumAroundRadius == input.MinimumAroundRadius || + this.MinimumAroundRadius.Equals(input.MinimumAroundRadius) + ) && + ( + this.InsideBoundingBox == input.InsideBoundingBox || + this.InsideBoundingBox != null && + input.InsideBoundingBox != null && + this.InsideBoundingBox.SequenceEqual(input.InsideBoundingBox) + ) && + ( + this.InsidePolygon == input.InsidePolygon || + this.InsidePolygon != null && + input.InsidePolygon != null && + this.InsidePolygon.SequenceEqual(input.InsidePolygon) + ) && + ( + this.NaturalLanguages == input.NaturalLanguages || + this.NaturalLanguages != null && + input.NaturalLanguages != null && + this.NaturalLanguages.SequenceEqual(input.NaturalLanguages) + ) && + ( + this.RuleContexts == input.RuleContexts || + this.RuleContexts != null && + input.RuleContexts != null && + this.RuleContexts.SequenceEqual(input.RuleContexts) + ) && + ( + this.PersonalizationImpact == input.PersonalizationImpact || + this.PersonalizationImpact.Equals(input.PersonalizationImpact) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.GetRankingInfo == input.GetRankingInfo || + this.GetRankingInfo.Equals(input.GetRankingInfo) + ) && + ( + this.Explain == input.Explain || + this.Explain != null && + input.Explain != null && + this.Explain.SequenceEqual(input.Explain) + ) && + ( + this.Synonyms == input.Synonyms || + this.Synonyms.Equals(input.Synonyms) + ) && + ( + this.ClickAnalytics == input.ClickAnalytics || + this.ClickAnalytics.Equals(input.ClickAnalytics) + ) && + ( + this.Analytics == input.Analytics || + this.Analytics.Equals(input.Analytics) + ) && + ( + this.AnalyticsTags == input.AnalyticsTags || + this.AnalyticsTags != null && + input.AnalyticsTags != null && + this.AnalyticsTags.SequenceEqual(input.AnalyticsTags) + ) && + ( + this.PercentileComputation == input.PercentileComputation || + this.PercentileComputation.Equals(input.PercentileComputation) + ) && + ( + this.EnableABTest == input.EnableABTest || + this.EnableABTest.Equals(input.EnableABTest) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.SimilarQuery != null) + { + hashCode = (hashCode * 59) + this.SimilarQuery.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.FacetFilters != null) + { + hashCode = (hashCode * 59) + this.FacetFilters.GetHashCode(); + } + if (this.OptionalFilters != null) + { + hashCode = (hashCode * 59) + this.OptionalFilters.GetHashCode(); + } + if (this.NumericFilters != null) + { + hashCode = (hashCode * 59) + this.NumericFilters.GetHashCode(); + } + if (this.TagFilters != null) + { + hashCode = (hashCode * 59) + this.TagFilters.GetHashCode(); + } + hashCode = (hashCode * 59) + this.SumOrFiltersScores.GetHashCode(); + if (this.RestrictSearchableAttributes != null) + { + hashCode = (hashCode * 59) + this.RestrictSearchableAttributes.GetHashCode(); + } + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + hashCode = (hashCode * 59) + this.FacetingAfterDistinct.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.Offset.GetHashCode(); + hashCode = (hashCode * 59) + this.Length.GetHashCode(); + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AroundLatLngViaIP.GetHashCode(); + if (this.AroundRadius != null) + { + hashCode = (hashCode * 59) + this.AroundRadius.GetHashCode(); + } + if (this.AroundPrecision != null) + { + hashCode = (hashCode * 59) + this.AroundPrecision.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MinimumAroundRadius.GetHashCode(); + if (this.InsideBoundingBox != null) + { + hashCode = (hashCode * 59) + this.InsideBoundingBox.GetHashCode(); + } + if (this.InsidePolygon != null) + { + hashCode = (hashCode * 59) + this.InsidePolygon.GetHashCode(); + } + if (this.NaturalLanguages != null) + { + hashCode = (hashCode * 59) + this.NaturalLanguages.GetHashCode(); + } + if (this.RuleContexts != null) + { + hashCode = (hashCode * 59) + this.RuleContexts.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PersonalizationImpact.GetHashCode(); + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.GetRankingInfo.GetHashCode(); + if (this.Explain != null) + { + hashCode = (hashCode * 59) + this.Explain.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Synonyms.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickAnalytics.GetHashCode(); + hashCode = (hashCode * 59) + this.Analytics.GetHashCode(); + if (this.AnalyticsTags != null) + { + hashCode = (hashCode * 59) + this.AnalyticsTags.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PercentileComputation.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableABTest.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Length (int) maximum + if (this.Length > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value less than or equal to 1000.", new[] { "Length" }); + } + + // Length (int) minimum + if (this.Length < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value greater than or equal to 1.", new[] { "Length" }); + } + + // MinimumAroundRadius (int) minimum + if (this.MinimumAroundRadius < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinimumAroundRadius, must be a value greater than or equal to 1.", new[] { "MinimumAroundRadius" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/BaseSearchParamsWithoutQuery.cs b/algoliasearch/Recommend/Models/BaseSearchParamsWithoutQuery.cs new file mode 100644 index 000000000..bf043bb91 --- /dev/null +++ b/algoliasearch/Recommend/Models/BaseSearchParamsWithoutQuery.cs @@ -0,0 +1,680 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// BaseSearchParamsWithoutQuery + /// + [DataContract(Name = "baseSearchParamsWithoutQuery")] + public partial class BaseSearchParamsWithoutQuery : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Overrides the query parameter and performs a more generic search. (default to ""). + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. (default to ""). + /// facetFilters. + /// optionalFilters. + /// numericFilters. + /// tagFilters. + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. (default to false). + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/).. + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values.. + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. (default to false). + /// Page to retrieve (the first page is `0`, not `1`). (default to 0). + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. (default to ""). + /// Search for entries around a location. The location is automatically computed from the requester's IP address. (default to false). + /// aroundRadius. + /// aroundPrecision. + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set.. + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries.. + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries.. + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). (default to 100). + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search.. + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). (default to false). + /// Enriches the API's response with information about how the query was processed.. + /// Whether to take into account an index's synonyms for a particular search. (default to true). + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). (default to false). + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). (default to true). + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).. + /// Whether to include or exclude a query from the processing-time percentile computation. (default to true). + /// Incidates whether this search will be considered in A/B testing. (default to true). + public BaseSearchParamsWithoutQuery(string similarQuery = @"", string filters = @"", FacetFilters facetFilters = default(FacetFilters), OptionalFilters optionalFilters = default(OptionalFilters), NumericFilters numericFilters = default(NumericFilters), TagFilters tagFilters = default(TagFilters), bool sumOrFiltersScores = false, List restrictSearchableAttributes = default(List), List facets = default(List), bool facetingAfterDistinct = false, int page = 0, int offset = default(int), int length = default(int), string aroundLatLng = @"", bool aroundLatLngViaIP = false, AroundRadius aroundRadius = default(AroundRadius), AroundPrecision aroundPrecision = default(AroundPrecision), int minimumAroundRadius = default(int), List> insideBoundingBox = default(List>), List> insidePolygon = default(List>), List naturalLanguages = default(List), List ruleContexts = default(List), int personalizationImpact = 100, string userToken = default(string), bool getRankingInfo = false, List explain = default(List), bool synonyms = true, bool clickAnalytics = false, bool analytics = true, List analyticsTags = default(List), bool percentileComputation = true, bool enableABTest = true) + { + // use default value if no "similarQuery" provided + this.SimilarQuery = similarQuery ?? @""; + // use default value if no "filters" provided + this.Filters = filters ?? @""; + this.FacetFilters = facetFilters; + this.OptionalFilters = optionalFilters; + this.NumericFilters = numericFilters; + this.TagFilters = tagFilters; + this.SumOrFiltersScores = sumOrFiltersScores; + this.RestrictSearchableAttributes = restrictSearchableAttributes; + this.Facets = facets; + this.FacetingAfterDistinct = facetingAfterDistinct; + this.Page = page; + this.Offset = offset; + this.Length = length; + // use default value if no "aroundLatLng" provided + this.AroundLatLng = aroundLatLng ?? @""; + this.AroundLatLngViaIP = aroundLatLngViaIP; + this.AroundRadius = aroundRadius; + this.AroundPrecision = aroundPrecision; + this.MinimumAroundRadius = minimumAroundRadius; + this.InsideBoundingBox = insideBoundingBox; + this.InsidePolygon = insidePolygon; + this.NaturalLanguages = naturalLanguages; + this.RuleContexts = ruleContexts; + this.PersonalizationImpact = personalizationImpact; + this.UserToken = userToken; + this.GetRankingInfo = getRankingInfo; + this.Explain = explain; + this.Synonyms = synonyms; + this.ClickAnalytics = clickAnalytics; + this.Analytics = analytics; + this.AnalyticsTags = analyticsTags; + this.PercentileComputation = percentileComputation; + this.EnableABTest = enableABTest; + } + + /// + /// Overrides the query parameter and performs a more generic search. + /// + /// Overrides the query parameter and performs a more generic search. + [DataMember(Name = "similarQuery", EmitDefaultValue = false)] + public string SimilarQuery { get; set; } + + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + [DataMember(Name = "filters", EmitDefaultValue = false)] + public string Filters { get; set; } + + /// + /// Gets or Sets FacetFilters + /// + [DataMember(Name = "facetFilters", EmitDefaultValue = false)] + public FacetFilters FacetFilters { get; set; } + + /// + /// Gets or Sets OptionalFilters + /// + [DataMember(Name = "optionalFilters", EmitDefaultValue = false)] + public OptionalFilters OptionalFilters { get; set; } + + /// + /// Gets or Sets NumericFilters + /// + [DataMember(Name = "numericFilters", EmitDefaultValue = false)] + public NumericFilters NumericFilters { get; set; } + + /// + /// Gets or Sets TagFilters + /// + [DataMember(Name = "tagFilters", EmitDefaultValue = false)] + public TagFilters TagFilters { get; set; } + + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + [DataMember(Name = "sumOrFiltersScores", EmitDefaultValue = true)] + public bool SumOrFiltersScores { get; set; } + + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + [DataMember(Name = "restrictSearchableAttributes", EmitDefaultValue = false)] + public List RestrictSearchableAttributes { get; set; } + + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + [DataMember(Name = "facets", EmitDefaultValue = false)] + public List Facets { get; set; } + + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + [DataMember(Name = "facetingAfterDistinct", EmitDefaultValue = true)] + public bool FacetingAfterDistinct { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", EmitDefaultValue = false)] + public int Page { get; set; } + + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "offset", EmitDefaultValue = false)] + public int Offset { get; set; } + + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "length", EmitDefaultValue = false)] + public int Length { get; set; } + + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + [DataMember(Name = "aroundLatLngViaIP", EmitDefaultValue = true)] + public bool AroundLatLngViaIP { get; set; } + + /// + /// Gets or Sets AroundRadius + /// + [DataMember(Name = "aroundRadius", EmitDefaultValue = false)] + public AroundRadius AroundRadius { get; set; } + + /// + /// Gets or Sets AroundPrecision + /// + [DataMember(Name = "aroundPrecision", EmitDefaultValue = false)] + public AroundPrecision AroundPrecision { get; set; } + + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + [DataMember(Name = "minimumAroundRadius", EmitDefaultValue = false)] + public int MinimumAroundRadius { get; set; } + + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insideBoundingBox", EmitDefaultValue = false)] + public List> InsideBoundingBox { get; set; } + + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insidePolygon", EmitDefaultValue = false)] + public List> InsidePolygon { get; set; } + + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + [DataMember(Name = "naturalLanguages", EmitDefaultValue = false)] + public List NaturalLanguages { get; set; } + + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + [DataMember(Name = "ruleContexts", EmitDefaultValue = false)] + public List RuleContexts { get; set; } + + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + [DataMember(Name = "personalizationImpact", EmitDefaultValue = false)] + public int PersonalizationImpact { get; set; } + + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + [DataMember(Name = "userToken", EmitDefaultValue = false)] + public string UserToken { get; set; } + + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + [DataMember(Name = "getRankingInfo", EmitDefaultValue = true)] + public bool GetRankingInfo { get; set; } + + /// + /// Enriches the API's response with information about how the query was processed. + /// + /// Enriches the API's response with information about how the query was processed. + [DataMember(Name = "explain", EmitDefaultValue = false)] + public List Explain { get; set; } + + /// + /// Whether to take into account an index's synonyms for a particular search. + /// + /// Whether to take into account an index's synonyms for a particular search. + [DataMember(Name = "synonyms", EmitDefaultValue = true)] + public bool Synonyms { get; set; } + + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + [DataMember(Name = "clickAnalytics", EmitDefaultValue = true)] + public bool ClickAnalytics { get; set; } + + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + [DataMember(Name = "analytics", EmitDefaultValue = true)] + public bool Analytics { get; set; } + + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + [DataMember(Name = "analyticsTags", EmitDefaultValue = false)] + public List AnalyticsTags { get; set; } + + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + [DataMember(Name = "percentileComputation", EmitDefaultValue = true)] + public bool PercentileComputation { get; set; } + + /// + /// Incidates whether this search will be considered in A/B testing. + /// + /// Incidates whether this search will be considered in A/B testing. + [DataMember(Name = "enableABTest", EmitDefaultValue = true)] + public bool EnableABTest { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BaseSearchParamsWithoutQuery {\n"); + sb.Append(" SimilarQuery: ").Append(SimilarQuery).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" FacetFilters: ").Append(FacetFilters).Append("\n"); + sb.Append(" OptionalFilters: ").Append(OptionalFilters).Append("\n"); + sb.Append(" NumericFilters: ").Append(NumericFilters).Append("\n"); + sb.Append(" TagFilters: ").Append(TagFilters).Append("\n"); + sb.Append(" SumOrFiltersScores: ").Append(SumOrFiltersScores).Append("\n"); + sb.Append(" RestrictSearchableAttributes: ").Append(RestrictSearchableAttributes).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" FacetingAfterDistinct: ").Append(FacetingAfterDistinct).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" Offset: ").Append(Offset).Append("\n"); + sb.Append(" Length: ").Append(Length).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AroundLatLngViaIP: ").Append(AroundLatLngViaIP).Append("\n"); + sb.Append(" AroundRadius: ").Append(AroundRadius).Append("\n"); + sb.Append(" AroundPrecision: ").Append(AroundPrecision).Append("\n"); + sb.Append(" MinimumAroundRadius: ").Append(MinimumAroundRadius).Append("\n"); + sb.Append(" InsideBoundingBox: ").Append(InsideBoundingBox).Append("\n"); + sb.Append(" InsidePolygon: ").Append(InsidePolygon).Append("\n"); + sb.Append(" NaturalLanguages: ").Append(NaturalLanguages).Append("\n"); + sb.Append(" RuleContexts: ").Append(RuleContexts).Append("\n"); + sb.Append(" PersonalizationImpact: ").Append(PersonalizationImpact).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" GetRankingInfo: ").Append(GetRankingInfo).Append("\n"); + sb.Append(" Explain: ").Append(Explain).Append("\n"); + sb.Append(" Synonyms: ").Append(Synonyms).Append("\n"); + sb.Append(" ClickAnalytics: ").Append(ClickAnalytics).Append("\n"); + sb.Append(" Analytics: ").Append(Analytics).Append("\n"); + sb.Append(" AnalyticsTags: ").Append(AnalyticsTags).Append("\n"); + sb.Append(" PercentileComputation: ").Append(PercentileComputation).Append("\n"); + sb.Append(" EnableABTest: ").Append(EnableABTest).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BaseSearchParamsWithoutQuery); + } + + /// + /// Returns true if BaseSearchParamsWithoutQuery instances are equal + /// + /// Instance of BaseSearchParamsWithoutQuery to be compared + /// Boolean + public bool Equals(BaseSearchParamsWithoutQuery input) + { + if (input == null) + { + return false; + } + return + ( + this.SimilarQuery == input.SimilarQuery || + (this.SimilarQuery != null && + this.SimilarQuery.Equals(input.SimilarQuery)) + ) && + ( + this.Filters == input.Filters || + (this.Filters != null && + this.Filters.Equals(input.Filters)) + ) && + ( + this.FacetFilters == input.FacetFilters || + (this.FacetFilters != null && + this.FacetFilters.Equals(input.FacetFilters)) + ) && + ( + this.OptionalFilters == input.OptionalFilters || + (this.OptionalFilters != null && + this.OptionalFilters.Equals(input.OptionalFilters)) + ) && + ( + this.NumericFilters == input.NumericFilters || + (this.NumericFilters != null && + this.NumericFilters.Equals(input.NumericFilters)) + ) && + ( + this.TagFilters == input.TagFilters || + (this.TagFilters != null && + this.TagFilters.Equals(input.TagFilters)) + ) && + ( + this.SumOrFiltersScores == input.SumOrFiltersScores || + this.SumOrFiltersScores.Equals(input.SumOrFiltersScores) + ) && + ( + this.RestrictSearchableAttributes == input.RestrictSearchableAttributes || + this.RestrictSearchableAttributes != null && + input.RestrictSearchableAttributes != null && + this.RestrictSearchableAttributes.SequenceEqual(input.RestrictSearchableAttributes) + ) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && + ( + this.FacetingAfterDistinct == input.FacetingAfterDistinct || + this.FacetingAfterDistinct.Equals(input.FacetingAfterDistinct) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.Offset == input.Offset || + this.Offset.Equals(input.Offset) + ) && + ( + this.Length == input.Length || + this.Length.Equals(input.Length) + ) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && + ( + this.AroundLatLngViaIP == input.AroundLatLngViaIP || + this.AroundLatLngViaIP.Equals(input.AroundLatLngViaIP) + ) && + ( + this.AroundRadius == input.AroundRadius || + (this.AroundRadius != null && + this.AroundRadius.Equals(input.AroundRadius)) + ) && + ( + this.AroundPrecision == input.AroundPrecision || + (this.AroundPrecision != null && + this.AroundPrecision.Equals(input.AroundPrecision)) + ) && + ( + this.MinimumAroundRadius == input.MinimumAroundRadius || + this.MinimumAroundRadius.Equals(input.MinimumAroundRadius) + ) && + ( + this.InsideBoundingBox == input.InsideBoundingBox || + this.InsideBoundingBox != null && + input.InsideBoundingBox != null && + this.InsideBoundingBox.SequenceEqual(input.InsideBoundingBox) + ) && + ( + this.InsidePolygon == input.InsidePolygon || + this.InsidePolygon != null && + input.InsidePolygon != null && + this.InsidePolygon.SequenceEqual(input.InsidePolygon) + ) && + ( + this.NaturalLanguages == input.NaturalLanguages || + this.NaturalLanguages != null && + input.NaturalLanguages != null && + this.NaturalLanguages.SequenceEqual(input.NaturalLanguages) + ) && + ( + this.RuleContexts == input.RuleContexts || + this.RuleContexts != null && + input.RuleContexts != null && + this.RuleContexts.SequenceEqual(input.RuleContexts) + ) && + ( + this.PersonalizationImpact == input.PersonalizationImpact || + this.PersonalizationImpact.Equals(input.PersonalizationImpact) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.GetRankingInfo == input.GetRankingInfo || + this.GetRankingInfo.Equals(input.GetRankingInfo) + ) && + ( + this.Explain == input.Explain || + this.Explain != null && + input.Explain != null && + this.Explain.SequenceEqual(input.Explain) + ) && + ( + this.Synonyms == input.Synonyms || + this.Synonyms.Equals(input.Synonyms) + ) && + ( + this.ClickAnalytics == input.ClickAnalytics || + this.ClickAnalytics.Equals(input.ClickAnalytics) + ) && + ( + this.Analytics == input.Analytics || + this.Analytics.Equals(input.Analytics) + ) && + ( + this.AnalyticsTags == input.AnalyticsTags || + this.AnalyticsTags != null && + input.AnalyticsTags != null && + this.AnalyticsTags.SequenceEqual(input.AnalyticsTags) + ) && + ( + this.PercentileComputation == input.PercentileComputation || + this.PercentileComputation.Equals(input.PercentileComputation) + ) && + ( + this.EnableABTest == input.EnableABTest || + this.EnableABTest.Equals(input.EnableABTest) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SimilarQuery != null) + { + hashCode = (hashCode * 59) + this.SimilarQuery.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.FacetFilters != null) + { + hashCode = (hashCode * 59) + this.FacetFilters.GetHashCode(); + } + if (this.OptionalFilters != null) + { + hashCode = (hashCode * 59) + this.OptionalFilters.GetHashCode(); + } + if (this.NumericFilters != null) + { + hashCode = (hashCode * 59) + this.NumericFilters.GetHashCode(); + } + if (this.TagFilters != null) + { + hashCode = (hashCode * 59) + this.TagFilters.GetHashCode(); + } + hashCode = (hashCode * 59) + this.SumOrFiltersScores.GetHashCode(); + if (this.RestrictSearchableAttributes != null) + { + hashCode = (hashCode * 59) + this.RestrictSearchableAttributes.GetHashCode(); + } + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + hashCode = (hashCode * 59) + this.FacetingAfterDistinct.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.Offset.GetHashCode(); + hashCode = (hashCode * 59) + this.Length.GetHashCode(); + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AroundLatLngViaIP.GetHashCode(); + if (this.AroundRadius != null) + { + hashCode = (hashCode * 59) + this.AroundRadius.GetHashCode(); + } + if (this.AroundPrecision != null) + { + hashCode = (hashCode * 59) + this.AroundPrecision.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MinimumAroundRadius.GetHashCode(); + if (this.InsideBoundingBox != null) + { + hashCode = (hashCode * 59) + this.InsideBoundingBox.GetHashCode(); + } + if (this.InsidePolygon != null) + { + hashCode = (hashCode * 59) + this.InsidePolygon.GetHashCode(); + } + if (this.NaturalLanguages != null) + { + hashCode = (hashCode * 59) + this.NaturalLanguages.GetHashCode(); + } + if (this.RuleContexts != null) + { + hashCode = (hashCode * 59) + this.RuleContexts.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PersonalizationImpact.GetHashCode(); + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.GetRankingInfo.GetHashCode(); + if (this.Explain != null) + { + hashCode = (hashCode * 59) + this.Explain.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Synonyms.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickAnalytics.GetHashCode(); + hashCode = (hashCode * 59) + this.Analytics.GetHashCode(); + if (this.AnalyticsTags != null) + { + hashCode = (hashCode * 59) + this.AnalyticsTags.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PercentileComputation.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableABTest.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Length (int) maximum + if (this.Length > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value less than or equal to 1000.", new[] { "Length" }); + } + + // Length (int) minimum + if (this.Length < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value greater than or equal to 1.", new[] { "Length" }); + } + + // MinimumAroundRadius (int) minimum + if (this.MinimumAroundRadius < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinimumAroundRadius, must be a value greater than or equal to 1.", new[] { "MinimumAroundRadius" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/BaseSearchResponse.cs b/algoliasearch/Recommend/Models/BaseSearchResponse.cs new file mode 100644 index 000000000..d51c3c2f1 --- /dev/null +++ b/algoliasearch/Recommend/Models/BaseSearchResponse.cs @@ -0,0 +1,632 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// BaseSearchResponse + /// + [DataContract(Name = "baseSearchResponse")] + public partial class BaseSearchResponse : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BaseSearchResponse() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// A/B test ID. This is only included in the response for indices that are part of an A/B test.. + /// Variant ID. This is only included in the response for indices that are part of an A/B test.. + /// Computed geographical location.. + /// Automatically-computed radius.. + /// exhaustive. + /// See the `facetsCount` field of the `exhaustive` object in the response.. + /// See the `nbHits` field of the `exhaustive` object in the response.. + /// See the `typo` field of the `exhaustive` object in the response.. + /// Mapping of each facet name to the corresponding facet counts.. + /// Statistics for numerical facets.. + /// Number of hits per page. (required) (default to 20). + /// Index name used for the query.. + /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query.. + /// Warnings about the query.. + /// Number of hits the search query matched. (required). + /// Number of pages of results for the current query. (required). + /// Number of hits selected and sorted by the relevant sort algorithm.. + /// Page to retrieve (the first page is `0`, not `1`). (required) (default to 0). + /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched.. + /// Time the server took to process the request, in milliseconds. (required). + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues.. + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set.. + /// redirect. + /// renderingContent. + /// Time the server took to process the request, in milliseconds.. + /// Host name of the server that processed the request.. + /// Lets you store custom data in your indices.. + public BaseSearchResponse(int abTestID = default(int), int abTestVariantID = default(int), string aroundLatLng = default(string), string automaticRadius = default(string), Exhaustive exhaustive = default(Exhaustive), bool exhaustiveFacetsCount = default(bool), bool exhaustiveNbHits = default(bool), bool exhaustiveTypo = default(bool), Dictionary> facets = default(Dictionary>), Dictionary facetsStats = default(Dictionary), int hitsPerPage = 20, string index = default(string), string indexUsed = default(string), string message = default(string), int nbHits = default(int), int nbPages = default(int), int nbSortedHits = default(int), int page = 0, string parsedQuery = default(string), int processingTimeMS = default(int), Object processingTimingsMS = default(Object), string queryAfterRemoval = default(string), Redirect redirect = default(Redirect), RenderingContent renderingContent = default(RenderingContent), int serverTimeMS = default(int), string serverUsed = default(string), Object userData = default(Object)) : base() + { + this.HitsPerPage = hitsPerPage; + this.NbHits = nbHits; + this.NbPages = nbPages; + this.Page = page; + this.ProcessingTimeMS = processingTimeMS; + this.AbTestID = abTestID; + this.AbTestVariantID = abTestVariantID; + this.AroundLatLng = aroundLatLng; + this.AutomaticRadius = automaticRadius; + this.Exhaustive = exhaustive; + this.ExhaustiveFacetsCount = exhaustiveFacetsCount; + this.ExhaustiveNbHits = exhaustiveNbHits; + this.ExhaustiveTypo = exhaustiveTypo; + this.Facets = facets; + this.FacetsStats = facetsStats; + this.Index = index; + this.IndexUsed = indexUsed; + this.Message = message; + this.NbSortedHits = nbSortedHits; + this.ParsedQuery = parsedQuery; + this.ProcessingTimingsMS = processingTimingsMS; + this.QueryAfterRemoval = queryAfterRemoval; + this.Redirect = redirect; + this.RenderingContent = renderingContent; + this.ServerTimeMS = serverTimeMS; + this.ServerUsed = serverUsed; + this.UserData = userData; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// A/B test ID. This is only included in the response for indices that are part of an A/B test. + /// + /// A/B test ID. This is only included in the response for indices that are part of an A/B test. + [DataMember(Name = "abTestID", EmitDefaultValue = false)] + public int AbTestID { get; set; } + + /// + /// Variant ID. This is only included in the response for indices that are part of an A/B test. + /// + /// Variant ID. This is only included in the response for indices that are part of an A/B test. + [DataMember(Name = "abTestVariantID", EmitDefaultValue = false)] + public int AbTestVariantID { get; set; } + + /// + /// Computed geographical location. + /// + /// Computed geographical location. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Automatically-computed radius. + /// + /// Automatically-computed radius. + [DataMember(Name = "automaticRadius", EmitDefaultValue = false)] + public string AutomaticRadius { get; set; } + + /// + /// Gets or Sets Exhaustive + /// + [DataMember(Name = "exhaustive", EmitDefaultValue = false)] + public Exhaustive Exhaustive { get; set; } + + /// + /// See the `facetsCount` field of the `exhaustive` object in the response. + /// + /// See the `facetsCount` field of the `exhaustive` object in the response. + [DataMember(Name = "exhaustiveFacetsCount", EmitDefaultValue = true)] + [Obsolete] + public bool ExhaustiveFacetsCount { get; set; } + + /// + /// See the `nbHits` field of the `exhaustive` object in the response. + /// + /// See the `nbHits` field of the `exhaustive` object in the response. + [DataMember(Name = "exhaustiveNbHits", EmitDefaultValue = true)] + [Obsolete] + public bool ExhaustiveNbHits { get; set; } + + /// + /// See the `typo` field of the `exhaustive` object in the response. + /// + /// See the `typo` field of the `exhaustive` object in the response. + [DataMember(Name = "exhaustiveTypo", EmitDefaultValue = true)] + [Obsolete] + public bool ExhaustiveTypo { get; set; } + + /// + /// Mapping of each facet name to the corresponding facet counts. + /// + /// Mapping of each facet name to the corresponding facet counts. + [DataMember(Name = "facets", EmitDefaultValue = false)] + public Dictionary> Facets { get; set; } + + /// + /// Statistics for numerical facets. + /// + /// Statistics for numerical facets. + [DataMember(Name = "facets_stats", EmitDefaultValue = false)] + public Dictionary FacetsStats { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", IsRequired = true, EmitDefaultValue = true)] + public int HitsPerPage { get; set; } + + /// + /// Index name used for the query. + /// + /// Index name used for the query. + [DataMember(Name = "index", EmitDefaultValue = false)] + public string Index { get; set; } + + /// + /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. + /// + /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. + [DataMember(Name = "indexUsed", EmitDefaultValue = false)] + public string IndexUsed { get; set; } + + /// + /// Warnings about the query. + /// + /// Warnings about the query. + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Number of hits the search query matched. + /// + /// Number of hits the search query matched. + [DataMember(Name = "nbHits", IsRequired = true, EmitDefaultValue = true)] + public int NbHits { get; set; } + + /// + /// Number of pages of results for the current query. + /// + /// Number of pages of results for the current query. + [DataMember(Name = "nbPages", IsRequired = true, EmitDefaultValue = true)] + public int NbPages { get; set; } + + /// + /// Number of hits selected and sorted by the relevant sort algorithm. + /// + /// Number of hits selected and sorted by the relevant sort algorithm. + [DataMember(Name = "nbSortedHits", EmitDefaultValue = false)] + public int NbSortedHits { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", IsRequired = true, EmitDefaultValue = true)] + public int Page { get; set; } + + /// + /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. + /// + /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. + [DataMember(Name = "parsedQuery", EmitDefaultValue = false)] + public string ParsedQuery { get; set; } + + /// + /// Time the server took to process the request, in milliseconds. + /// + /// Time the server took to process the request, in milliseconds. + [DataMember(Name = "processingTimeMS", IsRequired = true, EmitDefaultValue = true)] + public int ProcessingTimeMS { get; set; } + + /// + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + /// + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + [DataMember(Name = "processingTimingsMS", EmitDefaultValue = false)] + public Object ProcessingTimingsMS { get; set; } + + /// + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + /// + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + [DataMember(Name = "queryAfterRemoval", EmitDefaultValue = false)] + public string QueryAfterRemoval { get; set; } + + /// + /// Gets or Sets Redirect + /// + [DataMember(Name = "redirect", EmitDefaultValue = false)] + public Redirect Redirect { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Time the server took to process the request, in milliseconds. + /// + /// Time the server took to process the request, in milliseconds. + [DataMember(Name = "serverTimeMS", EmitDefaultValue = false)] + public int ServerTimeMS { get; set; } + + /// + /// Host name of the server that processed the request. + /// + /// Host name of the server that processed the request. + [DataMember(Name = "serverUsed", EmitDefaultValue = false)] + public string ServerUsed { get; set; } + + /// + /// Lets you store custom data in your indices. + /// + /// Lets you store custom data in your indices. + [DataMember(Name = "userData", EmitDefaultValue = true)] + public Object UserData { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BaseSearchResponse {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" AbTestID: ").Append(AbTestID).Append("\n"); + sb.Append(" AbTestVariantID: ").Append(AbTestVariantID).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AutomaticRadius: ").Append(AutomaticRadius).Append("\n"); + sb.Append(" Exhaustive: ").Append(Exhaustive).Append("\n"); + sb.Append(" ExhaustiveFacetsCount: ").Append(ExhaustiveFacetsCount).Append("\n"); + sb.Append(" ExhaustiveNbHits: ").Append(ExhaustiveNbHits).Append("\n"); + sb.Append(" ExhaustiveTypo: ").Append(ExhaustiveTypo).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" FacetsStats: ").Append(FacetsStats).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" IndexUsed: ").Append(IndexUsed).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" NbPages: ").Append(NbPages).Append("\n"); + sb.Append(" NbSortedHits: ").Append(NbSortedHits).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" ParsedQuery: ").Append(ParsedQuery).Append("\n"); + sb.Append(" ProcessingTimeMS: ").Append(ProcessingTimeMS).Append("\n"); + sb.Append(" ProcessingTimingsMS: ").Append(ProcessingTimingsMS).Append("\n"); + sb.Append(" QueryAfterRemoval: ").Append(QueryAfterRemoval).Append("\n"); + sb.Append(" Redirect: ").Append(Redirect).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append(" ServerTimeMS: ").Append(ServerTimeMS).Append("\n"); + sb.Append(" ServerUsed: ").Append(ServerUsed).Append("\n"); + sb.Append(" UserData: ").Append(UserData).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BaseSearchResponse); + } + + /// + /// Returns true if BaseSearchResponse instances are equal + /// + /// Instance of BaseSearchResponse to be compared + /// Boolean + public bool Equals(BaseSearchResponse input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.AbTestID == input.AbTestID || + this.AbTestID.Equals(input.AbTestID) + ) && base.Equals(input) && + ( + this.AbTestVariantID == input.AbTestVariantID || + this.AbTestVariantID.Equals(input.AbTestVariantID) + ) && base.Equals(input) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && base.Equals(input) && + ( + this.AutomaticRadius == input.AutomaticRadius || + (this.AutomaticRadius != null && + this.AutomaticRadius.Equals(input.AutomaticRadius)) + ) && base.Equals(input) && + ( + this.Exhaustive == input.Exhaustive || + (this.Exhaustive != null && + this.Exhaustive.Equals(input.Exhaustive)) + ) && base.Equals(input) && + ( + this.ExhaustiveFacetsCount == input.ExhaustiveFacetsCount || + this.ExhaustiveFacetsCount.Equals(input.ExhaustiveFacetsCount) + ) && base.Equals(input) && + ( + this.ExhaustiveNbHits == input.ExhaustiveNbHits || + this.ExhaustiveNbHits.Equals(input.ExhaustiveNbHits) + ) && base.Equals(input) && + ( + this.ExhaustiveTypo == input.ExhaustiveTypo || + this.ExhaustiveTypo.Equals(input.ExhaustiveTypo) + ) && base.Equals(input) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && base.Equals(input) && + ( + this.FacetsStats == input.FacetsStats || + this.FacetsStats != null && + input.FacetsStats != null && + this.FacetsStats.SequenceEqual(input.FacetsStats) + ) && base.Equals(input) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && base.Equals(input) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && base.Equals(input) && + ( + this.IndexUsed == input.IndexUsed || + (this.IndexUsed != null && + this.IndexUsed.Equals(input.IndexUsed)) + ) && base.Equals(input) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) && base.Equals(input) && + ( + this.NbHits == input.NbHits || + this.NbHits.Equals(input.NbHits) + ) && base.Equals(input) && + ( + this.NbPages == input.NbPages || + this.NbPages.Equals(input.NbPages) + ) && base.Equals(input) && + ( + this.NbSortedHits == input.NbSortedHits || + this.NbSortedHits.Equals(input.NbSortedHits) + ) && base.Equals(input) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && base.Equals(input) && + ( + this.ParsedQuery == input.ParsedQuery || + (this.ParsedQuery != null && + this.ParsedQuery.Equals(input.ParsedQuery)) + ) && base.Equals(input) && + ( + this.ProcessingTimeMS == input.ProcessingTimeMS || + this.ProcessingTimeMS.Equals(input.ProcessingTimeMS) + ) && base.Equals(input) && + ( + this.ProcessingTimingsMS == input.ProcessingTimingsMS || + (this.ProcessingTimingsMS != null && + this.ProcessingTimingsMS.Equals(input.ProcessingTimingsMS)) + ) && base.Equals(input) && + ( + this.QueryAfterRemoval == input.QueryAfterRemoval || + (this.QueryAfterRemoval != null && + this.QueryAfterRemoval.Equals(input.QueryAfterRemoval)) + ) && base.Equals(input) && + ( + this.Redirect == input.Redirect || + (this.Redirect != null && + this.Redirect.Equals(input.Redirect)) + ) && base.Equals(input) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ) && base.Equals(input) && + ( + this.ServerTimeMS == input.ServerTimeMS || + this.ServerTimeMS.Equals(input.ServerTimeMS) + ) && base.Equals(input) && + ( + this.ServerUsed == input.ServerUsed || + (this.ServerUsed != null && + this.ServerUsed.Equals(input.ServerUsed)) + ) && base.Equals(input) && + ( + this.UserData == input.UserData || + (this.UserData != null && + this.UserData.Equals(input.UserData)) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + hashCode = (hashCode * 59) + this.AbTestID.GetHashCode(); + hashCode = (hashCode * 59) + this.AbTestVariantID.GetHashCode(); + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + if (this.AutomaticRadius != null) + { + hashCode = (hashCode * 59) + this.AutomaticRadius.GetHashCode(); + } + if (this.Exhaustive != null) + { + hashCode = (hashCode * 59) + this.Exhaustive.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ExhaustiveFacetsCount.GetHashCode(); + hashCode = (hashCode * 59) + this.ExhaustiveNbHits.GetHashCode(); + hashCode = (hashCode * 59) + this.ExhaustiveTypo.GetHashCode(); + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + if (this.FacetsStats != null) + { + hashCode = (hashCode * 59) + this.FacetsStats.GetHashCode(); + } + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.IndexUsed != null) + { + hashCode = (hashCode * 59) + this.IndexUsed.GetHashCode(); + } + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NbHits.GetHashCode(); + hashCode = (hashCode * 59) + this.NbPages.GetHashCode(); + hashCode = (hashCode * 59) + this.NbSortedHits.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + if (this.ParsedQuery != null) + { + hashCode = (hashCode * 59) + this.ParsedQuery.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ProcessingTimeMS.GetHashCode(); + if (this.ProcessingTimingsMS != null) + { + hashCode = (hashCode * 59) + this.ProcessingTimingsMS.GetHashCode(); + } + if (this.QueryAfterRemoval != null) + { + hashCode = (hashCode * 59) + this.QueryAfterRemoval.GetHashCode(); + } + if (this.Redirect != null) + { + hashCode = (hashCode * 59) + this.Redirect.GetHashCode(); + } + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ServerTimeMS.GetHashCode(); + if (this.ServerUsed != null) + { + hashCode = (hashCode * 59) + this.ServerUsed.GetHashCode(); + } + if (this.UserData != null) + { + hashCode = (hashCode * 59) + this.UserData.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + // AbTestVariantID (int) minimum + if (this.AbTestVariantID < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for AbTestVariantID, must be a value greater than or equal to 1.", new[] { "AbTestVariantID" }); + } + + if (this.AroundLatLng != null) + { + // AroundLatLng (string) pattern + Regex regexAroundLatLng = new Regex(@"^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$", RegexOptions.CultureInvariant); + if (!regexAroundLatLng.Match(this.AroundLatLng).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for AroundLatLng, must match a pattern of " + regexAroundLatLng, new[] { "AroundLatLng" }); + } + } + + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/BaseTrendingFacetsQuery.cs b/algoliasearch/Recommend/Models/BaseTrendingFacetsQuery.cs new file mode 100644 index 000000000..a26339b7a --- /dev/null +++ b/algoliasearch/Recommend/Models/BaseTrendingFacetsQuery.cs @@ -0,0 +1,148 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// BaseTrendingFacetsQuery + /// + [DataContract(Name = "baseTrendingFacetsQuery")] + public partial class BaseTrendingFacetsQuery : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Model + /// + [DataMember(Name = "model", EmitDefaultValue = false)] + public TrendingFacetsModel? Model { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BaseTrendingFacetsQuery() { } + /// + /// Initializes a new instance of the class. + /// + /// Facet name for trending models. (required). + /// model. + public BaseTrendingFacetsQuery(string facetName = default(string), TrendingFacetsModel? model = default(TrendingFacetsModel?)) + { + // to ensure "facetName" is required (not null) + if (facetName == null) + { + throw new ArgumentNullException("facetName is a required property for BaseTrendingFacetsQuery and cannot be null"); + } + this.FacetName = facetName; + this.Model = model; + } + + /// + /// Facet name for trending models. + /// + /// Facet name for trending models. + [DataMember(Name = "facetName", IsRequired = true, EmitDefaultValue = true)] + public string FacetName { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BaseTrendingFacetsQuery {\n"); + sb.Append(" FacetName: ").Append(FacetName).Append("\n"); + sb.Append(" Model: ").Append(Model).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BaseTrendingFacetsQuery); + } + + /// + /// Returns true if BaseTrendingFacetsQuery instances are equal + /// + /// Instance of BaseTrendingFacetsQuery to be compared + /// Boolean + public bool Equals(BaseTrendingFacetsQuery input) + { + if (input == null) + { + return false; + } + return + ( + this.FacetName == input.FacetName || + (this.FacetName != null && + this.FacetName.Equals(input.FacetName)) + ) && + ( + this.Model == input.Model || + this.Model.Equals(input.Model) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.FacetName != null) + { + hashCode = (hashCode * 59) + this.FacetName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Model.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/BaseTrendingItemsQuery.cs b/algoliasearch/Recommend/Models/BaseTrendingItemsQuery.cs new file mode 100644 index 000000000..5267251ce --- /dev/null +++ b/algoliasearch/Recommend/Models/BaseTrendingItemsQuery.cs @@ -0,0 +1,193 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// BaseTrendingItemsQuery + /// + [DataContract(Name = "baseTrendingItemsQuery")] + public partial class BaseTrendingItemsQuery : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Model + /// + [DataMember(Name = "model", EmitDefaultValue = false)] + public TrendingItemsModel? Model { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Facet name for trending models.. + /// Facet value for trending models.. + /// model. + /// queryParameters. + /// fallbackParameters. + public BaseTrendingItemsQuery(string facetName = default(string), string facetValue = default(string), TrendingItemsModel? model = default(TrendingItemsModel?), SearchParamsObject queryParameters = default(SearchParamsObject), SearchParamsObject fallbackParameters = default(SearchParamsObject)) + { + this.FacetName = facetName; + this.FacetValue = facetValue; + this.Model = model; + this.QueryParameters = queryParameters; + this.FallbackParameters = fallbackParameters; + } + + /// + /// Facet name for trending models. + /// + /// Facet name for trending models. + [DataMember(Name = "facetName", EmitDefaultValue = false)] + public string FacetName { get; set; } + + /// + /// Facet value for trending models. + /// + /// Facet value for trending models. + [DataMember(Name = "facetValue", EmitDefaultValue = false)] + public string FacetValue { get; set; } + + /// + /// Gets or Sets QueryParameters + /// + [DataMember(Name = "queryParameters", EmitDefaultValue = false)] + public SearchParamsObject QueryParameters { get; set; } + + /// + /// Gets or Sets FallbackParameters + /// + [DataMember(Name = "fallbackParameters", EmitDefaultValue = false)] + public SearchParamsObject FallbackParameters { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BaseTrendingItemsQuery {\n"); + sb.Append(" FacetName: ").Append(FacetName).Append("\n"); + sb.Append(" FacetValue: ").Append(FacetValue).Append("\n"); + sb.Append(" Model: ").Append(Model).Append("\n"); + sb.Append(" QueryParameters: ").Append(QueryParameters).Append("\n"); + sb.Append(" FallbackParameters: ").Append(FallbackParameters).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BaseTrendingItemsQuery); + } + + /// + /// Returns true if BaseTrendingItemsQuery instances are equal + /// + /// Instance of BaseTrendingItemsQuery to be compared + /// Boolean + public bool Equals(BaseTrendingItemsQuery input) + { + if (input == null) + { + return false; + } + return + ( + this.FacetName == input.FacetName || + (this.FacetName != null && + this.FacetName.Equals(input.FacetName)) + ) && + ( + this.FacetValue == input.FacetValue || + (this.FacetValue != null && + this.FacetValue.Equals(input.FacetValue)) + ) && + ( + this.Model == input.Model || + this.Model.Equals(input.Model) + ) && + ( + this.QueryParameters == input.QueryParameters || + (this.QueryParameters != null && + this.QueryParameters.Equals(input.QueryParameters)) + ) && + ( + this.FallbackParameters == input.FallbackParameters || + (this.FallbackParameters != null && + this.FallbackParameters.Equals(input.FallbackParameters)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.FacetName != null) + { + hashCode = (hashCode * 59) + this.FacetName.GetHashCode(); + } + if (this.FacetValue != null) + { + hashCode = (hashCode * 59) + this.FacetValue.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Model.GetHashCode(); + if (this.QueryParameters != null) + { + hashCode = (hashCode * 59) + this.QueryParameters.GetHashCode(); + } + if (this.FallbackParameters != null) + { + hashCode = (hashCode * 59) + this.FallbackParameters.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/Condition.cs b/algoliasearch/Recommend/Models/Condition.cs new file mode 100644 index 000000000..9d79f0d05 --- /dev/null +++ b/algoliasearch/Recommend/Models/Condition.cs @@ -0,0 +1,172 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Condition + /// + [DataContract(Name = "condition")] + public partial class Condition : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Anchoring + /// + [DataMember(Name = "anchoring", EmitDefaultValue = false)] + public Anchoring? Anchoring { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Query pattern syntax.. + /// anchoring. + /// Whether the pattern matches on plurals, synonyms, and typos. (default to false). + /// Rule context format: [A-Za-z0-9_-]+).. + public Condition(string pattern = default(string), Anchoring? anchoring = default(Anchoring?), bool alternatives = false, string context = default(string)) + { + this.Pattern = pattern; + this.Anchoring = anchoring; + this.Alternatives = alternatives; + this.Context = context; + } + + /// + /// Query pattern syntax. + /// + /// Query pattern syntax. + [DataMember(Name = "pattern", EmitDefaultValue = false)] + public string Pattern { get; set; } + + /// + /// Whether the pattern matches on plurals, synonyms, and typos. + /// + /// Whether the pattern matches on plurals, synonyms, and typos. + [DataMember(Name = "alternatives", EmitDefaultValue = true)] + public bool Alternatives { get; set; } + + /// + /// Rule context format: [A-Za-z0-9_-]+). + /// + /// Rule context format: [A-Za-z0-9_-]+). + [DataMember(Name = "context", EmitDefaultValue = false)] + public string Context { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Condition {\n"); + sb.Append(" Pattern: ").Append(Pattern).Append("\n"); + sb.Append(" Anchoring: ").Append(Anchoring).Append("\n"); + sb.Append(" Alternatives: ").Append(Alternatives).Append("\n"); + sb.Append(" Context: ").Append(Context).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Condition); + } + + /// + /// Returns true if Condition instances are equal + /// + /// Instance of Condition to be compared + /// Boolean + public bool Equals(Condition input) + { + if (input == null) + { + return false; + } + return + ( + this.Pattern == input.Pattern || + (this.Pattern != null && + this.Pattern.Equals(input.Pattern)) + ) && + ( + this.Anchoring == input.Anchoring || + this.Anchoring.Equals(input.Anchoring) + ) && + ( + this.Alternatives == input.Alternatives || + this.Alternatives.Equals(input.Alternatives) + ) && + ( + this.Context == input.Context || + (this.Context != null && + this.Context.Equals(input.Context)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Pattern != null) + { + hashCode = (hashCode * 59) + this.Pattern.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Anchoring.GetHashCode(); + hashCode = (hashCode * 59) + this.Alternatives.GetHashCode(); + if (this.Context != null) + { + hashCode = (hashCode * 59) + this.Context.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/Consequence.cs b/algoliasearch/Recommend/Models/Consequence.cs new file mode 100644 index 000000000..cf675995e --- /dev/null +++ b/algoliasearch/Recommend/Models/Consequence.cs @@ -0,0 +1,197 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// [Consequences](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/#consequences) of a rule. + /// + [DataContract(Name = "consequence")] + public partial class Consequence : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// varParams. + /// Records to promote.. + /// Only use in combination with the `promote` consequence. When `true`, promoted results will be restricted to match the filters of the current search. When `false`, the promoted results will show up regardless of the filters. (default to false). + /// Records to hide. By default, you can hide up to 50 records per rule.. + /// Custom JSON object that will be appended to the userData array in the response. This object isn't interpreted by the API. It's limited to 1kB of minified JSON.. + public Consequence(ConsequenceParams varParams = default(ConsequenceParams), List promote = default(List), bool filterPromotes = false, List hide = default(List), Object userData = default(Object)) + { + this.VarParams = varParams; + this.Promote = promote; + this.FilterPromotes = filterPromotes; + this.Hide = hide; + this.UserData = userData; + } + + /// + /// Gets or Sets VarParams + /// + [DataMember(Name = "params", EmitDefaultValue = false)] + public ConsequenceParams VarParams { get; set; } + + /// + /// Records to promote. + /// + /// Records to promote. + [DataMember(Name = "promote", EmitDefaultValue = false)] + public List Promote { get; set; } + + /// + /// Only use in combination with the `promote` consequence. When `true`, promoted results will be restricted to match the filters of the current search. When `false`, the promoted results will show up regardless of the filters. + /// + /// Only use in combination with the `promote` consequence. When `true`, promoted results will be restricted to match the filters of the current search. When `false`, the promoted results will show up regardless of the filters. + [DataMember(Name = "filterPromotes", EmitDefaultValue = true)] + public bool FilterPromotes { get; set; } + + /// + /// Records to hide. By default, you can hide up to 50 records per rule. + /// + /// Records to hide. By default, you can hide up to 50 records per rule. + [DataMember(Name = "hide", EmitDefaultValue = false)] + public List Hide { get; set; } + + /// + /// Custom JSON object that will be appended to the userData array in the response. This object isn't interpreted by the API. It's limited to 1kB of minified JSON. + /// + /// Custom JSON object that will be appended to the userData array in the response. This object isn't interpreted by the API. It's limited to 1kB of minified JSON. + [DataMember(Name = "userData", EmitDefaultValue = true)] + public Object UserData { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Consequence {\n"); + sb.Append(" VarParams: ").Append(VarParams).Append("\n"); + sb.Append(" Promote: ").Append(Promote).Append("\n"); + sb.Append(" FilterPromotes: ").Append(FilterPromotes).Append("\n"); + sb.Append(" Hide: ").Append(Hide).Append("\n"); + sb.Append(" UserData: ").Append(UserData).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Consequence); + } + + /// + /// Returns true if Consequence instances are equal + /// + /// Instance of Consequence to be compared + /// Boolean + public bool Equals(Consequence input) + { + if (input == null) + { + return false; + } + return + ( + this.VarParams == input.VarParams || + (this.VarParams != null && + this.VarParams.Equals(input.VarParams)) + ) && + ( + this.Promote == input.Promote || + this.Promote != null && + input.Promote != null && + this.Promote.SequenceEqual(input.Promote) + ) && + ( + this.FilterPromotes == input.FilterPromotes || + this.FilterPromotes.Equals(input.FilterPromotes) + ) && + ( + this.Hide == input.Hide || + this.Hide != null && + input.Hide != null && + this.Hide.SequenceEqual(input.Hide) + ) && + ( + this.UserData == input.UserData || + (this.UserData != null && + this.UserData.Equals(input.UserData)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.VarParams != null) + { + hashCode = (hashCode * 59) + this.VarParams.GetHashCode(); + } + if (this.Promote != null) + { + hashCode = (hashCode * 59) + this.Promote.GetHashCode(); + } + hashCode = (hashCode * 59) + this.FilterPromotes.GetHashCode(); + if (this.Hide != null) + { + hashCode = (hashCode * 59) + this.Hide.GetHashCode(); + } + if (this.UserData != null) + { + hashCode = (hashCode * 59) + this.UserData.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/ConsequenceHide.cs b/algoliasearch/Recommend/Models/ConsequenceHide.cs new file mode 100644 index 000000000..3fa9f3b42 --- /dev/null +++ b/algoliasearch/Recommend/Models/ConsequenceHide.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Unique identifier of the record to hide. + /// + [DataContract(Name = "consequenceHide")] + public partial class ConsequenceHide : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ConsequenceHide() { } + /// + /// Initializes a new instance of the class. + /// + /// Unique object identifier. (required). + public ConsequenceHide(string objectID = default(string)) + { + // to ensure "objectID" is required (not null) + if (objectID == null) + { + throw new ArgumentNullException("objectID is a required property for ConsequenceHide and cannot be null"); + } + this.ObjectID = objectID; + } + + /// + /// Unique object identifier. + /// + /// Unique object identifier. + [DataMember(Name = "objectID", IsRequired = true, EmitDefaultValue = true)] + public string ObjectID { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ConsequenceHide {\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ConsequenceHide); + } + + /// + /// Returns true if ConsequenceHide instances are equal + /// + /// Instance of ConsequenceHide to be compared + /// Boolean + public bool Equals(ConsequenceHide input) + { + if (input == null) + { + return false; + } + return + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/ConsequenceParams.cs b/algoliasearch/Recommend/Models/ConsequenceParams.cs new file mode 100644 index 000000000..e5b3be44f --- /dev/null +++ b/algoliasearch/Recommend/Models/ConsequenceParams.cs @@ -0,0 +1,1546 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// ConsequenceParams + /// + [DataContract(Name = "consequenceParams")] + public partial class ConsequenceParams : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets QueryType + /// + [DataMember(Name = "queryType", EmitDefaultValue = false)] + public QueryType? QueryType { get; set; } + + /// + /// Gets or Sets RemoveWordsIfNoResults + /// + [DataMember(Name = "removeWordsIfNoResults", EmitDefaultValue = false)] + public RemoveWordsIfNoResults? RemoveWordsIfNoResults { get; set; } + + /// + /// Gets or Sets Mode + /// + [DataMember(Name = "mode", EmitDefaultValue = false)] + public Mode? Mode { get; set; } + + /// + /// Gets or Sets ExactOnSingleWordQuery + /// + [DataMember(Name = "exactOnSingleWordQuery", EmitDefaultValue = false)] + public ExactOnSingleWordQuery? ExactOnSingleWordQuery { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Overrides the query parameter and performs a more generic search. (default to ""). + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. (default to ""). + /// facetFilters. + /// optionalFilters. + /// numericFilters. + /// tagFilters. + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. (default to false). + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/).. + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values.. + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. (default to false). + /// Page to retrieve (the first page is `0`, not `1`). (default to 0). + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. (default to ""). + /// Search for entries around a location. The location is automatically computed from the requester's IP address. (default to false). + /// aroundRadius. + /// aroundPrecision. + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set.. + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries.. + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries.. + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). (default to 100). + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search.. + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). (default to false). + /// Enriches the API's response with information about how the query was processed.. + /// Whether to take into account an index's synonyms for a particular search. (default to true). + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). (default to false). + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). (default to true). + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).. + /// Whether to include or exclude a query from the processing-time percentile computation. (default to true). + /// Incidates whether this search will be considered in A/B testing. (default to true). + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. . + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes.. + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/).. + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. . + /// Relevancy threshold below which less relevant results aren't included in the results. (default to 100). + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`).. + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. . + /// HTML string to insert before the highlighted parts in all highlight and snippet results. (default to "<em>"). + /// HTML string to insert after the highlighted parts in all highlight and snippet results. (default to "</em>"). + /// String used as an ellipsis indicator when a snippet is truncated. (default to "…"). + /// Restrict highlighting and snippeting to items that matched the query. (default to false). + /// Number of hits per page. (default to 20). + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 4). + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 8). + /// typoTolerance. + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. (default to true). + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/).. + /// ignorePlurals. + /// removeStopWords. + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). (default to ""). + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection.. + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. (default to true). + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. (default to true). + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. (default to false). + /// queryType. + /// removeWordsIfNoResults. + /// mode. + /// semanticSearch. + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). (default to false). + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query.. + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// exactOnSingleWordQuery. + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled.. + /// distinct. + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. (default to false). + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). (default to 1). + /// Attributes to include in the API response for search and browse queries.. + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). (default to 10). + /// Maximum number of facet values to return for each facet. (default to 100). + /// Controls how facet values are fetched. (default to "count"). + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. (default to false). + /// renderingContent. + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). (default to true). + /// reRankingApplyFilter. + /// query. + /// automaticFacetFilters. + /// automaticOptionalFacetFilters. + public ConsequenceParams(string similarQuery = @"", string filters = @"", FacetFilters facetFilters = default(FacetFilters), OptionalFilters optionalFilters = default(OptionalFilters), NumericFilters numericFilters = default(NumericFilters), TagFilters tagFilters = default(TagFilters), bool sumOrFiltersScores = false, List restrictSearchableAttributes = default(List), List facets = default(List), bool facetingAfterDistinct = false, int page = 0, int offset = default(int), int length = default(int), string aroundLatLng = @"", bool aroundLatLngViaIP = false, AroundRadius aroundRadius = default(AroundRadius), AroundPrecision aroundPrecision = default(AroundPrecision), int minimumAroundRadius = default(int), List> insideBoundingBox = default(List>), List> insidePolygon = default(List>), List naturalLanguages = default(List), List ruleContexts = default(List), int personalizationImpact = 100, string userToken = default(string), bool getRankingInfo = false, List explain = default(List), bool synonyms = true, bool clickAnalytics = false, bool analytics = true, List analyticsTags = default(List), bool percentileComputation = true, bool enableABTest = true, List attributesForFaceting = default(List), List attributesToRetrieve = default(List), List ranking = default(List), List customRanking = default(List), int relevancyStrictness = 100, List attributesToHighlight = default(List), List attributesToSnippet = default(List), string highlightPreTag = @"", string highlightPostTag = @"", string snippetEllipsisText = @"…", bool restrictHighlightAndSnippetArrays = false, int hitsPerPage = 20, int minWordSizefor1Typo = 4, int minWordSizefor2Typos = 8, TypoTolerance typoTolerance = default(TypoTolerance), bool allowTyposOnNumericTokens = true, List disableTypoToleranceOnAttributes = default(List), IgnorePlurals ignorePlurals = default(IgnorePlurals), RemoveStopWords removeStopWords = default(RemoveStopWords), string keepDiacriticsOnCharacters = @"", List queryLanguages = default(List), bool decompoundQuery = true, bool enableRules = true, bool enablePersonalization = false, QueryType? queryType = default(QueryType?), RemoveWordsIfNoResults? removeWordsIfNoResults = default(RemoveWordsIfNoResults?), Mode? mode = default(Mode?), SemanticSearch semanticSearch = default(SemanticSearch), bool advancedSyntax = false, List optionalWords = default(List), List disableExactOnAttributes = default(List), ExactOnSingleWordQuery? exactOnSingleWordQuery = default(ExactOnSingleWordQuery?), List alternativesAsExact = default(List), List advancedSyntaxFeatures = default(List), Distinct distinct = default(Distinct), bool replaceSynonymsInHighlight = false, int minProximity = 1, List responseFields = default(List), int maxFacetHits = 10, int maxValuesPerFacet = 100, string sortFacetValuesBy = @"count", bool attributeCriteriaComputedByMinProximity = false, RenderingContent renderingContent = default(RenderingContent), bool enableReRanking = true, ReRankingApplyFilter reRankingApplyFilter = default(ReRankingApplyFilter), ConsequenceQuery query = default(ConsequenceQuery), AutomaticFacetFilters automaticFacetFilters = default(AutomaticFacetFilters), AutomaticFacetFilters automaticOptionalFacetFilters = default(AutomaticFacetFilters)) + { + // use default value if no "similarQuery" provided + this.SimilarQuery = similarQuery ?? @""; + // use default value if no "filters" provided + this.Filters = filters ?? @""; + this.FacetFilters = facetFilters; + this.OptionalFilters = optionalFilters; + this.NumericFilters = numericFilters; + this.TagFilters = tagFilters; + this.SumOrFiltersScores = sumOrFiltersScores; + this.RestrictSearchableAttributes = restrictSearchableAttributes; + this.Facets = facets; + this.FacetingAfterDistinct = facetingAfterDistinct; + this.Page = page; + this.Offset = offset; + this.Length = length; + // use default value if no "aroundLatLng" provided + this.AroundLatLng = aroundLatLng ?? @""; + this.AroundLatLngViaIP = aroundLatLngViaIP; + this.AroundRadius = aroundRadius; + this.AroundPrecision = aroundPrecision; + this.MinimumAroundRadius = minimumAroundRadius; + this.InsideBoundingBox = insideBoundingBox; + this.InsidePolygon = insidePolygon; + this.NaturalLanguages = naturalLanguages; + this.RuleContexts = ruleContexts; + this.PersonalizationImpact = personalizationImpact; + this.UserToken = userToken; + this.GetRankingInfo = getRankingInfo; + this.Explain = explain; + this.Synonyms = synonyms; + this.ClickAnalytics = clickAnalytics; + this.Analytics = analytics; + this.AnalyticsTags = analyticsTags; + this.PercentileComputation = percentileComputation; + this.EnableABTest = enableABTest; + this.AttributesForFaceting = attributesForFaceting; + this.AttributesToRetrieve = attributesToRetrieve; + this.Ranking = ranking; + this.CustomRanking = customRanking; + this.RelevancyStrictness = relevancyStrictness; + this.AttributesToHighlight = attributesToHighlight; + this.AttributesToSnippet = attributesToSnippet; + // use default value if no "highlightPreTag" provided + this.HighlightPreTag = highlightPreTag ?? @""; + // use default value if no "highlightPostTag" provided + this.HighlightPostTag = highlightPostTag ?? @""; + // use default value if no "snippetEllipsisText" provided + this.SnippetEllipsisText = snippetEllipsisText ?? @"…"; + this.RestrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + this.HitsPerPage = hitsPerPage; + this.MinWordSizefor1Typo = minWordSizefor1Typo; + this.MinWordSizefor2Typos = minWordSizefor2Typos; + this.TypoTolerance = typoTolerance; + this.AllowTyposOnNumericTokens = allowTyposOnNumericTokens; + this.DisableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + this.IgnorePlurals = ignorePlurals; + this.RemoveStopWords = removeStopWords; + // use default value if no "keepDiacriticsOnCharacters" provided + this.KeepDiacriticsOnCharacters = keepDiacriticsOnCharacters ?? @""; + this.QueryLanguages = queryLanguages; + this.DecompoundQuery = decompoundQuery; + this.EnableRules = enableRules; + this.EnablePersonalization = enablePersonalization; + this.QueryType = queryType; + this.RemoveWordsIfNoResults = removeWordsIfNoResults; + this.Mode = mode; + this.SemanticSearch = semanticSearch; + this.AdvancedSyntax = advancedSyntax; + this.OptionalWords = optionalWords; + this.DisableExactOnAttributes = disableExactOnAttributes; + this.ExactOnSingleWordQuery = exactOnSingleWordQuery; + this.AlternativesAsExact = alternativesAsExact; + this.AdvancedSyntaxFeatures = advancedSyntaxFeatures; + this.Distinct = distinct; + this.ReplaceSynonymsInHighlight = replaceSynonymsInHighlight; + this.MinProximity = minProximity; + this.ResponseFields = responseFields; + this.MaxFacetHits = maxFacetHits; + this.MaxValuesPerFacet = maxValuesPerFacet; + // use default value if no "sortFacetValuesBy" provided + this.SortFacetValuesBy = sortFacetValuesBy ?? @"count"; + this.AttributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + this.RenderingContent = renderingContent; + this.EnableReRanking = enableReRanking; + this.ReRankingApplyFilter = reRankingApplyFilter; + this.Query = query; + this.AutomaticFacetFilters = automaticFacetFilters; + this.AutomaticOptionalFacetFilters = automaticOptionalFacetFilters; + } + + /// + /// Overrides the query parameter and performs a more generic search. + /// + /// Overrides the query parameter and performs a more generic search. + [DataMember(Name = "similarQuery", EmitDefaultValue = false)] + public string SimilarQuery { get; set; } + + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + [DataMember(Name = "filters", EmitDefaultValue = false)] + public string Filters { get; set; } + + /// + /// Gets or Sets FacetFilters + /// + [DataMember(Name = "facetFilters", EmitDefaultValue = false)] + public FacetFilters FacetFilters { get; set; } + + /// + /// Gets or Sets OptionalFilters + /// + [DataMember(Name = "optionalFilters", EmitDefaultValue = false)] + public OptionalFilters OptionalFilters { get; set; } + + /// + /// Gets or Sets NumericFilters + /// + [DataMember(Name = "numericFilters", EmitDefaultValue = false)] + public NumericFilters NumericFilters { get; set; } + + /// + /// Gets or Sets TagFilters + /// + [DataMember(Name = "tagFilters", EmitDefaultValue = false)] + public TagFilters TagFilters { get; set; } + + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + [DataMember(Name = "sumOrFiltersScores", EmitDefaultValue = true)] + public bool SumOrFiltersScores { get; set; } + + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + [DataMember(Name = "restrictSearchableAttributes", EmitDefaultValue = false)] + public List RestrictSearchableAttributes { get; set; } + + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + [DataMember(Name = "facets", EmitDefaultValue = false)] + public List Facets { get; set; } + + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + [DataMember(Name = "facetingAfterDistinct", EmitDefaultValue = true)] + public bool FacetingAfterDistinct { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", EmitDefaultValue = false)] + public int Page { get; set; } + + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "offset", EmitDefaultValue = false)] + public int Offset { get; set; } + + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "length", EmitDefaultValue = false)] + public int Length { get; set; } + + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + [DataMember(Name = "aroundLatLngViaIP", EmitDefaultValue = true)] + public bool AroundLatLngViaIP { get; set; } + + /// + /// Gets or Sets AroundRadius + /// + [DataMember(Name = "aroundRadius", EmitDefaultValue = false)] + public AroundRadius AroundRadius { get; set; } + + /// + /// Gets or Sets AroundPrecision + /// + [DataMember(Name = "aroundPrecision", EmitDefaultValue = false)] + public AroundPrecision AroundPrecision { get; set; } + + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + [DataMember(Name = "minimumAroundRadius", EmitDefaultValue = false)] + public int MinimumAroundRadius { get; set; } + + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insideBoundingBox", EmitDefaultValue = false)] + public List> InsideBoundingBox { get; set; } + + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insidePolygon", EmitDefaultValue = false)] + public List> InsidePolygon { get; set; } + + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + [DataMember(Name = "naturalLanguages", EmitDefaultValue = false)] + public List NaturalLanguages { get; set; } + + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + [DataMember(Name = "ruleContexts", EmitDefaultValue = false)] + public List RuleContexts { get; set; } + + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + [DataMember(Name = "personalizationImpact", EmitDefaultValue = false)] + public int PersonalizationImpact { get; set; } + + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + [DataMember(Name = "userToken", EmitDefaultValue = false)] + public string UserToken { get; set; } + + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + [DataMember(Name = "getRankingInfo", EmitDefaultValue = true)] + public bool GetRankingInfo { get; set; } + + /// + /// Enriches the API's response with information about how the query was processed. + /// + /// Enriches the API's response with information about how the query was processed. + [DataMember(Name = "explain", EmitDefaultValue = false)] + public List Explain { get; set; } + + /// + /// Whether to take into account an index's synonyms for a particular search. + /// + /// Whether to take into account an index's synonyms for a particular search. + [DataMember(Name = "synonyms", EmitDefaultValue = true)] + public bool Synonyms { get; set; } + + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + [DataMember(Name = "clickAnalytics", EmitDefaultValue = true)] + public bool ClickAnalytics { get; set; } + + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + [DataMember(Name = "analytics", EmitDefaultValue = true)] + public bool Analytics { get; set; } + + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + [DataMember(Name = "analyticsTags", EmitDefaultValue = false)] + public List AnalyticsTags { get; set; } + + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + [DataMember(Name = "percentileComputation", EmitDefaultValue = true)] + public bool PercentileComputation { get; set; } + + /// + /// Incidates whether this search will be considered in A/B testing. + /// + /// Incidates whether this search will be considered in A/B testing. + [DataMember(Name = "enableABTest", EmitDefaultValue = true)] + public bool EnableABTest { get; set; } + + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + [DataMember(Name = "attributesForFaceting", EmitDefaultValue = false)] + public List AttributesForFaceting { get; set; } + + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + [DataMember(Name = "attributesToRetrieve", EmitDefaultValue = false)] + public List AttributesToRetrieve { get; set; } + + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + [DataMember(Name = "ranking", EmitDefaultValue = false)] + public List Ranking { get; set; } + + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + [DataMember(Name = "customRanking", EmitDefaultValue = false)] + public List CustomRanking { get; set; } + + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + [DataMember(Name = "relevancyStrictness", EmitDefaultValue = false)] + public int RelevancyStrictness { get; set; } + + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + [DataMember(Name = "attributesToHighlight", EmitDefaultValue = false)] + public List AttributesToHighlight { get; set; } + + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + [DataMember(Name = "attributesToSnippet", EmitDefaultValue = false)] + public List AttributesToSnippet { get; set; } + + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPreTag", EmitDefaultValue = false)] + public string HighlightPreTag { get; set; } + + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPostTag", EmitDefaultValue = false)] + public string HighlightPostTag { get; set; } + + /// + /// String used as an ellipsis indicator when a snippet is truncated. + /// + /// String used as an ellipsis indicator when a snippet is truncated. + [DataMember(Name = "snippetEllipsisText", EmitDefaultValue = false)] + public string SnippetEllipsisText { get; set; } + + /// + /// Restrict highlighting and snippeting to items that matched the query. + /// + /// Restrict highlighting and snippeting to items that matched the query. + [DataMember(Name = "restrictHighlightAndSnippetArrays", EmitDefaultValue = true)] + public bool RestrictHighlightAndSnippetArrays { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", EmitDefaultValue = false)] + public int HitsPerPage { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor1Typo", EmitDefaultValue = false)] + public int MinWordSizefor1Typo { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor2Typos", EmitDefaultValue = false)] + public int MinWordSizefor2Typos { get; set; } + + /// + /// Gets or Sets TypoTolerance + /// + [DataMember(Name = "typoTolerance", EmitDefaultValue = false)] + public TypoTolerance TypoTolerance { get; set; } + + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + [DataMember(Name = "allowTyposOnNumericTokens", EmitDefaultValue = true)] + public bool AllowTyposOnNumericTokens { get; set; } + + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + [DataMember(Name = "disableTypoToleranceOnAttributes", EmitDefaultValue = false)] + public List DisableTypoToleranceOnAttributes { get; set; } + + /// + /// Gets or Sets IgnorePlurals + /// + [DataMember(Name = "ignorePlurals", EmitDefaultValue = false)] + public IgnorePlurals IgnorePlurals { get; set; } + + /// + /// Gets or Sets RemoveStopWords + /// + [DataMember(Name = "removeStopWords", EmitDefaultValue = false)] + public RemoveStopWords RemoveStopWords { get; set; } + + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + [DataMember(Name = "keepDiacriticsOnCharacters", EmitDefaultValue = false)] + public string KeepDiacriticsOnCharacters { get; set; } + + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + [DataMember(Name = "queryLanguages", EmitDefaultValue = false)] + public List QueryLanguages { get; set; } + + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + [DataMember(Name = "decompoundQuery", EmitDefaultValue = true)] + public bool DecompoundQuery { get; set; } + + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + [DataMember(Name = "enableRules", EmitDefaultValue = true)] + public bool EnableRules { get; set; } + + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + [DataMember(Name = "enablePersonalization", EmitDefaultValue = true)] + public bool EnablePersonalization { get; set; } + + /// + /// Gets or Sets SemanticSearch + /// + [DataMember(Name = "semanticSearch", EmitDefaultValue = false)] + public SemanticSearch SemanticSearch { get; set; } + + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + [DataMember(Name = "advancedSyntax", EmitDefaultValue = true)] + public bool AdvancedSyntax { get; set; } + + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + [DataMember(Name = "optionalWords", EmitDefaultValue = false)] + public List OptionalWords { get; set; } + + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "disableExactOnAttributes", EmitDefaultValue = false)] + public List DisableExactOnAttributes { get; set; } + + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "alternativesAsExact", EmitDefaultValue = false)] + public List AlternativesAsExact { get; set; } + + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + [DataMember(Name = "advancedSyntaxFeatures", EmitDefaultValue = false)] + public List AdvancedSyntaxFeatures { get; set; } + + /// + /// Gets or Sets Distinct + /// + [DataMember(Name = "distinct", EmitDefaultValue = false)] + public Distinct Distinct { get; set; } + + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + [DataMember(Name = "replaceSynonymsInHighlight", EmitDefaultValue = true)] + public bool ReplaceSynonymsInHighlight { get; set; } + + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + [DataMember(Name = "minProximity", EmitDefaultValue = false)] + public int MinProximity { get; set; } + + /// + /// Attributes to include in the API response for search and browse queries. + /// + /// Attributes to include in the API response for search and browse queries. + [DataMember(Name = "responseFields", EmitDefaultValue = false)] + public List ResponseFields { get; set; } + + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + [DataMember(Name = "maxFacetHits", EmitDefaultValue = false)] + public int MaxFacetHits { get; set; } + + /// + /// Maximum number of facet values to return for each facet. + /// + /// Maximum number of facet values to return for each facet. + [DataMember(Name = "maxValuesPerFacet", EmitDefaultValue = false)] + public int MaxValuesPerFacet { get; set; } + + /// + /// Controls how facet values are fetched. + /// + /// Controls how facet values are fetched. + [DataMember(Name = "sortFacetValuesBy", EmitDefaultValue = false)] + public string SortFacetValuesBy { get; set; } + + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + [DataMember(Name = "attributeCriteriaComputedByMinProximity", EmitDefaultValue = true)] + public bool AttributeCriteriaComputedByMinProximity { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + [DataMember(Name = "enableReRanking", EmitDefaultValue = true)] + public bool EnableReRanking { get; set; } + + /// + /// Gets or Sets ReRankingApplyFilter + /// + [DataMember(Name = "reRankingApplyFilter", EmitDefaultValue = true)] + public ReRankingApplyFilter ReRankingApplyFilter { get; set; } + + /// + /// Gets or Sets Query + /// + [DataMember(Name = "query", EmitDefaultValue = false)] + public ConsequenceQuery Query { get; set; } + + /// + /// Gets or Sets AutomaticFacetFilters + /// + [DataMember(Name = "automaticFacetFilters", EmitDefaultValue = false)] + public AutomaticFacetFilters AutomaticFacetFilters { get; set; } + + /// + /// Gets or Sets AutomaticOptionalFacetFilters + /// + [DataMember(Name = "automaticOptionalFacetFilters", EmitDefaultValue = false)] + public AutomaticFacetFilters AutomaticOptionalFacetFilters { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ConsequenceParams {\n"); + sb.Append(" SimilarQuery: ").Append(SimilarQuery).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" FacetFilters: ").Append(FacetFilters).Append("\n"); + sb.Append(" OptionalFilters: ").Append(OptionalFilters).Append("\n"); + sb.Append(" NumericFilters: ").Append(NumericFilters).Append("\n"); + sb.Append(" TagFilters: ").Append(TagFilters).Append("\n"); + sb.Append(" SumOrFiltersScores: ").Append(SumOrFiltersScores).Append("\n"); + sb.Append(" RestrictSearchableAttributes: ").Append(RestrictSearchableAttributes).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" FacetingAfterDistinct: ").Append(FacetingAfterDistinct).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" Offset: ").Append(Offset).Append("\n"); + sb.Append(" Length: ").Append(Length).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AroundLatLngViaIP: ").Append(AroundLatLngViaIP).Append("\n"); + sb.Append(" AroundRadius: ").Append(AroundRadius).Append("\n"); + sb.Append(" AroundPrecision: ").Append(AroundPrecision).Append("\n"); + sb.Append(" MinimumAroundRadius: ").Append(MinimumAroundRadius).Append("\n"); + sb.Append(" InsideBoundingBox: ").Append(InsideBoundingBox).Append("\n"); + sb.Append(" InsidePolygon: ").Append(InsidePolygon).Append("\n"); + sb.Append(" NaturalLanguages: ").Append(NaturalLanguages).Append("\n"); + sb.Append(" RuleContexts: ").Append(RuleContexts).Append("\n"); + sb.Append(" PersonalizationImpact: ").Append(PersonalizationImpact).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" GetRankingInfo: ").Append(GetRankingInfo).Append("\n"); + sb.Append(" Explain: ").Append(Explain).Append("\n"); + sb.Append(" Synonyms: ").Append(Synonyms).Append("\n"); + sb.Append(" ClickAnalytics: ").Append(ClickAnalytics).Append("\n"); + sb.Append(" Analytics: ").Append(Analytics).Append("\n"); + sb.Append(" AnalyticsTags: ").Append(AnalyticsTags).Append("\n"); + sb.Append(" PercentileComputation: ").Append(PercentileComputation).Append("\n"); + sb.Append(" EnableABTest: ").Append(EnableABTest).Append("\n"); + sb.Append(" AttributesForFaceting: ").Append(AttributesForFaceting).Append("\n"); + sb.Append(" AttributesToRetrieve: ").Append(AttributesToRetrieve).Append("\n"); + sb.Append(" Ranking: ").Append(Ranking).Append("\n"); + sb.Append(" CustomRanking: ").Append(CustomRanking).Append("\n"); + sb.Append(" RelevancyStrictness: ").Append(RelevancyStrictness).Append("\n"); + sb.Append(" AttributesToHighlight: ").Append(AttributesToHighlight).Append("\n"); + sb.Append(" AttributesToSnippet: ").Append(AttributesToSnippet).Append("\n"); + sb.Append(" HighlightPreTag: ").Append(HighlightPreTag).Append("\n"); + sb.Append(" HighlightPostTag: ").Append(HighlightPostTag).Append("\n"); + sb.Append(" SnippetEllipsisText: ").Append(SnippetEllipsisText).Append("\n"); + sb.Append(" RestrictHighlightAndSnippetArrays: ").Append(RestrictHighlightAndSnippetArrays).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" MinWordSizefor1Typo: ").Append(MinWordSizefor1Typo).Append("\n"); + sb.Append(" MinWordSizefor2Typos: ").Append(MinWordSizefor2Typos).Append("\n"); + sb.Append(" TypoTolerance: ").Append(TypoTolerance).Append("\n"); + sb.Append(" AllowTyposOnNumericTokens: ").Append(AllowTyposOnNumericTokens).Append("\n"); + sb.Append(" DisableTypoToleranceOnAttributes: ").Append(DisableTypoToleranceOnAttributes).Append("\n"); + sb.Append(" IgnorePlurals: ").Append(IgnorePlurals).Append("\n"); + sb.Append(" RemoveStopWords: ").Append(RemoveStopWords).Append("\n"); + sb.Append(" KeepDiacriticsOnCharacters: ").Append(KeepDiacriticsOnCharacters).Append("\n"); + sb.Append(" QueryLanguages: ").Append(QueryLanguages).Append("\n"); + sb.Append(" DecompoundQuery: ").Append(DecompoundQuery).Append("\n"); + sb.Append(" EnableRules: ").Append(EnableRules).Append("\n"); + sb.Append(" EnablePersonalization: ").Append(EnablePersonalization).Append("\n"); + sb.Append(" QueryType: ").Append(QueryType).Append("\n"); + sb.Append(" RemoveWordsIfNoResults: ").Append(RemoveWordsIfNoResults).Append("\n"); + sb.Append(" Mode: ").Append(Mode).Append("\n"); + sb.Append(" SemanticSearch: ").Append(SemanticSearch).Append("\n"); + sb.Append(" AdvancedSyntax: ").Append(AdvancedSyntax).Append("\n"); + sb.Append(" OptionalWords: ").Append(OptionalWords).Append("\n"); + sb.Append(" DisableExactOnAttributes: ").Append(DisableExactOnAttributes).Append("\n"); + sb.Append(" ExactOnSingleWordQuery: ").Append(ExactOnSingleWordQuery).Append("\n"); + sb.Append(" AlternativesAsExact: ").Append(AlternativesAsExact).Append("\n"); + sb.Append(" AdvancedSyntaxFeatures: ").Append(AdvancedSyntaxFeatures).Append("\n"); + sb.Append(" Distinct: ").Append(Distinct).Append("\n"); + sb.Append(" ReplaceSynonymsInHighlight: ").Append(ReplaceSynonymsInHighlight).Append("\n"); + sb.Append(" MinProximity: ").Append(MinProximity).Append("\n"); + sb.Append(" ResponseFields: ").Append(ResponseFields).Append("\n"); + sb.Append(" MaxFacetHits: ").Append(MaxFacetHits).Append("\n"); + sb.Append(" MaxValuesPerFacet: ").Append(MaxValuesPerFacet).Append("\n"); + sb.Append(" SortFacetValuesBy: ").Append(SortFacetValuesBy).Append("\n"); + sb.Append(" AttributeCriteriaComputedByMinProximity: ").Append(AttributeCriteriaComputedByMinProximity).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append(" EnableReRanking: ").Append(EnableReRanking).Append("\n"); + sb.Append(" ReRankingApplyFilter: ").Append(ReRankingApplyFilter).Append("\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" AutomaticFacetFilters: ").Append(AutomaticFacetFilters).Append("\n"); + sb.Append(" AutomaticOptionalFacetFilters: ").Append(AutomaticOptionalFacetFilters).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ConsequenceParams); + } + + /// + /// Returns true if ConsequenceParams instances are equal + /// + /// Instance of ConsequenceParams to be compared + /// Boolean + public bool Equals(ConsequenceParams input) + { + if (input == null) + { + return false; + } + return + ( + this.SimilarQuery == input.SimilarQuery || + (this.SimilarQuery != null && + this.SimilarQuery.Equals(input.SimilarQuery)) + ) && + ( + this.Filters == input.Filters || + (this.Filters != null && + this.Filters.Equals(input.Filters)) + ) && + ( + this.FacetFilters == input.FacetFilters || + (this.FacetFilters != null && + this.FacetFilters.Equals(input.FacetFilters)) + ) && + ( + this.OptionalFilters == input.OptionalFilters || + (this.OptionalFilters != null && + this.OptionalFilters.Equals(input.OptionalFilters)) + ) && + ( + this.NumericFilters == input.NumericFilters || + (this.NumericFilters != null && + this.NumericFilters.Equals(input.NumericFilters)) + ) && + ( + this.TagFilters == input.TagFilters || + (this.TagFilters != null && + this.TagFilters.Equals(input.TagFilters)) + ) && + ( + this.SumOrFiltersScores == input.SumOrFiltersScores || + this.SumOrFiltersScores.Equals(input.SumOrFiltersScores) + ) && + ( + this.RestrictSearchableAttributes == input.RestrictSearchableAttributes || + this.RestrictSearchableAttributes != null && + input.RestrictSearchableAttributes != null && + this.RestrictSearchableAttributes.SequenceEqual(input.RestrictSearchableAttributes) + ) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && + ( + this.FacetingAfterDistinct == input.FacetingAfterDistinct || + this.FacetingAfterDistinct.Equals(input.FacetingAfterDistinct) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.Offset == input.Offset || + this.Offset.Equals(input.Offset) + ) && + ( + this.Length == input.Length || + this.Length.Equals(input.Length) + ) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && + ( + this.AroundLatLngViaIP == input.AroundLatLngViaIP || + this.AroundLatLngViaIP.Equals(input.AroundLatLngViaIP) + ) && + ( + this.AroundRadius == input.AroundRadius || + (this.AroundRadius != null && + this.AroundRadius.Equals(input.AroundRadius)) + ) && + ( + this.AroundPrecision == input.AroundPrecision || + (this.AroundPrecision != null && + this.AroundPrecision.Equals(input.AroundPrecision)) + ) && + ( + this.MinimumAroundRadius == input.MinimumAroundRadius || + this.MinimumAroundRadius.Equals(input.MinimumAroundRadius) + ) && + ( + this.InsideBoundingBox == input.InsideBoundingBox || + this.InsideBoundingBox != null && + input.InsideBoundingBox != null && + this.InsideBoundingBox.SequenceEqual(input.InsideBoundingBox) + ) && + ( + this.InsidePolygon == input.InsidePolygon || + this.InsidePolygon != null && + input.InsidePolygon != null && + this.InsidePolygon.SequenceEqual(input.InsidePolygon) + ) && + ( + this.NaturalLanguages == input.NaturalLanguages || + this.NaturalLanguages != null && + input.NaturalLanguages != null && + this.NaturalLanguages.SequenceEqual(input.NaturalLanguages) + ) && + ( + this.RuleContexts == input.RuleContexts || + this.RuleContexts != null && + input.RuleContexts != null && + this.RuleContexts.SequenceEqual(input.RuleContexts) + ) && + ( + this.PersonalizationImpact == input.PersonalizationImpact || + this.PersonalizationImpact.Equals(input.PersonalizationImpact) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.GetRankingInfo == input.GetRankingInfo || + this.GetRankingInfo.Equals(input.GetRankingInfo) + ) && + ( + this.Explain == input.Explain || + this.Explain != null && + input.Explain != null && + this.Explain.SequenceEqual(input.Explain) + ) && + ( + this.Synonyms == input.Synonyms || + this.Synonyms.Equals(input.Synonyms) + ) && + ( + this.ClickAnalytics == input.ClickAnalytics || + this.ClickAnalytics.Equals(input.ClickAnalytics) + ) && + ( + this.Analytics == input.Analytics || + this.Analytics.Equals(input.Analytics) + ) && + ( + this.AnalyticsTags == input.AnalyticsTags || + this.AnalyticsTags != null && + input.AnalyticsTags != null && + this.AnalyticsTags.SequenceEqual(input.AnalyticsTags) + ) && + ( + this.PercentileComputation == input.PercentileComputation || + this.PercentileComputation.Equals(input.PercentileComputation) + ) && + ( + this.EnableABTest == input.EnableABTest || + this.EnableABTest.Equals(input.EnableABTest) + ) && + ( + this.AttributesForFaceting == input.AttributesForFaceting || + this.AttributesForFaceting != null && + input.AttributesForFaceting != null && + this.AttributesForFaceting.SequenceEqual(input.AttributesForFaceting) + ) && + ( + this.AttributesToRetrieve == input.AttributesToRetrieve || + this.AttributesToRetrieve != null && + input.AttributesToRetrieve != null && + this.AttributesToRetrieve.SequenceEqual(input.AttributesToRetrieve) + ) && + ( + this.Ranking == input.Ranking || + this.Ranking != null && + input.Ranking != null && + this.Ranking.SequenceEqual(input.Ranking) + ) && + ( + this.CustomRanking == input.CustomRanking || + this.CustomRanking != null && + input.CustomRanking != null && + this.CustomRanking.SequenceEqual(input.CustomRanking) + ) && + ( + this.RelevancyStrictness == input.RelevancyStrictness || + this.RelevancyStrictness.Equals(input.RelevancyStrictness) + ) && + ( + this.AttributesToHighlight == input.AttributesToHighlight || + this.AttributesToHighlight != null && + input.AttributesToHighlight != null && + this.AttributesToHighlight.SequenceEqual(input.AttributesToHighlight) + ) && + ( + this.AttributesToSnippet == input.AttributesToSnippet || + this.AttributesToSnippet != null && + input.AttributesToSnippet != null && + this.AttributesToSnippet.SequenceEqual(input.AttributesToSnippet) + ) && + ( + this.HighlightPreTag == input.HighlightPreTag || + (this.HighlightPreTag != null && + this.HighlightPreTag.Equals(input.HighlightPreTag)) + ) && + ( + this.HighlightPostTag == input.HighlightPostTag || + (this.HighlightPostTag != null && + this.HighlightPostTag.Equals(input.HighlightPostTag)) + ) && + ( + this.SnippetEllipsisText == input.SnippetEllipsisText || + (this.SnippetEllipsisText != null && + this.SnippetEllipsisText.Equals(input.SnippetEllipsisText)) + ) && + ( + this.RestrictHighlightAndSnippetArrays == input.RestrictHighlightAndSnippetArrays || + this.RestrictHighlightAndSnippetArrays.Equals(input.RestrictHighlightAndSnippetArrays) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && + ( + this.MinWordSizefor1Typo == input.MinWordSizefor1Typo || + this.MinWordSizefor1Typo.Equals(input.MinWordSizefor1Typo) + ) && + ( + this.MinWordSizefor2Typos == input.MinWordSizefor2Typos || + this.MinWordSizefor2Typos.Equals(input.MinWordSizefor2Typos) + ) && + ( + this.TypoTolerance == input.TypoTolerance || + (this.TypoTolerance != null && + this.TypoTolerance.Equals(input.TypoTolerance)) + ) && + ( + this.AllowTyposOnNumericTokens == input.AllowTyposOnNumericTokens || + this.AllowTyposOnNumericTokens.Equals(input.AllowTyposOnNumericTokens) + ) && + ( + this.DisableTypoToleranceOnAttributes == input.DisableTypoToleranceOnAttributes || + this.DisableTypoToleranceOnAttributes != null && + input.DisableTypoToleranceOnAttributes != null && + this.DisableTypoToleranceOnAttributes.SequenceEqual(input.DisableTypoToleranceOnAttributes) + ) && + ( + this.IgnorePlurals == input.IgnorePlurals || + (this.IgnorePlurals != null && + this.IgnorePlurals.Equals(input.IgnorePlurals)) + ) && + ( + this.RemoveStopWords == input.RemoveStopWords || + (this.RemoveStopWords != null && + this.RemoveStopWords.Equals(input.RemoveStopWords)) + ) && + ( + this.KeepDiacriticsOnCharacters == input.KeepDiacriticsOnCharacters || + (this.KeepDiacriticsOnCharacters != null && + this.KeepDiacriticsOnCharacters.Equals(input.KeepDiacriticsOnCharacters)) + ) && + ( + this.QueryLanguages == input.QueryLanguages || + this.QueryLanguages != null && + input.QueryLanguages != null && + this.QueryLanguages.SequenceEqual(input.QueryLanguages) + ) && + ( + this.DecompoundQuery == input.DecompoundQuery || + this.DecompoundQuery.Equals(input.DecompoundQuery) + ) && + ( + this.EnableRules == input.EnableRules || + this.EnableRules.Equals(input.EnableRules) + ) && + ( + this.EnablePersonalization == input.EnablePersonalization || + this.EnablePersonalization.Equals(input.EnablePersonalization) + ) && + ( + this.QueryType == input.QueryType || + this.QueryType.Equals(input.QueryType) + ) && + ( + this.RemoveWordsIfNoResults == input.RemoveWordsIfNoResults || + this.RemoveWordsIfNoResults.Equals(input.RemoveWordsIfNoResults) + ) && + ( + this.Mode == input.Mode || + this.Mode.Equals(input.Mode) + ) && + ( + this.SemanticSearch == input.SemanticSearch || + (this.SemanticSearch != null && + this.SemanticSearch.Equals(input.SemanticSearch)) + ) && + ( + this.AdvancedSyntax == input.AdvancedSyntax || + this.AdvancedSyntax.Equals(input.AdvancedSyntax) + ) && + ( + this.OptionalWords == input.OptionalWords || + this.OptionalWords != null && + input.OptionalWords != null && + this.OptionalWords.SequenceEqual(input.OptionalWords) + ) && + ( + this.DisableExactOnAttributes == input.DisableExactOnAttributes || + this.DisableExactOnAttributes != null && + input.DisableExactOnAttributes != null && + this.DisableExactOnAttributes.SequenceEqual(input.DisableExactOnAttributes) + ) && + ( + this.ExactOnSingleWordQuery == input.ExactOnSingleWordQuery || + this.ExactOnSingleWordQuery.Equals(input.ExactOnSingleWordQuery) + ) && + ( + this.AlternativesAsExact == input.AlternativesAsExact || + this.AlternativesAsExact != null && + input.AlternativesAsExact != null && + this.AlternativesAsExact.SequenceEqual(input.AlternativesAsExact) + ) && + ( + this.AdvancedSyntaxFeatures == input.AdvancedSyntaxFeatures || + this.AdvancedSyntaxFeatures != null && + input.AdvancedSyntaxFeatures != null && + this.AdvancedSyntaxFeatures.SequenceEqual(input.AdvancedSyntaxFeatures) + ) && + ( + this.Distinct == input.Distinct || + (this.Distinct != null && + this.Distinct.Equals(input.Distinct)) + ) && + ( + this.ReplaceSynonymsInHighlight == input.ReplaceSynonymsInHighlight || + this.ReplaceSynonymsInHighlight.Equals(input.ReplaceSynonymsInHighlight) + ) && + ( + this.MinProximity == input.MinProximity || + this.MinProximity.Equals(input.MinProximity) + ) && + ( + this.ResponseFields == input.ResponseFields || + this.ResponseFields != null && + input.ResponseFields != null && + this.ResponseFields.SequenceEqual(input.ResponseFields) + ) && + ( + this.MaxFacetHits == input.MaxFacetHits || + this.MaxFacetHits.Equals(input.MaxFacetHits) + ) && + ( + this.MaxValuesPerFacet == input.MaxValuesPerFacet || + this.MaxValuesPerFacet.Equals(input.MaxValuesPerFacet) + ) && + ( + this.SortFacetValuesBy == input.SortFacetValuesBy || + (this.SortFacetValuesBy != null && + this.SortFacetValuesBy.Equals(input.SortFacetValuesBy)) + ) && + ( + this.AttributeCriteriaComputedByMinProximity == input.AttributeCriteriaComputedByMinProximity || + this.AttributeCriteriaComputedByMinProximity.Equals(input.AttributeCriteriaComputedByMinProximity) + ) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ) && + ( + this.EnableReRanking == input.EnableReRanking || + this.EnableReRanking.Equals(input.EnableReRanking) + ) && + ( + this.ReRankingApplyFilter == input.ReRankingApplyFilter || + (this.ReRankingApplyFilter != null && + this.ReRankingApplyFilter.Equals(input.ReRankingApplyFilter)) + ) && + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.AutomaticFacetFilters == input.AutomaticFacetFilters || + (this.AutomaticFacetFilters != null && + this.AutomaticFacetFilters.Equals(input.AutomaticFacetFilters)) + ) && + ( + this.AutomaticOptionalFacetFilters == input.AutomaticOptionalFacetFilters || + (this.AutomaticOptionalFacetFilters != null && + this.AutomaticOptionalFacetFilters.Equals(input.AutomaticOptionalFacetFilters)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SimilarQuery != null) + { + hashCode = (hashCode * 59) + this.SimilarQuery.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.FacetFilters != null) + { + hashCode = (hashCode * 59) + this.FacetFilters.GetHashCode(); + } + if (this.OptionalFilters != null) + { + hashCode = (hashCode * 59) + this.OptionalFilters.GetHashCode(); + } + if (this.NumericFilters != null) + { + hashCode = (hashCode * 59) + this.NumericFilters.GetHashCode(); + } + if (this.TagFilters != null) + { + hashCode = (hashCode * 59) + this.TagFilters.GetHashCode(); + } + hashCode = (hashCode * 59) + this.SumOrFiltersScores.GetHashCode(); + if (this.RestrictSearchableAttributes != null) + { + hashCode = (hashCode * 59) + this.RestrictSearchableAttributes.GetHashCode(); + } + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + hashCode = (hashCode * 59) + this.FacetingAfterDistinct.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.Offset.GetHashCode(); + hashCode = (hashCode * 59) + this.Length.GetHashCode(); + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AroundLatLngViaIP.GetHashCode(); + if (this.AroundRadius != null) + { + hashCode = (hashCode * 59) + this.AroundRadius.GetHashCode(); + } + if (this.AroundPrecision != null) + { + hashCode = (hashCode * 59) + this.AroundPrecision.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MinimumAroundRadius.GetHashCode(); + if (this.InsideBoundingBox != null) + { + hashCode = (hashCode * 59) + this.InsideBoundingBox.GetHashCode(); + } + if (this.InsidePolygon != null) + { + hashCode = (hashCode * 59) + this.InsidePolygon.GetHashCode(); + } + if (this.NaturalLanguages != null) + { + hashCode = (hashCode * 59) + this.NaturalLanguages.GetHashCode(); + } + if (this.RuleContexts != null) + { + hashCode = (hashCode * 59) + this.RuleContexts.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PersonalizationImpact.GetHashCode(); + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.GetRankingInfo.GetHashCode(); + if (this.Explain != null) + { + hashCode = (hashCode * 59) + this.Explain.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Synonyms.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickAnalytics.GetHashCode(); + hashCode = (hashCode * 59) + this.Analytics.GetHashCode(); + if (this.AnalyticsTags != null) + { + hashCode = (hashCode * 59) + this.AnalyticsTags.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PercentileComputation.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableABTest.GetHashCode(); + if (this.AttributesForFaceting != null) + { + hashCode = (hashCode * 59) + this.AttributesForFaceting.GetHashCode(); + } + if (this.AttributesToRetrieve != null) + { + hashCode = (hashCode * 59) + this.AttributesToRetrieve.GetHashCode(); + } + if (this.Ranking != null) + { + hashCode = (hashCode * 59) + this.Ranking.GetHashCode(); + } + if (this.CustomRanking != null) + { + hashCode = (hashCode * 59) + this.CustomRanking.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RelevancyStrictness.GetHashCode(); + if (this.AttributesToHighlight != null) + { + hashCode = (hashCode * 59) + this.AttributesToHighlight.GetHashCode(); + } + if (this.AttributesToSnippet != null) + { + hashCode = (hashCode * 59) + this.AttributesToSnippet.GetHashCode(); + } + if (this.HighlightPreTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPreTag.GetHashCode(); + } + if (this.HighlightPostTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPostTag.GetHashCode(); + } + if (this.SnippetEllipsisText != null) + { + hashCode = (hashCode * 59) + this.SnippetEllipsisText.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RestrictHighlightAndSnippetArrays.GetHashCode(); + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor1Typo.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor2Typos.GetHashCode(); + if (this.TypoTolerance != null) + { + hashCode = (hashCode * 59) + this.TypoTolerance.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AllowTyposOnNumericTokens.GetHashCode(); + if (this.DisableTypoToleranceOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableTypoToleranceOnAttributes.GetHashCode(); + } + if (this.IgnorePlurals != null) + { + hashCode = (hashCode * 59) + this.IgnorePlurals.GetHashCode(); + } + if (this.RemoveStopWords != null) + { + hashCode = (hashCode * 59) + this.RemoveStopWords.GetHashCode(); + } + if (this.KeepDiacriticsOnCharacters != null) + { + hashCode = (hashCode * 59) + this.KeepDiacriticsOnCharacters.GetHashCode(); + } + if (this.QueryLanguages != null) + { + hashCode = (hashCode * 59) + this.QueryLanguages.GetHashCode(); + } + hashCode = (hashCode * 59) + this.DecompoundQuery.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableRules.GetHashCode(); + hashCode = (hashCode * 59) + this.EnablePersonalization.GetHashCode(); + hashCode = (hashCode * 59) + this.QueryType.GetHashCode(); + hashCode = (hashCode * 59) + this.RemoveWordsIfNoResults.GetHashCode(); + hashCode = (hashCode * 59) + this.Mode.GetHashCode(); + if (this.SemanticSearch != null) + { + hashCode = (hashCode * 59) + this.SemanticSearch.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AdvancedSyntax.GetHashCode(); + if (this.OptionalWords != null) + { + hashCode = (hashCode * 59) + this.OptionalWords.GetHashCode(); + } + if (this.DisableExactOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableExactOnAttributes.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ExactOnSingleWordQuery.GetHashCode(); + if (this.AlternativesAsExact != null) + { + hashCode = (hashCode * 59) + this.AlternativesAsExact.GetHashCode(); + } + if (this.AdvancedSyntaxFeatures != null) + { + hashCode = (hashCode * 59) + this.AdvancedSyntaxFeatures.GetHashCode(); + } + if (this.Distinct != null) + { + hashCode = (hashCode * 59) + this.Distinct.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ReplaceSynonymsInHighlight.GetHashCode(); + hashCode = (hashCode * 59) + this.MinProximity.GetHashCode(); + if (this.ResponseFields != null) + { + hashCode = (hashCode * 59) + this.ResponseFields.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MaxFacetHits.GetHashCode(); + hashCode = (hashCode * 59) + this.MaxValuesPerFacet.GetHashCode(); + if (this.SortFacetValuesBy != null) + { + hashCode = (hashCode * 59) + this.SortFacetValuesBy.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AttributeCriteriaComputedByMinProximity.GetHashCode(); + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EnableReRanking.GetHashCode(); + if (this.ReRankingApplyFilter != null) + { + hashCode = (hashCode * 59) + this.ReRankingApplyFilter.GetHashCode(); + } + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.AutomaticFacetFilters != null) + { + hashCode = (hashCode * 59) + this.AutomaticFacetFilters.GetHashCode(); + } + if (this.AutomaticOptionalFacetFilters != null) + { + hashCode = (hashCode * 59) + this.AutomaticOptionalFacetFilters.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Length (int) maximum + if (this.Length > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value less than or equal to 1000.", new[] { "Length" }); + } + + // Length (int) minimum + if (this.Length < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value greater than or equal to 1.", new[] { "Length" }); + } + + // MinimumAroundRadius (int) minimum + if (this.MinimumAroundRadius < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinimumAroundRadius, must be a value greater than or equal to 1.", new[] { "MinimumAroundRadius" }); + } + + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + // MinProximity (int) maximum + if (this.MinProximity > (int)7) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value less than or equal to 7.", new[] { "MinProximity" }); + } + + // MinProximity (int) minimum + if (this.MinProximity < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value greater than or equal to 1.", new[] { "MinProximity" }); + } + + // MaxFacetHits (int) maximum + if (this.MaxFacetHits > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MaxFacetHits, must be a value less than or equal to 100.", new[] { "MaxFacetHits" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/ConsequenceQuery.cs b/algoliasearch/Recommend/Models/ConsequenceQuery.cs new file mode 100644 index 000000000..9477ad995 --- /dev/null +++ b/algoliasearch/Recommend/Models/ConsequenceQuery.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// When providing a string, it replaces the entire query string. When providing an object, it describes incremental edits to be made to the query string (but you can't do both). + /// + [JsonConverter(typeof(ConsequenceQueryJsonConverter))] + [DataContract(Name = "consequenceQuery")] + public partial class ConsequenceQuery : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of ConsequenceQueryObject. + public ConsequenceQuery(ConsequenceQueryObject actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public ConsequenceQuery(string actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(ConsequenceQueryObject)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: ConsequenceQueryObject, string"); + } + } + } + + /// + /// Get the actual instance of `ConsequenceQueryObject`. If the actual instance is not `ConsequenceQueryObject`, + /// the InvalidClassException will be thrown + /// + /// An instance of ConsequenceQueryObject + public ConsequenceQueryObject GetterConsequenceQueryObject() + { + return (ConsequenceQueryObject)this.ActualInstance; + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class ConsequenceQuery {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, ConsequenceQuery.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of ConsequenceQuery + /// + /// JSON string + /// An instance of ConsequenceQuery + public static ConsequenceQuery FromJson(string jsonString) + { + ConsequenceQuery newConsequenceQuery = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newConsequenceQuery; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(ConsequenceQueryObject).GetProperty("AdditionalProperties") == null) + { + newConsequenceQuery = new ConsequenceQuery(JsonConvert.DeserializeObject(jsonString, ConsequenceQuery.SerializerSettings)); + } + else + { + newConsequenceQuery = new ConsequenceQuery(JsonConvert.DeserializeObject(jsonString, ConsequenceQuery.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("ConsequenceQueryObject"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into ConsequenceQueryObject: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newConsequenceQuery = new ConsequenceQuery(JsonConvert.DeserializeObject(jsonString, ConsequenceQuery.SerializerSettings)); + } + else + { + newConsequenceQuery = new ConsequenceQuery(JsonConvert.DeserializeObject(jsonString, ConsequenceQuery.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newConsequenceQuery; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ConsequenceQuery); + } + + /// + /// Returns true if ConsequenceQuery instances are equal + /// + /// Instance of ConsequenceQuery to be compared + /// Boolean + public bool Equals(ConsequenceQuery input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for ConsequenceQuery + /// + public class ConsequenceQueryJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(ConsequenceQuery).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return ConsequenceQuery.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/ConsequenceQueryObject.cs b/algoliasearch/Recommend/Models/ConsequenceQueryObject.cs new file mode 100644 index 000000000..4c9e48ca2 --- /dev/null +++ b/algoliasearch/Recommend/Models/ConsequenceQueryObject.cs @@ -0,0 +1,145 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// ConsequenceQueryObject + /// + [DataContract(Name = "consequenceQueryObject")] + public partial class ConsequenceQueryObject : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Words to remove.. + /// Edits to apply.. + public ConsequenceQueryObject(List remove = default(List), List edits = default(List)) + { + this.Remove = remove; + this.Edits = edits; + } + + /// + /// Words to remove. + /// + /// Words to remove. + [DataMember(Name = "remove", EmitDefaultValue = false)] + public List Remove { get; set; } + + /// + /// Edits to apply. + /// + /// Edits to apply. + [DataMember(Name = "edits", EmitDefaultValue = false)] + public List Edits { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ConsequenceQueryObject {\n"); + sb.Append(" Remove: ").Append(Remove).Append("\n"); + sb.Append(" Edits: ").Append(Edits).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ConsequenceQueryObject); + } + + /// + /// Returns true if ConsequenceQueryObject instances are equal + /// + /// Instance of ConsequenceQueryObject to be compared + /// Boolean + public bool Equals(ConsequenceQueryObject input) + { + if (input == null) + { + return false; + } + return + ( + this.Remove == input.Remove || + this.Remove != null && + input.Remove != null && + this.Remove.SequenceEqual(input.Remove) + ) && + ( + this.Edits == input.Edits || + this.Edits != null && + input.Edits != null && + this.Edits.SequenceEqual(input.Edits) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Remove != null) + { + hashCode = (hashCode * 59) + this.Remove.GetHashCode(); + } + if (this.Edits != null) + { + hashCode = (hashCode * 59) + this.Edits.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/DeletedAtResponse.cs b/algoliasearch/Recommend/Models/DeletedAtResponse.cs new file mode 100644 index 000000000..d2c032150 --- /dev/null +++ b/algoliasearch/Recommend/Models/DeletedAtResponse.cs @@ -0,0 +1,149 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Response, taskID, and deletion timestamp. + /// + [DataContract(Name = "deletedAtResponse")] + public partial class DeletedAtResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DeletedAtResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. (required). + /// Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + public DeletedAtResponse(long taskID = default(long), string deletedAt = default(string)) + { + this.TaskID = taskID; + // to ensure "deletedAt" is required (not null) + if (deletedAt == null) + { + throw new ArgumentNullException("deletedAt is a required property for DeletedAtResponse and cannot be null"); + } + this.DeletedAt = deletedAt; + } + + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + [DataMember(Name = "taskID", IsRequired = true, EmitDefaultValue = true)] + public long TaskID { get; set; } + + /// + /// Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "deletedAt", IsRequired = true, EmitDefaultValue = true)] + public string DeletedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DeletedAtResponse {\n"); + sb.Append(" TaskID: ").Append(TaskID).Append("\n"); + sb.Append(" DeletedAt: ").Append(DeletedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DeletedAtResponse); + } + + /// + /// Returns true if DeletedAtResponse instances are equal + /// + /// Instance of DeletedAtResponse to be compared + /// Boolean + public bool Equals(DeletedAtResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.TaskID == input.TaskID || + this.TaskID.Equals(input.TaskID) + ) && + ( + this.DeletedAt == input.DeletedAt || + (this.DeletedAt != null && + this.DeletedAt.Equals(input.DeletedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.TaskID.GetHashCode(); + if (this.DeletedAt != null) + { + hashCode = (hashCode * 59) + this.DeletedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/Distinct.cs b/algoliasearch/Recommend/Models/Distinct.cs new file mode 100644 index 000000000..1e76b67bd --- /dev/null +++ b/algoliasearch/Recommend/Models/Distinct.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Enables [deduplication or grouping of results (Algolia's _distinct_ feature](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/#introducing-algolias-distinct-feature)). + /// + [JsonConverter(typeof(DistinctJsonConverter))] + [DataContract(Name = "distinct")] + public partial class Distinct : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of bool. + public Distinct(bool actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of int. + public Distinct(int actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(bool)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(int)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: bool, int"); + } + } + } + + /// + /// Get the actual instance of `bool`. If the actual instance is not `bool`, + /// the InvalidClassException will be thrown + /// + /// An instance of bool + public bool GetterBool() + { + return (bool)this.ActualInstance; + } + + /// + /// Get the actual instance of `int`. If the actual instance is not `int`, + /// the InvalidClassException will be thrown + /// + /// An instance of int + public int GetterInt() + { + return (int)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Distinct {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, Distinct.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of Distinct + /// + /// JSON string + /// An instance of Distinct + public static Distinct FromJson(string jsonString) + { + Distinct newDistinct = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newDistinct; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(bool).GetProperty("AdditionalProperties") == null) + { + newDistinct = new Distinct(JsonConvert.DeserializeObject(jsonString, Distinct.SerializerSettings)); + } + else + { + newDistinct = new Distinct(JsonConvert.DeserializeObject(jsonString, Distinct.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("bool"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into bool: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(int).GetProperty("AdditionalProperties") == null) + { + newDistinct = new Distinct(JsonConvert.DeserializeObject(jsonString, Distinct.SerializerSettings)); + } + else + { + newDistinct = new Distinct(JsonConvert.DeserializeObject(jsonString, Distinct.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("int"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into int: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newDistinct; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Distinct); + } + + /// + /// Returns true if Distinct instances are equal + /// + /// Instance of Distinct to be compared + /// Boolean + public bool Equals(Distinct input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for Distinct + /// + public class DistinctJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(Distinct).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return Distinct.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/Edit.cs b/algoliasearch/Recommend/Models/Edit.cs new file mode 100644 index 000000000..62f9621f5 --- /dev/null +++ b/algoliasearch/Recommend/Models/Edit.cs @@ -0,0 +1,157 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Edit + /// + [DataContract(Name = "edit")] + public partial class Edit : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", EmitDefaultValue = false)] + public EditType? Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// type. + /// Text or patterns to remove from the query string.. + /// Text that should be inserted in place of the removed text inside the query string.. + public Edit(EditType? type = default(EditType?), string delete = default(string), string insert = default(string)) + { + this.Type = type; + this.Delete = delete; + this.Insert = insert; + } + + /// + /// Text or patterns to remove from the query string. + /// + /// Text or patterns to remove from the query string. + [DataMember(Name = "delete", EmitDefaultValue = false)] + public string Delete { get; set; } + + /// + /// Text that should be inserted in place of the removed text inside the query string. + /// + /// Text that should be inserted in place of the removed text inside the query string. + [DataMember(Name = "insert", EmitDefaultValue = false)] + public string Insert { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Edit {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Delete: ").Append(Delete).Append("\n"); + sb.Append(" Insert: ").Append(Insert).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Edit); + } + + /// + /// Returns true if Edit instances are equal + /// + /// Instance of Edit to be compared + /// Boolean + public bool Equals(Edit input) + { + if (input == null) + { + return false; + } + return + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.Delete == input.Delete || + (this.Delete != null && + this.Delete.Equals(input.Delete)) + ) && + ( + this.Insert == input.Insert || + (this.Insert != null && + this.Insert.Equals(input.Insert)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.Delete != null) + { + hashCode = (hashCode * 59) + this.Delete.GetHashCode(); + } + if (this.Insert != null) + { + hashCode = (hashCode * 59) + this.Insert.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/EditType.cs b/algoliasearch/Recommend/Models/EditType.cs new file mode 100644 index 000000000..45e59b434 --- /dev/null +++ b/algoliasearch/Recommend/Models/EditType.cs @@ -0,0 +1,43 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Type of edit. + /// + /// Type of edit. + [JsonConverter(typeof(StringEnumConverter))] + public enum EditType + { + /// + /// Enum Remove for value: remove + /// + [EnumMember(Value = "remove")] + Remove = 1, + + /// + /// Enum Replace for value: replace + /// + [EnumMember(Value = "replace")] + Replace = 2 + } + +} diff --git a/algoliasearch/Recommend/Models/ErrorBase.cs b/algoliasearch/Recommend/Models/ErrorBase.cs new file mode 100644 index 000000000..3cf023e0d --- /dev/null +++ b/algoliasearch/Recommend/Models/ErrorBase.cs @@ -0,0 +1,147 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Error. + /// + [DataContract(Name = "ErrorBase")] + public partial class ErrorBase : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// message. + public ErrorBase(string message = default(string)) : base() + { + this.Message = message; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Message + /// + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ErrorBase {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ErrorBase); + } + + /// + /// Returns true if ErrorBase instances are equal + /// + /// Instance of ErrorBase to be compared + /// Boolean + public bool Equals(ErrorBase input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/ExactOnSingleWordQuery.cs b/algoliasearch/Recommend/Models/ExactOnSingleWordQuery.cs new file mode 100644 index 000000000..9e66d4c7a --- /dev/null +++ b/algoliasearch/Recommend/Models/ExactOnSingleWordQuery.cs @@ -0,0 +1,49 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Determines how the [Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes) is computed when the query contains only one word. + /// + /// Determines how the [Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes) is computed when the query contains only one word. + [JsonConverter(typeof(StringEnumConverter))] + public enum ExactOnSingleWordQuery + { + /// + /// Enum Attribute for value: attribute + /// + [EnumMember(Value = "attribute")] + Attribute = 1, + + /// + /// Enum None for value: none + /// + [EnumMember(Value = "none")] + None = 2, + + /// + /// Enum Word for value: word + /// + [EnumMember(Value = "word")] + Word = 3 + } + +} diff --git a/algoliasearch/Recommend/Models/Exhaustive.cs b/algoliasearch/Recommend/Models/Exhaustive.cs new file mode 100644 index 000000000..b4d93ab09 --- /dev/null +++ b/algoliasearch/Recommend/Models/Exhaustive.cs @@ -0,0 +1,180 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Whether certain properties of the search response are calculated exhaustive (exact) or approximated. + /// + [DataContract(Name = "exhaustive")] + public partial class Exhaustive : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-).. + /// The value is `false` if not all facet values are retrieved.. + /// Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query.. + /// Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large.. + /// Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled.. + public Exhaustive(bool facetsCount = default(bool), bool facetValues = default(bool), bool nbHits = default(bool), bool rulesMatch = default(bool), bool typo = default(bool)) + { + this.FacetsCount = facetsCount; + this.FacetValues = facetValues; + this.NbHits = nbHits; + this.RulesMatch = rulesMatch; + this.Typo = typo; + } + + /// + /// Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + /// + /// Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + [DataMember(Name = "facetsCount", EmitDefaultValue = true)] + public bool FacetsCount { get; set; } + + /// + /// The value is `false` if not all facet values are retrieved. + /// + /// The value is `false` if not all facet values are retrieved. + [DataMember(Name = "facetValues", EmitDefaultValue = true)] + public bool FacetValues { get; set; } + + /// + /// Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query. + /// + /// Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query. + [DataMember(Name = "nbHits", EmitDefaultValue = true)] + public bool NbHits { get; set; } + + /// + /// Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large. + /// + /// Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large. + [DataMember(Name = "rulesMatch", EmitDefaultValue = true)] + public bool RulesMatch { get; set; } + + /// + /// Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. + /// + /// Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. + [DataMember(Name = "typo", EmitDefaultValue = true)] + public bool Typo { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Exhaustive {\n"); + sb.Append(" FacetsCount: ").Append(FacetsCount).Append("\n"); + sb.Append(" FacetValues: ").Append(FacetValues).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" RulesMatch: ").Append(RulesMatch).Append("\n"); + sb.Append(" Typo: ").Append(Typo).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Exhaustive); + } + + /// + /// Returns true if Exhaustive instances are equal + /// + /// Instance of Exhaustive to be compared + /// Boolean + public bool Equals(Exhaustive input) + { + if (input == null) + { + return false; + } + return + ( + this.FacetsCount == input.FacetsCount || + this.FacetsCount.Equals(input.FacetsCount) + ) && + ( + this.FacetValues == input.FacetValues || + this.FacetValues.Equals(input.FacetValues) + ) && + ( + this.NbHits == input.NbHits || + this.NbHits.Equals(input.NbHits) + ) && + ( + this.RulesMatch == input.RulesMatch || + this.RulesMatch.Equals(input.RulesMatch) + ) && + ( + this.Typo == input.Typo || + this.Typo.Equals(input.Typo) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.FacetsCount.GetHashCode(); + hashCode = (hashCode * 59) + this.FacetValues.GetHashCode(); + hashCode = (hashCode * 59) + this.NbHits.GetHashCode(); + hashCode = (hashCode * 59) + this.RulesMatch.GetHashCode(); + hashCode = (hashCode * 59) + this.Typo.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/FacetFilters.cs b/algoliasearch/Recommend/Models/FacetFilters.cs new file mode 100644 index 000000000..0baed65a7 --- /dev/null +++ b/algoliasearch/Recommend/Models/FacetFilters.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// [Filter hits by facet value](https://www.algolia.com/doc/api-reference/api-parameters/facetFilters/). + /// + [JsonConverter(typeof(FacetFiltersJsonConverter))] + [DataContract(Name = "facetFilters")] + public partial class FacetFilters : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<MixedSearchFilters>. + public FacetFilters(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public FacetFilters(string actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, string"); + } + } + } + + /// + /// Get the actual instance of `List<MixedSearchFilters>`. If the actual instance is not `List<MixedSearchFilters>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<MixedSearchFilters> + public List GetterList() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class FacetFilters {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, FacetFilters.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of FacetFilters + /// + /// JSON string + /// An instance of FacetFilters + public static FacetFilters FromJson(string jsonString) + { + FacetFilters newFacetFilters = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newFacetFilters; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newFacetFilters = new FacetFilters(JsonConvert.DeserializeObject>(jsonString, FacetFilters.SerializerSettings)); + } + else + { + newFacetFilters = new FacetFilters(JsonConvert.DeserializeObject>(jsonString, FacetFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newFacetFilters = new FacetFilters(JsonConvert.DeserializeObject(jsonString, FacetFilters.SerializerSettings)); + } + else + { + newFacetFilters = new FacetFilters(JsonConvert.DeserializeObject(jsonString, FacetFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newFacetFilters; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FacetFilters); + } + + /// + /// Returns true if FacetFilters instances are equal + /// + /// Instance of FacetFilters to be compared + /// Boolean + public bool Equals(FacetFilters input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for FacetFilters + /// + public class FacetFiltersJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(FacetFilters).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return FacetFilters.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/FacetOrdering.cs b/algoliasearch/Recommend/Models/FacetOrdering.cs new file mode 100644 index 000000000..0024bb7f4 --- /dev/null +++ b/algoliasearch/Recommend/Models/FacetOrdering.cs @@ -0,0 +1,143 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Defines the ordering of facets (widgets). + /// + [DataContract(Name = "facetOrdering")] + public partial class FacetOrdering : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// facets. + /// Ordering of facet values within an individual facet.. + public FacetOrdering(Facets facets = default(Facets), Dictionary values = default(Dictionary)) + { + this.Facets = facets; + this.Values = values; + } + + /// + /// Gets or Sets Facets + /// + [DataMember(Name = "facets", EmitDefaultValue = false)] + public Facets Facets { get; set; } + + /// + /// Ordering of facet values within an individual facet. + /// + /// Ordering of facet values within an individual facet. + [DataMember(Name = "values", EmitDefaultValue = false)] + public Dictionary Values { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FacetOrdering {\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" Values: ").Append(Values).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FacetOrdering); + } + + /// + /// Returns true if FacetOrdering instances are equal + /// + /// Instance of FacetOrdering to be compared + /// Boolean + public bool Equals(FacetOrdering input) + { + if (input == null) + { + return false; + } + return + ( + this.Facets == input.Facets || + (this.Facets != null && + this.Facets.Equals(input.Facets)) + ) && + ( + this.Values == input.Values || + this.Values != null && + input.Values != null && + this.Values.SequenceEqual(input.Values) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + if (this.Values != null) + { + hashCode = (hashCode * 59) + this.Values.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/Facets.cs b/algoliasearch/Recommend/Models/Facets.cs new file mode 100644 index 000000000..0a144938e --- /dev/null +++ b/algoliasearch/Recommend/Models/Facets.cs @@ -0,0 +1,125 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Ordering of facets (widgets). + /// + [DataContract(Name = "facets")] + public partial class Facets : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Pinned order of facet lists.. + public Facets(List order = default(List)) + { + this.Order = order; + } + + /// + /// Pinned order of facet lists. + /// + /// Pinned order of facet lists. + [DataMember(Name = "order", EmitDefaultValue = false)] + public List Order { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Facets {\n"); + sb.Append(" Order: ").Append(Order).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Facets); + } + + /// + /// Returns true if Facets instances are equal + /// + /// Instance of Facets to be compared + /// Boolean + public bool Equals(Facets input) + { + if (input == null) + { + return false; + } + return + ( + this.Order == input.Order || + this.Order != null && + input.Order != null && + this.Order.SequenceEqual(input.Order) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Order != null) + { + hashCode = (hashCode * 59) + this.Order.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/FacetsStats.cs b/algoliasearch/Recommend/Models/FacetsStats.cs new file mode 100644 index 000000000..34d204393 --- /dev/null +++ b/algoliasearch/Recommend/Models/FacetsStats.cs @@ -0,0 +1,165 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// FacetsStats + /// + [DataContract(Name = "facetsStats")] + public partial class FacetsStats : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Minimum value in the results.. + /// Maximum value in the results.. + /// Average facet value in the results.. + /// Sum of all values in the results.. + public FacetsStats(double min = default(double), double max = default(double), double avg = default(double), double sum = default(double)) + { + this.Min = min; + this.Max = max; + this.Avg = avg; + this.Sum = sum; + } + + /// + /// Minimum value in the results. + /// + /// Minimum value in the results. + [DataMember(Name = "min", EmitDefaultValue = false)] + public double Min { get; set; } + + /// + /// Maximum value in the results. + /// + /// Maximum value in the results. + [DataMember(Name = "max", EmitDefaultValue = false)] + public double Max { get; set; } + + /// + /// Average facet value in the results. + /// + /// Average facet value in the results. + [DataMember(Name = "avg", EmitDefaultValue = false)] + public double Avg { get; set; } + + /// + /// Sum of all values in the results. + /// + /// Sum of all values in the results. + [DataMember(Name = "sum", EmitDefaultValue = false)] + public double Sum { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FacetsStats {\n"); + sb.Append(" Min: ").Append(Min).Append("\n"); + sb.Append(" Max: ").Append(Max).Append("\n"); + sb.Append(" Avg: ").Append(Avg).Append("\n"); + sb.Append(" Sum: ").Append(Sum).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FacetsStats); + } + + /// + /// Returns true if FacetsStats instances are equal + /// + /// Instance of FacetsStats to be compared + /// Boolean + public bool Equals(FacetsStats input) + { + if (input == null) + { + return false; + } + return + ( + this.Min == input.Min || + this.Min.Equals(input.Min) + ) && + ( + this.Max == input.Max || + this.Max.Equals(input.Max) + ) && + ( + this.Avg == input.Avg || + this.Avg.Equals(input.Avg) + ) && + ( + this.Sum == input.Sum || + this.Sum.Equals(input.Sum) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Min.GetHashCode(); + hashCode = (hashCode * 59) + this.Max.GetHashCode(); + hashCode = (hashCode * 59) + this.Avg.GetHashCode(); + hashCode = (hashCode * 59) + this.Sum.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/GetRecommendTaskResponse.cs b/algoliasearch/Recommend/Models/GetRecommendTaskResponse.cs new file mode 100644 index 000000000..9465a7a1a --- /dev/null +++ b/algoliasearch/Recommend/Models/GetRecommendTaskResponse.cs @@ -0,0 +1,124 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// GetRecommendTaskResponse + /// + [DataContract(Name = "getRecommendTaskResponse")] + public partial class GetRecommendTaskResponse : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Status + /// + [DataMember(Name = "status", IsRequired = true, EmitDefaultValue = true)] + public TaskStatus Status { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetRecommendTaskResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// status (required). + public GetRecommendTaskResponse(TaskStatus status = default(TaskStatus)) + { + this.Status = status; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetRecommendTaskResponse {\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetRecommendTaskResponse); + } + + /// + /// Returns true if GetRecommendTaskResponse instances are equal + /// + /// Instance of GetRecommendTaskResponse to be compared + /// Boolean + public bool Equals(GetRecommendTaskResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Status == input.Status || + this.Status.Equals(input.Status) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Status.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/GetRecommendationsParams.cs b/algoliasearch/Recommend/Models/GetRecommendationsParams.cs new file mode 100644 index 000000000..28b574f82 --- /dev/null +++ b/algoliasearch/Recommend/Models/GetRecommendationsParams.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Recommend parameters. + /// + [DataContract(Name = "getRecommendationsParams")] + public partial class GetRecommendationsParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetRecommendationsParams() { } + /// + /// Initializes a new instance of the class. + /// + /// Request parameters depend on the model (recommendations or trending). (required). + public GetRecommendationsParams(List requests = default(List)) + { + // to ensure "requests" is required (not null) + if (requests == null) + { + throw new ArgumentNullException("requests is a required property for GetRecommendationsParams and cannot be null"); + } + this.Requests = requests; + } + + /// + /// Request parameters depend on the model (recommendations or trending). + /// + /// Request parameters depend on the model (recommendations or trending). + [DataMember(Name = "requests", IsRequired = true, EmitDefaultValue = true)] + public List Requests { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetRecommendationsParams {\n"); + sb.Append(" Requests: ").Append(Requests).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetRecommendationsParams); + } + + /// + /// Returns true if GetRecommendationsParams instances are equal + /// + /// Instance of GetRecommendationsParams to be compared + /// Boolean + public bool Equals(GetRecommendationsParams input) + { + if (input == null) + { + return false; + } + return + ( + this.Requests == input.Requests || + this.Requests != null && + input.Requests != null && + this.Requests.SequenceEqual(input.Requests) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Requests != null) + { + hashCode = (hashCode * 59) + this.Requests.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/GetRecommendationsResponse.cs b/algoliasearch/Recommend/Models/GetRecommendationsResponse.cs new file mode 100644 index 000000000..ed78cf124 --- /dev/null +++ b/algoliasearch/Recommend/Models/GetRecommendationsResponse.cs @@ -0,0 +1,124 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// GetRecommendationsResponse + /// + [DataContract(Name = "getRecommendationsResponse")] + public partial class GetRecommendationsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// results. + public GetRecommendationsResponse(List results = default(List)) + { + this.Results = results; + } + + /// + /// Gets or Sets Results + /// + [DataMember(Name = "results", EmitDefaultValue = false)] + public List Results { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetRecommendationsResponse {\n"); + sb.Append(" Results: ").Append(Results).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetRecommendationsResponse); + } + + /// + /// Returns true if GetRecommendationsResponse instances are equal + /// + /// Instance of GetRecommendationsResponse to be compared + /// Boolean + public bool Equals(GetRecommendationsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Results == input.Results || + this.Results != null && + input.Results != null && + this.Results.SequenceEqual(input.Results) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Results != null) + { + hashCode = (hashCode * 59) + this.Results.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/HighlightResult.cs b/algoliasearch/Recommend/Models/HighlightResult.cs new file mode 100644 index 000000000..b53c4c01e --- /dev/null +++ b/algoliasearch/Recommend/Models/HighlightResult.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// HighlightResult + /// + [JsonConverter(typeof(HighlightResultJsonConverter))] + [DataContract(Name = "highlightResult")] + public partial class HighlightResult : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of HighlightResultOption. + public HighlightResult(HighlightResultOption actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of Dictionary<string, HighlightResultOption>. + public HighlightResult(Dictionary actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(Dictionary)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(HighlightResultOption)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: Dictionary, HighlightResultOption"); + } + } + } + + /// + /// Get the actual instance of `HighlightResultOption`. If the actual instance is not `HighlightResultOption`, + /// the InvalidClassException will be thrown + /// + /// An instance of HighlightResultOption + public HighlightResultOption GetterHighlightResultOption() + { + return (HighlightResultOption)this.ActualInstance; + } + + /// + /// Get the actual instance of `Dictionary<string, HighlightResultOption>`. If the actual instance is not `Dictionary<string, HighlightResultOption>`, + /// the InvalidClassException will be thrown + /// + /// An instance of Dictionary<string, HighlightResultOption> + public Dictionary GetterDictionary() + { + return (Dictionary)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class HighlightResult {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, HighlightResult.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of HighlightResult + /// + /// JSON string + /// An instance of HighlightResult + public static HighlightResult FromJson(string jsonString) + { + HighlightResult newHighlightResult = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newHighlightResult; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(Dictionary).GetProperty("AdditionalProperties") == null) + { + newHighlightResult = new HighlightResult(JsonConvert.DeserializeObject>(jsonString, HighlightResult.SerializerSettings)); + } + else + { + newHighlightResult = new HighlightResult(JsonConvert.DeserializeObject>(jsonString, HighlightResult.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("Dictionary"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into Dictionary: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(HighlightResultOption).GetProperty("AdditionalProperties") == null) + { + newHighlightResult = new HighlightResult(JsonConvert.DeserializeObject(jsonString, HighlightResult.SerializerSettings)); + } + else + { + newHighlightResult = new HighlightResult(JsonConvert.DeserializeObject(jsonString, HighlightResult.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("HighlightResultOption"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into HighlightResultOption: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newHighlightResult; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as HighlightResult); + } + + /// + /// Returns true if HighlightResult instances are equal + /// + /// Instance of HighlightResult to be compared + /// Boolean + public bool Equals(HighlightResult input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for HighlightResult + /// + public class HighlightResultJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(HighlightResult).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return HighlightResult.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/HighlightResultOption.cs b/algoliasearch/Recommend/Models/HighlightResultOption.cs new file mode 100644 index 000000000..3304b0c6a --- /dev/null +++ b/algoliasearch/Recommend/Models/HighlightResultOption.cs @@ -0,0 +1,188 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Show highlighted section and words matched on a query. + /// + [DataContract(Name = "highlightResultOption")] + public partial class HighlightResultOption : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets MatchLevel + /// + [DataMember(Name = "matchLevel", IsRequired = true, EmitDefaultValue = true)] + public MatchLevel MatchLevel { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected HighlightResultOption() { } + /// + /// Initializes a new instance of the class. + /// + /// Markup text with `facetQuery` matches highlighted. (required). + /// matchLevel (required). + /// List of words from the query that matched the object. (required). + /// Whether the entire attribute value is highlighted.. + public HighlightResultOption(string value = default(string), MatchLevel matchLevel = default(MatchLevel), List matchedWords = default(List), bool fullyHighlighted = default(bool)) + { + // to ensure "value" is required (not null) + if (value == null) + { + throw new ArgumentNullException("value is a required property for HighlightResultOption and cannot be null"); + } + this.Value = value; + this.MatchLevel = matchLevel; + // to ensure "matchedWords" is required (not null) + if (matchedWords == null) + { + throw new ArgumentNullException("matchedWords is a required property for HighlightResultOption and cannot be null"); + } + this.MatchedWords = matchedWords; + this.FullyHighlighted = fullyHighlighted; + } + + /// + /// Markup text with `facetQuery` matches highlighted. + /// + /// Markup text with `facetQuery` matches highlighted. + [DataMember(Name = "value", IsRequired = true, EmitDefaultValue = true)] + public string Value { get; set; } + + /// + /// List of words from the query that matched the object. + /// + /// List of words from the query that matched the object. + [DataMember(Name = "matchedWords", IsRequired = true, EmitDefaultValue = true)] + public List MatchedWords { get; set; } + + /// + /// Whether the entire attribute value is highlighted. + /// + /// Whether the entire attribute value is highlighted. + [DataMember(Name = "fullyHighlighted", EmitDefaultValue = true)] + public bool FullyHighlighted { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class HighlightResultOption {\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append(" MatchLevel: ").Append(MatchLevel).Append("\n"); + sb.Append(" MatchedWords: ").Append(MatchedWords).Append("\n"); + sb.Append(" FullyHighlighted: ").Append(FullyHighlighted).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as HighlightResultOption); + } + + /// + /// Returns true if HighlightResultOption instances are equal + /// + /// Instance of HighlightResultOption to be compared + /// Boolean + public bool Equals(HighlightResultOption input) + { + if (input == null) + { + return false; + } + return + ( + this.Value == input.Value || + (this.Value != null && + this.Value.Equals(input.Value)) + ) && + ( + this.MatchLevel == input.MatchLevel || + this.MatchLevel.Equals(input.MatchLevel) + ) && + ( + this.MatchedWords == input.MatchedWords || + this.MatchedWords != null && + input.MatchedWords != null && + this.MatchedWords.SequenceEqual(input.MatchedWords) + ) && + ( + this.FullyHighlighted == input.FullyHighlighted || + this.FullyHighlighted.Equals(input.FullyHighlighted) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Value != null) + { + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MatchLevel.GetHashCode(); + if (this.MatchedWords != null) + { + hashCode = (hashCode * 59) + this.MatchedWords.GetHashCode(); + } + hashCode = (hashCode * 59) + this.FullyHighlighted.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/IgnorePlurals.cs b/algoliasearch/Recommend/Models/IgnorePlurals.cs new file mode 100644 index 000000000..70ff2650d --- /dev/null +++ b/algoliasearch/Recommend/Models/IgnorePlurals.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Treats singular, plurals, and other forms of declensions as matching terms. `ignorePlurals` is used in conjunction with the `queryLanguages` setting. _list_: language ISO codes for which ignoring plurals should be enabled. This list will override any values that you may have set in `queryLanguages`. _true_: enables the ignore plurals feature, where singulars and plurals are considered equivalent (\"foot\" = \"feet\"). The languages supported here are either [every language](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/) (this is the default) or those set by `queryLanguages`. _false_: turns off the ignore plurals feature, so that singulars and plurals aren't considered to be the same (\"foot\" will not find \"feet\"). + /// + [JsonConverter(typeof(IgnorePluralsJsonConverter))] + [DataContract(Name = "ignorePlurals")] + public partial class IgnorePlurals : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<string>. + public IgnorePlurals(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of bool. + public IgnorePlurals(bool actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(bool)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, bool"); + } + } + } + + /// + /// Get the actual instance of `List<string>`. If the actual instance is not `List<string>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<string> + public List GetterListString() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `bool`. If the actual instance is not `bool`, + /// the InvalidClassException will be thrown + /// + /// An instance of bool + public bool GetterBool() + { + return (bool)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class IgnorePlurals {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, IgnorePlurals.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of IgnorePlurals + /// + /// JSON string + /// An instance of IgnorePlurals + public static IgnorePlurals FromJson(string jsonString) + { + IgnorePlurals newIgnorePlurals = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newIgnorePlurals; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newIgnorePlurals = new IgnorePlurals(JsonConvert.DeserializeObject>(jsonString, IgnorePlurals.SerializerSettings)); + } + else + { + newIgnorePlurals = new IgnorePlurals(JsonConvert.DeserializeObject>(jsonString, IgnorePlurals.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(bool).GetProperty("AdditionalProperties") == null) + { + newIgnorePlurals = new IgnorePlurals(JsonConvert.DeserializeObject(jsonString, IgnorePlurals.SerializerSettings)); + } + else + { + newIgnorePlurals = new IgnorePlurals(JsonConvert.DeserializeObject(jsonString, IgnorePlurals.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("bool"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into bool: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newIgnorePlurals; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as IgnorePlurals); + } + + /// + /// Returns true if IgnorePlurals instances are equal + /// + /// Instance of IgnorePlurals to be compared + /// Boolean + public bool Equals(IgnorePlurals input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for IgnorePlurals + /// + public class IgnorePluralsJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(IgnorePlurals).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return IgnorePlurals.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/IndexSettingsAsSearchParams.cs b/algoliasearch/Recommend/Models/IndexSettingsAsSearchParams.cs new file mode 100644 index 000000000..6fed6e36f --- /dev/null +++ b/algoliasearch/Recommend/Models/IndexSettingsAsSearchParams.cs @@ -0,0 +1,917 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// IndexSettingsAsSearchParams + /// + [DataContract(Name = "indexSettingsAsSearchParams")] + public partial class IndexSettingsAsSearchParams : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets QueryType + /// + [DataMember(Name = "queryType", EmitDefaultValue = false)] + public QueryType? QueryType { get; set; } + + /// + /// Gets or Sets RemoveWordsIfNoResults + /// + [DataMember(Name = "removeWordsIfNoResults", EmitDefaultValue = false)] + public RemoveWordsIfNoResults? RemoveWordsIfNoResults { get; set; } + + /// + /// Gets or Sets Mode + /// + [DataMember(Name = "mode", EmitDefaultValue = false)] + public Mode? Mode { get; set; } + + /// + /// Gets or Sets ExactOnSingleWordQuery + /// + [DataMember(Name = "exactOnSingleWordQuery", EmitDefaultValue = false)] + public ExactOnSingleWordQuery? ExactOnSingleWordQuery { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. . + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes.. + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/).. + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. . + /// Relevancy threshold below which less relevant results aren't included in the results. (default to 100). + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`).. + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. . + /// HTML string to insert before the highlighted parts in all highlight and snippet results. (default to "<em>"). + /// HTML string to insert after the highlighted parts in all highlight and snippet results. (default to "</em>"). + /// String used as an ellipsis indicator when a snippet is truncated. (default to "…"). + /// Restrict highlighting and snippeting to items that matched the query. (default to false). + /// Number of hits per page. (default to 20). + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 4). + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 8). + /// typoTolerance. + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. (default to true). + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/).. + /// ignorePlurals. + /// removeStopWords. + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). (default to ""). + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection.. + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. (default to true). + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. (default to true). + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. (default to false). + /// queryType. + /// removeWordsIfNoResults. + /// mode. + /// semanticSearch. + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). (default to false). + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query.. + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// exactOnSingleWordQuery. + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled.. + /// distinct. + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. (default to false). + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). (default to 1). + /// Attributes to include in the API response for search and browse queries.. + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). (default to 10). + /// Maximum number of facet values to return for each facet. (default to 100). + /// Controls how facet values are fetched. (default to "count"). + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. (default to false). + /// renderingContent. + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). (default to true). + /// reRankingApplyFilter. + public IndexSettingsAsSearchParams(List attributesForFaceting = default(List), List attributesToRetrieve = default(List), List ranking = default(List), List customRanking = default(List), int relevancyStrictness = 100, List attributesToHighlight = default(List), List attributesToSnippet = default(List), string highlightPreTag = @"", string highlightPostTag = @"", string snippetEllipsisText = @"…", bool restrictHighlightAndSnippetArrays = false, int hitsPerPage = 20, int minWordSizefor1Typo = 4, int minWordSizefor2Typos = 8, TypoTolerance typoTolerance = default(TypoTolerance), bool allowTyposOnNumericTokens = true, List disableTypoToleranceOnAttributes = default(List), IgnorePlurals ignorePlurals = default(IgnorePlurals), RemoveStopWords removeStopWords = default(RemoveStopWords), string keepDiacriticsOnCharacters = @"", List queryLanguages = default(List), bool decompoundQuery = true, bool enableRules = true, bool enablePersonalization = false, QueryType? queryType = default(QueryType?), RemoveWordsIfNoResults? removeWordsIfNoResults = default(RemoveWordsIfNoResults?), Mode? mode = default(Mode?), SemanticSearch semanticSearch = default(SemanticSearch), bool advancedSyntax = false, List optionalWords = default(List), List disableExactOnAttributes = default(List), ExactOnSingleWordQuery? exactOnSingleWordQuery = default(ExactOnSingleWordQuery?), List alternativesAsExact = default(List), List advancedSyntaxFeatures = default(List), Distinct distinct = default(Distinct), bool replaceSynonymsInHighlight = false, int minProximity = 1, List responseFields = default(List), int maxFacetHits = 10, int maxValuesPerFacet = 100, string sortFacetValuesBy = @"count", bool attributeCriteriaComputedByMinProximity = false, RenderingContent renderingContent = default(RenderingContent), bool enableReRanking = true, ReRankingApplyFilter reRankingApplyFilter = default(ReRankingApplyFilter)) + { + this.AttributesForFaceting = attributesForFaceting; + this.AttributesToRetrieve = attributesToRetrieve; + this.Ranking = ranking; + this.CustomRanking = customRanking; + this.RelevancyStrictness = relevancyStrictness; + this.AttributesToHighlight = attributesToHighlight; + this.AttributesToSnippet = attributesToSnippet; + // use default value if no "highlightPreTag" provided + this.HighlightPreTag = highlightPreTag ?? @""; + // use default value if no "highlightPostTag" provided + this.HighlightPostTag = highlightPostTag ?? @""; + // use default value if no "snippetEllipsisText" provided + this.SnippetEllipsisText = snippetEllipsisText ?? @"…"; + this.RestrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + this.HitsPerPage = hitsPerPage; + this.MinWordSizefor1Typo = minWordSizefor1Typo; + this.MinWordSizefor2Typos = minWordSizefor2Typos; + this.TypoTolerance = typoTolerance; + this.AllowTyposOnNumericTokens = allowTyposOnNumericTokens; + this.DisableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + this.IgnorePlurals = ignorePlurals; + this.RemoveStopWords = removeStopWords; + // use default value if no "keepDiacriticsOnCharacters" provided + this.KeepDiacriticsOnCharacters = keepDiacriticsOnCharacters ?? @""; + this.QueryLanguages = queryLanguages; + this.DecompoundQuery = decompoundQuery; + this.EnableRules = enableRules; + this.EnablePersonalization = enablePersonalization; + this.QueryType = queryType; + this.RemoveWordsIfNoResults = removeWordsIfNoResults; + this.Mode = mode; + this.SemanticSearch = semanticSearch; + this.AdvancedSyntax = advancedSyntax; + this.OptionalWords = optionalWords; + this.DisableExactOnAttributes = disableExactOnAttributes; + this.ExactOnSingleWordQuery = exactOnSingleWordQuery; + this.AlternativesAsExact = alternativesAsExact; + this.AdvancedSyntaxFeatures = advancedSyntaxFeatures; + this.Distinct = distinct; + this.ReplaceSynonymsInHighlight = replaceSynonymsInHighlight; + this.MinProximity = minProximity; + this.ResponseFields = responseFields; + this.MaxFacetHits = maxFacetHits; + this.MaxValuesPerFacet = maxValuesPerFacet; + // use default value if no "sortFacetValuesBy" provided + this.SortFacetValuesBy = sortFacetValuesBy ?? @"count"; + this.AttributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + this.RenderingContent = renderingContent; + this.EnableReRanking = enableReRanking; + this.ReRankingApplyFilter = reRankingApplyFilter; + } + + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + [DataMember(Name = "attributesForFaceting", EmitDefaultValue = false)] + public List AttributesForFaceting { get; set; } + + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + [DataMember(Name = "attributesToRetrieve", EmitDefaultValue = false)] + public List AttributesToRetrieve { get; set; } + + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + [DataMember(Name = "ranking", EmitDefaultValue = false)] + public List Ranking { get; set; } + + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + [DataMember(Name = "customRanking", EmitDefaultValue = false)] + public List CustomRanking { get; set; } + + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + [DataMember(Name = "relevancyStrictness", EmitDefaultValue = false)] + public int RelevancyStrictness { get; set; } + + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + [DataMember(Name = "attributesToHighlight", EmitDefaultValue = false)] + public List AttributesToHighlight { get; set; } + + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + [DataMember(Name = "attributesToSnippet", EmitDefaultValue = false)] + public List AttributesToSnippet { get; set; } + + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPreTag", EmitDefaultValue = false)] + public string HighlightPreTag { get; set; } + + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPostTag", EmitDefaultValue = false)] + public string HighlightPostTag { get; set; } + + /// + /// String used as an ellipsis indicator when a snippet is truncated. + /// + /// String used as an ellipsis indicator when a snippet is truncated. + [DataMember(Name = "snippetEllipsisText", EmitDefaultValue = false)] + public string SnippetEllipsisText { get; set; } + + /// + /// Restrict highlighting and snippeting to items that matched the query. + /// + /// Restrict highlighting and snippeting to items that matched the query. + [DataMember(Name = "restrictHighlightAndSnippetArrays", EmitDefaultValue = true)] + public bool RestrictHighlightAndSnippetArrays { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", EmitDefaultValue = false)] + public int HitsPerPage { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor1Typo", EmitDefaultValue = false)] + public int MinWordSizefor1Typo { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor2Typos", EmitDefaultValue = false)] + public int MinWordSizefor2Typos { get; set; } + + /// + /// Gets or Sets TypoTolerance + /// + [DataMember(Name = "typoTolerance", EmitDefaultValue = false)] + public TypoTolerance TypoTolerance { get; set; } + + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + [DataMember(Name = "allowTyposOnNumericTokens", EmitDefaultValue = true)] + public bool AllowTyposOnNumericTokens { get; set; } + + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + [DataMember(Name = "disableTypoToleranceOnAttributes", EmitDefaultValue = false)] + public List DisableTypoToleranceOnAttributes { get; set; } + + /// + /// Gets or Sets IgnorePlurals + /// + [DataMember(Name = "ignorePlurals", EmitDefaultValue = false)] + public IgnorePlurals IgnorePlurals { get; set; } + + /// + /// Gets or Sets RemoveStopWords + /// + [DataMember(Name = "removeStopWords", EmitDefaultValue = false)] + public RemoveStopWords RemoveStopWords { get; set; } + + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + [DataMember(Name = "keepDiacriticsOnCharacters", EmitDefaultValue = false)] + public string KeepDiacriticsOnCharacters { get; set; } + + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + [DataMember(Name = "queryLanguages", EmitDefaultValue = false)] + public List QueryLanguages { get; set; } + + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + [DataMember(Name = "decompoundQuery", EmitDefaultValue = true)] + public bool DecompoundQuery { get; set; } + + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + [DataMember(Name = "enableRules", EmitDefaultValue = true)] + public bool EnableRules { get; set; } + + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + [DataMember(Name = "enablePersonalization", EmitDefaultValue = true)] + public bool EnablePersonalization { get; set; } + + /// + /// Gets or Sets SemanticSearch + /// + [DataMember(Name = "semanticSearch", EmitDefaultValue = false)] + public SemanticSearch SemanticSearch { get; set; } + + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + [DataMember(Name = "advancedSyntax", EmitDefaultValue = true)] + public bool AdvancedSyntax { get; set; } + + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + [DataMember(Name = "optionalWords", EmitDefaultValue = false)] + public List OptionalWords { get; set; } + + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "disableExactOnAttributes", EmitDefaultValue = false)] + public List DisableExactOnAttributes { get; set; } + + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "alternativesAsExact", EmitDefaultValue = false)] + public List AlternativesAsExact { get; set; } + + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + [DataMember(Name = "advancedSyntaxFeatures", EmitDefaultValue = false)] + public List AdvancedSyntaxFeatures { get; set; } + + /// + /// Gets or Sets Distinct + /// + [DataMember(Name = "distinct", EmitDefaultValue = false)] + public Distinct Distinct { get; set; } + + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + [DataMember(Name = "replaceSynonymsInHighlight", EmitDefaultValue = true)] + public bool ReplaceSynonymsInHighlight { get; set; } + + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + [DataMember(Name = "minProximity", EmitDefaultValue = false)] + public int MinProximity { get; set; } + + /// + /// Attributes to include in the API response for search and browse queries. + /// + /// Attributes to include in the API response for search and browse queries. + [DataMember(Name = "responseFields", EmitDefaultValue = false)] + public List ResponseFields { get; set; } + + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + [DataMember(Name = "maxFacetHits", EmitDefaultValue = false)] + public int MaxFacetHits { get; set; } + + /// + /// Maximum number of facet values to return for each facet. + /// + /// Maximum number of facet values to return for each facet. + [DataMember(Name = "maxValuesPerFacet", EmitDefaultValue = false)] + public int MaxValuesPerFacet { get; set; } + + /// + /// Controls how facet values are fetched. + /// + /// Controls how facet values are fetched. + [DataMember(Name = "sortFacetValuesBy", EmitDefaultValue = false)] + public string SortFacetValuesBy { get; set; } + + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + [DataMember(Name = "attributeCriteriaComputedByMinProximity", EmitDefaultValue = true)] + public bool AttributeCriteriaComputedByMinProximity { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + [DataMember(Name = "enableReRanking", EmitDefaultValue = true)] + public bool EnableReRanking { get; set; } + + /// + /// Gets or Sets ReRankingApplyFilter + /// + [DataMember(Name = "reRankingApplyFilter", EmitDefaultValue = true)] + public ReRankingApplyFilter ReRankingApplyFilter { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class IndexSettingsAsSearchParams {\n"); + sb.Append(" AttributesForFaceting: ").Append(AttributesForFaceting).Append("\n"); + sb.Append(" AttributesToRetrieve: ").Append(AttributesToRetrieve).Append("\n"); + sb.Append(" Ranking: ").Append(Ranking).Append("\n"); + sb.Append(" CustomRanking: ").Append(CustomRanking).Append("\n"); + sb.Append(" RelevancyStrictness: ").Append(RelevancyStrictness).Append("\n"); + sb.Append(" AttributesToHighlight: ").Append(AttributesToHighlight).Append("\n"); + sb.Append(" AttributesToSnippet: ").Append(AttributesToSnippet).Append("\n"); + sb.Append(" HighlightPreTag: ").Append(HighlightPreTag).Append("\n"); + sb.Append(" HighlightPostTag: ").Append(HighlightPostTag).Append("\n"); + sb.Append(" SnippetEllipsisText: ").Append(SnippetEllipsisText).Append("\n"); + sb.Append(" RestrictHighlightAndSnippetArrays: ").Append(RestrictHighlightAndSnippetArrays).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" MinWordSizefor1Typo: ").Append(MinWordSizefor1Typo).Append("\n"); + sb.Append(" MinWordSizefor2Typos: ").Append(MinWordSizefor2Typos).Append("\n"); + sb.Append(" TypoTolerance: ").Append(TypoTolerance).Append("\n"); + sb.Append(" AllowTyposOnNumericTokens: ").Append(AllowTyposOnNumericTokens).Append("\n"); + sb.Append(" DisableTypoToleranceOnAttributes: ").Append(DisableTypoToleranceOnAttributes).Append("\n"); + sb.Append(" IgnorePlurals: ").Append(IgnorePlurals).Append("\n"); + sb.Append(" RemoveStopWords: ").Append(RemoveStopWords).Append("\n"); + sb.Append(" KeepDiacriticsOnCharacters: ").Append(KeepDiacriticsOnCharacters).Append("\n"); + sb.Append(" QueryLanguages: ").Append(QueryLanguages).Append("\n"); + sb.Append(" DecompoundQuery: ").Append(DecompoundQuery).Append("\n"); + sb.Append(" EnableRules: ").Append(EnableRules).Append("\n"); + sb.Append(" EnablePersonalization: ").Append(EnablePersonalization).Append("\n"); + sb.Append(" QueryType: ").Append(QueryType).Append("\n"); + sb.Append(" RemoveWordsIfNoResults: ").Append(RemoveWordsIfNoResults).Append("\n"); + sb.Append(" Mode: ").Append(Mode).Append("\n"); + sb.Append(" SemanticSearch: ").Append(SemanticSearch).Append("\n"); + sb.Append(" AdvancedSyntax: ").Append(AdvancedSyntax).Append("\n"); + sb.Append(" OptionalWords: ").Append(OptionalWords).Append("\n"); + sb.Append(" DisableExactOnAttributes: ").Append(DisableExactOnAttributes).Append("\n"); + sb.Append(" ExactOnSingleWordQuery: ").Append(ExactOnSingleWordQuery).Append("\n"); + sb.Append(" AlternativesAsExact: ").Append(AlternativesAsExact).Append("\n"); + sb.Append(" AdvancedSyntaxFeatures: ").Append(AdvancedSyntaxFeatures).Append("\n"); + sb.Append(" Distinct: ").Append(Distinct).Append("\n"); + sb.Append(" ReplaceSynonymsInHighlight: ").Append(ReplaceSynonymsInHighlight).Append("\n"); + sb.Append(" MinProximity: ").Append(MinProximity).Append("\n"); + sb.Append(" ResponseFields: ").Append(ResponseFields).Append("\n"); + sb.Append(" MaxFacetHits: ").Append(MaxFacetHits).Append("\n"); + sb.Append(" MaxValuesPerFacet: ").Append(MaxValuesPerFacet).Append("\n"); + sb.Append(" SortFacetValuesBy: ").Append(SortFacetValuesBy).Append("\n"); + sb.Append(" AttributeCriteriaComputedByMinProximity: ").Append(AttributeCriteriaComputedByMinProximity).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append(" EnableReRanking: ").Append(EnableReRanking).Append("\n"); + sb.Append(" ReRankingApplyFilter: ").Append(ReRankingApplyFilter).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as IndexSettingsAsSearchParams); + } + + /// + /// Returns true if IndexSettingsAsSearchParams instances are equal + /// + /// Instance of IndexSettingsAsSearchParams to be compared + /// Boolean + public bool Equals(IndexSettingsAsSearchParams input) + { + if (input == null) + { + return false; + } + return + ( + this.AttributesForFaceting == input.AttributesForFaceting || + this.AttributesForFaceting != null && + input.AttributesForFaceting != null && + this.AttributesForFaceting.SequenceEqual(input.AttributesForFaceting) + ) && + ( + this.AttributesToRetrieve == input.AttributesToRetrieve || + this.AttributesToRetrieve != null && + input.AttributesToRetrieve != null && + this.AttributesToRetrieve.SequenceEqual(input.AttributesToRetrieve) + ) && + ( + this.Ranking == input.Ranking || + this.Ranking != null && + input.Ranking != null && + this.Ranking.SequenceEqual(input.Ranking) + ) && + ( + this.CustomRanking == input.CustomRanking || + this.CustomRanking != null && + input.CustomRanking != null && + this.CustomRanking.SequenceEqual(input.CustomRanking) + ) && + ( + this.RelevancyStrictness == input.RelevancyStrictness || + this.RelevancyStrictness.Equals(input.RelevancyStrictness) + ) && + ( + this.AttributesToHighlight == input.AttributesToHighlight || + this.AttributesToHighlight != null && + input.AttributesToHighlight != null && + this.AttributesToHighlight.SequenceEqual(input.AttributesToHighlight) + ) && + ( + this.AttributesToSnippet == input.AttributesToSnippet || + this.AttributesToSnippet != null && + input.AttributesToSnippet != null && + this.AttributesToSnippet.SequenceEqual(input.AttributesToSnippet) + ) && + ( + this.HighlightPreTag == input.HighlightPreTag || + (this.HighlightPreTag != null && + this.HighlightPreTag.Equals(input.HighlightPreTag)) + ) && + ( + this.HighlightPostTag == input.HighlightPostTag || + (this.HighlightPostTag != null && + this.HighlightPostTag.Equals(input.HighlightPostTag)) + ) && + ( + this.SnippetEllipsisText == input.SnippetEllipsisText || + (this.SnippetEllipsisText != null && + this.SnippetEllipsisText.Equals(input.SnippetEllipsisText)) + ) && + ( + this.RestrictHighlightAndSnippetArrays == input.RestrictHighlightAndSnippetArrays || + this.RestrictHighlightAndSnippetArrays.Equals(input.RestrictHighlightAndSnippetArrays) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && + ( + this.MinWordSizefor1Typo == input.MinWordSizefor1Typo || + this.MinWordSizefor1Typo.Equals(input.MinWordSizefor1Typo) + ) && + ( + this.MinWordSizefor2Typos == input.MinWordSizefor2Typos || + this.MinWordSizefor2Typos.Equals(input.MinWordSizefor2Typos) + ) && + ( + this.TypoTolerance == input.TypoTolerance || + (this.TypoTolerance != null && + this.TypoTolerance.Equals(input.TypoTolerance)) + ) && + ( + this.AllowTyposOnNumericTokens == input.AllowTyposOnNumericTokens || + this.AllowTyposOnNumericTokens.Equals(input.AllowTyposOnNumericTokens) + ) && + ( + this.DisableTypoToleranceOnAttributes == input.DisableTypoToleranceOnAttributes || + this.DisableTypoToleranceOnAttributes != null && + input.DisableTypoToleranceOnAttributes != null && + this.DisableTypoToleranceOnAttributes.SequenceEqual(input.DisableTypoToleranceOnAttributes) + ) && + ( + this.IgnorePlurals == input.IgnorePlurals || + (this.IgnorePlurals != null && + this.IgnorePlurals.Equals(input.IgnorePlurals)) + ) && + ( + this.RemoveStopWords == input.RemoveStopWords || + (this.RemoveStopWords != null && + this.RemoveStopWords.Equals(input.RemoveStopWords)) + ) && + ( + this.KeepDiacriticsOnCharacters == input.KeepDiacriticsOnCharacters || + (this.KeepDiacriticsOnCharacters != null && + this.KeepDiacriticsOnCharacters.Equals(input.KeepDiacriticsOnCharacters)) + ) && + ( + this.QueryLanguages == input.QueryLanguages || + this.QueryLanguages != null && + input.QueryLanguages != null && + this.QueryLanguages.SequenceEqual(input.QueryLanguages) + ) && + ( + this.DecompoundQuery == input.DecompoundQuery || + this.DecompoundQuery.Equals(input.DecompoundQuery) + ) && + ( + this.EnableRules == input.EnableRules || + this.EnableRules.Equals(input.EnableRules) + ) && + ( + this.EnablePersonalization == input.EnablePersonalization || + this.EnablePersonalization.Equals(input.EnablePersonalization) + ) && + ( + this.QueryType == input.QueryType || + this.QueryType.Equals(input.QueryType) + ) && + ( + this.RemoveWordsIfNoResults == input.RemoveWordsIfNoResults || + this.RemoveWordsIfNoResults.Equals(input.RemoveWordsIfNoResults) + ) && + ( + this.Mode == input.Mode || + this.Mode.Equals(input.Mode) + ) && + ( + this.SemanticSearch == input.SemanticSearch || + (this.SemanticSearch != null && + this.SemanticSearch.Equals(input.SemanticSearch)) + ) && + ( + this.AdvancedSyntax == input.AdvancedSyntax || + this.AdvancedSyntax.Equals(input.AdvancedSyntax) + ) && + ( + this.OptionalWords == input.OptionalWords || + this.OptionalWords != null && + input.OptionalWords != null && + this.OptionalWords.SequenceEqual(input.OptionalWords) + ) && + ( + this.DisableExactOnAttributes == input.DisableExactOnAttributes || + this.DisableExactOnAttributes != null && + input.DisableExactOnAttributes != null && + this.DisableExactOnAttributes.SequenceEqual(input.DisableExactOnAttributes) + ) && + ( + this.ExactOnSingleWordQuery == input.ExactOnSingleWordQuery || + this.ExactOnSingleWordQuery.Equals(input.ExactOnSingleWordQuery) + ) && + ( + this.AlternativesAsExact == input.AlternativesAsExact || + this.AlternativesAsExact != null && + input.AlternativesAsExact != null && + this.AlternativesAsExact.SequenceEqual(input.AlternativesAsExact) + ) && + ( + this.AdvancedSyntaxFeatures == input.AdvancedSyntaxFeatures || + this.AdvancedSyntaxFeatures != null && + input.AdvancedSyntaxFeatures != null && + this.AdvancedSyntaxFeatures.SequenceEqual(input.AdvancedSyntaxFeatures) + ) && + ( + this.Distinct == input.Distinct || + (this.Distinct != null && + this.Distinct.Equals(input.Distinct)) + ) && + ( + this.ReplaceSynonymsInHighlight == input.ReplaceSynonymsInHighlight || + this.ReplaceSynonymsInHighlight.Equals(input.ReplaceSynonymsInHighlight) + ) && + ( + this.MinProximity == input.MinProximity || + this.MinProximity.Equals(input.MinProximity) + ) && + ( + this.ResponseFields == input.ResponseFields || + this.ResponseFields != null && + input.ResponseFields != null && + this.ResponseFields.SequenceEqual(input.ResponseFields) + ) && + ( + this.MaxFacetHits == input.MaxFacetHits || + this.MaxFacetHits.Equals(input.MaxFacetHits) + ) && + ( + this.MaxValuesPerFacet == input.MaxValuesPerFacet || + this.MaxValuesPerFacet.Equals(input.MaxValuesPerFacet) + ) && + ( + this.SortFacetValuesBy == input.SortFacetValuesBy || + (this.SortFacetValuesBy != null && + this.SortFacetValuesBy.Equals(input.SortFacetValuesBy)) + ) && + ( + this.AttributeCriteriaComputedByMinProximity == input.AttributeCriteriaComputedByMinProximity || + this.AttributeCriteriaComputedByMinProximity.Equals(input.AttributeCriteriaComputedByMinProximity) + ) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ) && + ( + this.EnableReRanking == input.EnableReRanking || + this.EnableReRanking.Equals(input.EnableReRanking) + ) && + ( + this.ReRankingApplyFilter == input.ReRankingApplyFilter || + (this.ReRankingApplyFilter != null && + this.ReRankingApplyFilter.Equals(input.ReRankingApplyFilter)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AttributesForFaceting != null) + { + hashCode = (hashCode * 59) + this.AttributesForFaceting.GetHashCode(); + } + if (this.AttributesToRetrieve != null) + { + hashCode = (hashCode * 59) + this.AttributesToRetrieve.GetHashCode(); + } + if (this.Ranking != null) + { + hashCode = (hashCode * 59) + this.Ranking.GetHashCode(); + } + if (this.CustomRanking != null) + { + hashCode = (hashCode * 59) + this.CustomRanking.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RelevancyStrictness.GetHashCode(); + if (this.AttributesToHighlight != null) + { + hashCode = (hashCode * 59) + this.AttributesToHighlight.GetHashCode(); + } + if (this.AttributesToSnippet != null) + { + hashCode = (hashCode * 59) + this.AttributesToSnippet.GetHashCode(); + } + if (this.HighlightPreTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPreTag.GetHashCode(); + } + if (this.HighlightPostTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPostTag.GetHashCode(); + } + if (this.SnippetEllipsisText != null) + { + hashCode = (hashCode * 59) + this.SnippetEllipsisText.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RestrictHighlightAndSnippetArrays.GetHashCode(); + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor1Typo.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor2Typos.GetHashCode(); + if (this.TypoTolerance != null) + { + hashCode = (hashCode * 59) + this.TypoTolerance.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AllowTyposOnNumericTokens.GetHashCode(); + if (this.DisableTypoToleranceOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableTypoToleranceOnAttributes.GetHashCode(); + } + if (this.IgnorePlurals != null) + { + hashCode = (hashCode * 59) + this.IgnorePlurals.GetHashCode(); + } + if (this.RemoveStopWords != null) + { + hashCode = (hashCode * 59) + this.RemoveStopWords.GetHashCode(); + } + if (this.KeepDiacriticsOnCharacters != null) + { + hashCode = (hashCode * 59) + this.KeepDiacriticsOnCharacters.GetHashCode(); + } + if (this.QueryLanguages != null) + { + hashCode = (hashCode * 59) + this.QueryLanguages.GetHashCode(); + } + hashCode = (hashCode * 59) + this.DecompoundQuery.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableRules.GetHashCode(); + hashCode = (hashCode * 59) + this.EnablePersonalization.GetHashCode(); + hashCode = (hashCode * 59) + this.QueryType.GetHashCode(); + hashCode = (hashCode * 59) + this.RemoveWordsIfNoResults.GetHashCode(); + hashCode = (hashCode * 59) + this.Mode.GetHashCode(); + if (this.SemanticSearch != null) + { + hashCode = (hashCode * 59) + this.SemanticSearch.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AdvancedSyntax.GetHashCode(); + if (this.OptionalWords != null) + { + hashCode = (hashCode * 59) + this.OptionalWords.GetHashCode(); + } + if (this.DisableExactOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableExactOnAttributes.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ExactOnSingleWordQuery.GetHashCode(); + if (this.AlternativesAsExact != null) + { + hashCode = (hashCode * 59) + this.AlternativesAsExact.GetHashCode(); + } + if (this.AdvancedSyntaxFeatures != null) + { + hashCode = (hashCode * 59) + this.AdvancedSyntaxFeatures.GetHashCode(); + } + if (this.Distinct != null) + { + hashCode = (hashCode * 59) + this.Distinct.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ReplaceSynonymsInHighlight.GetHashCode(); + hashCode = (hashCode * 59) + this.MinProximity.GetHashCode(); + if (this.ResponseFields != null) + { + hashCode = (hashCode * 59) + this.ResponseFields.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MaxFacetHits.GetHashCode(); + hashCode = (hashCode * 59) + this.MaxValuesPerFacet.GetHashCode(); + if (this.SortFacetValuesBy != null) + { + hashCode = (hashCode * 59) + this.SortFacetValuesBy.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AttributeCriteriaComputedByMinProximity.GetHashCode(); + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EnableReRanking.GetHashCode(); + if (this.ReRankingApplyFilter != null) + { + hashCode = (hashCode * 59) + this.ReRankingApplyFilter.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + // MinProximity (int) maximum + if (this.MinProximity > (int)7) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value less than or equal to 7.", new[] { "MinProximity" }); + } + + // MinProximity (int) minimum + if (this.MinProximity < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value greater than or equal to 1.", new[] { "MinProximity" }); + } + + // MaxFacetHits (int) maximum + if (this.MaxFacetHits > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MaxFacetHits, must be a value less than or equal to 100.", new[] { "MaxFacetHits" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/MatchLevel.cs b/algoliasearch/Recommend/Models/MatchLevel.cs new file mode 100644 index 000000000..d8f9644f7 --- /dev/null +++ b/algoliasearch/Recommend/Models/MatchLevel.cs @@ -0,0 +1,49 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Indicates how well the attribute matched the search query. + /// + /// Indicates how well the attribute matched the search query. + [JsonConverter(typeof(StringEnumConverter))] + public enum MatchLevel + { + /// + /// Enum None for value: none + /// + [EnumMember(Value = "none")] + None = 1, + + /// + /// Enum Partial for value: partial + /// + [EnumMember(Value = "partial")] + Partial = 2, + + /// + /// Enum Full for value: full + /// + [EnumMember(Value = "full")] + Full = 3 + } + +} diff --git a/algoliasearch/Recommend/Models/MatchedGeoLocation.cs b/algoliasearch/Recommend/Models/MatchedGeoLocation.cs new file mode 100644 index 000000000..17b4619b4 --- /dev/null +++ b/algoliasearch/Recommend/Models/MatchedGeoLocation.cs @@ -0,0 +1,150 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// MatchedGeoLocation + /// + [DataContract(Name = "matchedGeoLocation")] + public partial class MatchedGeoLocation : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Latitude of the matched location.. + /// Longitude of the matched location.. + /// Distance between the matched location and the search location (in meters).. + public MatchedGeoLocation(double lat = default(double), double lng = default(double), int distance = default(int)) + { + this.Lat = lat; + this.Lng = lng; + this.Distance = distance; + } + + /// + /// Latitude of the matched location. + /// + /// Latitude of the matched location. + [DataMember(Name = "lat", EmitDefaultValue = false)] + public double Lat { get; set; } + + /// + /// Longitude of the matched location. + /// + /// Longitude of the matched location. + [DataMember(Name = "lng", EmitDefaultValue = false)] + public double Lng { get; set; } + + /// + /// Distance between the matched location and the search location (in meters). + /// + /// Distance between the matched location and the search location (in meters). + [DataMember(Name = "distance", EmitDefaultValue = false)] + public int Distance { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MatchedGeoLocation {\n"); + sb.Append(" Lat: ").Append(Lat).Append("\n"); + sb.Append(" Lng: ").Append(Lng).Append("\n"); + sb.Append(" Distance: ").Append(Distance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as MatchedGeoLocation); + } + + /// + /// Returns true if MatchedGeoLocation instances are equal + /// + /// Instance of MatchedGeoLocation to be compared + /// Boolean + public bool Equals(MatchedGeoLocation input) + { + if (input == null) + { + return false; + } + return + ( + this.Lat == input.Lat || + this.Lat.Equals(input.Lat) + ) && + ( + this.Lng == input.Lng || + this.Lng.Equals(input.Lng) + ) && + ( + this.Distance == input.Distance || + this.Distance.Equals(input.Distance) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Lat.GetHashCode(); + hashCode = (hashCode * 59) + this.Lng.GetHashCode(); + hashCode = (hashCode * 59) + this.Distance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/MixedSearchFilters.cs b/algoliasearch/Recommend/Models/MixedSearchFilters.cs new file mode 100644 index 000000000..c79fee2c6 --- /dev/null +++ b/algoliasearch/Recommend/Models/MixedSearchFilters.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// MixedSearchFilters + /// + [JsonConverter(typeof(MixedSearchFiltersJsonConverter))] + [DataContract(Name = "mixedSearchFilters")] + public partial class MixedSearchFilters : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<string>. + public MixedSearchFilters(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public MixedSearchFilters(string actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, string"); + } + } + } + + /// + /// Get the actual instance of `List<string>`. If the actual instance is not `List<string>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<string> + public List GetterListString() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class MixedSearchFilters {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, MixedSearchFilters.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of MixedSearchFilters + /// + /// JSON string + /// An instance of MixedSearchFilters + public static MixedSearchFilters FromJson(string jsonString) + { + MixedSearchFilters newMixedSearchFilters = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newMixedSearchFilters; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newMixedSearchFilters = new MixedSearchFilters(JsonConvert.DeserializeObject>(jsonString, MixedSearchFilters.SerializerSettings)); + } + else + { + newMixedSearchFilters = new MixedSearchFilters(JsonConvert.DeserializeObject>(jsonString, MixedSearchFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newMixedSearchFilters = new MixedSearchFilters(JsonConvert.DeserializeObject(jsonString, MixedSearchFilters.SerializerSettings)); + } + else + { + newMixedSearchFilters = new MixedSearchFilters(JsonConvert.DeserializeObject(jsonString, MixedSearchFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newMixedSearchFilters; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as MixedSearchFilters); + } + + /// + /// Returns true if MixedSearchFilters instances are equal + /// + /// Instance of MixedSearchFilters to be compared + /// Boolean + public bool Equals(MixedSearchFilters input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for MixedSearchFilters + /// + public class MixedSearchFiltersJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(MixedSearchFilters).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return MixedSearchFilters.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/Mode.cs b/algoliasearch/Recommend/Models/Mode.cs new file mode 100644 index 000000000..12c6b9193 --- /dev/null +++ b/algoliasearch/Recommend/Models/Mode.cs @@ -0,0 +1,43 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Search mode the index will use to query for results. + /// + /// Search mode the index will use to query for results. + [JsonConverter(typeof(StringEnumConverter))] + public enum Mode + { + /// + /// Enum NeuralSearch for value: neuralSearch + /// + [EnumMember(Value = "neuralSearch")] + NeuralSearch = 1, + + /// + /// Enum KeywordSearch for value: keywordSearch + /// + [EnumMember(Value = "keywordSearch")] + KeywordSearch = 2 + } + +} diff --git a/algoliasearch/Recommend/Models/NumericFilters.cs b/algoliasearch/Recommend/Models/NumericFilters.cs new file mode 100644 index 000000000..3ca17a686 --- /dev/null +++ b/algoliasearch/Recommend/Models/NumericFilters.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// [Filter on numeric attributes](https://www.algolia.com/doc/api-reference/api-parameters/numericFilters/). + /// + [JsonConverter(typeof(NumericFiltersJsonConverter))] + [DataContract(Name = "numericFilters")] + public partial class NumericFilters : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<MixedSearchFilters>. + public NumericFilters(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public NumericFilters(string actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, string"); + } + } + } + + /// + /// Get the actual instance of `List<MixedSearchFilters>`. If the actual instance is not `List<MixedSearchFilters>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<MixedSearchFilters> + public List GetterList() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class NumericFilters {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, NumericFilters.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of NumericFilters + /// + /// JSON string + /// An instance of NumericFilters + public static NumericFilters FromJson(string jsonString) + { + NumericFilters newNumericFilters = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newNumericFilters; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newNumericFilters = new NumericFilters(JsonConvert.DeserializeObject>(jsonString, NumericFilters.SerializerSettings)); + } + else + { + newNumericFilters = new NumericFilters(JsonConvert.DeserializeObject>(jsonString, NumericFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newNumericFilters = new NumericFilters(JsonConvert.DeserializeObject(jsonString, NumericFilters.SerializerSettings)); + } + else + { + newNumericFilters = new NumericFilters(JsonConvert.DeserializeObject(jsonString, NumericFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newNumericFilters; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as NumericFilters); + } + + /// + /// Returns true if NumericFilters instances are equal + /// + /// Instance of NumericFilters to be compared + /// Boolean + public bool Equals(NumericFilters input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for NumericFilters + /// + public class NumericFiltersJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(NumericFilters).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return NumericFilters.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/OptionalFilters.cs b/algoliasearch/Recommend/Models/OptionalFilters.cs new file mode 100644 index 000000000..bf35c30ef --- /dev/null +++ b/algoliasearch/Recommend/Models/OptionalFilters.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Create filters to boost or demote records. Records that match the filter are ranked higher for positive and lower for negative optional filters. In contrast to regular filters, records that don't match the optional filter are still included in the results, only their ranking is affected. + /// + [JsonConverter(typeof(OptionalFiltersJsonConverter))] + [DataContract(Name = "optionalFilters")] + public partial class OptionalFilters : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<MixedSearchFilters>. + public OptionalFilters(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public OptionalFilters(string actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, string"); + } + } + } + + /// + /// Get the actual instance of `List<MixedSearchFilters>`. If the actual instance is not `List<MixedSearchFilters>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<MixedSearchFilters> + public List GetterList() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class OptionalFilters {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, OptionalFilters.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of OptionalFilters + /// + /// JSON string + /// An instance of OptionalFilters + public static OptionalFilters FromJson(string jsonString) + { + OptionalFilters newOptionalFilters = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newOptionalFilters; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newOptionalFilters = new OptionalFilters(JsonConvert.DeserializeObject>(jsonString, OptionalFilters.SerializerSettings)); + } + else + { + newOptionalFilters = new OptionalFilters(JsonConvert.DeserializeObject>(jsonString, OptionalFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newOptionalFilters = new OptionalFilters(JsonConvert.DeserializeObject(jsonString, OptionalFilters.SerializerSettings)); + } + else + { + newOptionalFilters = new OptionalFilters(JsonConvert.DeserializeObject(jsonString, OptionalFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newOptionalFilters; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as OptionalFilters); + } + + /// + /// Returns true if OptionalFilters instances are equal + /// + /// Instance of OptionalFilters to be compared + /// Boolean + public bool Equals(OptionalFilters input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for OptionalFilters + /// + public class OptionalFiltersJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(OptionalFilters).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return OptionalFilters.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/Params.cs b/algoliasearch/Recommend/Models/Params.cs new file mode 100644 index 000000000..3a6201b6b --- /dev/null +++ b/algoliasearch/Recommend/Models/Params.cs @@ -0,0 +1,177 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Additional search parameters. + /// + [DataContract(Name = "varParams")] + public partial class Params : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// query. + /// automaticFacetFilters. + /// automaticOptionalFacetFilters. + /// renderingContent. + public Params(ConsequenceQuery query = default(ConsequenceQuery), AutomaticFacetFilters automaticFacetFilters = default(AutomaticFacetFilters), AutomaticFacetFilters automaticOptionalFacetFilters = default(AutomaticFacetFilters), RenderingContent renderingContent = default(RenderingContent)) + { + this.Query = query; + this.AutomaticFacetFilters = automaticFacetFilters; + this.AutomaticOptionalFacetFilters = automaticOptionalFacetFilters; + this.RenderingContent = renderingContent; + } + + /// + /// Gets or Sets Query + /// + [DataMember(Name = "query", EmitDefaultValue = false)] + public ConsequenceQuery Query { get; set; } + + /// + /// Gets or Sets AutomaticFacetFilters + /// + [DataMember(Name = "automaticFacetFilters", EmitDefaultValue = false)] + public AutomaticFacetFilters AutomaticFacetFilters { get; set; } + + /// + /// Gets or Sets AutomaticOptionalFacetFilters + /// + [DataMember(Name = "automaticOptionalFacetFilters", EmitDefaultValue = false)] + public AutomaticFacetFilters AutomaticOptionalFacetFilters { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Params {\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" AutomaticFacetFilters: ").Append(AutomaticFacetFilters).Append("\n"); + sb.Append(" AutomaticOptionalFacetFilters: ").Append(AutomaticOptionalFacetFilters).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Params); + } + + /// + /// Returns true if Params instances are equal + /// + /// Instance of Params to be compared + /// Boolean + public bool Equals(Params input) + { + if (input == null) + { + return false; + } + return + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.AutomaticFacetFilters == input.AutomaticFacetFilters || + (this.AutomaticFacetFilters != null && + this.AutomaticFacetFilters.Equals(input.AutomaticFacetFilters)) + ) && + ( + this.AutomaticOptionalFacetFilters == input.AutomaticOptionalFacetFilters || + (this.AutomaticOptionalFacetFilters != null && + this.AutomaticOptionalFacetFilters.Equals(input.AutomaticOptionalFacetFilters)) + ) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.AutomaticFacetFilters != null) + { + hashCode = (hashCode * 59) + this.AutomaticFacetFilters.GetHashCode(); + } + if (this.AutomaticOptionalFacetFilters != null) + { + hashCode = (hashCode * 59) + this.AutomaticOptionalFacetFilters.GetHashCode(); + } + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/Personalization.cs b/algoliasearch/Recommend/Models/Personalization.cs new file mode 100644 index 000000000..614424ca5 --- /dev/null +++ b/algoliasearch/Recommend/Models/Personalization.cs @@ -0,0 +1,150 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Personalization + /// + [DataContract(Name = "personalization")] + public partial class Personalization : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// The score of the filters.. + /// The score of the ranking.. + /// The score of the event.. + public Personalization(int filtersScore = default(int), int rankingScore = default(int), int score = default(int)) + { + this.FiltersScore = filtersScore; + this.RankingScore = rankingScore; + this.Score = score; + } + + /// + /// The score of the filters. + /// + /// The score of the filters. + [DataMember(Name = "filtersScore", EmitDefaultValue = false)] + public int FiltersScore { get; set; } + + /// + /// The score of the ranking. + /// + /// The score of the ranking. + [DataMember(Name = "rankingScore", EmitDefaultValue = false)] + public int RankingScore { get; set; } + + /// + /// The score of the event. + /// + /// The score of the event. + [DataMember(Name = "score", EmitDefaultValue = false)] + public int Score { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Personalization {\n"); + sb.Append(" FiltersScore: ").Append(FiltersScore).Append("\n"); + sb.Append(" RankingScore: ").Append(RankingScore).Append("\n"); + sb.Append(" Score: ").Append(Score).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Personalization); + } + + /// + /// Returns true if Personalization instances are equal + /// + /// Instance of Personalization to be compared + /// Boolean + public bool Equals(Personalization input) + { + if (input == null) + { + return false; + } + return + ( + this.FiltersScore == input.FiltersScore || + this.FiltersScore.Equals(input.FiltersScore) + ) && + ( + this.RankingScore == input.RankingScore || + this.RankingScore.Equals(input.RankingScore) + ) && + ( + this.Score == input.Score || + this.Score.Equals(input.Score) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.FiltersScore.GetHashCode(); + hashCode = (hashCode * 59) + this.RankingScore.GetHashCode(); + hashCode = (hashCode * 59) + this.Score.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/Promote.cs b/algoliasearch/Recommend/Models/Promote.cs new file mode 100644 index 000000000..1e1a7ed6e --- /dev/null +++ b/algoliasearch/Recommend/Models/Promote.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Promote + /// + [JsonConverter(typeof(PromoteJsonConverter))] + [DataContract(Name = "promote")] + public partial class Promote : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of PromoteObjectIDs. + public Promote(PromoteObjectIDs actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of PromoteObjectID. + public Promote(PromoteObjectID actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(PromoteObjectID)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(PromoteObjectIDs)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: PromoteObjectID, PromoteObjectIDs"); + } + } + } + + /// + /// Get the actual instance of `PromoteObjectIDs`. If the actual instance is not `PromoteObjectIDs`, + /// the InvalidClassException will be thrown + /// + /// An instance of PromoteObjectIDs + public PromoteObjectIDs GetterPromoteObjectIDs() + { + return (PromoteObjectIDs)this.ActualInstance; + } + + /// + /// Get the actual instance of `PromoteObjectID`. If the actual instance is not `PromoteObjectID`, + /// the InvalidClassException will be thrown + /// + /// An instance of PromoteObjectID + public PromoteObjectID GetterPromoteObjectID() + { + return (PromoteObjectID)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Promote {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, Promote.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of Promote + /// + /// JSON string + /// An instance of Promote + public static Promote FromJson(string jsonString) + { + Promote newPromote = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newPromote; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(PromoteObjectID).GetProperty("AdditionalProperties") == null) + { + newPromote = new Promote(JsonConvert.DeserializeObject(jsonString, Promote.SerializerSettings)); + } + else + { + newPromote = new Promote(JsonConvert.DeserializeObject(jsonString, Promote.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("PromoteObjectID"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PromoteObjectID: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(PromoteObjectIDs).GetProperty("AdditionalProperties") == null) + { + newPromote = new Promote(JsonConvert.DeserializeObject(jsonString, Promote.SerializerSettings)); + } + else + { + newPromote = new Promote(JsonConvert.DeserializeObject(jsonString, Promote.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("PromoteObjectIDs"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PromoteObjectIDs: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newPromote; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Promote); + } + + /// + /// Returns true if Promote instances are equal + /// + /// Instance of Promote to be compared + /// Boolean + public bool Equals(Promote input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for Promote + /// + public class PromoteJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(Promote).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return Promote.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/PromoteObjectID.cs b/algoliasearch/Recommend/Models/PromoteObjectID.cs new file mode 100644 index 000000000..813510a1d --- /dev/null +++ b/algoliasearch/Recommend/Models/PromoteObjectID.cs @@ -0,0 +1,149 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Record to promote. + /// + [DataContract(Name = "promoteObjectID")] + public partial class PromoteObjectID : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PromoteObjectID() { } + /// + /// Initializes a new instance of the class. + /// + /// Unique identifier of the record to promote. (required). + /// The position to promote the records to. If you pass objectIDs, the records are placed at this position as a group. For example, if you pronmote four objectIDs to position 0, the records take the first four positions. (required). + public PromoteObjectID(string objectID = default(string), int position = default(int)) + { + // to ensure "objectID" is required (not null) + if (objectID == null) + { + throw new ArgumentNullException("objectID is a required property for PromoteObjectID and cannot be null"); + } + this.ObjectID = objectID; + this.Position = position; + } + + /// + /// Unique identifier of the record to promote. + /// + /// Unique identifier of the record to promote. + [DataMember(Name = "objectID", IsRequired = true, EmitDefaultValue = true)] + public string ObjectID { get; set; } + + /// + /// The position to promote the records to. If you pass objectIDs, the records are placed at this position as a group. For example, if you pronmote four objectIDs to position 0, the records take the first four positions. + /// + /// The position to promote the records to. If you pass objectIDs, the records are placed at this position as a group. For example, if you pronmote four objectIDs to position 0, the records take the first four positions. + [DataMember(Name = "position", IsRequired = true, EmitDefaultValue = true)] + public int Position { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PromoteObjectID {\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append(" Position: ").Append(Position).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as PromoteObjectID); + } + + /// + /// Returns true if PromoteObjectID instances are equal + /// + /// Instance of PromoteObjectID to be compared + /// Boolean + public bool Equals(PromoteObjectID input) + { + if (input == null) + { + return false; + } + return + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ) && + ( + this.Position == input.Position || + this.Position.Equals(input.Position) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Position.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/PromoteObjectIDs.cs b/algoliasearch/Recommend/Models/PromoteObjectIDs.cs new file mode 100644 index 000000000..024e2a50a --- /dev/null +++ b/algoliasearch/Recommend/Models/PromoteObjectIDs.cs @@ -0,0 +1,150 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Records to promote. + /// + [DataContract(Name = "promoteObjectIDs")] + public partial class PromoteObjectIDs : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PromoteObjectIDs() { } + /// + /// Initializes a new instance of the class. + /// + /// Unique identifiers of the records to promote. (required). + /// The position to promote the records to. If you pass objectIDs, the records are placed at this position as a group. For example, if you pronmote four objectIDs to position 0, the records take the first four positions. (required). + public PromoteObjectIDs(List objectIDs = default(List), int position = default(int)) + { + // to ensure "objectIDs" is required (not null) + if (objectIDs == null) + { + throw new ArgumentNullException("objectIDs is a required property for PromoteObjectIDs and cannot be null"); + } + this.ObjectIDs = objectIDs; + this.Position = position; + } + + /// + /// Unique identifiers of the records to promote. + /// + /// Unique identifiers of the records to promote. + [DataMember(Name = "objectIDs", IsRequired = true, EmitDefaultValue = true)] + public List ObjectIDs { get; set; } + + /// + /// The position to promote the records to. If you pass objectIDs, the records are placed at this position as a group. For example, if you pronmote four objectIDs to position 0, the records take the first four positions. + /// + /// The position to promote the records to. If you pass objectIDs, the records are placed at this position as a group. For example, if you pronmote four objectIDs to position 0, the records take the first four positions. + [DataMember(Name = "position", IsRequired = true, EmitDefaultValue = true)] + public int Position { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PromoteObjectIDs {\n"); + sb.Append(" ObjectIDs: ").Append(ObjectIDs).Append("\n"); + sb.Append(" Position: ").Append(Position).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as PromoteObjectIDs); + } + + /// + /// Returns true if PromoteObjectIDs instances are equal + /// + /// Instance of PromoteObjectIDs to be compared + /// Boolean + public bool Equals(PromoteObjectIDs input) + { + if (input == null) + { + return false; + } + return + ( + this.ObjectIDs == input.ObjectIDs || + this.ObjectIDs != null && + input.ObjectIDs != null && + this.ObjectIDs.SequenceEqual(input.ObjectIDs) + ) && + ( + this.Position == input.Position || + this.Position.Equals(input.Position) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ObjectIDs != null) + { + hashCode = (hashCode * 59) + this.ObjectIDs.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Position.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/QueryType.cs b/algoliasearch/Recommend/Models/QueryType.cs new file mode 100644 index 000000000..8b80b3a4c --- /dev/null +++ b/algoliasearch/Recommend/Models/QueryType.cs @@ -0,0 +1,49 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Determines how query words are [interpreted as prefixes](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/prefix-searching/). + /// + /// Determines how query words are [interpreted as prefixes](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/prefix-searching/). + [JsonConverter(typeof(StringEnumConverter))] + public enum QueryType + { + /// + /// Enum PrefixLast for value: prefixLast + /// + [EnumMember(Value = "prefixLast")] + PrefixLast = 1, + + /// + /// Enum PrefixAll for value: prefixAll + /// + [EnumMember(Value = "prefixAll")] + PrefixAll = 2, + + /// + /// Enum PrefixNone for value: prefixNone + /// + [EnumMember(Value = "prefixNone")] + PrefixNone = 3 + } + +} diff --git a/algoliasearch/Recommend/Models/RankingInfo.cs b/algoliasearch/Recommend/Models/RankingInfo.cs new file mode 100644 index 000000000..269f34f24 --- /dev/null +++ b/algoliasearch/Recommend/Models/RankingInfo.cs @@ -0,0 +1,311 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// RankingInfo + /// + [DataContract(Name = "rankingInfo")] + public partial class RankingInfo : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RankingInfo() { } + /// + /// Initializes a new instance of the class. + /// + /// This field is reserved for advanced usage. (required). + /// Position of the most important matched attribute in the attributes to index list. (required). + /// Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). (required). + /// Precision used when computing the geo distance, in meters.. + /// matchedGeoLocation. + /// personalization. + /// Number of exactly matched words. (required). + /// Number of typos encountered when matching the record. (required). + /// Present and set to true if a Rule promoted the hit. (required). + /// When the query contains more than one word, the sum of the distances between matched words (in meters).. + /// Custom ranking for the object, expressed as a single integer value. (required). + /// Number of matched words, including prefixes and typos. (required). + /// Wether the record are promoted by the re-ranking strategy.. + public RankingInfo(int filters = default(int), int firstMatchedWord = default(int), int geoDistance = default(int), int geoPrecision = default(int), MatchedGeoLocation matchedGeoLocation = default(MatchedGeoLocation), Personalization personalization = default(Personalization), int nbExactWords = default(int), int nbTypos = default(int), bool promoted = default(bool), int proximityDistance = default(int), int userScore = default(int), int words = default(int), bool promotedByReRanking = default(bool)) + { + this.Filters = filters; + this.FirstMatchedWord = firstMatchedWord; + this.GeoDistance = geoDistance; + this.NbExactWords = nbExactWords; + this.NbTypos = nbTypos; + this.Promoted = promoted; + this.UserScore = userScore; + this.Words = words; + this.GeoPrecision = geoPrecision; + this.MatchedGeoLocation = matchedGeoLocation; + this.Personalization = personalization; + this.ProximityDistance = proximityDistance; + this.PromotedByReRanking = promotedByReRanking; + } + + /// + /// This field is reserved for advanced usage. + /// + /// This field is reserved for advanced usage. + [DataMember(Name = "filters", IsRequired = true, EmitDefaultValue = true)] + public int Filters { get; set; } + + /// + /// Position of the most important matched attribute in the attributes to index list. + /// + /// Position of the most important matched attribute in the attributes to index list. + [DataMember(Name = "firstMatchedWord", IsRequired = true, EmitDefaultValue = true)] + public int FirstMatchedWord { get; set; } + + /// + /// Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). + /// + /// Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). + [DataMember(Name = "geoDistance", IsRequired = true, EmitDefaultValue = true)] + public int GeoDistance { get; set; } + + /// + /// Precision used when computing the geo distance, in meters. + /// + /// Precision used when computing the geo distance, in meters. + [DataMember(Name = "geoPrecision", EmitDefaultValue = false)] + public int GeoPrecision { get; set; } + + /// + /// Gets or Sets MatchedGeoLocation + /// + [DataMember(Name = "matchedGeoLocation", EmitDefaultValue = false)] + public MatchedGeoLocation MatchedGeoLocation { get; set; } + + /// + /// Gets or Sets Personalization + /// + [DataMember(Name = "personalization", EmitDefaultValue = false)] + public Personalization Personalization { get; set; } + + /// + /// Number of exactly matched words. + /// + /// Number of exactly matched words. + [DataMember(Name = "nbExactWords", IsRequired = true, EmitDefaultValue = true)] + public int NbExactWords { get; set; } + + /// + /// Number of typos encountered when matching the record. + /// + /// Number of typos encountered when matching the record. + [DataMember(Name = "nbTypos", IsRequired = true, EmitDefaultValue = true)] + public int NbTypos { get; set; } + + /// + /// Present and set to true if a Rule promoted the hit. + /// + /// Present and set to true if a Rule promoted the hit. + [DataMember(Name = "promoted", IsRequired = true, EmitDefaultValue = true)] + public bool Promoted { get; set; } + + /// + /// When the query contains more than one word, the sum of the distances between matched words (in meters). + /// + /// When the query contains more than one word, the sum of the distances between matched words (in meters). + [DataMember(Name = "proximityDistance", EmitDefaultValue = false)] + public int ProximityDistance { get; set; } + + /// + /// Custom ranking for the object, expressed as a single integer value. + /// + /// Custom ranking for the object, expressed as a single integer value. + [DataMember(Name = "userScore", IsRequired = true, EmitDefaultValue = true)] + public int UserScore { get; set; } + + /// + /// Number of matched words, including prefixes and typos. + /// + /// Number of matched words, including prefixes and typos. + [DataMember(Name = "words", IsRequired = true, EmitDefaultValue = true)] + public int Words { get; set; } + + /// + /// Wether the record are promoted by the re-ranking strategy. + /// + /// Wether the record are promoted by the re-ranking strategy. + [DataMember(Name = "promotedByReRanking", EmitDefaultValue = true)] + public bool PromotedByReRanking { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RankingInfo {\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" FirstMatchedWord: ").Append(FirstMatchedWord).Append("\n"); + sb.Append(" GeoDistance: ").Append(GeoDistance).Append("\n"); + sb.Append(" GeoPrecision: ").Append(GeoPrecision).Append("\n"); + sb.Append(" MatchedGeoLocation: ").Append(MatchedGeoLocation).Append("\n"); + sb.Append(" Personalization: ").Append(Personalization).Append("\n"); + sb.Append(" NbExactWords: ").Append(NbExactWords).Append("\n"); + sb.Append(" NbTypos: ").Append(NbTypos).Append("\n"); + sb.Append(" Promoted: ").Append(Promoted).Append("\n"); + sb.Append(" ProximityDistance: ").Append(ProximityDistance).Append("\n"); + sb.Append(" UserScore: ").Append(UserScore).Append("\n"); + sb.Append(" Words: ").Append(Words).Append("\n"); + sb.Append(" PromotedByReRanking: ").Append(PromotedByReRanking).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RankingInfo); + } + + /// + /// Returns true if RankingInfo instances are equal + /// + /// Instance of RankingInfo to be compared + /// Boolean + public bool Equals(RankingInfo input) + { + if (input == null) + { + return false; + } + return + ( + this.Filters == input.Filters || + this.Filters.Equals(input.Filters) + ) && + ( + this.FirstMatchedWord == input.FirstMatchedWord || + this.FirstMatchedWord.Equals(input.FirstMatchedWord) + ) && + ( + this.GeoDistance == input.GeoDistance || + this.GeoDistance.Equals(input.GeoDistance) + ) && + ( + this.GeoPrecision == input.GeoPrecision || + this.GeoPrecision.Equals(input.GeoPrecision) + ) && + ( + this.MatchedGeoLocation == input.MatchedGeoLocation || + (this.MatchedGeoLocation != null && + this.MatchedGeoLocation.Equals(input.MatchedGeoLocation)) + ) && + ( + this.Personalization == input.Personalization || + (this.Personalization != null && + this.Personalization.Equals(input.Personalization)) + ) && + ( + this.NbExactWords == input.NbExactWords || + this.NbExactWords.Equals(input.NbExactWords) + ) && + ( + this.NbTypos == input.NbTypos || + this.NbTypos.Equals(input.NbTypos) + ) && + ( + this.Promoted == input.Promoted || + this.Promoted.Equals(input.Promoted) + ) && + ( + this.ProximityDistance == input.ProximityDistance || + this.ProximityDistance.Equals(input.ProximityDistance) + ) && + ( + this.UserScore == input.UserScore || + this.UserScore.Equals(input.UserScore) + ) && + ( + this.Words == input.Words || + this.Words.Equals(input.Words) + ) && + ( + this.PromotedByReRanking == input.PromotedByReRanking || + this.PromotedByReRanking.Equals(input.PromotedByReRanking) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + hashCode = (hashCode * 59) + this.FirstMatchedWord.GetHashCode(); + hashCode = (hashCode * 59) + this.GeoDistance.GetHashCode(); + hashCode = (hashCode * 59) + this.GeoPrecision.GetHashCode(); + if (this.MatchedGeoLocation != null) + { + hashCode = (hashCode * 59) + this.MatchedGeoLocation.GetHashCode(); + } + if (this.Personalization != null) + { + hashCode = (hashCode * 59) + this.Personalization.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NbExactWords.GetHashCode(); + hashCode = (hashCode * 59) + this.NbTypos.GetHashCode(); + hashCode = (hashCode * 59) + this.Promoted.GetHashCode(); + hashCode = (hashCode * 59) + this.ProximityDistance.GetHashCode(); + hashCode = (hashCode * 59) + this.UserScore.GetHashCode(); + hashCode = (hashCode * 59) + this.Words.GetHashCode(); + hashCode = (hashCode * 59) + this.PromotedByReRanking.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/ReRankingApplyFilter.cs b/algoliasearch/Recommend/Models/ReRankingApplyFilter.cs new file mode 100644 index 000000000..081bfd155 --- /dev/null +++ b/algoliasearch/Recommend/Models/ReRankingApplyFilter.cs @@ -0,0 +1,297 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// When [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/) is enabled, only records that match these filters will be affected by Dynamic Re-Ranking. + /// + [JsonConverter(typeof(ReRankingApplyFilterJsonConverter))] + [DataContract(Name = "reRankingApplyFilter")] + public partial class ReRankingApplyFilter : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + public ReRankingApplyFilter() + { + this.IsNullable = true; + this.SchemaType = "oneOf"; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<MixedSearchFilters>. + public ReRankingApplyFilter(List actualInstance) + { + this.IsNullable = true; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public ReRankingApplyFilter(string actualInstance) + { + this.IsNullable = true; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, string"); + } + } + } + + /// + /// Get the actual instance of `List<MixedSearchFilters>`. If the actual instance is not `List<MixedSearchFilters>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<MixedSearchFilters> + public List GetterList() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class ReRankingApplyFilter {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, ReRankingApplyFilter.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of ReRankingApplyFilter + /// + /// JSON string + /// An instance of ReRankingApplyFilter + public static ReRankingApplyFilter FromJson(string jsonString) + { + ReRankingApplyFilter newReRankingApplyFilter = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newReRankingApplyFilter; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newReRankingApplyFilter = new ReRankingApplyFilter(JsonConvert.DeserializeObject>(jsonString, ReRankingApplyFilter.SerializerSettings)); + } + else + { + newReRankingApplyFilter = new ReRankingApplyFilter(JsonConvert.DeserializeObject>(jsonString, ReRankingApplyFilter.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newReRankingApplyFilter = new ReRankingApplyFilter(JsonConvert.DeserializeObject(jsonString, ReRankingApplyFilter.SerializerSettings)); + } + else + { + newReRankingApplyFilter = new ReRankingApplyFilter(JsonConvert.DeserializeObject(jsonString, ReRankingApplyFilter.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newReRankingApplyFilter; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ReRankingApplyFilter); + } + + /// + /// Returns true if ReRankingApplyFilter instances are equal + /// + /// Instance of ReRankingApplyFilter to be compared + /// Boolean + public bool Equals(ReRankingApplyFilter input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for ReRankingApplyFilter + /// + public class ReRankingApplyFilterJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(ReRankingApplyFilter).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return ReRankingApplyFilter.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/RecommendHit.cs b/algoliasearch/Recommend/Models/RecommendHit.cs new file mode 100644 index 000000000..d66886429 --- /dev/null +++ b/algoliasearch/Recommend/Models/RecommendHit.cs @@ -0,0 +1,260 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Recommend hit. + /// + [DataContract(Name = "recommendHit")] + public partial class RecommendHit : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RecommendHit() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// Unique object identifier. (required). + /// Show highlighted section and words matched on a query.. + /// Snippeted attributes show parts of the matched attributes. Only returned when attributesToSnippet is non-empty.. + /// rankingInfo. + /// distinctSeqID. + /// Recommendation score. (required). + public RecommendHit(string objectID = default(string), Dictionary highlightResult = default(Dictionary), Dictionary snippetResult = default(Dictionary), RankingInfo rankingInfo = default(RankingInfo), int distinctSeqID = default(int), double score = default(double)) : base() + { + // to ensure "objectID" is required (not null) + if (objectID == null) + { + throw new ArgumentNullException("objectID is a required property for RecommendHit and cannot be null"); + } + this.ObjectID = objectID; + this.Score = score; + this.HighlightResult = highlightResult; + this.SnippetResult = snippetResult; + this.RankingInfo = rankingInfo; + this.DistinctSeqID = distinctSeqID; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Unique object identifier. + /// + /// Unique object identifier. + [DataMember(Name = "objectID", IsRequired = true, EmitDefaultValue = true)] + public string ObjectID { get; set; } + + /// + /// Show highlighted section and words matched on a query. + /// + /// Show highlighted section and words matched on a query. + [DataMember(Name = "_highlightResult", EmitDefaultValue = false)] + public Dictionary HighlightResult { get; set; } + + /// + /// Snippeted attributes show parts of the matched attributes. Only returned when attributesToSnippet is non-empty. + /// + /// Snippeted attributes show parts of the matched attributes. Only returned when attributesToSnippet is non-empty. + [DataMember(Name = "_snippetResult", EmitDefaultValue = false)] + public Dictionary SnippetResult { get; set; } + + /// + /// Gets or Sets RankingInfo + /// + [DataMember(Name = "_rankingInfo", EmitDefaultValue = false)] + public RankingInfo RankingInfo { get; set; } + + /// + /// Gets or Sets DistinctSeqID + /// + [DataMember(Name = "_distinctSeqID", EmitDefaultValue = false)] + public int DistinctSeqID { get; set; } + + /// + /// Recommendation score. + /// + /// Recommendation score. + [DataMember(Name = "_score", IsRequired = true, EmitDefaultValue = true)] + public double Score { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RecommendHit {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append(" HighlightResult: ").Append(HighlightResult).Append("\n"); + sb.Append(" SnippetResult: ").Append(SnippetResult).Append("\n"); + sb.Append(" RankingInfo: ").Append(RankingInfo).Append("\n"); + sb.Append(" DistinctSeqID: ").Append(DistinctSeqID).Append("\n"); + sb.Append(" Score: ").Append(Score).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RecommendHit); + } + + /// + /// Returns true if RecommendHit instances are equal + /// + /// Instance of RecommendHit to be compared + /// Boolean + public bool Equals(RecommendHit input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ) && base.Equals(input) && + ( + this.HighlightResult == input.HighlightResult || + this.HighlightResult != null && + input.HighlightResult != null && + this.HighlightResult.SequenceEqual(input.HighlightResult) + ) && base.Equals(input) && + ( + this.SnippetResult == input.SnippetResult || + this.SnippetResult != null && + input.SnippetResult != null && + this.SnippetResult.SequenceEqual(input.SnippetResult) + ) && base.Equals(input) && + ( + this.RankingInfo == input.RankingInfo || + (this.RankingInfo != null && + this.RankingInfo.Equals(input.RankingInfo)) + ) && base.Equals(input) && + ( + this.DistinctSeqID == input.DistinctSeqID || + this.DistinctSeqID.Equals(input.DistinctSeqID) + ) && base.Equals(input) && + ( + this.Score == input.Score || + this.Score.Equals(input.Score) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + if (this.HighlightResult != null) + { + hashCode = (hashCode * 59) + this.HighlightResult.GetHashCode(); + } + if (this.SnippetResult != null) + { + hashCode = (hashCode * 59) + this.SnippetResult.GetHashCode(); + } + if (this.RankingInfo != null) + { + hashCode = (hashCode * 59) + this.RankingInfo.GetHashCode(); + } + hashCode = (hashCode * 59) + this.DistinctSeqID.GetHashCode(); + hashCode = (hashCode * 59) + this.Score.GetHashCode(); + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + // Score (double) maximum + if (this.Score > (double)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Score, must be a value less than or equal to 100.", new[] { "Score" }); + } + + // Score (double) minimum + if (this.Score < (double)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Score, must be a value greater than or equal to 0.", new[] { "Score" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/RecommendHits.cs b/algoliasearch/Recommend/Models/RecommendHits.cs new file mode 100644 index 000000000..d64383107 --- /dev/null +++ b/algoliasearch/Recommend/Models/RecommendHits.cs @@ -0,0 +1,173 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// RecommendHits + /// + [DataContract(Name = "recommendHits")] + public partial class RecommendHits : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RecommendHits() { } + /// + /// Initializes a new instance of the class. + /// + /// hits (required). + /// Text to search for in an index. (default to ""). + /// URL-encoded string of all search parameters.. + public RecommendHits(List hits = default(List), string query = @"", string varParams = default(string)) + { + // to ensure "hits" is required (not null) + if (hits == null) + { + throw new ArgumentNullException("hits is a required property for RecommendHits and cannot be null"); + } + this.Hits = hits; + // use default value if no "query" provided + this.Query = query ?? @""; + this.VarParams = varParams; + } + + /// + /// Gets or Sets Hits + /// + [DataMember(Name = "hits", IsRequired = true, EmitDefaultValue = true)] + public List Hits { get; set; } + + /// + /// Text to search for in an index. + /// + /// Text to search for in an index. + [DataMember(Name = "query", EmitDefaultValue = false)] + public string Query { get; set; } + + /// + /// URL-encoded string of all search parameters. + /// + /// URL-encoded string of all search parameters. + [DataMember(Name = "params", EmitDefaultValue = false)] + public string VarParams { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RecommendHits {\n"); + sb.Append(" Hits: ").Append(Hits).Append("\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" VarParams: ").Append(VarParams).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RecommendHits); + } + + /// + /// Returns true if RecommendHits instances are equal + /// + /// Instance of RecommendHits to be compared + /// Boolean + public bool Equals(RecommendHits input) + { + if (input == null) + { + return false; + } + return + ( + this.Hits == input.Hits || + this.Hits != null && + input.Hits != null && + this.Hits.SequenceEqual(input.Hits) + ) && + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.VarParams == input.VarParams || + (this.VarParams != null && + this.VarParams.Equals(input.VarParams)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Hits != null) + { + hashCode = (hashCode * 59) + this.Hits.GetHashCode(); + } + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.VarParams != null) + { + hashCode = (hashCode * 59) + this.VarParams.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/RecommendModels.cs b/algoliasearch/Recommend/Models/RecommendModels.cs new file mode 100644 index 000000000..79c975f13 --- /dev/null +++ b/algoliasearch/Recommend/Models/RecommendModels.cs @@ -0,0 +1,54 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Defines recommendModels + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RecommendModels + { + /// + /// Enum RelatedProducts for value: related-products + /// + [EnumMember(Value = "related-products")] + RelatedProducts = 1, + + /// + /// Enum BoughtTogether for value: bought-together + /// + [EnumMember(Value = "bought-together")] + BoughtTogether = 2, + + /// + /// Enum TrendingFacets for value: trending-facets + /// + [EnumMember(Value = "trending-facets")] + TrendingFacets = 3, + + /// + /// Enum TrendingItems for value: trending-items + /// + [EnumMember(Value = "trending-items")] + TrendingItems = 4 + } + +} diff --git a/algoliasearch/Recommend/Models/RecommendationModels.cs b/algoliasearch/Recommend/Models/RecommendationModels.cs new file mode 100644 index 000000000..58fabadb0 --- /dev/null +++ b/algoliasearch/Recommend/Models/RecommendationModels.cs @@ -0,0 +1,43 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Recommendation model. + /// + /// Recommendation model. + [JsonConverter(typeof(StringEnumConverter))] + public enum RecommendationModels + { + /// + /// Enum RelatedProducts for value: related-products + /// + [EnumMember(Value = "related-products")] + RelatedProducts = 1, + + /// + /// Enum BoughtTogether for value: bought-together + /// + [EnumMember(Value = "bought-together")] + BoughtTogether = 2 + } + +} diff --git a/algoliasearch/Recommend/Models/RecommendationsQuery.cs b/algoliasearch/Recommend/Models/RecommendationsQuery.cs new file mode 100644 index 000000000..f78d9b816 --- /dev/null +++ b/algoliasearch/Recommend/Models/RecommendationsQuery.cs @@ -0,0 +1,250 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// RecommendationsQuery + /// + [DataContract(Name = "recommendationsQuery")] + public partial class RecommendationsQuery : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Model + /// + [DataMember(Name = "model", IsRequired = true, EmitDefaultValue = true)] + public RecommendationModels Model { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RecommendationsQuery() { } + /// + /// Initializes a new instance of the class. + /// + /// model (required). + /// Unique object identifier. (required). + /// queryParameters. + /// fallbackParameters. + /// Algolia index name. (required). + /// Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are. . + /// Maximum number of recommendations to retrieve. If 0, all recommendations will be returned. (default to 0). + public RecommendationsQuery(RecommendationModels model = default(RecommendationModels), string objectID = default(string), SearchParamsObject queryParameters = default(SearchParamsObject), SearchParamsObject fallbackParameters = default(SearchParamsObject), string indexName = default(string), int threshold = default(int), int maxRecommendations = 0) + { + this.Model = model; + // to ensure "objectID" is required (not null) + if (objectID == null) + { + throw new ArgumentNullException("objectID is a required property for RecommendationsQuery and cannot be null"); + } + this.ObjectID = objectID; + // to ensure "indexName" is required (not null) + if (indexName == null) + { + throw new ArgumentNullException("indexName is a required property for RecommendationsQuery and cannot be null"); + } + this.IndexName = indexName; + this.QueryParameters = queryParameters; + this.FallbackParameters = fallbackParameters; + this.Threshold = threshold; + this.MaxRecommendations = maxRecommendations; + } + + /// + /// Unique object identifier. + /// + /// Unique object identifier. + [DataMember(Name = "objectID", IsRequired = true, EmitDefaultValue = true)] + public string ObjectID { get; set; } + + /// + /// Gets or Sets QueryParameters + /// + [DataMember(Name = "queryParameters", EmitDefaultValue = false)] + public SearchParamsObject QueryParameters { get; set; } + + /// + /// Gets or Sets FallbackParameters + /// + [DataMember(Name = "fallbackParameters", EmitDefaultValue = false)] + public SearchParamsObject FallbackParameters { get; set; } + + /// + /// Algolia index name. + /// + /// Algolia index name. + [DataMember(Name = "indexName", IsRequired = true, EmitDefaultValue = true)] + public string IndexName { get; set; } + + /// + /// Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are. + /// + /// Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are. + [DataMember(Name = "threshold", EmitDefaultValue = false)] + public int Threshold { get; set; } + + /// + /// Maximum number of recommendations to retrieve. If 0, all recommendations will be returned. + /// + /// Maximum number of recommendations to retrieve. If 0, all recommendations will be returned. + [DataMember(Name = "maxRecommendations", EmitDefaultValue = false)] + public int MaxRecommendations { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RecommendationsQuery {\n"); + sb.Append(" Model: ").Append(Model).Append("\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append(" QueryParameters: ").Append(QueryParameters).Append("\n"); + sb.Append(" FallbackParameters: ").Append(FallbackParameters).Append("\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append(" Threshold: ").Append(Threshold).Append("\n"); + sb.Append(" MaxRecommendations: ").Append(MaxRecommendations).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RecommendationsQuery); + } + + /// + /// Returns true if RecommendationsQuery instances are equal + /// + /// Instance of RecommendationsQuery to be compared + /// Boolean + public bool Equals(RecommendationsQuery input) + { + if (input == null) + { + return false; + } + return + ( + this.Model == input.Model || + this.Model.Equals(input.Model) + ) && + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ) && + ( + this.QueryParameters == input.QueryParameters || + (this.QueryParameters != null && + this.QueryParameters.Equals(input.QueryParameters)) + ) && + ( + this.FallbackParameters == input.FallbackParameters || + (this.FallbackParameters != null && + this.FallbackParameters.Equals(input.FallbackParameters)) + ) && + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ) && + ( + this.Threshold == input.Threshold || + this.Threshold.Equals(input.Threshold) + ) && + ( + this.MaxRecommendations == input.MaxRecommendations || + this.MaxRecommendations.Equals(input.MaxRecommendations) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Model.GetHashCode(); + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + if (this.QueryParameters != null) + { + hashCode = (hashCode * 59) + this.QueryParameters.GetHashCode(); + } + if (this.FallbackParameters != null) + { + hashCode = (hashCode * 59) + this.FallbackParameters.GetHashCode(); + } + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Threshold.GetHashCode(); + hashCode = (hashCode * 59) + this.MaxRecommendations.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Threshold (int) maximum + if (this.Threshold > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Threshold, must be a value less than or equal to 100.", new[] { "Threshold" }); + } + + // Threshold (int) minimum + if (this.Threshold < (int)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Threshold, must be a value greater than or equal to 0.", new[] { "Threshold" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/RecommendationsRequest.cs b/algoliasearch/Recommend/Models/RecommendationsRequest.cs new file mode 100644 index 000000000..38423f270 --- /dev/null +++ b/algoliasearch/Recommend/Models/RecommendationsRequest.cs @@ -0,0 +1,334 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// RecommendationsRequest + /// + [JsonConverter(typeof(RecommendationsRequestJsonConverter))] + [DataContract(Name = "recommendationsRequest")] + public partial class RecommendationsRequest : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of TrendingItemsQuery. + public RecommendationsRequest(TrendingItemsQuery actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of TrendingFacetsQuery. + public RecommendationsRequest(TrendingFacetsQuery actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of RecommendationsQuery. + public RecommendationsRequest(RecommendationsQuery actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(RecommendationsQuery)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(TrendingFacetsQuery)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(TrendingItemsQuery)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: RecommendationsQuery, TrendingFacetsQuery, TrendingItemsQuery"); + } + } + } + + /// + /// Get the actual instance of `TrendingItemsQuery`. If the actual instance is not `TrendingItemsQuery`, + /// the InvalidClassException will be thrown + /// + /// An instance of TrendingItemsQuery + public TrendingItemsQuery GetterTrendingItemsQuery() + { + return (TrendingItemsQuery)this.ActualInstance; + } + + /// + /// Get the actual instance of `TrendingFacetsQuery`. If the actual instance is not `TrendingFacetsQuery`, + /// the InvalidClassException will be thrown + /// + /// An instance of TrendingFacetsQuery + public TrendingFacetsQuery GetterTrendingFacetsQuery() + { + return (TrendingFacetsQuery)this.ActualInstance; + } + + /// + /// Get the actual instance of `RecommendationsQuery`. If the actual instance is not `RecommendationsQuery`, + /// the InvalidClassException will be thrown + /// + /// An instance of RecommendationsQuery + public RecommendationsQuery GetterRecommendationsQuery() + { + return (RecommendationsQuery)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class RecommendationsRequest {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, RecommendationsRequest.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of RecommendationsRequest + /// + /// JSON string + /// An instance of RecommendationsRequest + public static RecommendationsRequest FromJson(string jsonString) + { + RecommendationsRequest newRecommendationsRequest = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newRecommendationsRequest; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(RecommendationsQuery).GetProperty("AdditionalProperties") == null) + { + newRecommendationsRequest = new RecommendationsRequest(JsonConvert.DeserializeObject(jsonString, RecommendationsRequest.SerializerSettings)); + } + else + { + newRecommendationsRequest = new RecommendationsRequest(JsonConvert.DeserializeObject(jsonString, RecommendationsRequest.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("RecommendationsQuery"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into RecommendationsQuery: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(TrendingFacetsQuery).GetProperty("AdditionalProperties") == null) + { + newRecommendationsRequest = new RecommendationsRequest(JsonConvert.DeserializeObject(jsonString, RecommendationsRequest.SerializerSettings)); + } + else + { + newRecommendationsRequest = new RecommendationsRequest(JsonConvert.DeserializeObject(jsonString, RecommendationsRequest.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("TrendingFacetsQuery"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into TrendingFacetsQuery: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(TrendingItemsQuery).GetProperty("AdditionalProperties") == null) + { + newRecommendationsRequest = new RecommendationsRequest(JsonConvert.DeserializeObject(jsonString, RecommendationsRequest.SerializerSettings)); + } + else + { + newRecommendationsRequest = new RecommendationsRequest(JsonConvert.DeserializeObject(jsonString, RecommendationsRequest.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("TrendingItemsQuery"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into TrendingItemsQuery: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newRecommendationsRequest; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RecommendationsRequest); + } + + /// + /// Returns true if RecommendationsRequest instances are equal + /// + /// Instance of RecommendationsRequest to be compared + /// Boolean + public bool Equals(RecommendationsRequest input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for RecommendationsRequest + /// + public class RecommendationsRequestJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(RecommendationsRequest).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return RecommendationsRequest.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/RecommendationsResponse.cs b/algoliasearch/Recommend/Models/RecommendationsResponse.cs new file mode 100644 index 000000000..6fdbfcd28 --- /dev/null +++ b/algoliasearch/Recommend/Models/RecommendationsResponse.cs @@ -0,0 +1,668 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// RecommendationsResponse + /// + [DataContract(Name = "recommendationsResponse")] + public partial class RecommendationsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RecommendationsResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// A/B test ID. This is only included in the response for indices that are part of an A/B test.. + /// Variant ID. This is only included in the response for indices that are part of an A/B test.. + /// Computed geographical location.. + /// Automatically-computed radius.. + /// exhaustive. + /// See the `facetsCount` field of the `exhaustive` object in the response.. + /// See the `nbHits` field of the `exhaustive` object in the response.. + /// See the `typo` field of the `exhaustive` object in the response.. + /// Mapping of each facet name to the corresponding facet counts.. + /// Statistics for numerical facets.. + /// Number of hits per page. (required) (default to 20). + /// Index name used for the query.. + /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query.. + /// Warnings about the query.. + /// Number of hits the search query matched. (required). + /// Number of pages of results for the current query. (required). + /// Number of hits selected and sorted by the relevant sort algorithm.. + /// Page to retrieve (the first page is `0`, not `1`). (required) (default to 0). + /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched.. + /// Time the server took to process the request, in milliseconds. (required). + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues.. + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set.. + /// redirect. + /// renderingContent. + /// Time the server took to process the request, in milliseconds.. + /// Host name of the server that processed the request.. + /// Lets you store custom data in your indices.. + /// hits (required). + /// Text to search for in an index. (default to ""). + /// URL-encoded string of all search parameters.. + public RecommendationsResponse(int abTestID = default(int), int abTestVariantID = default(int), string aroundLatLng = default(string), string automaticRadius = default(string), Exhaustive exhaustive = default(Exhaustive), bool exhaustiveFacetsCount = default(bool), bool exhaustiveNbHits = default(bool), bool exhaustiveTypo = default(bool), Dictionary> facets = default(Dictionary>), Dictionary facetsStats = default(Dictionary), int hitsPerPage = 20, string index = default(string), string indexUsed = default(string), string message = default(string), int nbHits = default(int), int nbPages = default(int), int nbSortedHits = default(int), int page = 0, string parsedQuery = default(string), int processingTimeMS = default(int), Object processingTimingsMS = default(Object), string queryAfterRemoval = default(string), Redirect redirect = default(Redirect), RenderingContent renderingContent = default(RenderingContent), int serverTimeMS = default(int), string serverUsed = default(string), Object userData = default(Object), List hits = default(List), string query = @"", string varParams = default(string)) + { + this.HitsPerPage = hitsPerPage; + this.NbHits = nbHits; + this.NbPages = nbPages; + this.Page = page; + this.ProcessingTimeMS = processingTimeMS; + // to ensure "hits" is required (not null) + if (hits == null) + { + throw new ArgumentNullException("hits is a required property for RecommendationsResponse and cannot be null"); + } + this.Hits = hits; + this.AbTestID = abTestID; + this.AbTestVariantID = abTestVariantID; + this.AroundLatLng = aroundLatLng; + this.AutomaticRadius = automaticRadius; + this.Exhaustive = exhaustive; + this.ExhaustiveFacetsCount = exhaustiveFacetsCount; + this.ExhaustiveNbHits = exhaustiveNbHits; + this.ExhaustiveTypo = exhaustiveTypo; + this.Facets = facets; + this.FacetsStats = facetsStats; + this.Index = index; + this.IndexUsed = indexUsed; + this.Message = message; + this.NbSortedHits = nbSortedHits; + this.ParsedQuery = parsedQuery; + this.ProcessingTimingsMS = processingTimingsMS; + this.QueryAfterRemoval = queryAfterRemoval; + this.Redirect = redirect; + this.RenderingContent = renderingContent; + this.ServerTimeMS = serverTimeMS; + this.ServerUsed = serverUsed; + this.UserData = userData; + // use default value if no "query" provided + this.Query = query ?? @""; + this.VarParams = varParams; + } + + /// + /// A/B test ID. This is only included in the response for indices that are part of an A/B test. + /// + /// A/B test ID. This is only included in the response for indices that are part of an A/B test. + [DataMember(Name = "abTestID", EmitDefaultValue = false)] + public int AbTestID { get; set; } + + /// + /// Variant ID. This is only included in the response for indices that are part of an A/B test. + /// + /// Variant ID. This is only included in the response for indices that are part of an A/B test. + [DataMember(Name = "abTestVariantID", EmitDefaultValue = false)] + public int AbTestVariantID { get; set; } + + /// + /// Computed geographical location. + /// + /// Computed geographical location. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Automatically-computed radius. + /// + /// Automatically-computed radius. + [DataMember(Name = "automaticRadius", EmitDefaultValue = false)] + public string AutomaticRadius { get; set; } + + /// + /// Gets or Sets Exhaustive + /// + [DataMember(Name = "exhaustive", EmitDefaultValue = false)] + public Exhaustive Exhaustive { get; set; } + + /// + /// See the `facetsCount` field of the `exhaustive` object in the response. + /// + /// See the `facetsCount` field of the `exhaustive` object in the response. + [DataMember(Name = "exhaustiveFacetsCount", EmitDefaultValue = true)] + [Obsolete] + public bool ExhaustiveFacetsCount { get; set; } + + /// + /// See the `nbHits` field of the `exhaustive` object in the response. + /// + /// See the `nbHits` field of the `exhaustive` object in the response. + [DataMember(Name = "exhaustiveNbHits", EmitDefaultValue = true)] + [Obsolete] + public bool ExhaustiveNbHits { get; set; } + + /// + /// See the `typo` field of the `exhaustive` object in the response. + /// + /// See the `typo` field of the `exhaustive` object in the response. + [DataMember(Name = "exhaustiveTypo", EmitDefaultValue = true)] + [Obsolete] + public bool ExhaustiveTypo { get; set; } + + /// + /// Mapping of each facet name to the corresponding facet counts. + /// + /// Mapping of each facet name to the corresponding facet counts. + [DataMember(Name = "facets", EmitDefaultValue = false)] + public Dictionary> Facets { get; set; } + + /// + /// Statistics for numerical facets. + /// + /// Statistics for numerical facets. + [DataMember(Name = "facets_stats", EmitDefaultValue = false)] + public Dictionary FacetsStats { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", IsRequired = true, EmitDefaultValue = true)] + public int HitsPerPage { get; set; } + + /// + /// Index name used for the query. + /// + /// Index name used for the query. + [DataMember(Name = "index", EmitDefaultValue = false)] + public string Index { get; set; } + + /// + /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. + /// + /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. + [DataMember(Name = "indexUsed", EmitDefaultValue = false)] + public string IndexUsed { get; set; } + + /// + /// Warnings about the query. + /// + /// Warnings about the query. + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Number of hits the search query matched. + /// + /// Number of hits the search query matched. + [DataMember(Name = "nbHits", IsRequired = true, EmitDefaultValue = true)] + public int NbHits { get; set; } + + /// + /// Number of pages of results for the current query. + /// + /// Number of pages of results for the current query. + [DataMember(Name = "nbPages", IsRequired = true, EmitDefaultValue = true)] + public int NbPages { get; set; } + + /// + /// Number of hits selected and sorted by the relevant sort algorithm. + /// + /// Number of hits selected and sorted by the relevant sort algorithm. + [DataMember(Name = "nbSortedHits", EmitDefaultValue = false)] + public int NbSortedHits { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", IsRequired = true, EmitDefaultValue = true)] + public int Page { get; set; } + + /// + /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. + /// + /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. + [DataMember(Name = "parsedQuery", EmitDefaultValue = false)] + public string ParsedQuery { get; set; } + + /// + /// Time the server took to process the request, in milliseconds. + /// + /// Time the server took to process the request, in milliseconds. + [DataMember(Name = "processingTimeMS", IsRequired = true, EmitDefaultValue = true)] + public int ProcessingTimeMS { get; set; } + + /// + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + /// + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + [DataMember(Name = "processingTimingsMS", EmitDefaultValue = false)] + public Object ProcessingTimingsMS { get; set; } + + /// + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + /// + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + [DataMember(Name = "queryAfterRemoval", EmitDefaultValue = false)] + public string QueryAfterRemoval { get; set; } + + /// + /// Gets or Sets Redirect + /// + [DataMember(Name = "redirect", EmitDefaultValue = false)] + public Redirect Redirect { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Time the server took to process the request, in milliseconds. + /// + /// Time the server took to process the request, in milliseconds. + [DataMember(Name = "serverTimeMS", EmitDefaultValue = false)] + public int ServerTimeMS { get; set; } + + /// + /// Host name of the server that processed the request. + /// + /// Host name of the server that processed the request. + [DataMember(Name = "serverUsed", EmitDefaultValue = false)] + public string ServerUsed { get; set; } + + /// + /// Lets you store custom data in your indices. + /// + /// Lets you store custom data in your indices. + [DataMember(Name = "userData", EmitDefaultValue = false)] + public Object UserData { get; set; } + + /// + /// Gets or Sets Hits + /// + [DataMember(Name = "hits", IsRequired = true, EmitDefaultValue = true)] + public List Hits { get; set; } + + /// + /// Text to search for in an index. + /// + /// Text to search for in an index. + [DataMember(Name = "query", EmitDefaultValue = false)] + public string Query { get; set; } + + /// + /// URL-encoded string of all search parameters. + /// + /// URL-encoded string of all search parameters. + [DataMember(Name = "params", EmitDefaultValue = false)] + public string VarParams { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RecommendationsResponse {\n"); + sb.Append(" AbTestID: ").Append(AbTestID).Append("\n"); + sb.Append(" AbTestVariantID: ").Append(AbTestVariantID).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AutomaticRadius: ").Append(AutomaticRadius).Append("\n"); + sb.Append(" Exhaustive: ").Append(Exhaustive).Append("\n"); + sb.Append(" ExhaustiveFacetsCount: ").Append(ExhaustiveFacetsCount).Append("\n"); + sb.Append(" ExhaustiveNbHits: ").Append(ExhaustiveNbHits).Append("\n"); + sb.Append(" ExhaustiveTypo: ").Append(ExhaustiveTypo).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" FacetsStats: ").Append(FacetsStats).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" IndexUsed: ").Append(IndexUsed).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" NbPages: ").Append(NbPages).Append("\n"); + sb.Append(" NbSortedHits: ").Append(NbSortedHits).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" ParsedQuery: ").Append(ParsedQuery).Append("\n"); + sb.Append(" ProcessingTimeMS: ").Append(ProcessingTimeMS).Append("\n"); + sb.Append(" ProcessingTimingsMS: ").Append(ProcessingTimingsMS).Append("\n"); + sb.Append(" QueryAfterRemoval: ").Append(QueryAfterRemoval).Append("\n"); + sb.Append(" Redirect: ").Append(Redirect).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append(" ServerTimeMS: ").Append(ServerTimeMS).Append("\n"); + sb.Append(" ServerUsed: ").Append(ServerUsed).Append("\n"); + sb.Append(" UserData: ").Append(UserData).Append("\n"); + sb.Append(" Hits: ").Append(Hits).Append("\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" VarParams: ").Append(VarParams).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RecommendationsResponse); + } + + /// + /// Returns true if RecommendationsResponse instances are equal + /// + /// Instance of RecommendationsResponse to be compared + /// Boolean + public bool Equals(RecommendationsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.AbTestID == input.AbTestID || + this.AbTestID.Equals(input.AbTestID) + ) && + ( + this.AbTestVariantID == input.AbTestVariantID || + this.AbTestVariantID.Equals(input.AbTestVariantID) + ) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && + ( + this.AutomaticRadius == input.AutomaticRadius || + (this.AutomaticRadius != null && + this.AutomaticRadius.Equals(input.AutomaticRadius)) + ) && + ( + this.Exhaustive == input.Exhaustive || + (this.Exhaustive != null && + this.Exhaustive.Equals(input.Exhaustive)) + ) && + ( + this.ExhaustiveFacetsCount == input.ExhaustiveFacetsCount || + this.ExhaustiveFacetsCount.Equals(input.ExhaustiveFacetsCount) + ) && + ( + this.ExhaustiveNbHits == input.ExhaustiveNbHits || + this.ExhaustiveNbHits.Equals(input.ExhaustiveNbHits) + ) && + ( + this.ExhaustiveTypo == input.ExhaustiveTypo || + this.ExhaustiveTypo.Equals(input.ExhaustiveTypo) + ) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && + ( + this.FacetsStats == input.FacetsStats || + this.FacetsStats != null && + input.FacetsStats != null && + this.FacetsStats.SequenceEqual(input.FacetsStats) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.IndexUsed == input.IndexUsed || + (this.IndexUsed != null && + this.IndexUsed.Equals(input.IndexUsed)) + ) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) && + ( + this.NbHits == input.NbHits || + this.NbHits.Equals(input.NbHits) + ) && + ( + this.NbPages == input.NbPages || + this.NbPages.Equals(input.NbPages) + ) && + ( + this.NbSortedHits == input.NbSortedHits || + this.NbSortedHits.Equals(input.NbSortedHits) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.ParsedQuery == input.ParsedQuery || + (this.ParsedQuery != null && + this.ParsedQuery.Equals(input.ParsedQuery)) + ) && + ( + this.ProcessingTimeMS == input.ProcessingTimeMS || + this.ProcessingTimeMS.Equals(input.ProcessingTimeMS) + ) && + ( + this.ProcessingTimingsMS == input.ProcessingTimingsMS || + (this.ProcessingTimingsMS != null && + this.ProcessingTimingsMS.Equals(input.ProcessingTimingsMS)) + ) && + ( + this.QueryAfterRemoval == input.QueryAfterRemoval || + (this.QueryAfterRemoval != null && + this.QueryAfterRemoval.Equals(input.QueryAfterRemoval)) + ) && + ( + this.Redirect == input.Redirect || + (this.Redirect != null && + this.Redirect.Equals(input.Redirect)) + ) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ) && + ( + this.ServerTimeMS == input.ServerTimeMS || + this.ServerTimeMS.Equals(input.ServerTimeMS) + ) && + ( + this.ServerUsed == input.ServerUsed || + (this.ServerUsed != null && + this.ServerUsed.Equals(input.ServerUsed)) + ) && + ( + this.UserData == input.UserData || + (this.UserData != null && + this.UserData.Equals(input.UserData)) + ) && + ( + this.Hits == input.Hits || + this.Hits != null && + input.Hits != null && + this.Hits.SequenceEqual(input.Hits) + ) && + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.VarParams == input.VarParams || + (this.VarParams != null && + this.VarParams.Equals(input.VarParams)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.AbTestID.GetHashCode(); + hashCode = (hashCode * 59) + this.AbTestVariantID.GetHashCode(); + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + if (this.AutomaticRadius != null) + { + hashCode = (hashCode * 59) + this.AutomaticRadius.GetHashCode(); + } + if (this.Exhaustive != null) + { + hashCode = (hashCode * 59) + this.Exhaustive.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ExhaustiveFacetsCount.GetHashCode(); + hashCode = (hashCode * 59) + this.ExhaustiveNbHits.GetHashCode(); + hashCode = (hashCode * 59) + this.ExhaustiveTypo.GetHashCode(); + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + if (this.FacetsStats != null) + { + hashCode = (hashCode * 59) + this.FacetsStats.GetHashCode(); + } + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.IndexUsed != null) + { + hashCode = (hashCode * 59) + this.IndexUsed.GetHashCode(); + } + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NbHits.GetHashCode(); + hashCode = (hashCode * 59) + this.NbPages.GetHashCode(); + hashCode = (hashCode * 59) + this.NbSortedHits.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + if (this.ParsedQuery != null) + { + hashCode = (hashCode * 59) + this.ParsedQuery.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ProcessingTimeMS.GetHashCode(); + if (this.ProcessingTimingsMS != null) + { + hashCode = (hashCode * 59) + this.ProcessingTimingsMS.GetHashCode(); + } + if (this.QueryAfterRemoval != null) + { + hashCode = (hashCode * 59) + this.QueryAfterRemoval.GetHashCode(); + } + if (this.Redirect != null) + { + hashCode = (hashCode * 59) + this.Redirect.GetHashCode(); + } + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ServerTimeMS.GetHashCode(); + if (this.ServerUsed != null) + { + hashCode = (hashCode * 59) + this.ServerUsed.GetHashCode(); + } + if (this.UserData != null) + { + hashCode = (hashCode * 59) + this.UserData.GetHashCode(); + } + if (this.Hits != null) + { + hashCode = (hashCode * 59) + this.Hits.GetHashCode(); + } + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.VarParams != null) + { + hashCode = (hashCode * 59) + this.VarParams.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // AbTestVariantID (int) minimum + if (this.AbTestVariantID < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for AbTestVariantID, must be a value greater than or equal to 1.", new[] { "AbTestVariantID" }); + } + + if (this.AroundLatLng != null) + { + // AroundLatLng (string) pattern + Regex regexAroundLatLng = new Regex(@"^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$", RegexOptions.CultureInvariant); + if (!regexAroundLatLng.Match(this.AroundLatLng).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for AroundLatLng, must match a pattern of " + regexAroundLatLng, new[] { "AroundLatLng" }); + } + } + + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/Redirect.cs b/algoliasearch/Recommend/Models/Redirect.cs new file mode 100644 index 000000000..f445e56cf --- /dev/null +++ b/algoliasearch/Recommend/Models/Redirect.cs @@ -0,0 +1,124 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// [Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/). + /// + [DataContract(Name = "redirect")] + public partial class Redirect : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// index. + public Redirect(List index = default(List)) + { + this.Index = index; + } + + /// + /// Gets or Sets Index + /// + [DataMember(Name = "index", EmitDefaultValue = false)] + public List Index { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Redirect {\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Redirect); + } + + /// + /// Returns true if Redirect instances are equal + /// + /// Instance of Redirect to be compared + /// Boolean + public bool Equals(Redirect input) + { + if (input == null) + { + return false; + } + return + ( + this.Index == input.Index || + this.Index != null && + input.Index != null && + this.Index.SequenceEqual(input.Index) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/RedirectRuleIndexMetadata.cs b/algoliasearch/Recommend/Models/RedirectRuleIndexMetadata.cs new file mode 100644 index 000000000..118f71840 --- /dev/null +++ b/algoliasearch/Recommend/Models/RedirectRuleIndexMetadata.cs @@ -0,0 +1,220 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// RedirectRuleIndexMetadata + /// + [DataContract(Name = "RedirectRuleIndexMetadata")] + public partial class RedirectRuleIndexMetadata : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RedirectRuleIndexMetadata() { } + /// + /// Initializes a new instance of the class. + /// + /// Source index for the redirect rule. (required). + /// Destination index for the redirect rule. (required). + /// Reason for the redirect rule. (required). + /// Redirect rule status. (required). + /// data (required). + public RedirectRuleIndexMetadata(string source = default(string), string dest = default(string), string reason = default(string), bool succeed = default(bool), RedirectRuleIndexMetadataData data = default(RedirectRuleIndexMetadataData)) + { + // to ensure "source" is required (not null) + if (source == null) + { + throw new ArgumentNullException("source is a required property for RedirectRuleIndexMetadata and cannot be null"); + } + this.Source = source; + // to ensure "dest" is required (not null) + if (dest == null) + { + throw new ArgumentNullException("dest is a required property for RedirectRuleIndexMetadata and cannot be null"); + } + this.Dest = dest; + // to ensure "reason" is required (not null) + if (reason == null) + { + throw new ArgumentNullException("reason is a required property for RedirectRuleIndexMetadata and cannot be null"); + } + this.Reason = reason; + this.Succeed = succeed; + // to ensure "data" is required (not null) + if (data == null) + { + throw new ArgumentNullException("data is a required property for RedirectRuleIndexMetadata and cannot be null"); + } + this.Data = data; + } + + /// + /// Source index for the redirect rule. + /// + /// Source index for the redirect rule. + [DataMember(Name = "source", IsRequired = true, EmitDefaultValue = true)] + public string Source { get; set; } + + /// + /// Destination index for the redirect rule. + /// + /// Destination index for the redirect rule. + [DataMember(Name = "dest", IsRequired = true, EmitDefaultValue = true)] + public string Dest { get; set; } + + /// + /// Reason for the redirect rule. + /// + /// Reason for the redirect rule. + [DataMember(Name = "reason", IsRequired = true, EmitDefaultValue = true)] + public string Reason { get; set; } + + /// + /// Redirect rule status. + /// + /// Redirect rule status. + [DataMember(Name = "succeed", IsRequired = true, EmitDefaultValue = true)] + public bool Succeed { get; set; } + + /// + /// Gets or Sets Data + /// + [DataMember(Name = "data", IsRequired = true, EmitDefaultValue = true)] + public RedirectRuleIndexMetadataData Data { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RedirectRuleIndexMetadata {\n"); + sb.Append(" Source: ").Append(Source).Append("\n"); + sb.Append(" Dest: ").Append(Dest).Append("\n"); + sb.Append(" Reason: ").Append(Reason).Append("\n"); + sb.Append(" Succeed: ").Append(Succeed).Append("\n"); + sb.Append(" Data: ").Append(Data).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RedirectRuleIndexMetadata); + } + + /// + /// Returns true if RedirectRuleIndexMetadata instances are equal + /// + /// Instance of RedirectRuleIndexMetadata to be compared + /// Boolean + public bool Equals(RedirectRuleIndexMetadata input) + { + if (input == null) + { + return false; + } + return + ( + this.Source == input.Source || + (this.Source != null && + this.Source.Equals(input.Source)) + ) && + ( + this.Dest == input.Dest || + (this.Dest != null && + this.Dest.Equals(input.Dest)) + ) && + ( + this.Reason == input.Reason || + (this.Reason != null && + this.Reason.Equals(input.Reason)) + ) && + ( + this.Succeed == input.Succeed || + this.Succeed.Equals(input.Succeed) + ) && + ( + this.Data == input.Data || + (this.Data != null && + this.Data.Equals(input.Data)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Source != null) + { + hashCode = (hashCode * 59) + this.Source.GetHashCode(); + } + if (this.Dest != null) + { + hashCode = (hashCode * 59) + this.Dest.GetHashCode(); + } + if (this.Reason != null) + { + hashCode = (hashCode * 59) + this.Reason.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Succeed.GetHashCode(); + if (this.Data != null) + { + hashCode = (hashCode * 59) + this.Data.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/RedirectRuleIndexMetadataData.cs b/algoliasearch/Recommend/Models/RedirectRuleIndexMetadataData.cs new file mode 100644 index 000000000..0ff1582da --- /dev/null +++ b/algoliasearch/Recommend/Models/RedirectRuleIndexMetadataData.cs @@ -0,0 +1,133 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Redirect rule data. + /// + [DataContract(Name = "RedirectRuleIndexMetadata_data")] + public partial class RedirectRuleIndexMetadataData : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RedirectRuleIndexMetadataData() { } + /// + /// Initializes a new instance of the class. + /// + /// ruleObjectID (required). + public RedirectRuleIndexMetadataData(string ruleObjectID = default(string)) + { + // to ensure "ruleObjectID" is required (not null) + if (ruleObjectID == null) + { + throw new ArgumentNullException("ruleObjectID is a required property for RedirectRuleIndexMetadataData and cannot be null"); + } + this.RuleObjectID = ruleObjectID; + } + + /// + /// Gets or Sets RuleObjectID + /// + [DataMember(Name = "ruleObjectID", IsRequired = true, EmitDefaultValue = true)] + public string RuleObjectID { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RedirectRuleIndexMetadataData {\n"); + sb.Append(" RuleObjectID: ").Append(RuleObjectID).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RedirectRuleIndexMetadataData); + } + + /// + /// Returns true if RedirectRuleIndexMetadataData instances are equal + /// + /// Instance of RedirectRuleIndexMetadataData to be compared + /// Boolean + public bool Equals(RedirectRuleIndexMetadataData input) + { + if (input == null) + { + return false; + } + return + ( + this.RuleObjectID == input.RuleObjectID || + (this.RuleObjectID != null && + this.RuleObjectID.Equals(input.RuleObjectID)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RuleObjectID != null) + { + hashCode = (hashCode * 59) + this.RuleObjectID.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/RemoveStopWords.cs b/algoliasearch/Recommend/Models/RemoveStopWords.cs new file mode 100644 index 000000000..bbb599862 --- /dev/null +++ b/algoliasearch/Recommend/Models/RemoveStopWords.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Removes stop (common) words from the query before executing it. `removeStopWords` is used in conjunction with the `queryLanguages` setting. _list_: language ISO codes for which stop words should be enabled. This list will override any values that you may have set in `queryLanguages`. _true_: enables the stop words feature, ensuring that stop words are removed from consideration in a search. The languages supported here are either [every language](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/) (this is the default) or those set by `queryLanguages`. _false_: turns off the stop words feature, allowing stop words to be taken into account in a search. + /// + [JsonConverter(typeof(RemoveStopWordsJsonConverter))] + [DataContract(Name = "removeStopWords")] + public partial class RemoveStopWords : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<string>. + public RemoveStopWords(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of bool. + public RemoveStopWords(bool actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(bool)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, bool"); + } + } + } + + /// + /// Get the actual instance of `List<string>`. If the actual instance is not `List<string>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<string> + public List GetterListString() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `bool`. If the actual instance is not `bool`, + /// the InvalidClassException will be thrown + /// + /// An instance of bool + public bool GetterBool() + { + return (bool)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class RemoveStopWords {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, RemoveStopWords.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of RemoveStopWords + /// + /// JSON string + /// An instance of RemoveStopWords + public static RemoveStopWords FromJson(string jsonString) + { + RemoveStopWords newRemoveStopWords = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newRemoveStopWords; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newRemoveStopWords = new RemoveStopWords(JsonConvert.DeserializeObject>(jsonString, RemoveStopWords.SerializerSettings)); + } + else + { + newRemoveStopWords = new RemoveStopWords(JsonConvert.DeserializeObject>(jsonString, RemoveStopWords.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(bool).GetProperty("AdditionalProperties") == null) + { + newRemoveStopWords = new RemoveStopWords(JsonConvert.DeserializeObject(jsonString, RemoveStopWords.SerializerSettings)); + } + else + { + newRemoveStopWords = new RemoveStopWords(JsonConvert.DeserializeObject(jsonString, RemoveStopWords.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("bool"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into bool: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newRemoveStopWords; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RemoveStopWords); + } + + /// + /// Returns true if RemoveStopWords instances are equal + /// + /// Instance of RemoveStopWords to be compared + /// Boolean + public bool Equals(RemoveStopWords input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for RemoveStopWords + /// + public class RemoveStopWordsJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(RemoveStopWords).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return RemoveStopWords.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/RemoveWordsIfNoResults.cs b/algoliasearch/Recommend/Models/RemoveWordsIfNoResults.cs new file mode 100644 index 000000000..10a5e9991 --- /dev/null +++ b/algoliasearch/Recommend/Models/RemoveWordsIfNoResults.cs @@ -0,0 +1,55 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Strategy to [remove words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/in-depth/why-use-remove-words-if-no-results/) from the query when it doesn't match any hits. + /// + /// Strategy to [remove words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/in-depth/why-use-remove-words-if-no-results/) from the query when it doesn't match any hits. + [JsonConverter(typeof(StringEnumConverter))] + public enum RemoveWordsIfNoResults + { + /// + /// Enum None for value: none + /// + [EnumMember(Value = "none")] + None = 1, + + /// + /// Enum LastWords for value: lastWords + /// + [EnumMember(Value = "lastWords")] + LastWords = 2, + + /// + /// Enum FirstWords for value: firstWords + /// + [EnumMember(Value = "firstWords")] + FirstWords = 3, + + /// + /// Enum AllOptional for value: allOptional + /// + [EnumMember(Value = "allOptional")] + AllOptional = 4 + } + +} diff --git a/algoliasearch/Recommend/Models/RenderingContent.cs b/algoliasearch/Recommend/Models/RenderingContent.cs new file mode 100644 index 000000000..6cd984a20 --- /dev/null +++ b/algoliasearch/Recommend/Models/RenderingContent.cs @@ -0,0 +1,123 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Extra content for the search UI, for example, to control the [ordering and display of facets](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/merchandising-facets/#merchandise-facets-and-their-values-in-the-manual-editor). You can set a default value and dynamically override it with [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/). + /// + [DataContract(Name = "renderingContent")] + public partial class RenderingContent : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// facetOrdering. + public RenderingContent(FacetOrdering facetOrdering = default(FacetOrdering)) + { + this.FacetOrdering = facetOrdering; + } + + /// + /// Gets or Sets FacetOrdering + /// + [DataMember(Name = "facetOrdering", EmitDefaultValue = false)] + public FacetOrdering FacetOrdering { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RenderingContent {\n"); + sb.Append(" FacetOrdering: ").Append(FacetOrdering).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RenderingContent); + } + + /// + /// Returns true if RenderingContent instances are equal + /// + /// Instance of RenderingContent to be compared + /// Boolean + public bool Equals(RenderingContent input) + { + if (input == null) + { + return false; + } + return + ( + this.FacetOrdering == input.FacetOrdering || + (this.FacetOrdering != null && + this.FacetOrdering.Equals(input.FacetOrdering)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.FacetOrdering != null) + { + hashCode = (hashCode * 59) + this.FacetOrdering.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/RuleResponse.cs b/algoliasearch/Recommend/Models/RuleResponse.cs new file mode 100644 index 000000000..3929dc1b1 --- /dev/null +++ b/algoliasearch/Recommend/Models/RuleResponse.cs @@ -0,0 +1,224 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Rule object. + /// + [DataContract(Name = "ruleResponse")] + public partial class RuleResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RuleResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// metadata. + /// Unique identifier for a rule object. (required). + /// [Conditions](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/#conditions) required to activate a rule. You can use up to 25 conditions per rule. . + /// consequence. + /// Description of the rule's purpose. This can be helpful for display in the Algolia dashboard.. + /// Indicates whether to enable the rule. If it isn't enabled, it isn't applied at query time. (default to true). + public RuleResponse(RuleResponseMetadata metadata = default(RuleResponseMetadata), string objectID = default(string), List conditions = default(List), Consequence consequence = default(Consequence), string description = default(string), bool enabled = true) + { + // to ensure "objectID" is required (not null) + if (objectID == null) + { + throw new ArgumentNullException("objectID is a required property for RuleResponse and cannot be null"); + } + this.ObjectID = objectID; + this.Metadata = metadata; + this.Conditions = conditions; + this.Consequence = consequence; + this.Description = description; + this.Enabled = enabled; + } + + /// + /// Gets or Sets Metadata + /// + [DataMember(Name = "_metadata", EmitDefaultValue = false)] + public RuleResponseMetadata Metadata { get; set; } + + /// + /// Unique identifier for a rule object. + /// + /// Unique identifier for a rule object. + [DataMember(Name = "objectID", IsRequired = true, EmitDefaultValue = true)] + public string ObjectID { get; set; } + + /// + /// [Conditions](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/#conditions) required to activate a rule. You can use up to 25 conditions per rule. + /// + /// [Conditions](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/#conditions) required to activate a rule. You can use up to 25 conditions per rule. + [DataMember(Name = "conditions", EmitDefaultValue = false)] + public List Conditions { get; set; } + + /// + /// Gets or Sets Consequence + /// + [DataMember(Name = "consequence", EmitDefaultValue = false)] + public Consequence Consequence { get; set; } + + /// + /// Description of the rule's purpose. This can be helpful for display in the Algolia dashboard. + /// + /// Description of the rule's purpose. This can be helpful for display in the Algolia dashboard. + [DataMember(Name = "description", EmitDefaultValue = false)] + public string Description { get; set; } + + /// + /// Indicates whether to enable the rule. If it isn't enabled, it isn't applied at query time. + /// + /// Indicates whether to enable the rule. If it isn't enabled, it isn't applied at query time. + [DataMember(Name = "enabled", EmitDefaultValue = true)] + public bool Enabled { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RuleResponse {\n"); + sb.Append(" Metadata: ").Append(Metadata).Append("\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append(" Conditions: ").Append(Conditions).Append("\n"); + sb.Append(" Consequence: ").Append(Consequence).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append(" Enabled: ").Append(Enabled).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RuleResponse); + } + + /// + /// Returns true if RuleResponse instances are equal + /// + /// Instance of RuleResponse to be compared + /// Boolean + public bool Equals(RuleResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Metadata == input.Metadata || + (this.Metadata != null && + this.Metadata.Equals(input.Metadata)) + ) && + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ) && + ( + this.Conditions == input.Conditions || + this.Conditions != null && + input.Conditions != null && + this.Conditions.SequenceEqual(input.Conditions) + ) && + ( + this.Consequence == input.Consequence || + (this.Consequence != null && + this.Consequence.Equals(input.Consequence)) + ) && + ( + this.Description == input.Description || + (this.Description != null && + this.Description.Equals(input.Description)) + ) && + ( + this.Enabled == input.Enabled || + this.Enabled.Equals(input.Enabled) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Metadata != null) + { + hashCode = (hashCode * 59) + this.Metadata.GetHashCode(); + } + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + if (this.Conditions != null) + { + hashCode = (hashCode * 59) + this.Conditions.GetHashCode(); + } + if (this.Consequence != null) + { + hashCode = (hashCode * 59) + this.Consequence.GetHashCode(); + } + if (this.Description != null) + { + hashCode = (hashCode * 59) + this.Description.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Enabled.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/RuleResponseMetadata.cs b/algoliasearch/Recommend/Models/RuleResponseMetadata.cs new file mode 100644 index 000000000..e16ad9bb9 --- /dev/null +++ b/algoliasearch/Recommend/Models/RuleResponseMetadata.cs @@ -0,0 +1,124 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// RuleResponseMetadata + /// + [DataContract(Name = "ruleResponse__metadata")] + public partial class RuleResponseMetadata : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format.. + public RuleResponseMetadata(string lastUpdate = default(string)) + { + this.LastUpdate = lastUpdate; + } + + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "lastUpdate", EmitDefaultValue = false)] + public string LastUpdate { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RuleResponseMetadata {\n"); + sb.Append(" LastUpdate: ").Append(LastUpdate).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RuleResponseMetadata); + } + + /// + /// Returns true if RuleResponseMetadata instances are equal + /// + /// Instance of RuleResponseMetadata to be compared + /// Boolean + public bool Equals(RuleResponseMetadata input) + { + if (input == null) + { + return false; + } + return + ( + this.LastUpdate == input.LastUpdate || + (this.LastUpdate != null && + this.LastUpdate.Equals(input.LastUpdate)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.LastUpdate != null) + { + hashCode = (hashCode * 59) + this.LastUpdate.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/SearchParamsObject.cs b/algoliasearch/Recommend/Models/SearchParamsObject.cs new file mode 100644 index 000000000..5dc358597 --- /dev/null +++ b/algoliasearch/Recommend/Models/SearchParamsObject.cs @@ -0,0 +1,1512 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// SearchParamsObject + /// + [DataContract(Name = "searchParamsObject")] + public partial class SearchParamsObject : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets QueryType + /// + [DataMember(Name = "queryType", EmitDefaultValue = false)] + public QueryType? QueryType { get; set; } + + /// + /// Gets or Sets RemoveWordsIfNoResults + /// + [DataMember(Name = "removeWordsIfNoResults", EmitDefaultValue = false)] + public RemoveWordsIfNoResults? RemoveWordsIfNoResults { get; set; } + + /// + /// Gets or Sets Mode + /// + [DataMember(Name = "mode", EmitDefaultValue = false)] + public Mode? Mode { get; set; } + + /// + /// Gets or Sets ExactOnSingleWordQuery + /// + [DataMember(Name = "exactOnSingleWordQuery", EmitDefaultValue = false)] + public ExactOnSingleWordQuery? ExactOnSingleWordQuery { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Text to search for in an index. (default to ""). + /// Overrides the query parameter and performs a more generic search. (default to ""). + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. (default to ""). + /// facetFilters. + /// optionalFilters. + /// numericFilters. + /// tagFilters. + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. (default to false). + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/).. + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values.. + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. (default to false). + /// Page to retrieve (the first page is `0`, not `1`). (default to 0). + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. (default to ""). + /// Search for entries around a location. The location is automatically computed from the requester's IP address. (default to false). + /// aroundRadius. + /// aroundPrecision. + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set.. + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries.. + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries.. + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). (default to 100). + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search.. + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). (default to false). + /// Enriches the API's response with information about how the query was processed.. + /// Whether to take into account an index's synonyms for a particular search. (default to true). + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). (default to false). + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). (default to true). + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).. + /// Whether to include or exclude a query from the processing-time percentile computation. (default to true). + /// Incidates whether this search will be considered in A/B testing. (default to true). + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. . + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes.. + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/).. + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. . + /// Relevancy threshold below which less relevant results aren't included in the results. (default to 100). + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`).. + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. . + /// HTML string to insert before the highlighted parts in all highlight and snippet results. (default to "<em>"). + /// HTML string to insert after the highlighted parts in all highlight and snippet results. (default to "</em>"). + /// String used as an ellipsis indicator when a snippet is truncated. (default to "…"). + /// Restrict highlighting and snippeting to items that matched the query. (default to false). + /// Number of hits per page. (default to 20). + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 4). + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 8). + /// typoTolerance. + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. (default to true). + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/).. + /// ignorePlurals. + /// removeStopWords. + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). (default to ""). + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection.. + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. (default to true). + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. (default to true). + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. (default to false). + /// queryType. + /// removeWordsIfNoResults. + /// mode. + /// semanticSearch. + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). (default to false). + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query.. + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// exactOnSingleWordQuery. + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled.. + /// distinct. + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. (default to false). + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). (default to 1). + /// Attributes to include in the API response for search and browse queries.. + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). (default to 10). + /// Maximum number of facet values to return for each facet. (default to 100). + /// Controls how facet values are fetched. (default to "count"). + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. (default to false). + /// renderingContent. + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). (default to true). + /// reRankingApplyFilter. + public SearchParamsObject(string query = @"", string similarQuery = @"", string filters = @"", FacetFilters facetFilters = default(FacetFilters), OptionalFilters optionalFilters = default(OptionalFilters), NumericFilters numericFilters = default(NumericFilters), TagFilters tagFilters = default(TagFilters), bool sumOrFiltersScores = false, List restrictSearchableAttributes = default(List), List facets = default(List), bool facetingAfterDistinct = false, int page = 0, int offset = default(int), int length = default(int), string aroundLatLng = @"", bool aroundLatLngViaIP = false, AroundRadius aroundRadius = default(AroundRadius), AroundPrecision aroundPrecision = default(AroundPrecision), int minimumAroundRadius = default(int), List> insideBoundingBox = default(List>), List> insidePolygon = default(List>), List naturalLanguages = default(List), List ruleContexts = default(List), int personalizationImpact = 100, string userToken = default(string), bool getRankingInfo = false, List explain = default(List), bool synonyms = true, bool clickAnalytics = false, bool analytics = true, List analyticsTags = default(List), bool percentileComputation = true, bool enableABTest = true, List attributesForFaceting = default(List), List attributesToRetrieve = default(List), List ranking = default(List), List customRanking = default(List), int relevancyStrictness = 100, List attributesToHighlight = default(List), List attributesToSnippet = default(List), string highlightPreTag = @"", string highlightPostTag = @"", string snippetEllipsisText = @"…", bool restrictHighlightAndSnippetArrays = false, int hitsPerPage = 20, int minWordSizefor1Typo = 4, int minWordSizefor2Typos = 8, TypoTolerance typoTolerance = default(TypoTolerance), bool allowTyposOnNumericTokens = true, List disableTypoToleranceOnAttributes = default(List), IgnorePlurals ignorePlurals = default(IgnorePlurals), RemoveStopWords removeStopWords = default(RemoveStopWords), string keepDiacriticsOnCharacters = @"", List queryLanguages = default(List), bool decompoundQuery = true, bool enableRules = true, bool enablePersonalization = false, QueryType? queryType = default(QueryType?), RemoveWordsIfNoResults? removeWordsIfNoResults = default(RemoveWordsIfNoResults?), Mode? mode = default(Mode?), SemanticSearch semanticSearch = default(SemanticSearch), bool advancedSyntax = false, List optionalWords = default(List), List disableExactOnAttributes = default(List), ExactOnSingleWordQuery? exactOnSingleWordQuery = default(ExactOnSingleWordQuery?), List alternativesAsExact = default(List), List advancedSyntaxFeatures = default(List), Distinct distinct = default(Distinct), bool replaceSynonymsInHighlight = false, int minProximity = 1, List responseFields = default(List), int maxFacetHits = 10, int maxValuesPerFacet = 100, string sortFacetValuesBy = @"count", bool attributeCriteriaComputedByMinProximity = false, RenderingContent renderingContent = default(RenderingContent), bool enableReRanking = true, ReRankingApplyFilter reRankingApplyFilter = default(ReRankingApplyFilter)) + { + // use default value if no "query" provided + this.Query = query ?? @""; + // use default value if no "similarQuery" provided + this.SimilarQuery = similarQuery ?? @""; + // use default value if no "filters" provided + this.Filters = filters ?? @""; + this.FacetFilters = facetFilters; + this.OptionalFilters = optionalFilters; + this.NumericFilters = numericFilters; + this.TagFilters = tagFilters; + this.SumOrFiltersScores = sumOrFiltersScores; + this.RestrictSearchableAttributes = restrictSearchableAttributes; + this.Facets = facets; + this.FacetingAfterDistinct = facetingAfterDistinct; + this.Page = page; + this.Offset = offset; + this.Length = length; + // use default value if no "aroundLatLng" provided + this.AroundLatLng = aroundLatLng ?? @""; + this.AroundLatLngViaIP = aroundLatLngViaIP; + this.AroundRadius = aroundRadius; + this.AroundPrecision = aroundPrecision; + this.MinimumAroundRadius = minimumAroundRadius; + this.InsideBoundingBox = insideBoundingBox; + this.InsidePolygon = insidePolygon; + this.NaturalLanguages = naturalLanguages; + this.RuleContexts = ruleContexts; + this.PersonalizationImpact = personalizationImpact; + this.UserToken = userToken; + this.GetRankingInfo = getRankingInfo; + this.Explain = explain; + this.Synonyms = synonyms; + this.ClickAnalytics = clickAnalytics; + this.Analytics = analytics; + this.AnalyticsTags = analyticsTags; + this.PercentileComputation = percentileComputation; + this.EnableABTest = enableABTest; + this.AttributesForFaceting = attributesForFaceting; + this.AttributesToRetrieve = attributesToRetrieve; + this.Ranking = ranking; + this.CustomRanking = customRanking; + this.RelevancyStrictness = relevancyStrictness; + this.AttributesToHighlight = attributesToHighlight; + this.AttributesToSnippet = attributesToSnippet; + // use default value if no "highlightPreTag" provided + this.HighlightPreTag = highlightPreTag ?? @""; + // use default value if no "highlightPostTag" provided + this.HighlightPostTag = highlightPostTag ?? @""; + // use default value if no "snippetEllipsisText" provided + this.SnippetEllipsisText = snippetEllipsisText ?? @"…"; + this.RestrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + this.HitsPerPage = hitsPerPage; + this.MinWordSizefor1Typo = minWordSizefor1Typo; + this.MinWordSizefor2Typos = minWordSizefor2Typos; + this.TypoTolerance = typoTolerance; + this.AllowTyposOnNumericTokens = allowTyposOnNumericTokens; + this.DisableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + this.IgnorePlurals = ignorePlurals; + this.RemoveStopWords = removeStopWords; + // use default value if no "keepDiacriticsOnCharacters" provided + this.KeepDiacriticsOnCharacters = keepDiacriticsOnCharacters ?? @""; + this.QueryLanguages = queryLanguages; + this.DecompoundQuery = decompoundQuery; + this.EnableRules = enableRules; + this.EnablePersonalization = enablePersonalization; + this.QueryType = queryType; + this.RemoveWordsIfNoResults = removeWordsIfNoResults; + this.Mode = mode; + this.SemanticSearch = semanticSearch; + this.AdvancedSyntax = advancedSyntax; + this.OptionalWords = optionalWords; + this.DisableExactOnAttributes = disableExactOnAttributes; + this.ExactOnSingleWordQuery = exactOnSingleWordQuery; + this.AlternativesAsExact = alternativesAsExact; + this.AdvancedSyntaxFeatures = advancedSyntaxFeatures; + this.Distinct = distinct; + this.ReplaceSynonymsInHighlight = replaceSynonymsInHighlight; + this.MinProximity = minProximity; + this.ResponseFields = responseFields; + this.MaxFacetHits = maxFacetHits; + this.MaxValuesPerFacet = maxValuesPerFacet; + // use default value if no "sortFacetValuesBy" provided + this.SortFacetValuesBy = sortFacetValuesBy ?? @"count"; + this.AttributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + this.RenderingContent = renderingContent; + this.EnableReRanking = enableReRanking; + this.ReRankingApplyFilter = reRankingApplyFilter; + } + + /// + /// Text to search for in an index. + /// + /// Text to search for in an index. + [DataMember(Name = "query", EmitDefaultValue = false)] + public string Query { get; set; } + + /// + /// Overrides the query parameter and performs a more generic search. + /// + /// Overrides the query parameter and performs a more generic search. + [DataMember(Name = "similarQuery", EmitDefaultValue = false)] + public string SimilarQuery { get; set; } + + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + [DataMember(Name = "filters", EmitDefaultValue = false)] + public string Filters { get; set; } + + /// + /// Gets or Sets FacetFilters + /// + [DataMember(Name = "facetFilters", EmitDefaultValue = false)] + public FacetFilters FacetFilters { get; set; } + + /// + /// Gets or Sets OptionalFilters + /// + [DataMember(Name = "optionalFilters", EmitDefaultValue = false)] + public OptionalFilters OptionalFilters { get; set; } + + /// + /// Gets or Sets NumericFilters + /// + [DataMember(Name = "numericFilters", EmitDefaultValue = false)] + public NumericFilters NumericFilters { get; set; } + + /// + /// Gets or Sets TagFilters + /// + [DataMember(Name = "tagFilters", EmitDefaultValue = false)] + public TagFilters TagFilters { get; set; } + + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + [DataMember(Name = "sumOrFiltersScores", EmitDefaultValue = true)] + public bool SumOrFiltersScores { get; set; } + + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + [DataMember(Name = "restrictSearchableAttributes", EmitDefaultValue = false)] + public List RestrictSearchableAttributes { get; set; } + + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + [DataMember(Name = "facets", EmitDefaultValue = false)] + public List Facets { get; set; } + + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + [DataMember(Name = "facetingAfterDistinct", EmitDefaultValue = true)] + public bool FacetingAfterDistinct { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", EmitDefaultValue = false)] + public int Page { get; set; } + + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "offset", EmitDefaultValue = false)] + public int Offset { get; set; } + + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "length", EmitDefaultValue = false)] + public int Length { get; set; } + + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + [DataMember(Name = "aroundLatLngViaIP", EmitDefaultValue = true)] + public bool AroundLatLngViaIP { get; set; } + + /// + /// Gets or Sets AroundRadius + /// + [DataMember(Name = "aroundRadius", EmitDefaultValue = false)] + public AroundRadius AroundRadius { get; set; } + + /// + /// Gets or Sets AroundPrecision + /// + [DataMember(Name = "aroundPrecision", EmitDefaultValue = false)] + public AroundPrecision AroundPrecision { get; set; } + + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + [DataMember(Name = "minimumAroundRadius", EmitDefaultValue = false)] + public int MinimumAroundRadius { get; set; } + + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insideBoundingBox", EmitDefaultValue = false)] + public List> InsideBoundingBox { get; set; } + + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insidePolygon", EmitDefaultValue = false)] + public List> InsidePolygon { get; set; } + + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + [DataMember(Name = "naturalLanguages", EmitDefaultValue = false)] + public List NaturalLanguages { get; set; } + + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + [DataMember(Name = "ruleContexts", EmitDefaultValue = false)] + public List RuleContexts { get; set; } + + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + [DataMember(Name = "personalizationImpact", EmitDefaultValue = false)] + public int PersonalizationImpact { get; set; } + + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + [DataMember(Name = "userToken", EmitDefaultValue = false)] + public string UserToken { get; set; } + + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + [DataMember(Name = "getRankingInfo", EmitDefaultValue = true)] + public bool GetRankingInfo { get; set; } + + /// + /// Enriches the API's response with information about how the query was processed. + /// + /// Enriches the API's response with information about how the query was processed. + [DataMember(Name = "explain", EmitDefaultValue = false)] + public List Explain { get; set; } + + /// + /// Whether to take into account an index's synonyms for a particular search. + /// + /// Whether to take into account an index's synonyms for a particular search. + [DataMember(Name = "synonyms", EmitDefaultValue = true)] + public bool Synonyms { get; set; } + + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + [DataMember(Name = "clickAnalytics", EmitDefaultValue = true)] + public bool ClickAnalytics { get; set; } + + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + [DataMember(Name = "analytics", EmitDefaultValue = true)] + public bool Analytics { get; set; } + + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + [DataMember(Name = "analyticsTags", EmitDefaultValue = false)] + public List AnalyticsTags { get; set; } + + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + [DataMember(Name = "percentileComputation", EmitDefaultValue = true)] + public bool PercentileComputation { get; set; } + + /// + /// Incidates whether this search will be considered in A/B testing. + /// + /// Incidates whether this search will be considered in A/B testing. + [DataMember(Name = "enableABTest", EmitDefaultValue = true)] + public bool EnableABTest { get; set; } + + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + [DataMember(Name = "attributesForFaceting", EmitDefaultValue = false)] + public List AttributesForFaceting { get; set; } + + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + [DataMember(Name = "attributesToRetrieve", EmitDefaultValue = false)] + public List AttributesToRetrieve { get; set; } + + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + [DataMember(Name = "ranking", EmitDefaultValue = false)] + public List Ranking { get; set; } + + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + [DataMember(Name = "customRanking", EmitDefaultValue = false)] + public List CustomRanking { get; set; } + + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + [DataMember(Name = "relevancyStrictness", EmitDefaultValue = false)] + public int RelevancyStrictness { get; set; } + + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + [DataMember(Name = "attributesToHighlight", EmitDefaultValue = false)] + public List AttributesToHighlight { get; set; } + + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + [DataMember(Name = "attributesToSnippet", EmitDefaultValue = false)] + public List AttributesToSnippet { get; set; } + + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPreTag", EmitDefaultValue = false)] + public string HighlightPreTag { get; set; } + + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPostTag", EmitDefaultValue = false)] + public string HighlightPostTag { get; set; } + + /// + /// String used as an ellipsis indicator when a snippet is truncated. + /// + /// String used as an ellipsis indicator when a snippet is truncated. + [DataMember(Name = "snippetEllipsisText", EmitDefaultValue = false)] + public string SnippetEllipsisText { get; set; } + + /// + /// Restrict highlighting and snippeting to items that matched the query. + /// + /// Restrict highlighting and snippeting to items that matched the query. + [DataMember(Name = "restrictHighlightAndSnippetArrays", EmitDefaultValue = true)] + public bool RestrictHighlightAndSnippetArrays { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", EmitDefaultValue = false)] + public int HitsPerPage { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor1Typo", EmitDefaultValue = false)] + public int MinWordSizefor1Typo { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor2Typos", EmitDefaultValue = false)] + public int MinWordSizefor2Typos { get; set; } + + /// + /// Gets or Sets TypoTolerance + /// + [DataMember(Name = "typoTolerance", EmitDefaultValue = false)] + public TypoTolerance TypoTolerance { get; set; } + + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + [DataMember(Name = "allowTyposOnNumericTokens", EmitDefaultValue = true)] + public bool AllowTyposOnNumericTokens { get; set; } + + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + [DataMember(Name = "disableTypoToleranceOnAttributes", EmitDefaultValue = false)] + public List DisableTypoToleranceOnAttributes { get; set; } + + /// + /// Gets or Sets IgnorePlurals + /// + [DataMember(Name = "ignorePlurals", EmitDefaultValue = false)] + public IgnorePlurals IgnorePlurals { get; set; } + + /// + /// Gets or Sets RemoveStopWords + /// + [DataMember(Name = "removeStopWords", EmitDefaultValue = false)] + public RemoveStopWords RemoveStopWords { get; set; } + + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + [DataMember(Name = "keepDiacriticsOnCharacters", EmitDefaultValue = false)] + public string KeepDiacriticsOnCharacters { get; set; } + + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + [DataMember(Name = "queryLanguages", EmitDefaultValue = false)] + public List QueryLanguages { get; set; } + + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + [DataMember(Name = "decompoundQuery", EmitDefaultValue = true)] + public bool DecompoundQuery { get; set; } + + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + [DataMember(Name = "enableRules", EmitDefaultValue = true)] + public bool EnableRules { get; set; } + + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + [DataMember(Name = "enablePersonalization", EmitDefaultValue = true)] + public bool EnablePersonalization { get; set; } + + /// + /// Gets or Sets SemanticSearch + /// + [DataMember(Name = "semanticSearch", EmitDefaultValue = false)] + public SemanticSearch SemanticSearch { get; set; } + + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + [DataMember(Name = "advancedSyntax", EmitDefaultValue = true)] + public bool AdvancedSyntax { get; set; } + + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + [DataMember(Name = "optionalWords", EmitDefaultValue = false)] + public List OptionalWords { get; set; } + + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "disableExactOnAttributes", EmitDefaultValue = false)] + public List DisableExactOnAttributes { get; set; } + + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "alternativesAsExact", EmitDefaultValue = false)] + public List AlternativesAsExact { get; set; } + + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + [DataMember(Name = "advancedSyntaxFeatures", EmitDefaultValue = false)] + public List AdvancedSyntaxFeatures { get; set; } + + /// + /// Gets or Sets Distinct + /// + [DataMember(Name = "distinct", EmitDefaultValue = false)] + public Distinct Distinct { get; set; } + + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + [DataMember(Name = "replaceSynonymsInHighlight", EmitDefaultValue = true)] + public bool ReplaceSynonymsInHighlight { get; set; } + + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + [DataMember(Name = "minProximity", EmitDefaultValue = false)] + public int MinProximity { get; set; } + + /// + /// Attributes to include in the API response for search and browse queries. + /// + /// Attributes to include in the API response for search and browse queries. + [DataMember(Name = "responseFields", EmitDefaultValue = false)] + public List ResponseFields { get; set; } + + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + [DataMember(Name = "maxFacetHits", EmitDefaultValue = false)] + public int MaxFacetHits { get; set; } + + /// + /// Maximum number of facet values to return for each facet. + /// + /// Maximum number of facet values to return for each facet. + [DataMember(Name = "maxValuesPerFacet", EmitDefaultValue = false)] + public int MaxValuesPerFacet { get; set; } + + /// + /// Controls how facet values are fetched. + /// + /// Controls how facet values are fetched. + [DataMember(Name = "sortFacetValuesBy", EmitDefaultValue = false)] + public string SortFacetValuesBy { get; set; } + + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + [DataMember(Name = "attributeCriteriaComputedByMinProximity", EmitDefaultValue = true)] + public bool AttributeCriteriaComputedByMinProximity { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + [DataMember(Name = "enableReRanking", EmitDefaultValue = true)] + public bool EnableReRanking { get; set; } + + /// + /// Gets or Sets ReRankingApplyFilter + /// + [DataMember(Name = "reRankingApplyFilter", EmitDefaultValue = true)] + public ReRankingApplyFilter ReRankingApplyFilter { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchParamsObject {\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" SimilarQuery: ").Append(SimilarQuery).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" FacetFilters: ").Append(FacetFilters).Append("\n"); + sb.Append(" OptionalFilters: ").Append(OptionalFilters).Append("\n"); + sb.Append(" NumericFilters: ").Append(NumericFilters).Append("\n"); + sb.Append(" TagFilters: ").Append(TagFilters).Append("\n"); + sb.Append(" SumOrFiltersScores: ").Append(SumOrFiltersScores).Append("\n"); + sb.Append(" RestrictSearchableAttributes: ").Append(RestrictSearchableAttributes).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" FacetingAfterDistinct: ").Append(FacetingAfterDistinct).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" Offset: ").Append(Offset).Append("\n"); + sb.Append(" Length: ").Append(Length).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AroundLatLngViaIP: ").Append(AroundLatLngViaIP).Append("\n"); + sb.Append(" AroundRadius: ").Append(AroundRadius).Append("\n"); + sb.Append(" AroundPrecision: ").Append(AroundPrecision).Append("\n"); + sb.Append(" MinimumAroundRadius: ").Append(MinimumAroundRadius).Append("\n"); + sb.Append(" InsideBoundingBox: ").Append(InsideBoundingBox).Append("\n"); + sb.Append(" InsidePolygon: ").Append(InsidePolygon).Append("\n"); + sb.Append(" NaturalLanguages: ").Append(NaturalLanguages).Append("\n"); + sb.Append(" RuleContexts: ").Append(RuleContexts).Append("\n"); + sb.Append(" PersonalizationImpact: ").Append(PersonalizationImpact).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" GetRankingInfo: ").Append(GetRankingInfo).Append("\n"); + sb.Append(" Explain: ").Append(Explain).Append("\n"); + sb.Append(" Synonyms: ").Append(Synonyms).Append("\n"); + sb.Append(" ClickAnalytics: ").Append(ClickAnalytics).Append("\n"); + sb.Append(" Analytics: ").Append(Analytics).Append("\n"); + sb.Append(" AnalyticsTags: ").Append(AnalyticsTags).Append("\n"); + sb.Append(" PercentileComputation: ").Append(PercentileComputation).Append("\n"); + sb.Append(" EnableABTest: ").Append(EnableABTest).Append("\n"); + sb.Append(" AttributesForFaceting: ").Append(AttributesForFaceting).Append("\n"); + sb.Append(" AttributesToRetrieve: ").Append(AttributesToRetrieve).Append("\n"); + sb.Append(" Ranking: ").Append(Ranking).Append("\n"); + sb.Append(" CustomRanking: ").Append(CustomRanking).Append("\n"); + sb.Append(" RelevancyStrictness: ").Append(RelevancyStrictness).Append("\n"); + sb.Append(" AttributesToHighlight: ").Append(AttributesToHighlight).Append("\n"); + sb.Append(" AttributesToSnippet: ").Append(AttributesToSnippet).Append("\n"); + sb.Append(" HighlightPreTag: ").Append(HighlightPreTag).Append("\n"); + sb.Append(" HighlightPostTag: ").Append(HighlightPostTag).Append("\n"); + sb.Append(" SnippetEllipsisText: ").Append(SnippetEllipsisText).Append("\n"); + sb.Append(" RestrictHighlightAndSnippetArrays: ").Append(RestrictHighlightAndSnippetArrays).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" MinWordSizefor1Typo: ").Append(MinWordSizefor1Typo).Append("\n"); + sb.Append(" MinWordSizefor2Typos: ").Append(MinWordSizefor2Typos).Append("\n"); + sb.Append(" TypoTolerance: ").Append(TypoTolerance).Append("\n"); + sb.Append(" AllowTyposOnNumericTokens: ").Append(AllowTyposOnNumericTokens).Append("\n"); + sb.Append(" DisableTypoToleranceOnAttributes: ").Append(DisableTypoToleranceOnAttributes).Append("\n"); + sb.Append(" IgnorePlurals: ").Append(IgnorePlurals).Append("\n"); + sb.Append(" RemoveStopWords: ").Append(RemoveStopWords).Append("\n"); + sb.Append(" KeepDiacriticsOnCharacters: ").Append(KeepDiacriticsOnCharacters).Append("\n"); + sb.Append(" QueryLanguages: ").Append(QueryLanguages).Append("\n"); + sb.Append(" DecompoundQuery: ").Append(DecompoundQuery).Append("\n"); + sb.Append(" EnableRules: ").Append(EnableRules).Append("\n"); + sb.Append(" EnablePersonalization: ").Append(EnablePersonalization).Append("\n"); + sb.Append(" QueryType: ").Append(QueryType).Append("\n"); + sb.Append(" RemoveWordsIfNoResults: ").Append(RemoveWordsIfNoResults).Append("\n"); + sb.Append(" Mode: ").Append(Mode).Append("\n"); + sb.Append(" SemanticSearch: ").Append(SemanticSearch).Append("\n"); + sb.Append(" AdvancedSyntax: ").Append(AdvancedSyntax).Append("\n"); + sb.Append(" OptionalWords: ").Append(OptionalWords).Append("\n"); + sb.Append(" DisableExactOnAttributes: ").Append(DisableExactOnAttributes).Append("\n"); + sb.Append(" ExactOnSingleWordQuery: ").Append(ExactOnSingleWordQuery).Append("\n"); + sb.Append(" AlternativesAsExact: ").Append(AlternativesAsExact).Append("\n"); + sb.Append(" AdvancedSyntaxFeatures: ").Append(AdvancedSyntaxFeatures).Append("\n"); + sb.Append(" Distinct: ").Append(Distinct).Append("\n"); + sb.Append(" ReplaceSynonymsInHighlight: ").Append(ReplaceSynonymsInHighlight).Append("\n"); + sb.Append(" MinProximity: ").Append(MinProximity).Append("\n"); + sb.Append(" ResponseFields: ").Append(ResponseFields).Append("\n"); + sb.Append(" MaxFacetHits: ").Append(MaxFacetHits).Append("\n"); + sb.Append(" MaxValuesPerFacet: ").Append(MaxValuesPerFacet).Append("\n"); + sb.Append(" SortFacetValuesBy: ").Append(SortFacetValuesBy).Append("\n"); + sb.Append(" AttributeCriteriaComputedByMinProximity: ").Append(AttributeCriteriaComputedByMinProximity).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append(" EnableReRanking: ").Append(EnableReRanking).Append("\n"); + sb.Append(" ReRankingApplyFilter: ").Append(ReRankingApplyFilter).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchParamsObject); + } + + /// + /// Returns true if SearchParamsObject instances are equal + /// + /// Instance of SearchParamsObject to be compared + /// Boolean + public bool Equals(SearchParamsObject input) + { + if (input == null) + { + return false; + } + return + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.SimilarQuery == input.SimilarQuery || + (this.SimilarQuery != null && + this.SimilarQuery.Equals(input.SimilarQuery)) + ) && + ( + this.Filters == input.Filters || + (this.Filters != null && + this.Filters.Equals(input.Filters)) + ) && + ( + this.FacetFilters == input.FacetFilters || + (this.FacetFilters != null && + this.FacetFilters.Equals(input.FacetFilters)) + ) && + ( + this.OptionalFilters == input.OptionalFilters || + (this.OptionalFilters != null && + this.OptionalFilters.Equals(input.OptionalFilters)) + ) && + ( + this.NumericFilters == input.NumericFilters || + (this.NumericFilters != null && + this.NumericFilters.Equals(input.NumericFilters)) + ) && + ( + this.TagFilters == input.TagFilters || + (this.TagFilters != null && + this.TagFilters.Equals(input.TagFilters)) + ) && + ( + this.SumOrFiltersScores == input.SumOrFiltersScores || + this.SumOrFiltersScores.Equals(input.SumOrFiltersScores) + ) && + ( + this.RestrictSearchableAttributes == input.RestrictSearchableAttributes || + this.RestrictSearchableAttributes != null && + input.RestrictSearchableAttributes != null && + this.RestrictSearchableAttributes.SequenceEqual(input.RestrictSearchableAttributes) + ) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && + ( + this.FacetingAfterDistinct == input.FacetingAfterDistinct || + this.FacetingAfterDistinct.Equals(input.FacetingAfterDistinct) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.Offset == input.Offset || + this.Offset.Equals(input.Offset) + ) && + ( + this.Length == input.Length || + this.Length.Equals(input.Length) + ) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && + ( + this.AroundLatLngViaIP == input.AroundLatLngViaIP || + this.AroundLatLngViaIP.Equals(input.AroundLatLngViaIP) + ) && + ( + this.AroundRadius == input.AroundRadius || + (this.AroundRadius != null && + this.AroundRadius.Equals(input.AroundRadius)) + ) && + ( + this.AroundPrecision == input.AroundPrecision || + (this.AroundPrecision != null && + this.AroundPrecision.Equals(input.AroundPrecision)) + ) && + ( + this.MinimumAroundRadius == input.MinimumAroundRadius || + this.MinimumAroundRadius.Equals(input.MinimumAroundRadius) + ) && + ( + this.InsideBoundingBox == input.InsideBoundingBox || + this.InsideBoundingBox != null && + input.InsideBoundingBox != null && + this.InsideBoundingBox.SequenceEqual(input.InsideBoundingBox) + ) && + ( + this.InsidePolygon == input.InsidePolygon || + this.InsidePolygon != null && + input.InsidePolygon != null && + this.InsidePolygon.SequenceEqual(input.InsidePolygon) + ) && + ( + this.NaturalLanguages == input.NaturalLanguages || + this.NaturalLanguages != null && + input.NaturalLanguages != null && + this.NaturalLanguages.SequenceEqual(input.NaturalLanguages) + ) && + ( + this.RuleContexts == input.RuleContexts || + this.RuleContexts != null && + input.RuleContexts != null && + this.RuleContexts.SequenceEqual(input.RuleContexts) + ) && + ( + this.PersonalizationImpact == input.PersonalizationImpact || + this.PersonalizationImpact.Equals(input.PersonalizationImpact) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.GetRankingInfo == input.GetRankingInfo || + this.GetRankingInfo.Equals(input.GetRankingInfo) + ) && + ( + this.Explain == input.Explain || + this.Explain != null && + input.Explain != null && + this.Explain.SequenceEqual(input.Explain) + ) && + ( + this.Synonyms == input.Synonyms || + this.Synonyms.Equals(input.Synonyms) + ) && + ( + this.ClickAnalytics == input.ClickAnalytics || + this.ClickAnalytics.Equals(input.ClickAnalytics) + ) && + ( + this.Analytics == input.Analytics || + this.Analytics.Equals(input.Analytics) + ) && + ( + this.AnalyticsTags == input.AnalyticsTags || + this.AnalyticsTags != null && + input.AnalyticsTags != null && + this.AnalyticsTags.SequenceEqual(input.AnalyticsTags) + ) && + ( + this.PercentileComputation == input.PercentileComputation || + this.PercentileComputation.Equals(input.PercentileComputation) + ) && + ( + this.EnableABTest == input.EnableABTest || + this.EnableABTest.Equals(input.EnableABTest) + ) && + ( + this.AttributesForFaceting == input.AttributesForFaceting || + this.AttributesForFaceting != null && + input.AttributesForFaceting != null && + this.AttributesForFaceting.SequenceEqual(input.AttributesForFaceting) + ) && + ( + this.AttributesToRetrieve == input.AttributesToRetrieve || + this.AttributesToRetrieve != null && + input.AttributesToRetrieve != null && + this.AttributesToRetrieve.SequenceEqual(input.AttributesToRetrieve) + ) && + ( + this.Ranking == input.Ranking || + this.Ranking != null && + input.Ranking != null && + this.Ranking.SequenceEqual(input.Ranking) + ) && + ( + this.CustomRanking == input.CustomRanking || + this.CustomRanking != null && + input.CustomRanking != null && + this.CustomRanking.SequenceEqual(input.CustomRanking) + ) && + ( + this.RelevancyStrictness == input.RelevancyStrictness || + this.RelevancyStrictness.Equals(input.RelevancyStrictness) + ) && + ( + this.AttributesToHighlight == input.AttributesToHighlight || + this.AttributesToHighlight != null && + input.AttributesToHighlight != null && + this.AttributesToHighlight.SequenceEqual(input.AttributesToHighlight) + ) && + ( + this.AttributesToSnippet == input.AttributesToSnippet || + this.AttributesToSnippet != null && + input.AttributesToSnippet != null && + this.AttributesToSnippet.SequenceEqual(input.AttributesToSnippet) + ) && + ( + this.HighlightPreTag == input.HighlightPreTag || + (this.HighlightPreTag != null && + this.HighlightPreTag.Equals(input.HighlightPreTag)) + ) && + ( + this.HighlightPostTag == input.HighlightPostTag || + (this.HighlightPostTag != null && + this.HighlightPostTag.Equals(input.HighlightPostTag)) + ) && + ( + this.SnippetEllipsisText == input.SnippetEllipsisText || + (this.SnippetEllipsisText != null && + this.SnippetEllipsisText.Equals(input.SnippetEllipsisText)) + ) && + ( + this.RestrictHighlightAndSnippetArrays == input.RestrictHighlightAndSnippetArrays || + this.RestrictHighlightAndSnippetArrays.Equals(input.RestrictHighlightAndSnippetArrays) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && + ( + this.MinWordSizefor1Typo == input.MinWordSizefor1Typo || + this.MinWordSizefor1Typo.Equals(input.MinWordSizefor1Typo) + ) && + ( + this.MinWordSizefor2Typos == input.MinWordSizefor2Typos || + this.MinWordSizefor2Typos.Equals(input.MinWordSizefor2Typos) + ) && + ( + this.TypoTolerance == input.TypoTolerance || + (this.TypoTolerance != null && + this.TypoTolerance.Equals(input.TypoTolerance)) + ) && + ( + this.AllowTyposOnNumericTokens == input.AllowTyposOnNumericTokens || + this.AllowTyposOnNumericTokens.Equals(input.AllowTyposOnNumericTokens) + ) && + ( + this.DisableTypoToleranceOnAttributes == input.DisableTypoToleranceOnAttributes || + this.DisableTypoToleranceOnAttributes != null && + input.DisableTypoToleranceOnAttributes != null && + this.DisableTypoToleranceOnAttributes.SequenceEqual(input.DisableTypoToleranceOnAttributes) + ) && + ( + this.IgnorePlurals == input.IgnorePlurals || + (this.IgnorePlurals != null && + this.IgnorePlurals.Equals(input.IgnorePlurals)) + ) && + ( + this.RemoveStopWords == input.RemoveStopWords || + (this.RemoveStopWords != null && + this.RemoveStopWords.Equals(input.RemoveStopWords)) + ) && + ( + this.KeepDiacriticsOnCharacters == input.KeepDiacriticsOnCharacters || + (this.KeepDiacriticsOnCharacters != null && + this.KeepDiacriticsOnCharacters.Equals(input.KeepDiacriticsOnCharacters)) + ) && + ( + this.QueryLanguages == input.QueryLanguages || + this.QueryLanguages != null && + input.QueryLanguages != null && + this.QueryLanguages.SequenceEqual(input.QueryLanguages) + ) && + ( + this.DecompoundQuery == input.DecompoundQuery || + this.DecompoundQuery.Equals(input.DecompoundQuery) + ) && + ( + this.EnableRules == input.EnableRules || + this.EnableRules.Equals(input.EnableRules) + ) && + ( + this.EnablePersonalization == input.EnablePersonalization || + this.EnablePersonalization.Equals(input.EnablePersonalization) + ) && + ( + this.QueryType == input.QueryType || + this.QueryType.Equals(input.QueryType) + ) && + ( + this.RemoveWordsIfNoResults == input.RemoveWordsIfNoResults || + this.RemoveWordsIfNoResults.Equals(input.RemoveWordsIfNoResults) + ) && + ( + this.Mode == input.Mode || + this.Mode.Equals(input.Mode) + ) && + ( + this.SemanticSearch == input.SemanticSearch || + (this.SemanticSearch != null && + this.SemanticSearch.Equals(input.SemanticSearch)) + ) && + ( + this.AdvancedSyntax == input.AdvancedSyntax || + this.AdvancedSyntax.Equals(input.AdvancedSyntax) + ) && + ( + this.OptionalWords == input.OptionalWords || + this.OptionalWords != null && + input.OptionalWords != null && + this.OptionalWords.SequenceEqual(input.OptionalWords) + ) && + ( + this.DisableExactOnAttributes == input.DisableExactOnAttributes || + this.DisableExactOnAttributes != null && + input.DisableExactOnAttributes != null && + this.DisableExactOnAttributes.SequenceEqual(input.DisableExactOnAttributes) + ) && + ( + this.ExactOnSingleWordQuery == input.ExactOnSingleWordQuery || + this.ExactOnSingleWordQuery.Equals(input.ExactOnSingleWordQuery) + ) && + ( + this.AlternativesAsExact == input.AlternativesAsExact || + this.AlternativesAsExact != null && + input.AlternativesAsExact != null && + this.AlternativesAsExact.SequenceEqual(input.AlternativesAsExact) + ) && + ( + this.AdvancedSyntaxFeatures == input.AdvancedSyntaxFeatures || + this.AdvancedSyntaxFeatures != null && + input.AdvancedSyntaxFeatures != null && + this.AdvancedSyntaxFeatures.SequenceEqual(input.AdvancedSyntaxFeatures) + ) && + ( + this.Distinct == input.Distinct || + (this.Distinct != null && + this.Distinct.Equals(input.Distinct)) + ) && + ( + this.ReplaceSynonymsInHighlight == input.ReplaceSynonymsInHighlight || + this.ReplaceSynonymsInHighlight.Equals(input.ReplaceSynonymsInHighlight) + ) && + ( + this.MinProximity == input.MinProximity || + this.MinProximity.Equals(input.MinProximity) + ) && + ( + this.ResponseFields == input.ResponseFields || + this.ResponseFields != null && + input.ResponseFields != null && + this.ResponseFields.SequenceEqual(input.ResponseFields) + ) && + ( + this.MaxFacetHits == input.MaxFacetHits || + this.MaxFacetHits.Equals(input.MaxFacetHits) + ) && + ( + this.MaxValuesPerFacet == input.MaxValuesPerFacet || + this.MaxValuesPerFacet.Equals(input.MaxValuesPerFacet) + ) && + ( + this.SortFacetValuesBy == input.SortFacetValuesBy || + (this.SortFacetValuesBy != null && + this.SortFacetValuesBy.Equals(input.SortFacetValuesBy)) + ) && + ( + this.AttributeCriteriaComputedByMinProximity == input.AttributeCriteriaComputedByMinProximity || + this.AttributeCriteriaComputedByMinProximity.Equals(input.AttributeCriteriaComputedByMinProximity) + ) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ) && + ( + this.EnableReRanking == input.EnableReRanking || + this.EnableReRanking.Equals(input.EnableReRanking) + ) && + ( + this.ReRankingApplyFilter == input.ReRankingApplyFilter || + (this.ReRankingApplyFilter != null && + this.ReRankingApplyFilter.Equals(input.ReRankingApplyFilter)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.SimilarQuery != null) + { + hashCode = (hashCode * 59) + this.SimilarQuery.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.FacetFilters != null) + { + hashCode = (hashCode * 59) + this.FacetFilters.GetHashCode(); + } + if (this.OptionalFilters != null) + { + hashCode = (hashCode * 59) + this.OptionalFilters.GetHashCode(); + } + if (this.NumericFilters != null) + { + hashCode = (hashCode * 59) + this.NumericFilters.GetHashCode(); + } + if (this.TagFilters != null) + { + hashCode = (hashCode * 59) + this.TagFilters.GetHashCode(); + } + hashCode = (hashCode * 59) + this.SumOrFiltersScores.GetHashCode(); + if (this.RestrictSearchableAttributes != null) + { + hashCode = (hashCode * 59) + this.RestrictSearchableAttributes.GetHashCode(); + } + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + hashCode = (hashCode * 59) + this.FacetingAfterDistinct.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.Offset.GetHashCode(); + hashCode = (hashCode * 59) + this.Length.GetHashCode(); + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AroundLatLngViaIP.GetHashCode(); + if (this.AroundRadius != null) + { + hashCode = (hashCode * 59) + this.AroundRadius.GetHashCode(); + } + if (this.AroundPrecision != null) + { + hashCode = (hashCode * 59) + this.AroundPrecision.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MinimumAroundRadius.GetHashCode(); + if (this.InsideBoundingBox != null) + { + hashCode = (hashCode * 59) + this.InsideBoundingBox.GetHashCode(); + } + if (this.InsidePolygon != null) + { + hashCode = (hashCode * 59) + this.InsidePolygon.GetHashCode(); + } + if (this.NaturalLanguages != null) + { + hashCode = (hashCode * 59) + this.NaturalLanguages.GetHashCode(); + } + if (this.RuleContexts != null) + { + hashCode = (hashCode * 59) + this.RuleContexts.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PersonalizationImpact.GetHashCode(); + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.GetRankingInfo.GetHashCode(); + if (this.Explain != null) + { + hashCode = (hashCode * 59) + this.Explain.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Synonyms.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickAnalytics.GetHashCode(); + hashCode = (hashCode * 59) + this.Analytics.GetHashCode(); + if (this.AnalyticsTags != null) + { + hashCode = (hashCode * 59) + this.AnalyticsTags.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PercentileComputation.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableABTest.GetHashCode(); + if (this.AttributesForFaceting != null) + { + hashCode = (hashCode * 59) + this.AttributesForFaceting.GetHashCode(); + } + if (this.AttributesToRetrieve != null) + { + hashCode = (hashCode * 59) + this.AttributesToRetrieve.GetHashCode(); + } + if (this.Ranking != null) + { + hashCode = (hashCode * 59) + this.Ranking.GetHashCode(); + } + if (this.CustomRanking != null) + { + hashCode = (hashCode * 59) + this.CustomRanking.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RelevancyStrictness.GetHashCode(); + if (this.AttributesToHighlight != null) + { + hashCode = (hashCode * 59) + this.AttributesToHighlight.GetHashCode(); + } + if (this.AttributesToSnippet != null) + { + hashCode = (hashCode * 59) + this.AttributesToSnippet.GetHashCode(); + } + if (this.HighlightPreTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPreTag.GetHashCode(); + } + if (this.HighlightPostTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPostTag.GetHashCode(); + } + if (this.SnippetEllipsisText != null) + { + hashCode = (hashCode * 59) + this.SnippetEllipsisText.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RestrictHighlightAndSnippetArrays.GetHashCode(); + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor1Typo.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor2Typos.GetHashCode(); + if (this.TypoTolerance != null) + { + hashCode = (hashCode * 59) + this.TypoTolerance.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AllowTyposOnNumericTokens.GetHashCode(); + if (this.DisableTypoToleranceOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableTypoToleranceOnAttributes.GetHashCode(); + } + if (this.IgnorePlurals != null) + { + hashCode = (hashCode * 59) + this.IgnorePlurals.GetHashCode(); + } + if (this.RemoveStopWords != null) + { + hashCode = (hashCode * 59) + this.RemoveStopWords.GetHashCode(); + } + if (this.KeepDiacriticsOnCharacters != null) + { + hashCode = (hashCode * 59) + this.KeepDiacriticsOnCharacters.GetHashCode(); + } + if (this.QueryLanguages != null) + { + hashCode = (hashCode * 59) + this.QueryLanguages.GetHashCode(); + } + hashCode = (hashCode * 59) + this.DecompoundQuery.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableRules.GetHashCode(); + hashCode = (hashCode * 59) + this.EnablePersonalization.GetHashCode(); + hashCode = (hashCode * 59) + this.QueryType.GetHashCode(); + hashCode = (hashCode * 59) + this.RemoveWordsIfNoResults.GetHashCode(); + hashCode = (hashCode * 59) + this.Mode.GetHashCode(); + if (this.SemanticSearch != null) + { + hashCode = (hashCode * 59) + this.SemanticSearch.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AdvancedSyntax.GetHashCode(); + if (this.OptionalWords != null) + { + hashCode = (hashCode * 59) + this.OptionalWords.GetHashCode(); + } + if (this.DisableExactOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableExactOnAttributes.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ExactOnSingleWordQuery.GetHashCode(); + if (this.AlternativesAsExact != null) + { + hashCode = (hashCode * 59) + this.AlternativesAsExact.GetHashCode(); + } + if (this.AdvancedSyntaxFeatures != null) + { + hashCode = (hashCode * 59) + this.AdvancedSyntaxFeatures.GetHashCode(); + } + if (this.Distinct != null) + { + hashCode = (hashCode * 59) + this.Distinct.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ReplaceSynonymsInHighlight.GetHashCode(); + hashCode = (hashCode * 59) + this.MinProximity.GetHashCode(); + if (this.ResponseFields != null) + { + hashCode = (hashCode * 59) + this.ResponseFields.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MaxFacetHits.GetHashCode(); + hashCode = (hashCode * 59) + this.MaxValuesPerFacet.GetHashCode(); + if (this.SortFacetValuesBy != null) + { + hashCode = (hashCode * 59) + this.SortFacetValuesBy.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AttributeCriteriaComputedByMinProximity.GetHashCode(); + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EnableReRanking.GetHashCode(); + if (this.ReRankingApplyFilter != null) + { + hashCode = (hashCode * 59) + this.ReRankingApplyFilter.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Length (int) maximum + if (this.Length > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value less than or equal to 1000.", new[] { "Length" }); + } + + // Length (int) minimum + if (this.Length < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value greater than or equal to 1.", new[] { "Length" }); + } + + // MinimumAroundRadius (int) minimum + if (this.MinimumAroundRadius < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinimumAroundRadius, must be a value greater than or equal to 1.", new[] { "MinimumAroundRadius" }); + } + + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + // MinProximity (int) maximum + if (this.MinProximity > (int)7) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value less than or equal to 7.", new[] { "MinProximity" }); + } + + // MinProximity (int) minimum + if (this.MinProximity < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value greater than or equal to 1.", new[] { "MinProximity" }); + } + + // MaxFacetHits (int) maximum + if (this.MaxFacetHits > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MaxFacetHits, must be a value less than or equal to 100.", new[] { "MaxFacetHits" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/SearchParamsQuery.cs b/algoliasearch/Recommend/Models/SearchParamsQuery.cs new file mode 100644 index 000000000..356672c7f --- /dev/null +++ b/algoliasearch/Recommend/Models/SearchParamsQuery.cs @@ -0,0 +1,125 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// SearchParamsQuery + /// + [DataContract(Name = "searchParamsQuery")] + public partial class SearchParamsQuery : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Text to search for in an index. (default to ""). + public SearchParamsQuery(string query = @"") + { + // use default value if no "query" provided + this.Query = query ?? @""; + } + + /// + /// Text to search for in an index. + /// + /// Text to search for in an index. + [DataMember(Name = "query", EmitDefaultValue = false)] + public string Query { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchParamsQuery {\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchParamsQuery); + } + + /// + /// Returns true if SearchParamsQuery instances are equal + /// + /// Instance of SearchParamsQuery to be compared + /// Boolean + public bool Equals(SearchParamsQuery input) + { + if (input == null) + { + return false; + } + return + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/SearchRecommendRulesParams.cs b/algoliasearch/Recommend/Models/SearchRecommendRulesParams.cs new file mode 100644 index 000000000..bfabd6a9b --- /dev/null +++ b/algoliasearch/Recommend/Models/SearchRecommendRulesParams.cs @@ -0,0 +1,231 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Recommend rules search parameters. + /// + [DataContract(Name = "searchRecommendRulesParams")] + public partial class SearchRecommendRulesParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Full-text query. (default to ""). + /// Restricts responses to the specified [contextual rule](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#creating-contextual-rules).. + /// Requested page (the first page is page 0).. + /// Maximum number of hits per page. (default to 20). + /// Restricts responses to enabled rules. When absent (default), _all_ rules are retrieved.. + /// Request options to send with the API call.. + public SearchRecommendRulesParams(string query = @"", string context = default(string), int page = default(int), int hitsPerPage = 20, bool? enabled = default(bool?), List requestOptions = default(List)) + { + // use default value if no "query" provided + this.Query = query ?? @""; + this.Context = context; + this.Page = page; + this.HitsPerPage = hitsPerPage; + this.Enabled = enabled; + this.RequestOptions = requestOptions; + } + + /// + /// Full-text query. + /// + /// Full-text query. + [DataMember(Name = "query", EmitDefaultValue = false)] + public string Query { get; set; } + + /// + /// Restricts responses to the specified [contextual rule](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#creating-contextual-rules). + /// + /// Restricts responses to the specified [contextual rule](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#creating-contextual-rules). + [DataMember(Name = "context", EmitDefaultValue = false)] + public string Context { get; set; } + + /// + /// Requested page (the first page is page 0). + /// + /// Requested page (the first page is page 0). + [DataMember(Name = "page", EmitDefaultValue = false)] + public int Page { get; set; } + + /// + /// Maximum number of hits per page. + /// + /// Maximum number of hits per page. + [DataMember(Name = "hitsPerPage", EmitDefaultValue = false)] + public int HitsPerPage { get; set; } + + /// + /// Restricts responses to enabled rules. When absent (default), _all_ rules are retrieved. + /// + /// Restricts responses to enabled rules. When absent (default), _all_ rules are retrieved. + [DataMember(Name = "enabled", EmitDefaultValue = true)] + public bool? Enabled { get; set; } + + /// + /// Request options to send with the API call. + /// + /// Request options to send with the API call. + [DataMember(Name = "requestOptions", EmitDefaultValue = false)] + public List RequestOptions { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchRecommendRulesParams {\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" Context: ").Append(Context).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" Enabled: ").Append(Enabled).Append("\n"); + sb.Append(" RequestOptions: ").Append(RequestOptions).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchRecommendRulesParams); + } + + /// + /// Returns true if SearchRecommendRulesParams instances are equal + /// + /// Instance of SearchRecommendRulesParams to be compared + /// Boolean + public bool Equals(SearchRecommendRulesParams input) + { + if (input == null) + { + return false; + } + return + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.Context == input.Context || + (this.Context != null && + this.Context.Equals(input.Context)) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && + ( + this.Enabled == input.Enabled || + (this.Enabled != null && + this.Enabled.Equals(input.Enabled)) + ) && + ( + this.RequestOptions == input.RequestOptions || + this.RequestOptions != null && + input.RequestOptions != null && + this.RequestOptions.SequenceEqual(input.RequestOptions) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.Context != null) + { + hashCode = (hashCode * 59) + this.Context.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + if (this.Enabled != null) + { + hashCode = (hashCode * 59) + this.Enabled.GetHashCode(); + } + if (this.RequestOptions != null) + { + hashCode = (hashCode * 59) + this.RequestOptions.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Page (int) minimum + if (this.Page < (int)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Page, must be a value greater than or equal to 0.", new[] { "Page" }); + } + + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/SearchRecommendRulesResponse.cs b/algoliasearch/Recommend/Models/SearchRecommendRulesResponse.cs new file mode 100644 index 000000000..0c067d495 --- /dev/null +++ b/algoliasearch/Recommend/Models/SearchRecommendRulesResponse.cs @@ -0,0 +1,180 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// SearchRecommendRulesResponse + /// + [DataContract(Name = "searchRecommendRulesResponse")] + public partial class SearchRecommendRulesResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchRecommendRulesResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Fetched rules. (required). + /// Number of fetched rules. (required). + /// Current page. (required). + /// Number of pages. (required). + public SearchRecommendRulesResponse(List hits = default(List), int nbHits = default(int), int page = default(int), int nbPages = default(int)) + { + // to ensure "hits" is required (not null) + if (hits == null) + { + throw new ArgumentNullException("hits is a required property for SearchRecommendRulesResponse and cannot be null"); + } + this.Hits = hits; + this.NbHits = nbHits; + this.Page = page; + this.NbPages = nbPages; + } + + /// + /// Fetched rules. + /// + /// Fetched rules. + [DataMember(Name = "hits", IsRequired = true, EmitDefaultValue = true)] + public List Hits { get; set; } + + /// + /// Number of fetched rules. + /// + /// Number of fetched rules. + [DataMember(Name = "nbHits", IsRequired = true, EmitDefaultValue = true)] + public int NbHits { get; set; } + + /// + /// Current page. + /// + /// Current page. + [DataMember(Name = "page", IsRequired = true, EmitDefaultValue = true)] + public int Page { get; set; } + + /// + /// Number of pages. + /// + /// Number of pages. + [DataMember(Name = "nbPages", IsRequired = true, EmitDefaultValue = true)] + public int NbPages { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchRecommendRulesResponse {\n"); + sb.Append(" Hits: ").Append(Hits).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" NbPages: ").Append(NbPages).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchRecommendRulesResponse); + } + + /// + /// Returns true if SearchRecommendRulesResponse instances are equal + /// + /// Instance of SearchRecommendRulesResponse to be compared + /// Boolean + public bool Equals(SearchRecommendRulesResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Hits == input.Hits || + this.Hits != null && + input.Hits != null && + this.Hits.SequenceEqual(input.Hits) + ) && + ( + this.NbHits == input.NbHits || + this.NbHits.Equals(input.NbHits) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.NbPages == input.NbPages || + this.NbPages.Equals(input.NbPages) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Hits != null) + { + hashCode = (hashCode * 59) + this.Hits.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NbHits.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.NbPages.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/SemanticSearch.cs b/algoliasearch/Recommend/Models/SemanticSearch.cs new file mode 100644 index 000000000..30c9de7fe --- /dev/null +++ b/algoliasearch/Recommend/Models/SemanticSearch.cs @@ -0,0 +1,125 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Settings for the semantic search part of NeuralSearch. Only used when `mode` is _neuralSearch_. + /// + [DataContract(Name = "semanticSearch")] + public partial class SemanticSearch : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Indices from which to collect click and conversion events. If null, the current index and replica group will be used as the event source.. + public SemanticSearch(List eventSources = default(List)) + { + this.EventSources = eventSources; + } + + /// + /// Indices from which to collect click and conversion events. If null, the current index and replica group will be used as the event source. + /// + /// Indices from which to collect click and conversion events. If null, the current index and replica group will be used as the event source. + [DataMember(Name = "eventSources", EmitDefaultValue = true)] + public List EventSources { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SemanticSearch {\n"); + sb.Append(" EventSources: ").Append(EventSources).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SemanticSearch); + } + + /// + /// Returns true if SemanticSearch instances are equal + /// + /// Instance of SemanticSearch to be compared + /// Boolean + public bool Equals(SemanticSearch input) + { + if (input == null) + { + return false; + } + return + ( + this.EventSources == input.EventSources || + this.EventSources != null && + input.EventSources != null && + this.EventSources.SequenceEqual(input.EventSources) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EventSources != null) + { + hashCode = (hashCode * 59) + this.EventSources.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/SnippetResult.cs b/algoliasearch/Recommend/Models/SnippetResult.cs new file mode 100644 index 000000000..6d6f6c883 --- /dev/null +++ b/algoliasearch/Recommend/Models/SnippetResult.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// SnippetResult + /// + [JsonConverter(typeof(SnippetResultJsonConverter))] + [DataContract(Name = "snippetResult")] + public partial class SnippetResult : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SnippetResultOption. + public SnippetResult(SnippetResultOption actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of Dictionary<string, SnippetResultOption>. + public SnippetResult(Dictionary actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(Dictionary)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SnippetResultOption)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: Dictionary, SnippetResultOption"); + } + } + } + + /// + /// Get the actual instance of `SnippetResultOption`. If the actual instance is not `SnippetResultOption`, + /// the InvalidClassException will be thrown + /// + /// An instance of SnippetResultOption + public SnippetResultOption GetterSnippetResultOption() + { + return (SnippetResultOption)this.ActualInstance; + } + + /// + /// Get the actual instance of `Dictionary<string, SnippetResultOption>`. If the actual instance is not `Dictionary<string, SnippetResultOption>`, + /// the InvalidClassException will be thrown + /// + /// An instance of Dictionary<string, SnippetResultOption> + public Dictionary GetterDictionary() + { + return (Dictionary)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class SnippetResult {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, SnippetResult.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of SnippetResult + /// + /// JSON string + /// An instance of SnippetResult + public static SnippetResult FromJson(string jsonString) + { + SnippetResult newSnippetResult = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newSnippetResult; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(Dictionary).GetProperty("AdditionalProperties") == null) + { + newSnippetResult = new SnippetResult(JsonConvert.DeserializeObject>(jsonString, SnippetResult.SerializerSettings)); + } + else + { + newSnippetResult = new SnippetResult(JsonConvert.DeserializeObject>(jsonString, SnippetResult.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("Dictionary"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into Dictionary: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SnippetResultOption).GetProperty("AdditionalProperties") == null) + { + newSnippetResult = new SnippetResult(JsonConvert.DeserializeObject(jsonString, SnippetResult.SerializerSettings)); + } + else + { + newSnippetResult = new SnippetResult(JsonConvert.DeserializeObject(jsonString, SnippetResult.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SnippetResultOption"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SnippetResultOption: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newSnippetResult; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SnippetResult); + } + + /// + /// Returns true if SnippetResult instances are equal + /// + /// Instance of SnippetResult to be compared + /// Boolean + public bool Equals(SnippetResult input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for SnippetResult + /// + public class SnippetResultJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(SnippetResult).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return SnippetResult.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/SnippetResultOption.cs b/algoliasearch/Recommend/Models/SnippetResultOption.cs new file mode 100644 index 000000000..d81095256 --- /dev/null +++ b/algoliasearch/Recommend/Models/SnippetResultOption.cs @@ -0,0 +1,148 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Snippeted attributes show parts of the matched attributes. Only returned when attributesToSnippet is non-empty. + /// + [DataContract(Name = "snippetResultOption")] + public partial class SnippetResultOption : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets MatchLevel + /// + [DataMember(Name = "matchLevel", IsRequired = true, EmitDefaultValue = true)] + public MatchLevel MatchLevel { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SnippetResultOption() { } + /// + /// Initializes a new instance of the class. + /// + /// Markup text with `facetQuery` matches highlighted. (required). + /// matchLevel (required). + public SnippetResultOption(string value = default(string), MatchLevel matchLevel = default(MatchLevel)) + { + // to ensure "value" is required (not null) + if (value == null) + { + throw new ArgumentNullException("value is a required property for SnippetResultOption and cannot be null"); + } + this.Value = value; + this.MatchLevel = matchLevel; + } + + /// + /// Markup text with `facetQuery` matches highlighted. + /// + /// Markup text with `facetQuery` matches highlighted. + [DataMember(Name = "value", IsRequired = true, EmitDefaultValue = true)] + public string Value { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SnippetResultOption {\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append(" MatchLevel: ").Append(MatchLevel).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SnippetResultOption); + } + + /// + /// Returns true if SnippetResultOption instances are equal + /// + /// Instance of SnippetResultOption to be compared + /// Boolean + public bool Equals(SnippetResultOption input) + { + if (input == null) + { + return false; + } + return + ( + this.Value == input.Value || + (this.Value != null && + this.Value.Equals(input.Value)) + ) && + ( + this.MatchLevel == input.MatchLevel || + this.MatchLevel.Equals(input.MatchLevel) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Value != null) + { + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MatchLevel.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/SortRemainingBy.cs b/algoliasearch/Recommend/Models/SortRemainingBy.cs new file mode 100644 index 000000000..962af8f83 --- /dev/null +++ b/algoliasearch/Recommend/Models/SortRemainingBy.cs @@ -0,0 +1,49 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// How to display the remaining items: - `count`: facet count (descending). - `alpha`: alphabetical (ascending). - `hidden`: show only pinned values. + /// + /// How to display the remaining items: - `count`: facet count (descending). - `alpha`: alphabetical (ascending). - `hidden`: show only pinned values. + [JsonConverter(typeof(StringEnumConverter))] + public enum SortRemainingBy + { + /// + /// Enum Count for value: count + /// + [EnumMember(Value = "count")] + Count = 1, + + /// + /// Enum Alpha for value: alpha + /// + [EnumMember(Value = "alpha")] + Alpha = 2, + + /// + /// Enum Hidden for value: hidden + /// + [EnumMember(Value = "hidden")] + Hidden = 3 + } + +} diff --git a/algoliasearch/Recommend/Models/TagFilters.cs b/algoliasearch/Recommend/Models/TagFilters.cs new file mode 100644 index 000000000..02d218292 --- /dev/null +++ b/algoliasearch/Recommend/Models/TagFilters.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// [Filter hits by tags](https://www.algolia.com/doc/api-reference/api-parameters/tagFilters/). + /// + [JsonConverter(typeof(TagFiltersJsonConverter))] + [DataContract(Name = "tagFilters")] + public partial class TagFilters : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<MixedSearchFilters>. + public TagFilters(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public TagFilters(string actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, string"); + } + } + } + + /// + /// Get the actual instance of `List<MixedSearchFilters>`. If the actual instance is not `List<MixedSearchFilters>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<MixedSearchFilters> + public List GetterList() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class TagFilters {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, TagFilters.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of TagFilters + /// + /// JSON string + /// An instance of TagFilters + public static TagFilters FromJson(string jsonString) + { + TagFilters newTagFilters = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newTagFilters; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newTagFilters = new TagFilters(JsonConvert.DeserializeObject>(jsonString, TagFilters.SerializerSettings)); + } + else + { + newTagFilters = new TagFilters(JsonConvert.DeserializeObject>(jsonString, TagFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newTagFilters = new TagFilters(JsonConvert.DeserializeObject(jsonString, TagFilters.SerializerSettings)); + } + else + { + newTagFilters = new TagFilters(JsonConvert.DeserializeObject(jsonString, TagFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newTagFilters; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TagFilters); + } + + /// + /// Returns true if TagFilters instances are equal + /// + /// Instance of TagFilters to be compared + /// Boolean + public bool Equals(TagFilters input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for TagFilters + /// + public class TagFiltersJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(TagFilters).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return TagFilters.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/TaskStatus.cs b/algoliasearch/Recommend/Models/TaskStatus.cs new file mode 100644 index 000000000..5d74264bb --- /dev/null +++ b/algoliasearch/Recommend/Models/TaskStatus.cs @@ -0,0 +1,43 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// _published_ if the task has been processed, _notPublished_ otherwise. + /// + /// _published_ if the task has been processed, _notPublished_ otherwise. + [JsonConverter(typeof(StringEnumConverter))] + public enum TaskStatus + { + /// + /// Enum Published for value: published + /// + [EnumMember(Value = "published")] + Published = 1, + + /// + /// Enum NotPublished for value: notPublished + /// + [EnumMember(Value = "notPublished")] + NotPublished = 2 + } + +} diff --git a/algoliasearch/Recommend/Models/TrendingFacetsModel.cs b/algoliasearch/Recommend/Models/TrendingFacetsModel.cs new file mode 100644 index 000000000..5a6225ae2 --- /dev/null +++ b/algoliasearch/Recommend/Models/TrendingFacetsModel.cs @@ -0,0 +1,37 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Trending facets model. + /// + /// Trending facets model. + [JsonConverter(typeof(StringEnumConverter))] + public enum TrendingFacetsModel + { + /// + /// Enum TrendingFacets for value: trending-facets + /// + [EnumMember(Value = "trending-facets")] + TrendingFacets = 1 + } + +} diff --git a/algoliasearch/Recommend/Models/TrendingFacetsQuery.cs b/algoliasearch/Recommend/Models/TrendingFacetsQuery.cs new file mode 100644 index 000000000..cf8fcc9be --- /dev/null +++ b/algoliasearch/Recommend/Models/TrendingFacetsQuery.cs @@ -0,0 +1,214 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// TrendingFacetsQuery + /// + [DataContract(Name = "trendingFacetsQuery")] + public partial class TrendingFacetsQuery : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Model + /// + [DataMember(Name = "model", EmitDefaultValue = false)] + public TrendingFacetsModel? Model { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TrendingFacetsQuery() { } + /// + /// Initializes a new instance of the class. + /// + /// Facet name for trending models. (required). + /// model. + /// Algolia index name. (required). + /// Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are. . + /// Maximum number of recommendations to retrieve. If 0, all recommendations will be returned. (default to 0). + public TrendingFacetsQuery(string facetName = default(string), TrendingFacetsModel? model = default(TrendingFacetsModel?), string indexName = default(string), int threshold = default(int), int maxRecommendations = 0) + { + // to ensure "facetName" is required (not null) + if (facetName == null) + { + throw new ArgumentNullException("facetName is a required property for TrendingFacetsQuery and cannot be null"); + } + this.FacetName = facetName; + // to ensure "indexName" is required (not null) + if (indexName == null) + { + throw new ArgumentNullException("indexName is a required property for TrendingFacetsQuery and cannot be null"); + } + this.IndexName = indexName; + this.Model = model; + this.Threshold = threshold; + this.MaxRecommendations = maxRecommendations; + } + + /// + /// Facet name for trending models. + /// + /// Facet name for trending models. + [DataMember(Name = "facetName", IsRequired = true, EmitDefaultValue = true)] + public string FacetName { get; set; } + + /// + /// Algolia index name. + /// + /// Algolia index name. + [DataMember(Name = "indexName", IsRequired = true, EmitDefaultValue = true)] + public string IndexName { get; set; } + + /// + /// Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are. + /// + /// Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are. + [DataMember(Name = "threshold", EmitDefaultValue = false)] + public int Threshold { get; set; } + + /// + /// Maximum number of recommendations to retrieve. If 0, all recommendations will be returned. + /// + /// Maximum number of recommendations to retrieve. If 0, all recommendations will be returned. + [DataMember(Name = "maxRecommendations", EmitDefaultValue = false)] + public int MaxRecommendations { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TrendingFacetsQuery {\n"); + sb.Append(" FacetName: ").Append(FacetName).Append("\n"); + sb.Append(" Model: ").Append(Model).Append("\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append(" Threshold: ").Append(Threshold).Append("\n"); + sb.Append(" MaxRecommendations: ").Append(MaxRecommendations).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TrendingFacetsQuery); + } + + /// + /// Returns true if TrendingFacetsQuery instances are equal + /// + /// Instance of TrendingFacetsQuery to be compared + /// Boolean + public bool Equals(TrendingFacetsQuery input) + { + if (input == null) + { + return false; + } + return + ( + this.FacetName == input.FacetName || + (this.FacetName != null && + this.FacetName.Equals(input.FacetName)) + ) && + ( + this.Model == input.Model || + this.Model.Equals(input.Model) + ) && + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ) && + ( + this.Threshold == input.Threshold || + this.Threshold.Equals(input.Threshold) + ) && + ( + this.MaxRecommendations == input.MaxRecommendations || + this.MaxRecommendations.Equals(input.MaxRecommendations) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.FacetName != null) + { + hashCode = (hashCode * 59) + this.FacetName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Model.GetHashCode(); + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Threshold.GetHashCode(); + hashCode = (hashCode * 59) + this.MaxRecommendations.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Threshold (int) maximum + if (this.Threshold > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Threshold, must be a value less than or equal to 100.", new[] { "Threshold" }); + } + + // Threshold (int) minimum + if (this.Threshold < (int)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Threshold, must be a value greater than or equal to 0.", new[] { "Threshold" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/TrendingItemsModel.cs b/algoliasearch/Recommend/Models/TrendingItemsModel.cs new file mode 100644 index 000000000..654a5a490 --- /dev/null +++ b/algoliasearch/Recommend/Models/TrendingItemsModel.cs @@ -0,0 +1,37 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Trending items model. + /// + /// Trending items model. + [JsonConverter(typeof(StringEnumConverter))] + public enum TrendingItemsModel + { + /// + /// Enum TrendingItems for value: trending-items + /// + [EnumMember(Value = "trending-items")] + TrendingItems = 1 + } + +} diff --git a/algoliasearch/Recommend/Models/TrendingItemsQuery.cs b/algoliasearch/Recommend/Models/TrendingItemsQuery.cs new file mode 100644 index 000000000..73ea1e6e5 --- /dev/null +++ b/algoliasearch/Recommend/Models/TrendingItemsQuery.cs @@ -0,0 +1,264 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// TrendingItemsQuery + /// + [DataContract(Name = "trendingItemsQuery")] + public partial class TrendingItemsQuery : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Model + /// + [DataMember(Name = "model", EmitDefaultValue = false)] + public TrendingItemsModel? Model { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TrendingItemsQuery() { } + /// + /// Initializes a new instance of the class. + /// + /// Facet name for trending models.. + /// Facet value for trending models.. + /// model. + /// queryParameters. + /// fallbackParameters. + /// Algolia index name. (required). + /// Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are. . + /// Maximum number of recommendations to retrieve. If 0, all recommendations will be returned. (default to 0). + public TrendingItemsQuery(string facetName = default(string), string facetValue = default(string), TrendingItemsModel? model = default(TrendingItemsModel?), SearchParamsObject queryParameters = default(SearchParamsObject), SearchParamsObject fallbackParameters = default(SearchParamsObject), string indexName = default(string), int threshold = default(int), int maxRecommendations = 0) + { + // to ensure "indexName" is required (not null) + if (indexName == null) + { + throw new ArgumentNullException("indexName is a required property for TrendingItemsQuery and cannot be null"); + } + this.IndexName = indexName; + this.FacetName = facetName; + this.FacetValue = facetValue; + this.Model = model; + this.QueryParameters = queryParameters; + this.FallbackParameters = fallbackParameters; + this.Threshold = threshold; + this.MaxRecommendations = maxRecommendations; + } + + /// + /// Facet name for trending models. + /// + /// Facet name for trending models. + [DataMember(Name = "facetName", EmitDefaultValue = false)] + public string FacetName { get; set; } + + /// + /// Facet value for trending models. + /// + /// Facet value for trending models. + [DataMember(Name = "facetValue", EmitDefaultValue = false)] + public string FacetValue { get; set; } + + /// + /// Gets or Sets QueryParameters + /// + [DataMember(Name = "queryParameters", EmitDefaultValue = false)] + public SearchParamsObject QueryParameters { get; set; } + + /// + /// Gets or Sets FallbackParameters + /// + [DataMember(Name = "fallbackParameters", EmitDefaultValue = false)] + public SearchParamsObject FallbackParameters { get; set; } + + /// + /// Algolia index name. + /// + /// Algolia index name. + [DataMember(Name = "indexName", IsRequired = true, EmitDefaultValue = true)] + public string IndexName { get; set; } + + /// + /// Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are. + /// + /// Recommendations with a confidence score lower than `threshold` won't appear in results. > **Note**: Each recommendation has a confidence score of 0 to 100. The closer the score is to 100, the more relevant the recommendations are. + [DataMember(Name = "threshold", EmitDefaultValue = false)] + public int Threshold { get; set; } + + /// + /// Maximum number of recommendations to retrieve. If 0, all recommendations will be returned. + /// + /// Maximum number of recommendations to retrieve. If 0, all recommendations will be returned. + [DataMember(Name = "maxRecommendations", EmitDefaultValue = false)] + public int MaxRecommendations { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TrendingItemsQuery {\n"); + sb.Append(" FacetName: ").Append(FacetName).Append("\n"); + sb.Append(" FacetValue: ").Append(FacetValue).Append("\n"); + sb.Append(" Model: ").Append(Model).Append("\n"); + sb.Append(" QueryParameters: ").Append(QueryParameters).Append("\n"); + sb.Append(" FallbackParameters: ").Append(FallbackParameters).Append("\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append(" Threshold: ").Append(Threshold).Append("\n"); + sb.Append(" MaxRecommendations: ").Append(MaxRecommendations).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TrendingItemsQuery); + } + + /// + /// Returns true if TrendingItemsQuery instances are equal + /// + /// Instance of TrendingItemsQuery to be compared + /// Boolean + public bool Equals(TrendingItemsQuery input) + { + if (input == null) + { + return false; + } + return + ( + this.FacetName == input.FacetName || + (this.FacetName != null && + this.FacetName.Equals(input.FacetName)) + ) && + ( + this.FacetValue == input.FacetValue || + (this.FacetValue != null && + this.FacetValue.Equals(input.FacetValue)) + ) && + ( + this.Model == input.Model || + this.Model.Equals(input.Model) + ) && + ( + this.QueryParameters == input.QueryParameters || + (this.QueryParameters != null && + this.QueryParameters.Equals(input.QueryParameters)) + ) && + ( + this.FallbackParameters == input.FallbackParameters || + (this.FallbackParameters != null && + this.FallbackParameters.Equals(input.FallbackParameters)) + ) && + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ) && + ( + this.Threshold == input.Threshold || + this.Threshold.Equals(input.Threshold) + ) && + ( + this.MaxRecommendations == input.MaxRecommendations || + this.MaxRecommendations.Equals(input.MaxRecommendations) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.FacetName != null) + { + hashCode = (hashCode * 59) + this.FacetName.GetHashCode(); + } + if (this.FacetValue != null) + { + hashCode = (hashCode * 59) + this.FacetValue.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Model.GetHashCode(); + if (this.QueryParameters != null) + { + hashCode = (hashCode * 59) + this.QueryParameters.GetHashCode(); + } + if (this.FallbackParameters != null) + { + hashCode = (hashCode * 59) + this.FallbackParameters.GetHashCode(); + } + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Threshold.GetHashCode(); + hashCode = (hashCode * 59) + this.MaxRecommendations.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Threshold (int) maximum + if (this.Threshold > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Threshold, must be a value less than or equal to 100.", new[] { "Threshold" }); + } + + // Threshold (int) minimum + if (this.Threshold < (int)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Threshold, must be a value greater than or equal to 0.", new[] { "Threshold" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Recommend/Models/TypoTolerance.cs b/algoliasearch/Recommend/Models/TypoTolerance.cs new file mode 100644 index 000000000..1355e1179 --- /dev/null +++ b/algoliasearch/Recommend/Models/TypoTolerance.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Controls whether [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/) is enabled and how it is applied. + /// + [JsonConverter(typeof(TypoToleranceJsonConverter))] + [DataContract(Name = "typoTolerance")] + public partial class TypoTolerance : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of bool. + public TypoTolerance(bool actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of TypoToleranceEnum. + public TypoTolerance(TypoToleranceEnum actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(TypoToleranceEnum)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(bool)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: TypoToleranceEnum, bool"); + } + } + } + + /// + /// Get the actual instance of `bool`. If the actual instance is not `bool`, + /// the InvalidClassException will be thrown + /// + /// An instance of bool + public bool GetterBool() + { + return (bool)this.ActualInstance; + } + + /// + /// Get the actual instance of `TypoToleranceEnum`. If the actual instance is not `TypoToleranceEnum`, + /// the InvalidClassException will be thrown + /// + /// An instance of TypoToleranceEnum + public TypoToleranceEnum GetterTypoToleranceEnum() + { + return (TypoToleranceEnum)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class TypoTolerance {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, TypoTolerance.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of TypoTolerance + /// + /// JSON string + /// An instance of TypoTolerance + public static TypoTolerance FromJson(string jsonString) + { + TypoTolerance newTypoTolerance = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newTypoTolerance; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(TypoToleranceEnum).GetProperty("AdditionalProperties") == null) + { + newTypoTolerance = new TypoTolerance(JsonConvert.DeserializeObject(jsonString, TypoTolerance.SerializerSettings)); + } + else + { + newTypoTolerance = new TypoTolerance(JsonConvert.DeserializeObject(jsonString, TypoTolerance.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("TypoToleranceEnum"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into TypoToleranceEnum: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(bool).GetProperty("AdditionalProperties") == null) + { + newTypoTolerance = new TypoTolerance(JsonConvert.DeserializeObject(jsonString, TypoTolerance.SerializerSettings)); + } + else + { + newTypoTolerance = new TypoTolerance(JsonConvert.DeserializeObject(jsonString, TypoTolerance.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("bool"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into bool: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newTypoTolerance; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TypoTolerance); + } + + /// + /// Returns true if TypoTolerance instances are equal + /// + /// Instance of TypoTolerance to be compared + /// Boolean + public bool Equals(TypoTolerance input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for TypoTolerance + /// + public class TypoToleranceJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(TypoTolerance).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return TypoTolerance.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Recommend/Models/TypoToleranceEnum.cs b/algoliasearch/Recommend/Models/TypoToleranceEnum.cs new file mode 100644 index 000000000..66917e0c7 --- /dev/null +++ b/algoliasearch/Recommend/Models/TypoToleranceEnum.cs @@ -0,0 +1,42 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Defines typoToleranceEnum + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum TypoToleranceEnum + { + /// + /// Enum Min for value: min + /// + [EnumMember(Value = "min")] + Min = 1, + + /// + /// Enum Strict for value: strict + /// + [EnumMember(Value = "strict")] + Strict = 2 + } + +} diff --git a/algoliasearch/Recommend/Models/Value.cs b/algoliasearch/Recommend/Models/Value.cs new file mode 100644 index 000000000..501c2de9f --- /dev/null +++ b/algoliasearch/Recommend/Models/Value.cs @@ -0,0 +1,139 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Recommend.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Recommend.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Recommend.Models +{ + /// + /// Value + /// + [DataContract(Name = "value")] + public partial class Value : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets SortRemainingBy + /// + [DataMember(Name = "sortRemainingBy", EmitDefaultValue = false)] + public SortRemainingBy? SortRemainingBy { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Pinned order of facet lists.. + /// sortRemainingBy. + public Value(List order = default(List), SortRemainingBy? sortRemainingBy = default(SortRemainingBy?)) + { + this.Order = order; + this.SortRemainingBy = sortRemainingBy; + } + + /// + /// Pinned order of facet lists. + /// + /// Pinned order of facet lists. + [DataMember(Name = "order", EmitDefaultValue = false)] + public List Order { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Value {\n"); + sb.Append(" Order: ").Append(Order).Append("\n"); + sb.Append(" SortRemainingBy: ").Append(SortRemainingBy).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Value); + } + + /// + /// Returns true if Value instances are equal + /// + /// Instance of Value to be compared + /// Boolean + public bool Equals(Value input) + { + if (input == null) + { + return false; + } + return + ( + this.Order == input.Order || + this.Order != null && + input.Order != null && + this.Order.SequenceEqual(input.Order) + ) && + ( + this.SortRemainingBy == input.SortRemainingBy || + this.SortRemainingBy.Equals(input.SortRemainingBy) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Order != null) + { + hashCode = (hashCode * 59) + this.Order.GetHashCode(); + } + hashCode = (hashCode * 59) + this.SortRemainingBy.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Api/SearchClient.cs b/algoliasearch/Search/Api/SearchClient.cs new file mode 100644 index 000000000..65826af9b --- /dev/null +++ b/algoliasearch/Search/Api/SearchClient.cs @@ -0,0 +1,10915 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Net.Mime; +using Algolia.Search.Search.Client; +using Algolia.Search.Search.Models; + +namespace Algolia.Search.Search.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface ISearchClient + { + /// + /// Add API key. + /// + /// + /// Add a new API key with specific permissions and restrictions. The request must be authenticated with the admin API key. The response returns an API key string. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of AddApiKeyResponse + System.Threading.Tasks.Task AddApiKeyAsync(ApiKey apiKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Add API key. + /// + /// + /// Add a new API key with specific permissions and restrictions. The request must be authenticated with the admin API key. The response returns an API key string. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (AddApiKeyResponse) + System.Threading.Tasks.Task> AddApiKeyWithHttpInfoAsync(ApiKey apiKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Add or update a record (using objectID). + /// + /// + /// If you use an existing `objectID`, the existing record will be replaced with the new one. To update only some attributes of an existing record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject) instead. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Algolia record. + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtWithObjectIdResponse + System.Threading.Tasks.Task AddOrUpdateObjectAsync(string indexName, string objectID, Object body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Add or update a record (using objectID). + /// + /// + /// If you use an existing `objectID`, the existing record will be replaced with the new one. To update only some attributes of an existing record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject) instead. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Algolia record. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtWithObjectIdResponse) + System.Threading.Tasks.Task> AddOrUpdateObjectWithHttpInfoAsync(string indexName, string objectID, Object body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Add a source. + /// + /// + /// Add a source to the list of allowed sources. + /// + /// Thrown when fails to make API call + /// Source to add. + /// Cancellation Token to cancel the request. + /// Task of CreatedAtResponse + System.Threading.Tasks.Task AppendSourceAsync(Source source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Add a source. + /// + /// + /// Add a source to the list of allowed sources. + /// + /// Thrown when fails to make API call + /// Source to add. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (CreatedAtResponse) + System.Threading.Tasks.Task> AppendSourceWithHttpInfoAsync(Source source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Assign or move a user ID. + /// + /// + /// Assign or move a user ID to a cluster. The time it takes to move a user is proportional to the amount of data linked to the user ID. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// + /// Cancellation Token to cancel the request. + /// Task of CreatedAtResponse + System.Threading.Tasks.Task AssignUserIdAsync(string xAlgoliaUserID, AssignUserIdParams assignUserIdParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Assign or move a user ID. + /// + /// + /// Assign or move a user ID to a cluster. The time it takes to move a user is proportional to the amount of data linked to the user ID. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (CreatedAtResponse) + System.Threading.Tasks.Task> AssignUserIdWithHttpInfoAsync(string xAlgoliaUserID, AssignUserIdParams assignUserIdParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Batch write operations on one index. + /// + /// + /// To reduce the time spent on network round trips, you can perform several write actions in a single API call. Actions are applied in the order they are specified. The supported `action`s are equivalent to the individual operations of the same name. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Cancellation Token to cancel the request. + /// Task of BatchResponse + System.Threading.Tasks.Task BatchAsync(string indexName, BatchWriteParams batchWriteParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Batch write operations on one index. + /// + /// + /// To reduce the time spent on network round trips, you can perform several write actions in a single API call. Actions are applied in the order they are specified. The supported `action`s are equivalent to the individual operations of the same name. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (BatchResponse) + System.Threading.Tasks.Task> BatchWithHttpInfoAsync(string indexName, BatchWriteParams batchWriteParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Batch assign userIDs. + /// + /// + /// Assign multiple user IDs to a cluster. **You can't _move_ users with this operation.**. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// + /// Cancellation Token to cancel the request. + /// Task of CreatedAtResponse + System.Threading.Tasks.Task BatchAssignUserIdsAsync(string xAlgoliaUserID, BatchAssignUserIdsParams batchAssignUserIdsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Batch assign userIDs. + /// + /// + /// Assign multiple user IDs to a cluster. **You can't _move_ users with this operation.**. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (CreatedAtResponse) + System.Threading.Tasks.Task> BatchAssignUserIdsWithHttpInfoAsync(string xAlgoliaUserID, BatchAssignUserIdsParams batchAssignUserIdsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Batch dictionary entries. + /// + /// + /// Add or remove a batch of dictionary entries. + /// + /// Thrown when fails to make API call + /// Dictionary to search in. + /// + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + System.Threading.Tasks.Task BatchDictionaryEntriesAsync(DictionaryType dictionaryName, BatchDictionaryEntriesParams batchDictionaryEntriesParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Batch dictionary entries. + /// + /// + /// Add or remove a batch of dictionary entries. + /// + /// Thrown when fails to make API call + /// Dictionary to search in. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + System.Threading.Tasks.Task> BatchDictionaryEntriesWithHttpInfoAsync(DictionaryType dictionaryName, BatchDictionaryEntriesParams batchDictionaryEntriesParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get all records from an index. + /// + /// + /// Retrieve up to 1,000 records per call. Supports full-text search and filters. For better performance, it doesn't support: - The `distinct` query parameter - Sorting by typos, proximity, words, or geographical distance. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of BrowseResponse + System.Threading.Tasks.Task BrowseAsync(string indexName, BrowseParams browseParams = default(BrowseParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get all records from an index. + /// + /// + /// Retrieve up to 1,000 records per call. Supports full-text search and filters. For better performance, it doesn't support: - The `distinct` query parameter - Sorting by typos, proximity, words, or geographical distance. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (BrowseResponse) + System.Threading.Tasks.Task> BrowseWithHttpInfoAsync(string indexName, BrowseParams browseParams = default(BrowseParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete all synonyms. + /// + /// + /// Delete all synonyms in the index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + System.Threading.Tasks.Task ClearAllSynonymsAsync(string indexName, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete all synonyms. + /// + /// + /// Delete all synonyms in the index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + System.Threading.Tasks.Task> ClearAllSynonymsWithHttpInfoAsync(string indexName, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete all records from an index. + /// + /// + /// Delete the records but leave settings and index-specific API keys untouched. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + System.Threading.Tasks.Task ClearObjectsAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete all records from an index. + /// + /// + /// Delete the records but leave settings and index-specific API keys untouched. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + System.Threading.Tasks.Task> ClearObjectsWithHttpInfoAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete all rules. + /// + /// + /// Delete all rules in the index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + System.Threading.Tasks.Task ClearRulesAsync(string indexName, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete all rules. + /// + /// + /// Delete all rules in the index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + System.Threading.Tasks.Task> ClearRulesWithHttpInfoAsync(string indexName, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete API key. + /// + /// + /// Delete an existing API key. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// Cancellation Token to cancel the request. + /// Task of DeleteApiKeyResponse + System.Threading.Tasks.Task DeleteApiKeyAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete API key. + /// + /// + /// Delete an existing API key. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeleteApiKeyResponse) + System.Threading.Tasks.Task> DeleteApiKeyWithHttpInfoAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete all records matching a query. + /// + /// + /// This operation doesn't support all the query options, only its filters (numeric, facet, or tag) and geo queries. It doesn't accept empty filters or queries. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Cancellation Token to cancel the request. + /// Task of DeletedAtResponse + System.Threading.Tasks.Task DeleteByAsync(string indexName, DeleteByParams deleteByParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete all records matching a query. + /// + /// + /// This operation doesn't support all the query options, only its filters (numeric, facet, or tag) and geo queries. It doesn't accept empty filters or queries. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeletedAtResponse) + System.Threading.Tasks.Task> DeleteByWithHttpInfoAsync(string indexName, DeleteByParams deleteByParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete index. + /// + /// + /// Delete an existing index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Cancellation Token to cancel the request. + /// Task of DeletedAtResponse + System.Threading.Tasks.Task DeleteIndexAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete index. + /// + /// + /// Delete an existing index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeletedAtResponse) + System.Threading.Tasks.Task> DeleteIndexWithHttpInfoAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete a record. + /// + /// + /// To delete a set of records matching a query, use the [`deleteByQuery` operation](#tag/Records/operation/deleteBy) instead. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Cancellation Token to cancel the request. + /// Task of DeletedAtResponse + System.Threading.Tasks.Task DeleteObjectAsync(string indexName, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete a record. + /// + /// + /// To delete a set of records matching a query, use the [`deleteByQuery` operation](#tag/Records/operation/deleteBy) instead. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeletedAtResponse) + System.Threading.Tasks.Task> DeleteObjectWithHttpInfoAsync(string indexName, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete a rule. + /// + /// + /// Delete a rule by its `objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + System.Threading.Tasks.Task DeleteRuleAsync(string indexName, string objectID, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete a rule. + /// + /// + /// Delete a rule by its `objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + System.Threading.Tasks.Task> DeleteRuleWithHttpInfoAsync(string indexName, string objectID, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Remove a source. + /// + /// + /// Remove a source from the list of allowed sources. + /// + /// Thrown when fails to make API call + /// IP address range of the source. + /// Cancellation Token to cancel the request. + /// Task of DeleteSourceResponse + System.Threading.Tasks.Task DeleteSourceAsync(string source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Remove a source. + /// + /// + /// Remove a source from the list of allowed sources. + /// + /// Thrown when fails to make API call + /// IP address range of the source. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeleteSourceResponse) + System.Threading.Tasks.Task> DeleteSourceWithHttpInfoAsync(string source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Delete a synonym. + /// + /// + /// Delete a synonym by its `objectID`. To find the object IDs of your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of DeletedAtResponse + System.Threading.Tasks.Task DeleteSynonymAsync(string indexName, string objectID, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete a synonym. + /// + /// + /// Delete a synonym by its `objectID`. To find the object IDs of your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeletedAtResponse) + System.Threading.Tasks.Task> DeleteSynonymWithHttpInfoAsync(string indexName, string objectID, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get API key permissions. + /// + /// + /// Get the permissions and restrictions of a specific API key. When authenticating with the admin API key, you can request information for any of your application's keys. When authenticating with other API keys, you can only retrieve information for that key. + /// + /// Thrown when fails to make API call + /// API key. + /// Cancellation Token to cancel the request. + /// Task of GetApiKeyResponse + System.Threading.Tasks.Task GetApiKeyAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get API key permissions. + /// + /// + /// Get the permissions and restrictions of a specific API key. When authenticating with the admin API key, you can request information for any of your application's keys. When authenticating with other API keys, you can only retrieve information for that key. + /// + /// Thrown when fails to make API call + /// API key. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetApiKeyResponse) + System.Threading.Tasks.Task> GetApiKeyWithHttpInfoAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// List available languages. + /// + /// + /// Lists Algolia's [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/) and any customizations applied to each language's [stop word](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plural](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), and [segmentation (compound)](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) features. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of Dictionary<string, Languages> + System.Threading.Tasks.Task> GetDictionaryLanguagesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List available languages. + /// + /// + /// Lists Algolia's [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/) and any customizations applied to each language's [stop word](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plural](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), and [segmentation (compound)](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) features. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Dictionary<string, Languages>) + System.Threading.Tasks.Task>> GetDictionaryLanguagesWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get stop word settings. + /// + /// + /// Get the languages for which [stop words are turned off](#tag/Dictionaries/operation/setDictionarySettings). + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of GetDictionarySettingsResponse + System.Threading.Tasks.Task GetDictionarySettingsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get stop word settings. + /// + /// + /// Get the languages for which [stop words are turned off](#tag/Dictionaries/operation/setDictionarySettings). + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetDictionarySettingsResponse) + System.Threading.Tasks.Task> GetDictionarySettingsWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Return the latest log entries. + /// + /// + /// The request must be authenticated by an API key with the [`logs` ACL](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl). Logs are held for the last seven days. There's also a logging limit of 1,000 API calls per server. This request counts towards your [operations quota](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-) but doesn't appear in the logs itself. > **Note**: To fetch the logs for a Distributed Search Network (DSN) cluster, target the [DSN's endpoint](https://www.algolia.com/doc/guides/scaling/distributed-search-network-dsn/#accessing-dsn-servers). + /// + /// Thrown when fails to make API call + /// First log entry to retrieve. Sorted by decreasing date with 0 being the most recent. (optional, default to 0) + /// Maximum number of entries to retrieve. (optional, default to 10) + /// Index for which log entries should be retrieved. When omitted, log entries are retrieved for all indices. (optional) + /// Type of log entries to retrieve. When omitted, all log entries are retrieved. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetLogsResponse + System.Threading.Tasks.Task GetLogsAsync(int? offset = default(int?), int? length = default(int?), string indexName = default(string), LogType type = default(LogType), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Return the latest log entries. + /// + /// + /// The request must be authenticated by an API key with the [`logs` ACL](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl). Logs are held for the last seven days. There's also a logging limit of 1,000 API calls per server. This request counts towards your [operations quota](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-) but doesn't appear in the logs itself. > **Note**: To fetch the logs for a Distributed Search Network (DSN) cluster, target the [DSN's endpoint](https://www.algolia.com/doc/guides/scaling/distributed-search-network-dsn/#accessing-dsn-servers). + /// + /// Thrown when fails to make API call + /// First log entry to retrieve. Sorted by decreasing date with 0 being the most recent. (optional, default to 0) + /// Maximum number of entries to retrieve. (optional, default to 10) + /// Index for which log entries should be retrieved. When omitted, log entries are retrieved for all indices. (optional) + /// Type of log entries to retrieve. When omitted, all log entries are retrieved. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetLogsResponse) + System.Threading.Tasks.Task> GetLogsWithHttpInfoAsync(int? offset = default(int?), int? length = default(int?), string indexName = default(string), LogType type = default(LogType), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a record. + /// + /// + /// To get more than one record, use the [`objects` operation](#tag/Records/operation/getObjects). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Attributes to include with the records in the response. This is useful to reduce the size of the API response. By default, all retrievable attributes are returned. `objectID` is always retrieved, even when not specified. [`unretrievableAttributes`](https://www.algolia.com/doc/api-reference/api-parameters/unretrievableAttributes/) won't be retrieved unless the request is authenticated with the admin API key. (optional) + /// Cancellation Token to cancel the request. + /// Task of Dictionary<string, string> + System.Threading.Tasks.Task> GetObjectAsync(string indexName, string objectID, List attributesToRetrieve = default(List), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a record. + /// + /// + /// To get more than one record, use the [`objects` operation](#tag/Records/operation/getObjects). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Attributes to include with the records in the response. This is useful to reduce the size of the API response. By default, all retrievable attributes are returned. `objectID` is always retrieved, even when not specified. [`unretrievableAttributes`](https://www.algolia.com/doc/api-reference/api-parameters/unretrievableAttributes/) won't be retrieved unless the request is authenticated with the admin API key. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Dictionary<string, string>) + System.Threading.Tasks.Task>> GetObjectWithHttpInfoAsync(string indexName, string objectID, List attributesToRetrieve = default(List), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get multiple records. + /// + /// + /// Retrieve one or more records, potentially from different indices, in a single API operation. Results will be received in the same order as the requests. + /// + /// Thrown when fails to make API call + /// Request object. + /// Cancellation Token to cancel the request. + /// Task of GetObjectsResponse + System.Threading.Tasks.Task GetObjectsAsync(GetObjectsParams getObjectsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get multiple records. + /// + /// + /// Retrieve one or more records, potentially from different indices, in a single API operation. Results will be received in the same order as the requests. + /// + /// Thrown when fails to make API call + /// Request object. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetObjectsResponse) + System.Threading.Tasks.Task> GetObjectsWithHttpInfoAsync(GetObjectsParams getObjectsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a rule. + /// + /// + /// Get a rule by its `objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// Cancellation Token to cancel the request. + /// Task of Rule + System.Threading.Tasks.Task GetRuleAsync(string indexName, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a rule. + /// + /// + /// Get a rule by its `objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Rule) + System.Threading.Tasks.Task> GetRuleWithHttpInfoAsync(string indexName, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get index settings. + /// + /// + /// Return an object containing an index's [configuration settings](https://www.algolia.com/doc/api-reference/settings-api-parameters/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Cancellation Token to cancel the request. + /// Task of IndexSettings + System.Threading.Tasks.Task GetSettingsAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get index settings. + /// + /// + /// Return an object containing an index's [configuration settings](https://www.algolia.com/doc/api-reference/settings-api-parameters/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (IndexSettings) + System.Threading.Tasks.Task> GetSettingsWithHttpInfoAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get all allowed IP addresses. + /// + /// + /// Get all allowed sources (IP addresses). + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of List<Source> + System.Threading.Tasks.Task> GetSourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get all allowed IP addresses. + /// + /// + /// Get all allowed sources (IP addresses). + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Source>) + System.Threading.Tasks.Task>> GetSourcesWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get a synonym object. + /// + /// + /// Get a syonym by its `objectID`. To find the object IDs for your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// Cancellation Token to cancel the request. + /// Task of SynonymHit + System.Threading.Tasks.Task GetSynonymAsync(string indexName, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get a synonym object. + /// + /// + /// Get a syonym by its `objectID`. To find the object IDs for your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SynonymHit) + System.Threading.Tasks.Task> GetSynonymWithHttpInfoAsync(string indexName, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Check a task's status. + /// + /// + /// Some operations, such as copying an index, will respond with a `taskID` value. Use this value here to check the status of that task. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique task identifier. + /// Cancellation Token to cancel the request. + /// Task of GetTaskResponse + System.Threading.Tasks.Task GetTaskAsync(string indexName, long taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Check a task's status. + /// + /// + /// Some operations, such as copying an index, will respond with a `taskID` value. Use this value here to check the status of that task. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique task identifier. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetTaskResponse) + System.Threading.Tasks.Task> GetTaskWithHttpInfoAsync(string indexName, long taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get top userID. + /// + /// + /// Get the IDs of the 10 users with the highest number of records per cluster. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of GetTopUserIdsResponse + System.Threading.Tasks.Task GetTopUserIdsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get top userID. + /// + /// + /// Get the IDs of the 10 users with the highest number of records per cluster. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetTopUserIdsResponse) + System.Threading.Tasks.Task> GetTopUserIdsWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get userID. + /// + /// + /// Returns the userID data stored in the mapping. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// Cancellation Token to cancel the request. + /// Task of UserId + System.Threading.Tasks.Task GetUserIdAsync(string userID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get userID. + /// + /// + /// Returns the userID data stored in the mapping. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UserId) + System.Threading.Tasks.Task> GetUserIdWithHttpInfoAsync(string userID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Get migration and user mapping status. + /// + /// + /// To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process. + /// + /// Thrown when fails to make API call + /// Indicates whether to include the cluster's pending mapping state in the response. (optional) + /// Cancellation Token to cancel the request. + /// Task of HasPendingMappingsResponse + System.Threading.Tasks.Task HasPendingMappingsAsync(bool? getClusters = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Get migration and user mapping status. + /// + /// + /// To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process. + /// + /// Thrown when fails to make API call + /// Indicates whether to include the cluster's pending mapping state in the response. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (HasPendingMappingsResponse) + System.Threading.Tasks.Task> HasPendingMappingsWithHttpInfoAsync(bool? getClusters = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// List API keys. + /// + /// + /// List all API keys associated with your Algolia application, including their permissions and restrictions. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ListApiKeysResponse + System.Threading.Tasks.Task ListApiKeysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List API keys. + /// + /// + /// List all API keys associated with your Algolia application, including their permissions and restrictions. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListApiKeysResponse) + System.Threading.Tasks.Task> ListApiKeysWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// List clusters. + /// + /// + /// List the available clusters in a multi-cluster setup. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ListClustersResponse + System.Threading.Tasks.Task ListClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List clusters. + /// + /// + /// List the available clusters in a multi-cluster setup. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListClustersResponse) + System.Threading.Tasks.Task> ListClustersWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// List indices. + /// + /// + /// List indices in an Algolia application. + /// + /// Thrown when fails to make API call + /// Returns the requested page number. The page size is determined by the `hitsPerPage` parameter. You can see the number of available pages in the `nbPages` response attribute. When `page` is null, the API response is not paginated. (optional) + /// Maximum number of hits per page. (optional, default to 100) + /// Cancellation Token to cancel the request. + /// Task of ListIndicesResponse + System.Threading.Tasks.Task ListIndicesAsync(int? page = default(int?), int? hitsPerPage = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List indices. + /// + /// + /// List indices in an Algolia application. + /// + /// Thrown when fails to make API call + /// Returns the requested page number. The page size is determined by the `hitsPerPage` parameter. You can see the number of available pages in the `nbPages` response attribute. When `page` is null, the API response is not paginated. (optional) + /// Maximum number of hits per page. (optional, default to 100) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListIndicesResponse) + System.Threading.Tasks.Task> ListIndicesWithHttpInfoAsync(int? page = default(int?), int? hitsPerPage = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// List userIDs. + /// + /// + /// List the userIDs assigned to a multi-cluster application. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// Returns the requested page number. The page size is determined by the `hitsPerPage` parameter. You can see the number of available pages in the `nbPages` response attribute. When `page` is null, the API response is not paginated. (optional) + /// Maximum number of hits per page. (optional, default to 100) + /// Cancellation Token to cancel the request. + /// Task of ListUserIdsResponse + System.Threading.Tasks.Task ListUserIdsAsync(int? page = default(int?), int? hitsPerPage = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// List userIDs. + /// + /// + /// List the userIDs assigned to a multi-cluster application. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// Returns the requested page number. The page size is determined by the `hitsPerPage` parameter. You can see the number of available pages in the `nbPages` response attribute. When `page` is null, the API response is not paginated. (optional) + /// Maximum number of hits per page. (optional, default to 100) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListUserIdsResponse) + System.Threading.Tasks.Task> ListUserIdsWithHttpInfoAsync(int? page = default(int?), int? hitsPerPage = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Batch write operations on multiple indices. + /// + /// + /// To reduce the time spent on network round trips, you can perform several write actions in a single request. It's a multi-index version of the [`batch` operation](#tag/Records/operation/batch). Actions are applied in the order they are specified. The supported actions are equivalent to the individual operations of the same name. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of MultipleBatchResponse + System.Threading.Tasks.Task MultipleBatchAsync(BatchParams batchParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Batch write operations on multiple indices. + /// + /// + /// To reduce the time spent on network round trips, you can perform several write actions in a single request. It's a multi-index version of the [`batch` operation](#tag/Records/operation/batch). Actions are applied in the order they are specified. The supported actions are equivalent to the individual operations of the same name. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (MultipleBatchResponse) + System.Threading.Tasks.Task> MultipleBatchWithHttpInfoAsync(BatchParams batchParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Copy, move, or rename an index. + /// + /// + /// This `operation`, _copy_ or _move_, will copy or move a source index's (`IndexName`) records, settings, synonyms, and rules to a `destination` index. If the destination index exists, it will be replaced, except for index-specific API keys and analytics data. If the destination index doesn't exist, it will be created. The choice between moving or copying an index depends on your needs. Choose: - **Move** to rename an index. - **Copy** to create a new index with the same records and configuration as an existing one. > **Note**: When considering copying or moving, be aware of the [rate limitations](https://www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits) on these processes and the [impact on your analytics data](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/concepts/indices-analytics/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + System.Threading.Tasks.Task OperationIndexAsync(string indexName, OperationIndexParams operationIndexParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Copy, move, or rename an index. + /// + /// + /// This `operation`, _copy_ or _move_, will copy or move a source index's (`IndexName`) records, settings, synonyms, and rules to a `destination` index. If the destination index exists, it will be replaced, except for index-specific API keys and analytics data. If the destination index doesn't exist, it will be created. The choice between moving or copying an index depends on your needs. Choose: - **Move** to rename an index. - **Copy** to create a new index with the same records and configuration as an existing one. > **Note**: When considering copying or moving, be aware of the [rate limitations](https://www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits) on these processes and the [impact on your analytics data](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/concepts/indices-analytics/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + System.Threading.Tasks.Task> OperationIndexWithHttpInfoAsync(string indexName, OperationIndexParams operationIndexParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Update record attributes. + /// + /// + /// Add new attributes or update current ones in an existing record. You can use any first-level attribute but not nested attributes. If you specify a [nested attribute](https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/creating-and-using-nested-attributes/), the engine treats it as a replacement for its first-level ancestor. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Object with attributes to update. + /// Indicates whether to create a new record if it doesn't exist yet. (optional, default to true) + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtWithObjectIdResponse + System.Threading.Tasks.Task PartialUpdateObjectAsync(string indexName, string objectID, Dictionary attributesToUpdate, bool? createIfNotExists = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Update record attributes. + /// + /// + /// Add new attributes or update current ones in an existing record. You can use any first-level attribute but not nested attributes. If you specify a [nested attribute](https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/creating-and-using-nested-attributes/), the engine treats it as a replacement for its first-level ancestor. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Object with attributes to update. + /// Indicates whether to create a new record if it doesn't exist yet. (optional, default to true) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtWithObjectIdResponse) + System.Threading.Tasks.Task> PartialUpdateObjectWithHttpInfoAsync(string indexName, string objectID, Dictionary attributesToUpdate, bool? createIfNotExists = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Send requests to the Algolia REST API. + /// + /// + /// This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Remove userID. + /// + /// + /// Remove a userID and its associated data from the multi-clusters. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// Cancellation Token to cancel the request. + /// Task of RemoveUserIdResponse + System.Threading.Tasks.Task RemoveUserIdAsync(string userID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Remove userID. + /// + /// + /// Remove a userID and its associated data from the multi-clusters. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (RemoveUserIdResponse) + System.Threading.Tasks.Task> RemoveUserIdWithHttpInfoAsync(string userID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Replace all sources. + /// + /// + /// Replace all allowed sources. + /// + /// Thrown when fails to make API call + /// Allowed sources. + /// Cancellation Token to cancel the request. + /// Task of ReplaceSourceResponse + System.Threading.Tasks.Task ReplaceSourcesAsync(List source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Replace all sources. + /// + /// + /// Replace all allowed sources. + /// + /// Thrown when fails to make API call + /// Allowed sources. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ReplaceSourceResponse) + System.Threading.Tasks.Task> ReplaceSourcesWithHttpInfoAsync(List source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Restore API key. + /// + /// + /// Restore a deleted API key, along with its associated permissions. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// Cancellation Token to cancel the request. + /// Task of AddApiKeyResponse + System.Threading.Tasks.Task RestoreApiKeyAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Restore API key. + /// + /// + /// Restore a deleted API key, along with its associated permissions. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (AddApiKeyResponse) + System.Threading.Tasks.Task> RestoreApiKeyWithHttpInfoAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Add or update a record. + /// + /// + /// Add a record (object) to an index or replace it. If the record doesn't contain an `objectID`, Algolia automatically adds it. If you use an existing `objectID`, the existing record is replaced with the new one. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// The Algolia record. + /// Cancellation Token to cancel the request. + /// Task of SaveObjectResponse + System.Threading.Tasks.Task SaveObjectAsync(string indexName, Object body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Add or update a record. + /// + /// + /// Add a record (object) to an index or replace it. If the record doesn't contain an `objectID`, Algolia automatically adds it. If you use an existing `objectID`, the existing record is replaced with the new one. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// The Algolia record. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SaveObjectResponse) + System.Threading.Tasks.Task> SaveObjectWithHttpInfoAsync(string indexName, Object body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Create or update a rule. + /// + /// + /// To create or update more than one rule, use the [`batch` operation](#tag/Rules/operation/saveRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of UpdatedRuleResponse + System.Threading.Tasks.Task SaveRuleAsync(string indexName, string objectID, Rule rule, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Create or update a rule. + /// + /// + /// To create or update more than one rule, use the [`batch` operation](#tag/Rules/operation/saveRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedRuleResponse) + System.Threading.Tasks.Task> SaveRuleWithHttpInfoAsync(string indexName, string objectID, Rule rule, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Save a batch of rules. + /// + /// + /// Create or update multiple rules. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Indicates whether existing rules should be deleted before adding this batch. (optional) + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + System.Threading.Tasks.Task SaveRulesAsync(string indexName, List rules, bool? forwardToReplicas = default(bool?), bool? clearExistingRules = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Save a batch of rules. + /// + /// + /// Create or update multiple rules. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Indicates whether existing rules should be deleted before adding this batch. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + System.Threading.Tasks.Task> SaveRulesWithHttpInfoAsync(string indexName, List rules, bool? forwardToReplicas = default(bool?), bool? clearExistingRules = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Save a synonym. + /// + /// + /// Add a [synonym](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms) to an index or replace it. If the synonym `objectID` doesn't exist, Algolia adds a new one. If you use an existing synonym `objectID`, the existing synonym is replaced with the new one. To add multiple synonyms in a single API request, use the [`batch` operation](#tag/Synonyms/operation/saveSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of SaveSynonymResponse + System.Threading.Tasks.Task SaveSynonymAsync(string indexName, string objectID, SynonymHit synonymHit, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Save a synonym. + /// + /// + /// Add a [synonym](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms) to an index or replace it. If the synonym `objectID` doesn't exist, Algolia adds a new one. If you use an existing synonym `objectID`, the existing synonym is replaced with the new one. To add multiple synonyms in a single API request, use the [`batch` operation](#tag/Synonyms/operation/saveSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SaveSynonymResponse) + System.Threading.Tasks.Task> SaveSynonymWithHttpInfoAsync(string indexName, string objectID, SynonymHit synonymHit, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Save a batch of synonyms. + /// + /// + /// Create or update multiple synonyms. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Indicates whether to replace all synonyms in the index with the ones sent with this request. (optional) + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + System.Threading.Tasks.Task SaveSynonymsAsync(string indexName, List synonymHit, bool? forwardToReplicas = default(bool?), bool? replaceExistingSynonyms = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Save a batch of synonyms. + /// + /// + /// Create or update multiple synonyms. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Indicates whether to replace all synonyms in the index with the ones sent with this request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + System.Threading.Tasks.Task> SaveSynonymsWithHttpInfoAsync(string indexName, List synonymHit, bool? forwardToReplicas = default(bool?), bool? replaceExistingSynonyms = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Search multiple indices. + /// + /// + /// Send multiple search queries to one or more indices. + /// + /// Thrown when fails to make API call + /// Query requests and strategies. Results will be received in the same order as the queries. + /// Cancellation Token to cancel the request. + /// Task of SearchResponses + System.Threading.Tasks.Task SearchAsync(SearchMethodParams searchMethodParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Search multiple indices. + /// + /// + /// Send multiple search queries to one or more indices. + /// + /// Thrown when fails to make API call + /// Query requests and strategies. Results will be received in the same order as the queries. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SearchResponses) + System.Threading.Tasks.Task> SearchWithHttpInfoAsync(SearchMethodParams searchMethodParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Search dictionary entries. + /// + /// + /// Search for standard and [custom](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/) entries in the [stop words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plurals](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), or [segmentation (compounds)](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) dictionaries. + /// + /// Thrown when fails to make API call + /// Dictionary to search in. + /// + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + System.Threading.Tasks.Task SearchDictionaryEntriesAsync(DictionaryType dictionaryName, SearchDictionaryEntriesParams searchDictionaryEntriesParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Search dictionary entries. + /// + /// + /// Search for standard and [custom](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/) entries in the [stop words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plurals](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), or [segmentation (compounds)](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) dictionaries. + /// + /// Thrown when fails to make API call + /// Dictionary to search in. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + System.Threading.Tasks.Task> SearchDictionaryEntriesWithHttpInfoAsync(DictionaryType dictionaryName, SearchDictionaryEntriesParams searchDictionaryEntriesParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Search for facet values. + /// + /// + /// [Search for a facet's values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values), optionally restricting the returned values to those contained in records matching other search criteria. > **Note**: Pagination isn't supported (`page` and `hitsPerPage` are ignored). By default, the engine returns a maximum of 10 values but you can adjust this with `maxFacetHits`. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Facet name. + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of SearchForFacetValuesResponse + System.Threading.Tasks.Task SearchForFacetValuesAsync(string indexName, string facetName, SearchForFacetValuesRequest searchForFacetValuesRequest = default(SearchForFacetValuesRequest), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Search for facet values. + /// + /// + /// [Search for a facet's values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values), optionally restricting the returned values to those contained in records matching other search criteria. > **Note**: Pagination isn't supported (`page` and `hitsPerPage` are ignored). By default, the engine returns a maximum of 10 values but you can adjust this with `maxFacetHits`. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Facet name. + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SearchForFacetValuesResponse) + System.Threading.Tasks.Task> SearchForFacetValuesWithHttpInfoAsync(string indexName, string facetName, SearchForFacetValuesRequest searchForFacetValuesRequest = default(SearchForFacetValuesRequest), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Search for rules. + /// + /// + /// Search for rules in your index. You can control the search with parameters. To list all rules, send an empty request body. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of SearchRulesResponse + System.Threading.Tasks.Task SearchRulesAsync(string indexName, SearchRulesParams searchRulesParams = default(SearchRulesParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Search for rules. + /// + /// + /// Search for rules in your index. You can control the search with parameters. To list all rules, send an empty request body. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SearchRulesResponse) + System.Threading.Tasks.Task> SearchRulesWithHttpInfoAsync(string indexName, SearchRulesParams searchRulesParams = default(SearchRulesParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Search an index. + /// + /// + /// Return records that match the query. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of SearchResponse + System.Threading.Tasks.Task SearchSingleIndexAsync(string indexName, SearchParams searchParams = default(SearchParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Search an index. + /// + /// + /// Return records that match the query. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SearchResponse) + System.Threading.Tasks.Task> SearchSingleIndexWithHttpInfoAsync(string indexName, SearchParams searchParams = default(SearchParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Search for synonyms. + /// + /// + /// Search for synonyms in your index. You can control and filter the search with parameters. To get all synonyms, send an empty request body. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Search for specific [types of synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms). (optional) + /// Returns the requested page number (the first page is 0). Page size is set by `hitsPerPage`. When null, there's no pagination. (optional, default to 0) + /// Maximum number of hits per page. (optional, default to 100) + /// Body of the `searchSynonyms` operation. (optional) + /// Cancellation Token to cancel the request. + /// Task of SearchSynonymsResponse + System.Threading.Tasks.Task SearchSynonymsAsync(string indexName, SynonymType type = default(SynonymType), int? page = default(int?), int? hitsPerPage = default(int?), SearchSynonymsParams searchSynonymsParams = default(SearchSynonymsParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Search for synonyms. + /// + /// + /// Search for synonyms in your index. You can control and filter the search with parameters. To get all synonyms, send an empty request body. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Search for specific [types of synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms). (optional) + /// Returns the requested page number (the first page is 0). Page size is set by `hitsPerPage`. When null, there's no pagination. (optional, default to 0) + /// Maximum number of hits per page. (optional, default to 100) + /// Body of the `searchSynonyms` operation. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SearchSynonymsResponse) + System.Threading.Tasks.Task> SearchSynonymsWithHttpInfoAsync(string indexName, SynonymType type = default(SynonymType), int? page = default(int?), int? hitsPerPage = default(int?), SearchSynonymsParams searchSynonymsParams = default(SearchSynonymsParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Search for a user ID. + /// + /// + /// Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. To ensure rapid updates, the user IDs index isn't built at the same time as the mapping. Instead, it's built every 12 hours, at the same time as the update of user ID usage. For example, if you add or move a user ID, the search will show an old value until the next time the mapping is rebuilt (every 12 hours). + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of SearchUserIdsResponse + System.Threading.Tasks.Task SearchUserIdsAsync(SearchUserIdsParams searchUserIdsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Search for a user ID. + /// + /// + /// Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. To ensure rapid updates, the user IDs index isn't built at the same time as the mapping. Instead, it's built every 12 hours, at the same time as the update of user ID usage. For example, if you add or move a user ID, the search will show an old value until the next time the mapping is rebuilt (every 12 hours). + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SearchUserIdsResponse) + System.Threading.Tasks.Task> SearchUserIdsWithHttpInfoAsync(SearchUserIdsParams searchUserIdsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Set stop word settings. + /// + /// + /// Set stop word settings for a specific language. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + System.Threading.Tasks.Task SetDictionarySettingsAsync(DictionarySettingsParams dictionarySettingsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Set stop word settings. + /// + /// + /// Set stop word settings for a specific language. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + System.Threading.Tasks.Task> SetDictionarySettingsWithHttpInfoAsync(DictionarySettingsParams dictionarySettingsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Update index settings. + /// + /// + /// Update the specified [index settings](https://www.algolia.com/doc/api-reference/settings-api-parameters/). Specifying null for a setting resets it to its default value. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + System.Threading.Tasks.Task SetSettingsAsync(string indexName, IndexSettings indexSettings, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Update index settings. + /// + /// + /// Update the specified [index settings](https://www.algolia.com/doc/api-reference/settings-api-parameters/). Specifying null for a setting resets it to its default value. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + System.Threading.Tasks.Task> SetSettingsWithHttpInfoAsync(string indexName, IndexSettings indexSettings, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Update an API key. + /// + /// + /// Replace the permissions of an existing API key. Any unspecified parameter resets that permission to its default value. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// + /// Cancellation Token to cancel the request. + /// Task of UpdateApiKeyResponse + System.Threading.Tasks.Task UpdateApiKeyAsync(string key, ApiKey apiKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Update an API key. + /// + /// + /// Replace the permissions of an existing API key. Any unspecified parameter resets that permission to its default value. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdateApiKeyResponse) + System.Threading.Tasks.Task> UpdateApiKeyWithHttpInfoAsync(string key, ApiKey apiKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } + + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class SearchClient : IDisposable, ISearchClient + { + private Algolia.Search.Search.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// + public SearchClient() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + /// + public SearchClient(string basePath) + { + this.Configuration = Algolia.Search.Search.Client.Configuration.MergeConfigurations( + Algolia.Search.Search.Client.GlobalConfiguration.Instance, + new Algolia.Search.Search.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.Search.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.Search.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// An instance of Configuration. + /// + /// + public SearchClient(Algolia.Search.Search.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Algolia.Search.Search.Client.Configuration.MergeConfigurations( + Algolia.Search.Search.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.Search.Client.ApiClient(this.Configuration.BasePath); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.Search.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public SearchClient(HttpClient client, HttpClientHandler handler = null) : this(client, (string)null, handler) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public SearchClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.Search.Client.Configuration.MergeConfigurations( + Algolia.Search.Search.Client.GlobalConfiguration.Instance, + new Algolia.Search.Search.Client.Configuration { BasePath = basePath } + ); + this.ApiClient = new Algolia.Search.Search.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + this.ExceptionFactory = Algolia.Search.Search.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class using Configuration object. + /// + /// An instance of HttpClient. + /// An instance of Configuration. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public SearchClient(HttpClient client, Algolia.Search.Search.Client.Configuration configuration, HttpClientHandler handler = null) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + if (client == null) throw new ArgumentNullException("client"); + + this.Configuration = Algolia.Search.Search.Client.Configuration.MergeConfigurations( + Algolia.Search.Search.Client.GlobalConfiguration.Instance, + configuration + ); + this.ApiClient = new Algolia.Search.Search.Client.ApiClient(client, this.Configuration.BasePath, handler); + this.Client = this.ApiClient; + this.AsynchronousClient = this.ApiClient; + ExceptionFactory = Algolia.Search.Search.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + /// + public SearchClient(Algolia.Search.Search.Client.ISynchronousClient client, Algolia.Search.Search.Client.IAsynchronousClient asyncClient, Algolia.Search.Search.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Algolia.Search.Search.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + this.ApiClient?.Dispose(); + } + + /// + /// Holds the ApiClient if created + /// + public Algolia.Search.Search.Client.ApiClient ApiClient { get; set; } = null; + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Algolia.Search.Search.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Algolia.Search.Search.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Algolia.Search.Search.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Algolia.Search.Search.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Add API key. Add a new API key with specific permissions and restrictions. The request must be authenticated with the admin API key. The response returns an API key string. + /// + /// Thrown when fails to make API call + /// + /// AddApiKeyResponse + public AddApiKeyResponse AddApiKey(ApiKey apiKey) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = AddApiKeyWithHttpInfo(apiKey); + return localVarResponse.Data; + } + + /// + /// Add API key. Add a new API key with specific permissions and restrictions. The request must be authenticated with the admin API key. The response returns an API key string. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of AddApiKeyResponse + public Algolia.Search.Search.Client.ApiResponse AddApiKeyWithHttpInfo(ApiKey apiKey) + { + // verify the required parameter 'apiKey' is set + if (apiKey == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'apiKey' when calling SearchClient->AddApiKey"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = apiKey; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/keys", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("AddApiKey", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Add API key. Add a new API key with specific permissions and restrictions. The request must be authenticated with the admin API key. The response returns an API key string. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of AddApiKeyResponse + public async System.Threading.Tasks.Task AddApiKeyAsync(ApiKey apiKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await AddApiKeyWithHttpInfoAsync(apiKey, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Add API key. Add a new API key with specific permissions and restrictions. The request must be authenticated with the admin API key. The response returns an API key string. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (AddApiKeyResponse) + public async System.Threading.Tasks.Task> AddApiKeyWithHttpInfoAsync(ApiKey apiKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'apiKey' is set + if (apiKey == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'apiKey' when calling SearchClient->AddApiKey"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = apiKey; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/keys", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("AddApiKey", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Add or update a record (using objectID). If you use an existing `objectID`, the existing record will be replaced with the new one. To update only some attributes of an existing record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject) instead. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Algolia record. + /// UpdatedAtWithObjectIdResponse + public UpdatedAtWithObjectIdResponse AddOrUpdateObject(string indexName, string objectID, Object body) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = AddOrUpdateObjectWithHttpInfo(indexName, objectID, body); + return localVarResponse.Data; + } + + /// + /// Add or update a record (using objectID). If you use an existing `objectID`, the existing record will be replaced with the new one. To update only some attributes of an existing record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject) instead. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Algolia record. + /// ApiResponse of UpdatedAtWithObjectIdResponse + public Algolia.Search.Search.Client.ApiResponse AddOrUpdateObjectWithHttpInfo(string indexName, string objectID, Object body) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->AddOrUpdateObject"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->AddOrUpdateObject"); + + // verify the required parameter 'body' is set + if (body == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'body' when calling SearchClient->AddOrUpdateObject"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1/indexes/{indexName}/{objectID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("AddOrUpdateObject", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Add or update a record (using objectID). If you use an existing `objectID`, the existing record will be replaced with the new one. To update only some attributes of an existing record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject) instead. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Algolia record. + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtWithObjectIdResponse + public async System.Threading.Tasks.Task AddOrUpdateObjectAsync(string indexName, string objectID, Object body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await AddOrUpdateObjectWithHttpInfoAsync(indexName, objectID, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Add or update a record (using objectID). If you use an existing `objectID`, the existing record will be replaced with the new one. To update only some attributes of an existing record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject) instead. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Algolia record. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtWithObjectIdResponse) + public async System.Threading.Tasks.Task> AddOrUpdateObjectWithHttpInfoAsync(string indexName, string objectID, Object body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->AddOrUpdateObject"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->AddOrUpdateObject"); + + // verify the required parameter 'body' is set + if (body == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'body' when calling SearchClient->AddOrUpdateObject"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1/indexes/{indexName}/{objectID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("AddOrUpdateObject", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Add a source. Add a source to the list of allowed sources. + /// + /// Thrown when fails to make API call + /// Source to add. + /// CreatedAtResponse + public CreatedAtResponse AppendSource(Source source) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = AppendSourceWithHttpInfo(source); + return localVarResponse.Data; + } + + /// + /// Add a source. Add a source to the list of allowed sources. + /// + /// Thrown when fails to make API call + /// Source to add. + /// ApiResponse of CreatedAtResponse + public Algolia.Search.Search.Client.ApiResponse AppendSourceWithHttpInfo(Source source) + { + // verify the required parameter 'source' is set + if (source == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'source' when calling SearchClient->AppendSource"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = source; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/security/sources/append", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("AppendSource", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Add a source. Add a source to the list of allowed sources. + /// + /// Thrown when fails to make API call + /// Source to add. + /// Cancellation Token to cancel the request. + /// Task of CreatedAtResponse + public async System.Threading.Tasks.Task AppendSourceAsync(Source source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await AppendSourceWithHttpInfoAsync(source, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Add a source. Add a source to the list of allowed sources. + /// + /// Thrown when fails to make API call + /// Source to add. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (CreatedAtResponse) + public async System.Threading.Tasks.Task> AppendSourceWithHttpInfoAsync(Source source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'source' is set + if (source == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'source' when calling SearchClient->AppendSource"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = source; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/security/sources/append", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("AppendSource", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Assign or move a user ID. Assign or move a user ID to a cluster. The time it takes to move a user is proportional to the amount of data linked to the user ID. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// + /// CreatedAtResponse + public CreatedAtResponse AssignUserId(string xAlgoliaUserID, AssignUserIdParams assignUserIdParams) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = AssignUserIdWithHttpInfo(xAlgoliaUserID, assignUserIdParams); + return localVarResponse.Data; + } + + /// + /// Assign or move a user ID. Assign or move a user ID to a cluster. The time it takes to move a user is proportional to the amount of data linked to the user ID. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// + /// ApiResponse of CreatedAtResponse + public Algolia.Search.Search.Client.ApiResponse AssignUserIdWithHttpInfo(string xAlgoliaUserID, AssignUserIdParams assignUserIdParams) + { + // verify the required parameter 'xAlgoliaUserID' is set + if (xAlgoliaUserID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'xAlgoliaUserID' when calling SearchClient->AssignUserId"); + + // verify the required parameter 'assignUserIdParams' is set + if (assignUserIdParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'assignUserIdParams' when calling SearchClient->AssignUserId"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.HeaderParameters.Add("X-Algolia-User-ID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(xAlgoliaUserID)); // header parameter + localVarRequestOptions.Data = assignUserIdParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/clusters/mapping", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("AssignUserId", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Assign or move a user ID. Assign or move a user ID to a cluster. The time it takes to move a user is proportional to the amount of data linked to the user ID. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// + /// Cancellation Token to cancel the request. + /// Task of CreatedAtResponse + public async System.Threading.Tasks.Task AssignUserIdAsync(string xAlgoliaUserID, AssignUserIdParams assignUserIdParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await AssignUserIdWithHttpInfoAsync(xAlgoliaUserID, assignUserIdParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Assign or move a user ID. Assign or move a user ID to a cluster. The time it takes to move a user is proportional to the amount of data linked to the user ID. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (CreatedAtResponse) + public async System.Threading.Tasks.Task> AssignUserIdWithHttpInfoAsync(string xAlgoliaUserID, AssignUserIdParams assignUserIdParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'xAlgoliaUserID' is set + if (xAlgoliaUserID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'xAlgoliaUserID' when calling SearchClient->AssignUserId"); + + // verify the required parameter 'assignUserIdParams' is set + if (assignUserIdParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'assignUserIdParams' when calling SearchClient->AssignUserId"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.HeaderParameters.Add("X-Algolia-User-ID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(xAlgoliaUserID)); // header parameter + localVarRequestOptions.Data = assignUserIdParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/clusters/mapping", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("AssignUserId", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Batch write operations on one index. To reduce the time spent on network round trips, you can perform several write actions in a single API call. Actions are applied in the order they are specified. The supported `action`s are equivalent to the individual operations of the same name. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// BatchResponse + public BatchResponse Batch(string indexName, BatchWriteParams batchWriteParams) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = BatchWithHttpInfo(indexName, batchWriteParams); + return localVarResponse.Data; + } + + /// + /// Batch write operations on one index. To reduce the time spent on network round trips, you can perform several write actions in a single API call. Actions are applied in the order they are specified. The supported `action`s are equivalent to the individual operations of the same name. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// ApiResponse of BatchResponse + public Algolia.Search.Search.Client.ApiResponse BatchWithHttpInfo(string indexName, BatchWriteParams batchWriteParams) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->Batch"); + + // verify the required parameter 'batchWriteParams' is set + if (batchWriteParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'batchWriteParams' when calling SearchClient->Batch"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.Data = batchWriteParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/{indexName}/batch", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Batch", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Batch write operations on one index. To reduce the time spent on network round trips, you can perform several write actions in a single API call. Actions are applied in the order they are specified. The supported `action`s are equivalent to the individual operations of the same name. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Cancellation Token to cancel the request. + /// Task of BatchResponse + public async System.Threading.Tasks.Task BatchAsync(string indexName, BatchWriteParams batchWriteParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await BatchWithHttpInfoAsync(indexName, batchWriteParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Batch write operations on one index. To reduce the time spent on network round trips, you can perform several write actions in a single API call. Actions are applied in the order they are specified. The supported `action`s are equivalent to the individual operations of the same name. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (BatchResponse) + public async System.Threading.Tasks.Task> BatchWithHttpInfoAsync(string indexName, BatchWriteParams batchWriteParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->Batch"); + + // verify the required parameter 'batchWriteParams' is set + if (batchWriteParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'batchWriteParams' when calling SearchClient->Batch"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.Data = batchWriteParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/{indexName}/batch", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Batch", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Batch assign userIDs. Assign multiple user IDs to a cluster. **You can't _move_ users with this operation.**. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// + /// CreatedAtResponse + public CreatedAtResponse BatchAssignUserIds(string xAlgoliaUserID, BatchAssignUserIdsParams batchAssignUserIdsParams) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = BatchAssignUserIdsWithHttpInfo(xAlgoliaUserID, batchAssignUserIdsParams); + return localVarResponse.Data; + } + + /// + /// Batch assign userIDs. Assign multiple user IDs to a cluster. **You can't _move_ users with this operation.**. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// + /// ApiResponse of CreatedAtResponse + public Algolia.Search.Search.Client.ApiResponse BatchAssignUserIdsWithHttpInfo(string xAlgoliaUserID, BatchAssignUserIdsParams batchAssignUserIdsParams) + { + // verify the required parameter 'xAlgoliaUserID' is set + if (xAlgoliaUserID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'xAlgoliaUserID' when calling SearchClient->BatchAssignUserIds"); + + // verify the required parameter 'batchAssignUserIdsParams' is set + if (batchAssignUserIdsParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'batchAssignUserIdsParams' when calling SearchClient->BatchAssignUserIds"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.HeaderParameters.Add("X-Algolia-User-ID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(xAlgoliaUserID)); // header parameter + localVarRequestOptions.Data = batchAssignUserIdsParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/clusters/mapping/batch", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("BatchAssignUserIds", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Batch assign userIDs. Assign multiple user IDs to a cluster. **You can't _move_ users with this operation.**. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// + /// Cancellation Token to cancel the request. + /// Task of CreatedAtResponse + public async System.Threading.Tasks.Task BatchAssignUserIdsAsync(string xAlgoliaUserID, BatchAssignUserIdsParams batchAssignUserIdsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await BatchAssignUserIdsWithHttpInfoAsync(xAlgoliaUserID, batchAssignUserIdsParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Batch assign userIDs. Assign multiple user IDs to a cluster. **You can't _move_ users with this operation.**. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (CreatedAtResponse) + public async System.Threading.Tasks.Task> BatchAssignUserIdsWithHttpInfoAsync(string xAlgoliaUserID, BatchAssignUserIdsParams batchAssignUserIdsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'xAlgoliaUserID' is set + if (xAlgoliaUserID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'xAlgoliaUserID' when calling SearchClient->BatchAssignUserIds"); + + // verify the required parameter 'batchAssignUserIdsParams' is set + if (batchAssignUserIdsParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'batchAssignUserIdsParams' when calling SearchClient->BatchAssignUserIds"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.HeaderParameters.Add("X-Algolia-User-ID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(xAlgoliaUserID)); // header parameter + localVarRequestOptions.Data = batchAssignUserIdsParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/clusters/mapping/batch", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("BatchAssignUserIds", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Batch dictionary entries. Add or remove a batch of dictionary entries. + /// + /// Thrown when fails to make API call + /// Dictionary to search in. + /// + /// UpdatedAtResponse + public UpdatedAtResponse BatchDictionaryEntries(DictionaryType dictionaryName, BatchDictionaryEntriesParams batchDictionaryEntriesParams) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = BatchDictionaryEntriesWithHttpInfo(dictionaryName, batchDictionaryEntriesParams); + return localVarResponse.Data; + } + + /// + /// Batch dictionary entries. Add or remove a batch of dictionary entries. + /// + /// Thrown when fails to make API call + /// Dictionary to search in. + /// + /// ApiResponse of UpdatedAtResponse + public Algolia.Search.Search.Client.ApiResponse BatchDictionaryEntriesWithHttpInfo(DictionaryType dictionaryName, BatchDictionaryEntriesParams batchDictionaryEntriesParams) + { + // verify the required parameter 'dictionaryName' is set + if (dictionaryName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'dictionaryName' when calling SearchClient->BatchDictionaryEntries"); + + // verify the required parameter 'batchDictionaryEntriesParams' is set + if (batchDictionaryEntriesParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'batchDictionaryEntriesParams' when calling SearchClient->BatchDictionaryEntries"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("dictionaryName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(dictionaryName)); // path parameter + localVarRequestOptions.Data = batchDictionaryEntriesParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/dictionaries/{dictionaryName}/batch", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("BatchDictionaryEntries", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Batch dictionary entries. Add or remove a batch of dictionary entries. + /// + /// Thrown when fails to make API call + /// Dictionary to search in. + /// + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + public async System.Threading.Tasks.Task BatchDictionaryEntriesAsync(DictionaryType dictionaryName, BatchDictionaryEntriesParams batchDictionaryEntriesParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await BatchDictionaryEntriesWithHttpInfoAsync(dictionaryName, batchDictionaryEntriesParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Batch dictionary entries. Add or remove a batch of dictionary entries. + /// + /// Thrown when fails to make API call + /// Dictionary to search in. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + public async System.Threading.Tasks.Task> BatchDictionaryEntriesWithHttpInfoAsync(DictionaryType dictionaryName, BatchDictionaryEntriesParams batchDictionaryEntriesParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'dictionaryName' is set + if (dictionaryName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'dictionaryName' when calling SearchClient->BatchDictionaryEntries"); + + // verify the required parameter 'batchDictionaryEntriesParams' is set + if (batchDictionaryEntriesParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'batchDictionaryEntriesParams' when calling SearchClient->BatchDictionaryEntries"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("dictionaryName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(dictionaryName)); // path parameter + localVarRequestOptions.Data = batchDictionaryEntriesParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/dictionaries/{dictionaryName}/batch", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("BatchDictionaryEntries", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get all records from an index. Retrieve up to 1,000 records per call. Supports full-text search and filters. For better performance, it doesn't support: - The `distinct` query parameter - Sorting by typos, proximity, words, or geographical distance. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// BrowseResponse + public BrowseResponse Browse(string indexName, BrowseParams browseParams = default(BrowseParams)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = BrowseWithHttpInfo(indexName, browseParams); + return localVarResponse.Data; + } + + /// + /// Get all records from an index. Retrieve up to 1,000 records per call. Supports full-text search and filters. For better performance, it doesn't support: - The `distinct` query parameter - Sorting by typos, proximity, words, or geographical distance. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// ApiResponse of BrowseResponse + public Algolia.Search.Search.Client.ApiResponse BrowseWithHttpInfo(string indexName, BrowseParams browseParams = default(BrowseParams)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->Browse"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.Data = browseParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/{indexName}/browse", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Browse", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get all records from an index. Retrieve up to 1,000 records per call. Supports full-text search and filters. For better performance, it doesn't support: - The `distinct` query parameter - Sorting by typos, proximity, words, or geographical distance. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of BrowseResponse + public async System.Threading.Tasks.Task BrowseAsync(string indexName, BrowseParams browseParams = default(BrowseParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await BrowseWithHttpInfoAsync(indexName, browseParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get all records from an index. Retrieve up to 1,000 records per call. Supports full-text search and filters. For better performance, it doesn't support: - The `distinct` query parameter - Sorting by typos, proximity, words, or geographical distance. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (BrowseResponse) + public async System.Threading.Tasks.Task> BrowseWithHttpInfoAsync(string indexName, BrowseParams browseParams = default(BrowseParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->Browse"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.Data = browseParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/{indexName}/browse", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Browse", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete all synonyms. Delete all synonyms in the index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// UpdatedAtResponse + public UpdatedAtResponse ClearAllSynonyms(string indexName, bool? forwardToReplicas = default(bool?)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = ClearAllSynonymsWithHttpInfo(indexName, forwardToReplicas); + return localVarResponse.Data; + } + + /// + /// Delete all synonyms. Delete all synonyms in the index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// ApiResponse of UpdatedAtResponse + public Algolia.Search.Search.Client.ApiResponse ClearAllSynonymsWithHttpInfo(string indexName, bool? forwardToReplicas = default(bool?)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->ClearAllSynonyms"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/{indexName}/synonyms/clear", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ClearAllSynonyms", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete all synonyms. Delete all synonyms in the index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + public async System.Threading.Tasks.Task ClearAllSynonymsAsync(string indexName, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await ClearAllSynonymsWithHttpInfoAsync(indexName, forwardToReplicas, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete all synonyms. Delete all synonyms in the index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + public async System.Threading.Tasks.Task> ClearAllSynonymsWithHttpInfoAsync(string indexName, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->ClearAllSynonyms"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/{indexName}/synonyms/clear", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ClearAllSynonyms", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete all records from an index. Delete the records but leave settings and index-specific API keys untouched. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// UpdatedAtResponse + public UpdatedAtResponse ClearObjects(string indexName) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = ClearObjectsWithHttpInfo(indexName); + return localVarResponse.Data; + } + + /// + /// Delete all records from an index. Delete the records but leave settings and index-specific API keys untouched. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// ApiResponse of UpdatedAtResponse + public Algolia.Search.Search.Client.ApiResponse ClearObjectsWithHttpInfo(string indexName) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->ClearObjects"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/{indexName}/clear", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ClearObjects", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete all records from an index. Delete the records but leave settings and index-specific API keys untouched. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + public async System.Threading.Tasks.Task ClearObjectsAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await ClearObjectsWithHttpInfoAsync(indexName, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete all records from an index. Delete the records but leave settings and index-specific API keys untouched. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + public async System.Threading.Tasks.Task> ClearObjectsWithHttpInfoAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->ClearObjects"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/{indexName}/clear", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ClearObjects", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete all rules. Delete all rules in the index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// UpdatedAtResponse + public UpdatedAtResponse ClearRules(string indexName, bool? forwardToReplicas = default(bool?)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = ClearRulesWithHttpInfo(indexName, forwardToReplicas); + return localVarResponse.Data; + } + + /// + /// Delete all rules. Delete all rules in the index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// ApiResponse of UpdatedAtResponse + public Algolia.Search.Search.Client.ApiResponse ClearRulesWithHttpInfo(string indexName, bool? forwardToReplicas = default(bool?)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->ClearRules"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/{indexName}/rules/clear", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ClearRules", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete all rules. Delete all rules in the index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + public async System.Threading.Tasks.Task ClearRulesAsync(string indexName, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await ClearRulesWithHttpInfoAsync(indexName, forwardToReplicas, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete all rules. Delete all rules in the index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + public async System.Threading.Tasks.Task> ClearRulesWithHttpInfoAsync(string indexName, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->ClearRules"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/{indexName}/rules/clear", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ClearRules", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Del(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = DelWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.Search.Client.ApiResponse DelWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'path' when calling SearchClient->Del"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Search.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task DelAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await DelWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> DelWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'path' when calling SearchClient->Del"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Search.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Del", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete API key. Delete an existing API key. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// DeleteApiKeyResponse + public DeleteApiKeyResponse DeleteApiKey(string key) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = DeleteApiKeyWithHttpInfo(key); + return localVarResponse.Data; + } + + /// + /// Delete API key. Delete an existing API key. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// ApiResponse of DeleteApiKeyResponse + public Algolia.Search.Search.Client.ApiResponse DeleteApiKeyWithHttpInfo(string key) + { + // verify the required parameter 'key' is set + if (key == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'key' when calling SearchClient->DeleteApiKey"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("key", Algolia.Search.Search.Client.ClientUtils.ParameterToString(key)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1/keys/{key}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteApiKey", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete API key. Delete an existing API key. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// Cancellation Token to cancel the request. + /// Task of DeleteApiKeyResponse + public async System.Threading.Tasks.Task DeleteApiKeyAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await DeleteApiKeyWithHttpInfoAsync(key, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete API key. Delete an existing API key. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeleteApiKeyResponse) + public async System.Threading.Tasks.Task> DeleteApiKeyWithHttpInfoAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'key' is set + if (key == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'key' when calling SearchClient->DeleteApiKey"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("key", Algolia.Search.Search.Client.ClientUtils.ParameterToString(key)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1/keys/{key}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteApiKey", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete all records matching a query. This operation doesn't support all the query options, only its filters (numeric, facet, or tag) and geo queries. It doesn't accept empty filters or queries. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// DeletedAtResponse + public DeletedAtResponse DeleteBy(string indexName, DeleteByParams deleteByParams) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = DeleteByWithHttpInfo(indexName, deleteByParams); + return localVarResponse.Data; + } + + /// + /// Delete all records matching a query. This operation doesn't support all the query options, only its filters (numeric, facet, or tag) and geo queries. It doesn't accept empty filters or queries. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// ApiResponse of DeletedAtResponse + public Algolia.Search.Search.Client.ApiResponse DeleteByWithHttpInfo(string indexName, DeleteByParams deleteByParams) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->DeleteBy"); + + // verify the required parameter 'deleteByParams' is set + if (deleteByParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'deleteByParams' when calling SearchClient->DeleteBy"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.Data = deleteByParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/{indexName}/deleteByQuery", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteBy", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete all records matching a query. This operation doesn't support all the query options, only its filters (numeric, facet, or tag) and geo queries. It doesn't accept empty filters or queries. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Cancellation Token to cancel the request. + /// Task of DeletedAtResponse + public async System.Threading.Tasks.Task DeleteByAsync(string indexName, DeleteByParams deleteByParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await DeleteByWithHttpInfoAsync(indexName, deleteByParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete all records matching a query. This operation doesn't support all the query options, only its filters (numeric, facet, or tag) and geo queries. It doesn't accept empty filters or queries. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeletedAtResponse) + public async System.Threading.Tasks.Task> DeleteByWithHttpInfoAsync(string indexName, DeleteByParams deleteByParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->DeleteBy"); + + // verify the required parameter 'deleteByParams' is set + if (deleteByParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'deleteByParams' when calling SearchClient->DeleteBy"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.Data = deleteByParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/{indexName}/deleteByQuery", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteBy", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete index. Delete an existing index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// DeletedAtResponse + public DeletedAtResponse DeleteIndex(string indexName) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = DeleteIndexWithHttpInfo(indexName); + return localVarResponse.Data; + } + + /// + /// Delete index. Delete an existing index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// ApiResponse of DeletedAtResponse + public Algolia.Search.Search.Client.ApiResponse DeleteIndexWithHttpInfo(string indexName) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->DeleteIndex"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1/indexes/{indexName}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteIndex", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete index. Delete an existing index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Cancellation Token to cancel the request. + /// Task of DeletedAtResponse + public async System.Threading.Tasks.Task DeleteIndexAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await DeleteIndexWithHttpInfoAsync(indexName, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete index. Delete an existing index. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeletedAtResponse) + public async System.Threading.Tasks.Task> DeleteIndexWithHttpInfoAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->DeleteIndex"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1/indexes/{indexName}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteIndex", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a record. To delete a set of records matching a query, use the [`deleteByQuery` operation](#tag/Records/operation/deleteBy) instead. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// DeletedAtResponse + public DeletedAtResponse DeleteObject(string indexName, string objectID) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = DeleteObjectWithHttpInfo(indexName, objectID); + return localVarResponse.Data; + } + + /// + /// Delete a record. To delete a set of records matching a query, use the [`deleteByQuery` operation](#tag/Records/operation/deleteBy) instead. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// ApiResponse of DeletedAtResponse + public Algolia.Search.Search.Client.ApiResponse DeleteObjectWithHttpInfo(string indexName, string objectID) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->DeleteObject"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->DeleteObject"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1/indexes/{indexName}/{objectID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteObject", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a record. To delete a set of records matching a query, use the [`deleteByQuery` operation](#tag/Records/operation/deleteBy) instead. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Cancellation Token to cancel the request. + /// Task of DeletedAtResponse + public async System.Threading.Tasks.Task DeleteObjectAsync(string indexName, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await DeleteObjectWithHttpInfoAsync(indexName, objectID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete a record. To delete a set of records matching a query, use the [`deleteByQuery` operation](#tag/Records/operation/deleteBy) instead. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeletedAtResponse) + public async System.Threading.Tasks.Task> DeleteObjectWithHttpInfoAsync(string indexName, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->DeleteObject"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->DeleteObject"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1/indexes/{indexName}/{objectID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteObject", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a rule. Delete a rule by its `objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// UpdatedAtResponse + public UpdatedAtResponse DeleteRule(string indexName, string objectID, bool? forwardToReplicas = default(bool?)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = DeleteRuleWithHttpInfo(indexName, objectID, forwardToReplicas); + return localVarResponse.Data; + } + + /// + /// Delete a rule. Delete a rule by its `objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// ApiResponse of UpdatedAtResponse + public Algolia.Search.Search.Client.ApiResponse DeleteRuleWithHttpInfo(string indexName, string objectID, bool? forwardToReplicas = default(bool?)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->DeleteRule"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->DeleteRule"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1/indexes/{indexName}/rules/{objectID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteRule", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a rule. Delete a rule by its `objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + public async System.Threading.Tasks.Task DeleteRuleAsync(string indexName, string objectID, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await DeleteRuleWithHttpInfoAsync(indexName, objectID, forwardToReplicas, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete a rule. Delete a rule by its `objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + public async System.Threading.Tasks.Task> DeleteRuleWithHttpInfoAsync(string indexName, string objectID, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->DeleteRule"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->DeleteRule"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1/indexes/{indexName}/rules/{objectID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteRule", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Remove a source. Remove a source from the list of allowed sources. + /// + /// Thrown when fails to make API call + /// IP address range of the source. + /// DeleteSourceResponse + public DeleteSourceResponse DeleteSource(string source) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = DeleteSourceWithHttpInfo(source); + return localVarResponse.Data; + } + + /// + /// Remove a source. Remove a source from the list of allowed sources. + /// + /// Thrown when fails to make API call + /// IP address range of the source. + /// ApiResponse of DeleteSourceResponse + public Algolia.Search.Search.Client.ApiResponse DeleteSourceWithHttpInfo(string source) + { + // verify the required parameter 'source' is set + if (source == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'source' when calling SearchClient->DeleteSource"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("source", Algolia.Search.Search.Client.ClientUtils.ParameterToString(source)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1/security/sources/{source}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteSource", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Remove a source. Remove a source from the list of allowed sources. + /// + /// Thrown when fails to make API call + /// IP address range of the source. + /// Cancellation Token to cancel the request. + /// Task of DeleteSourceResponse + public async System.Threading.Tasks.Task DeleteSourceAsync(string source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await DeleteSourceWithHttpInfoAsync(source, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Remove a source. Remove a source from the list of allowed sources. + /// + /// Thrown when fails to make API call + /// IP address range of the source. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeleteSourceResponse) + public async System.Threading.Tasks.Task> DeleteSourceWithHttpInfoAsync(string source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'source' is set + if (source == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'source' when calling SearchClient->DeleteSource"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("source", Algolia.Search.Search.Client.ClientUtils.ParameterToString(source)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1/security/sources/{source}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteSource", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a synonym. Delete a synonym by its `objectID`. To find the object IDs of your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// DeletedAtResponse + public DeletedAtResponse DeleteSynonym(string indexName, string objectID, bool? forwardToReplicas = default(bool?)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = DeleteSynonymWithHttpInfo(indexName, objectID, forwardToReplicas); + return localVarResponse.Data; + } + + /// + /// Delete a synonym. Delete a synonym by its `objectID`. To find the object IDs of your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// ApiResponse of DeletedAtResponse + public Algolia.Search.Search.Client.ApiResponse DeleteSynonymWithHttpInfo(string indexName, string objectID, bool? forwardToReplicas = default(bool?)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->DeleteSynonym"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->DeleteSynonym"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1/indexes/{indexName}/synonyms/{objectID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteSynonym", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Delete a synonym. Delete a synonym by its `objectID`. To find the object IDs of your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of DeletedAtResponse + public async System.Threading.Tasks.Task DeleteSynonymAsync(string indexName, string objectID, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await DeleteSynonymWithHttpInfoAsync(indexName, objectID, forwardToReplicas, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Delete a synonym. Delete a synonym by its `objectID`. To find the object IDs of your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (DeletedAtResponse) + public async System.Threading.Tasks.Task> DeleteSynonymWithHttpInfoAsync(string indexName, string objectID, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->DeleteSynonym"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->DeleteSynonym"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1/indexes/{indexName}/synonyms/{objectID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteSynonym", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Object + public Object Get(string path, Dictionary parameters = default(Dictionary)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = GetWithHttpInfo(path, parameters); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// ApiResponse of Object + public Algolia.Search.Search.Client.ApiResponse GetWithHttpInfo(string path, Dictionary parameters = default(Dictionary)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'path' when calling SearchClient->Get"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Search.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task GetAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await GetWithHttpInfoAsync(path, parameters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> GetWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'path' when calling SearchClient->Get"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Search.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Get", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get API key permissions. Get the permissions and restrictions of a specific API key. When authenticating with the admin API key, you can request information for any of your application's keys. When authenticating with other API keys, you can only retrieve information for that key. + /// + /// Thrown when fails to make API call + /// API key. + /// GetApiKeyResponse + public GetApiKeyResponse GetApiKey(string key) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = GetApiKeyWithHttpInfo(key); + return localVarResponse.Data; + } + + /// + /// Get API key permissions. Get the permissions and restrictions of a specific API key. When authenticating with the admin API key, you can request information for any of your application's keys. When authenticating with other API keys, you can only retrieve information for that key. + /// + /// Thrown when fails to make API call + /// API key. + /// ApiResponse of GetApiKeyResponse + public Algolia.Search.Search.Client.ApiResponse GetApiKeyWithHttpInfo(string key) + { + // verify the required parameter 'key' is set + if (key == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'key' when calling SearchClient->GetApiKey"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("key", Algolia.Search.Search.Client.ClientUtils.ParameterToString(key)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/keys/{key}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetApiKey", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get API key permissions. Get the permissions and restrictions of a specific API key. When authenticating with the admin API key, you can request information for any of your application's keys. When authenticating with other API keys, you can only retrieve information for that key. + /// + /// Thrown when fails to make API call + /// API key. + /// Cancellation Token to cancel the request. + /// Task of GetApiKeyResponse + public async System.Threading.Tasks.Task GetApiKeyAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await GetApiKeyWithHttpInfoAsync(key, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get API key permissions. Get the permissions and restrictions of a specific API key. When authenticating with the admin API key, you can request information for any of your application's keys. When authenticating with other API keys, you can only retrieve information for that key. + /// + /// Thrown when fails to make API call + /// API key. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetApiKeyResponse) + public async System.Threading.Tasks.Task> GetApiKeyWithHttpInfoAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'key' is set + if (key == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'key' when calling SearchClient->GetApiKey"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("key", Algolia.Search.Search.Client.ClientUtils.ParameterToString(key)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/keys/{key}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetApiKey", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List available languages. Lists Algolia's [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/) and any customizations applied to each language's [stop word](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plural](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), and [segmentation (compound)](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) features. + /// + /// Thrown when fails to make API call + /// Dictionary<string, Languages> + public Dictionary GetDictionaryLanguages() + { + Algolia.Search.Search.Client.ApiResponse> localVarResponse = GetDictionaryLanguagesWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// List available languages. Lists Algolia's [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/) and any customizations applied to each language's [stop word](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plural](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), and [segmentation (compound)](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) features. + /// + /// Thrown when fails to make API call + /// ApiResponse of Dictionary<string, Languages> + public Algolia.Search.Search.Client.ApiResponse> GetDictionaryLanguagesWithHttpInfo() + { + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get>("/1/dictionaries/*/languages", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetDictionaryLanguages", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List available languages. Lists Algolia's [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/) and any customizations applied to each language's [stop word](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plural](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), and [segmentation (compound)](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) features. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of Dictionary<string, Languages> + public async System.Threading.Tasks.Task> GetDictionaryLanguagesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse> localVarResponse = await GetDictionaryLanguagesWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// List available languages. Lists Algolia's [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/) and any customizations applied to each language's [stop word](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plural](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), and [segmentation (compound)](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) features. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Dictionary<string, Languages>) + public async System.Threading.Tasks.Task>> GetDictionaryLanguagesWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync>("/1/dictionaries/*/languages", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetDictionaryLanguages", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get stop word settings. Get the languages for which [stop words are turned off](#tag/Dictionaries/operation/setDictionarySettings). + /// + /// Thrown when fails to make API call + /// GetDictionarySettingsResponse + public GetDictionarySettingsResponse GetDictionarySettings() + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = GetDictionarySettingsWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Get stop word settings. Get the languages for which [stop words are turned off](#tag/Dictionaries/operation/setDictionarySettings). + /// + /// Thrown when fails to make API call + /// ApiResponse of GetDictionarySettingsResponse + public Algolia.Search.Search.Client.ApiResponse GetDictionarySettingsWithHttpInfo() + { + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/dictionaries/*/settings", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetDictionarySettings", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get stop word settings. Get the languages for which [stop words are turned off](#tag/Dictionaries/operation/setDictionarySettings). + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of GetDictionarySettingsResponse + public async System.Threading.Tasks.Task GetDictionarySettingsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await GetDictionarySettingsWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get stop word settings. Get the languages for which [stop words are turned off](#tag/Dictionaries/operation/setDictionarySettings). + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetDictionarySettingsResponse) + public async System.Threading.Tasks.Task> GetDictionarySettingsWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/dictionaries/*/settings", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetDictionarySettings", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Return the latest log entries. The request must be authenticated by an API key with the [`logs` ACL](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl). Logs are held for the last seven days. There's also a logging limit of 1,000 API calls per server. This request counts towards your [operations quota](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-) but doesn't appear in the logs itself. > **Note**: To fetch the logs for a Distributed Search Network (DSN) cluster, target the [DSN's endpoint](https://www.algolia.com/doc/guides/scaling/distributed-search-network-dsn/#accessing-dsn-servers). + /// + /// Thrown when fails to make API call + /// First log entry to retrieve. Sorted by decreasing date with 0 being the most recent. (optional, default to 0) + /// Maximum number of entries to retrieve. (optional, default to 10) + /// Index for which log entries should be retrieved. When omitted, log entries are retrieved for all indices. (optional) + /// Type of log entries to retrieve. When omitted, all log entries are retrieved. (optional) + /// GetLogsResponse + public GetLogsResponse GetLogs(int? offset = default(int?), int? length = default(int?), string indexName = default(string), LogType type = default(LogType)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = GetLogsWithHttpInfo(offset, length, indexName, type); + return localVarResponse.Data; + } + + /// + /// Return the latest log entries. The request must be authenticated by an API key with the [`logs` ACL](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl). Logs are held for the last seven days. There's also a logging limit of 1,000 API calls per server. This request counts towards your [operations quota](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-) but doesn't appear in the logs itself. > **Note**: To fetch the logs for a Distributed Search Network (DSN) cluster, target the [DSN's endpoint](https://www.algolia.com/doc/guides/scaling/distributed-search-network-dsn/#accessing-dsn-servers). + /// + /// Thrown when fails to make API call + /// First log entry to retrieve. Sorted by decreasing date with 0 being the most recent. (optional, default to 0) + /// Maximum number of entries to retrieve. (optional, default to 10) + /// Index for which log entries should be retrieved. When omitted, log entries are retrieved for all indices. (optional) + /// Type of log entries to retrieve. When omitted, all log entries are retrieved. (optional) + /// ApiResponse of GetLogsResponse + public Algolia.Search.Search.Client.ApiResponse GetLogsWithHttpInfo(int? offset = default(int?), int? length = default(int?), string indexName = default(string), LogType type = default(LogType)) + { + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (length != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "length", length)); + } + if (indexName != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "indexName", indexName)); + } + if (type != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "type", type)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/logs", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetLogs", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Return the latest log entries. The request must be authenticated by an API key with the [`logs` ACL](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl). Logs are held for the last seven days. There's also a logging limit of 1,000 API calls per server. This request counts towards your [operations quota](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-) but doesn't appear in the logs itself. > **Note**: To fetch the logs for a Distributed Search Network (DSN) cluster, target the [DSN's endpoint](https://www.algolia.com/doc/guides/scaling/distributed-search-network-dsn/#accessing-dsn-servers). + /// + /// Thrown when fails to make API call + /// First log entry to retrieve. Sorted by decreasing date with 0 being the most recent. (optional, default to 0) + /// Maximum number of entries to retrieve. (optional, default to 10) + /// Index for which log entries should be retrieved. When omitted, log entries are retrieved for all indices. (optional) + /// Type of log entries to retrieve. When omitted, all log entries are retrieved. (optional) + /// Cancellation Token to cancel the request. + /// Task of GetLogsResponse + public async System.Threading.Tasks.Task GetLogsAsync(int? offset = default(int?), int? length = default(int?), string indexName = default(string), LogType type = default(LogType), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await GetLogsWithHttpInfoAsync(offset, length, indexName, type, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Return the latest log entries. The request must be authenticated by an API key with the [`logs` ACL](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl). Logs are held for the last seven days. There's also a logging limit of 1,000 API calls per server. This request counts towards your [operations quota](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-) but doesn't appear in the logs itself. > **Note**: To fetch the logs for a Distributed Search Network (DSN) cluster, target the [DSN's endpoint](https://www.algolia.com/doc/guides/scaling/distributed-search-network-dsn/#accessing-dsn-servers). + /// + /// Thrown when fails to make API call + /// First log entry to retrieve. Sorted by decreasing date with 0 being the most recent. (optional, default to 0) + /// Maximum number of entries to retrieve. (optional, default to 10) + /// Index for which log entries should be retrieved. When omitted, log entries are retrieved for all indices. (optional) + /// Type of log entries to retrieve. When omitted, all log entries are retrieved. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetLogsResponse) + public async System.Threading.Tasks.Task> GetLogsWithHttpInfoAsync(int? offset = default(int?), int? length = default(int?), string indexName = default(string), LogType type = default(LogType), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (offset != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "offset", offset)); + } + if (length != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "length", length)); + } + if (indexName != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "indexName", indexName)); + } + if (type != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "type", type)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/logs", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetLogs", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a record. To get more than one record, use the [`objects` operation](#tag/Records/operation/getObjects). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Attributes to include with the records in the response. This is useful to reduce the size of the API response. By default, all retrievable attributes are returned. `objectID` is always retrieved, even when not specified. [`unretrievableAttributes`](https://www.algolia.com/doc/api-reference/api-parameters/unretrievableAttributes/) won't be retrieved unless the request is authenticated with the admin API key. (optional) + /// Dictionary<string, string> + public Dictionary GetObject(string indexName, string objectID, List attributesToRetrieve = default(List)) + { + Algolia.Search.Search.Client.ApiResponse> localVarResponse = GetObjectWithHttpInfo(indexName, objectID, attributesToRetrieve); + return localVarResponse.Data; + } + + /// + /// Get a record. To get more than one record, use the [`objects` operation](#tag/Records/operation/getObjects). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Attributes to include with the records in the response. This is useful to reduce the size of the API response. By default, all retrievable attributes are returned. `objectID` is always retrieved, even when not specified. [`unretrievableAttributes`](https://www.algolia.com/doc/api-reference/api-parameters/unretrievableAttributes/) won't be retrieved unless the request is authenticated with the admin API key. (optional) + /// ApiResponse of Dictionary<string, string> + public Algolia.Search.Search.Client.ApiResponse> GetObjectWithHttpInfo(string indexName, string objectID, List attributesToRetrieve = default(List)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->GetObject"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->GetObject"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + if (attributesToRetrieve != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("multi", "attributesToRetrieve", attributesToRetrieve)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get>("/1/indexes/{indexName}/{objectID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetObject", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a record. To get more than one record, use the [`objects` operation](#tag/Records/operation/getObjects). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Attributes to include with the records in the response. This is useful to reduce the size of the API response. By default, all retrievable attributes are returned. `objectID` is always retrieved, even when not specified. [`unretrievableAttributes`](https://www.algolia.com/doc/api-reference/api-parameters/unretrievableAttributes/) won't be retrieved unless the request is authenticated with the admin API key. (optional) + /// Cancellation Token to cancel the request. + /// Task of Dictionary<string, string> + public async System.Threading.Tasks.Task> GetObjectAsync(string indexName, string objectID, List attributesToRetrieve = default(List), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse> localVarResponse = await GetObjectWithHttpInfoAsync(indexName, objectID, attributesToRetrieve, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a record. To get more than one record, use the [`objects` operation](#tag/Records/operation/getObjects). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Attributes to include with the records in the response. This is useful to reduce the size of the API response. By default, all retrievable attributes are returned. `objectID` is always retrieved, even when not specified. [`unretrievableAttributes`](https://www.algolia.com/doc/api-reference/api-parameters/unretrievableAttributes/) won't be retrieved unless the request is authenticated with the admin API key. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Dictionary<string, string>) + public async System.Threading.Tasks.Task>> GetObjectWithHttpInfoAsync(string indexName, string objectID, List attributesToRetrieve = default(List), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->GetObject"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->GetObject"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + if (attributesToRetrieve != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("multi", "attributesToRetrieve", attributesToRetrieve)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync>("/1/indexes/{indexName}/{objectID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetObject", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get multiple records. Retrieve one or more records, potentially from different indices, in a single API operation. Results will be received in the same order as the requests. + /// + /// Thrown when fails to make API call + /// Request object. + /// GetObjectsResponse + public GetObjectsResponse GetObjects(GetObjectsParams getObjectsParams) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = GetObjectsWithHttpInfo(getObjectsParams); + return localVarResponse.Data; + } + + /// + /// Get multiple records. Retrieve one or more records, potentially from different indices, in a single API operation. Results will be received in the same order as the requests. + /// + /// Thrown when fails to make API call + /// Request object. + /// ApiResponse of GetObjectsResponse + public Algolia.Search.Search.Client.ApiResponse GetObjectsWithHttpInfo(GetObjectsParams getObjectsParams) + { + // verify the required parameter 'getObjectsParams' is set + if (getObjectsParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'getObjectsParams' when calling SearchClient->GetObjects"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = getObjectsParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/*/objects", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetObjects", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get multiple records. Retrieve one or more records, potentially from different indices, in a single API operation. Results will be received in the same order as the requests. + /// + /// Thrown when fails to make API call + /// Request object. + /// Cancellation Token to cancel the request. + /// Task of GetObjectsResponse + public async System.Threading.Tasks.Task GetObjectsAsync(GetObjectsParams getObjectsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await GetObjectsWithHttpInfoAsync(getObjectsParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get multiple records. Retrieve one or more records, potentially from different indices, in a single API operation. Results will be received in the same order as the requests. + /// + /// Thrown when fails to make API call + /// Request object. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetObjectsResponse) + public async System.Threading.Tasks.Task> GetObjectsWithHttpInfoAsync(GetObjectsParams getObjectsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'getObjectsParams' is set + if (getObjectsParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'getObjectsParams' when calling SearchClient->GetObjects"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = getObjectsParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/*/objects", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetObjects", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a rule. Get a rule by its `objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// Rule + public Rule GetRule(string indexName, string objectID) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = GetRuleWithHttpInfo(indexName, objectID); + return localVarResponse.Data; + } + + /// + /// Get a rule. Get a rule by its `objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// ApiResponse of Rule + public Algolia.Search.Search.Client.ApiResponse GetRuleWithHttpInfo(string indexName, string objectID) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->GetRule"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->GetRule"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/indexes/{indexName}/rules/{objectID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetRule", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a rule. Get a rule by its `objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// Cancellation Token to cancel the request. + /// Task of Rule + public async System.Threading.Tasks.Task GetRuleAsync(string indexName, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await GetRuleWithHttpInfoAsync(indexName, objectID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a rule. Get a rule by its `objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Rule) + public async System.Threading.Tasks.Task> GetRuleWithHttpInfoAsync(string indexName, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->GetRule"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->GetRule"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/indexes/{indexName}/rules/{objectID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetRule", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get index settings. Return an object containing an index's [configuration settings](https://www.algolia.com/doc/api-reference/settings-api-parameters/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// IndexSettings + public IndexSettings GetSettings(string indexName) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = GetSettingsWithHttpInfo(indexName); + return localVarResponse.Data; + } + + /// + /// Get index settings. Return an object containing an index's [configuration settings](https://www.algolia.com/doc/api-reference/settings-api-parameters/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// ApiResponse of IndexSettings + public Algolia.Search.Search.Client.ApiResponse GetSettingsWithHttpInfo(string indexName) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->GetSettings"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/indexes/{indexName}/settings", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetSettings", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get index settings. Return an object containing an index's [configuration settings](https://www.algolia.com/doc/api-reference/settings-api-parameters/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Cancellation Token to cancel the request. + /// Task of IndexSettings + public async System.Threading.Tasks.Task GetSettingsAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await GetSettingsWithHttpInfoAsync(indexName, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get index settings. Return an object containing an index's [configuration settings](https://www.algolia.com/doc/api-reference/settings-api-parameters/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (IndexSettings) + public async System.Threading.Tasks.Task> GetSettingsWithHttpInfoAsync(string indexName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->GetSettings"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/indexes/{indexName}/settings", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetSettings", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get all allowed IP addresses. Get all allowed sources (IP addresses). + /// + /// Thrown when fails to make API call + /// List<Source> + public List GetSources() + { + Algolia.Search.Search.Client.ApiResponse> localVarResponse = GetSourcesWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Get all allowed IP addresses. Get all allowed sources (IP addresses). + /// + /// Thrown when fails to make API call + /// ApiResponse of List<Source> + public Algolia.Search.Search.Client.ApiResponse> GetSourcesWithHttpInfo() + { + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get>("/1/security/sources", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetSources", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get all allowed IP addresses. Get all allowed sources (IP addresses). + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of List<Source> + public async System.Threading.Tasks.Task> GetSourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse> localVarResponse = await GetSourcesWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get all allowed IP addresses. Get all allowed sources (IP addresses). + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Source>) + public async System.Threading.Tasks.Task>> GetSourcesWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync>("/1/security/sources", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetSources", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a synonym object. Get a syonym by its `objectID`. To find the object IDs for your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// SynonymHit + public SynonymHit GetSynonym(string indexName, string objectID) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = GetSynonymWithHttpInfo(indexName, objectID); + return localVarResponse.Data; + } + + /// + /// Get a synonym object. Get a syonym by its `objectID`. To find the object IDs for your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// ApiResponse of SynonymHit + public Algolia.Search.Search.Client.ApiResponse GetSynonymWithHttpInfo(string indexName, string objectID) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->GetSynonym"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->GetSynonym"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/indexes/{indexName}/synonyms/{objectID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetSynonym", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get a synonym object. Get a syonym by its `objectID`. To find the object IDs for your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// Cancellation Token to cancel the request. + /// Task of SynonymHit + public async System.Threading.Tasks.Task GetSynonymAsync(string indexName, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await GetSynonymWithHttpInfoAsync(indexName, objectID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get a synonym object. Get a syonym by its `objectID`. To find the object IDs for your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SynonymHit) + public async System.Threading.Tasks.Task> GetSynonymWithHttpInfoAsync(string indexName, string objectID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->GetSynonym"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->GetSynonym"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/indexes/{indexName}/synonyms/{objectID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetSynonym", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Check a task's status. Some operations, such as copying an index, will respond with a `taskID` value. Use this value here to check the status of that task. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique task identifier. + /// GetTaskResponse + public GetTaskResponse GetTask(string indexName, long taskID) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = GetTaskWithHttpInfo(indexName, taskID); + return localVarResponse.Data; + } + + /// + /// Check a task's status. Some operations, such as copying an index, will respond with a `taskID` value. Use this value here to check the status of that task. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique task identifier. + /// ApiResponse of GetTaskResponse + public Algolia.Search.Search.Client.ApiResponse GetTaskWithHttpInfo(string indexName, long taskID) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->GetTask"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("taskID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(taskID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/indexes/{indexName}/task/{taskID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTask", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Check a task's status. Some operations, such as copying an index, will respond with a `taskID` value. Use this value here to check the status of that task. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique task identifier. + /// Cancellation Token to cancel the request. + /// Task of GetTaskResponse + public async System.Threading.Tasks.Task GetTaskAsync(string indexName, long taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await GetTaskWithHttpInfoAsync(indexName, taskID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Check a task's status. Some operations, such as copying an index, will respond with a `taskID` value. Use this value here to check the status of that task. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique task identifier. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetTaskResponse) + public async System.Threading.Tasks.Task> GetTaskWithHttpInfoAsync(string indexName, long taskID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->GetTask"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("taskID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(taskID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/indexes/{indexName}/task/{taskID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTask", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top userID. Get the IDs of the 10 users with the highest number of records per cluster. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// GetTopUserIdsResponse + public GetTopUserIdsResponse GetTopUserIds() + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = GetTopUserIdsWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Get top userID. Get the IDs of the 10 users with the highest number of records per cluster. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// ApiResponse of GetTopUserIdsResponse + public Algolia.Search.Search.Client.ApiResponse GetTopUserIdsWithHttpInfo() + { + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/clusters/mapping/top", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTopUserIds", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get top userID. Get the IDs of the 10 users with the highest number of records per cluster. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of GetTopUserIdsResponse + public async System.Threading.Tasks.Task GetTopUserIdsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await GetTopUserIdsWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get top userID. Get the IDs of the 10 users with the highest number of records per cluster. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (GetTopUserIdsResponse) + public async System.Threading.Tasks.Task> GetTopUserIdsWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/clusters/mapping/top", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetTopUserIds", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get userID. Returns the userID data stored in the mapping. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// UserId + public UserId GetUserId(string userID) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = GetUserIdWithHttpInfo(userID); + return localVarResponse.Data; + } + + /// + /// Get userID. Returns the userID data stored in the mapping. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// ApiResponse of UserId + public Algolia.Search.Search.Client.ApiResponse GetUserIdWithHttpInfo(string userID) + { + // verify the required parameter 'userID' is set + if (userID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'userID' when calling SearchClient->GetUserId"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("userID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(userID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/clusters/mapping/{userID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetUserId", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get userID. Returns the userID data stored in the mapping. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// Cancellation Token to cancel the request. + /// Task of UserId + public async System.Threading.Tasks.Task GetUserIdAsync(string userID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await GetUserIdWithHttpInfoAsync(userID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get userID. Returns the userID data stored in the mapping. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UserId) + public async System.Threading.Tasks.Task> GetUserIdWithHttpInfoAsync(string userID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'userID' is set + if (userID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'userID' when calling SearchClient->GetUserId"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("userID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(userID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/clusters/mapping/{userID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetUserId", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get migration and user mapping status. To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process. + /// + /// Thrown when fails to make API call + /// Indicates whether to include the cluster's pending mapping state in the response. (optional) + /// HasPendingMappingsResponse + public HasPendingMappingsResponse HasPendingMappings(bool? getClusters = default(bool?)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = HasPendingMappingsWithHttpInfo(getClusters); + return localVarResponse.Data; + } + + /// + /// Get migration and user mapping status. To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process. + /// + /// Thrown when fails to make API call + /// Indicates whether to include the cluster's pending mapping state in the response. (optional) + /// ApiResponse of HasPendingMappingsResponse + public Algolia.Search.Search.Client.ApiResponse HasPendingMappingsWithHttpInfo(bool? getClusters = default(bool?)) + { + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (getClusters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "getClusters", getClusters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/clusters/mapping/pending", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("HasPendingMappings", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Get migration and user mapping status. To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process. + /// + /// Thrown when fails to make API call + /// Indicates whether to include the cluster's pending mapping state in the response. (optional) + /// Cancellation Token to cancel the request. + /// Task of HasPendingMappingsResponse + public async System.Threading.Tasks.Task HasPendingMappingsAsync(bool? getClusters = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await HasPendingMappingsWithHttpInfoAsync(getClusters, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get migration and user mapping status. To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process. + /// + /// Thrown when fails to make API call + /// Indicates whether to include the cluster's pending mapping state in the response. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (HasPendingMappingsResponse) + public async System.Threading.Tasks.Task> HasPendingMappingsWithHttpInfoAsync(bool? getClusters = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (getClusters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "getClusters", getClusters)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/clusters/mapping/pending", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("HasPendingMappings", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List API keys. List all API keys associated with your Algolia application, including their permissions and restrictions. + /// + /// Thrown when fails to make API call + /// ListApiKeysResponse + public ListApiKeysResponse ListApiKeys() + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = ListApiKeysWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// List API keys. List all API keys associated with your Algolia application, including their permissions and restrictions. + /// + /// Thrown when fails to make API call + /// ApiResponse of ListApiKeysResponse + public Algolia.Search.Search.Client.ApiResponse ListApiKeysWithHttpInfo() + { + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/keys", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ListApiKeys", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List API keys. List all API keys associated with your Algolia application, including their permissions and restrictions. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ListApiKeysResponse + public async System.Threading.Tasks.Task ListApiKeysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await ListApiKeysWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// List API keys. List all API keys associated with your Algolia application, including their permissions and restrictions. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListApiKeysResponse) + public async System.Threading.Tasks.Task> ListApiKeysWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/keys", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ListApiKeys", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List clusters. List the available clusters in a multi-cluster setup. + /// + /// Thrown when fails to make API call + /// ListClustersResponse + public ListClustersResponse ListClusters() + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = ListClustersWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// List clusters. List the available clusters in a multi-cluster setup. + /// + /// Thrown when fails to make API call + /// ApiResponse of ListClustersResponse + public Algolia.Search.Search.Client.ApiResponse ListClustersWithHttpInfo() + { + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/clusters", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ListClusters", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List clusters. List the available clusters in a multi-cluster setup. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ListClustersResponse + public async System.Threading.Tasks.Task ListClustersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await ListClustersWithHttpInfoAsync(cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// List clusters. List the available clusters in a multi-cluster setup. + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListClustersResponse) + public async System.Threading.Tasks.Task> ListClustersWithHttpInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/clusters", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ListClusters", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List indices. List indices in an Algolia application. + /// + /// Thrown when fails to make API call + /// Returns the requested page number. The page size is determined by the `hitsPerPage` parameter. You can see the number of available pages in the `nbPages` response attribute. When `page` is null, the API response is not paginated. (optional) + /// Maximum number of hits per page. (optional, default to 100) + /// ListIndicesResponse + public ListIndicesResponse ListIndices(int? page = default(int?), int? hitsPerPage = default(int?)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = ListIndicesWithHttpInfo(page, hitsPerPage); + return localVarResponse.Data; + } + + /// + /// List indices. List indices in an Algolia application. + /// + /// Thrown when fails to make API call + /// Returns the requested page number. The page size is determined by the `hitsPerPage` parameter. You can see the number of available pages in the `nbPages` response attribute. When `page` is null, the API response is not paginated. (optional) + /// Maximum number of hits per page. (optional, default to 100) + /// ApiResponse of ListIndicesResponse + public Algolia.Search.Search.Client.ApiResponse ListIndicesWithHttpInfo(int? page = default(int?), int? hitsPerPage = default(int?)) + { + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (hitsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "hitsPerPage", hitsPerPage)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/indexes", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ListIndices", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List indices. List indices in an Algolia application. + /// + /// Thrown when fails to make API call + /// Returns the requested page number. The page size is determined by the `hitsPerPage` parameter. You can see the number of available pages in the `nbPages` response attribute. When `page` is null, the API response is not paginated. (optional) + /// Maximum number of hits per page. (optional, default to 100) + /// Cancellation Token to cancel the request. + /// Task of ListIndicesResponse + public async System.Threading.Tasks.Task ListIndicesAsync(int? page = default(int?), int? hitsPerPage = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await ListIndicesWithHttpInfoAsync(page, hitsPerPage, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// List indices. List indices in an Algolia application. + /// + /// Thrown when fails to make API call + /// Returns the requested page number. The page size is determined by the `hitsPerPage` parameter. You can see the number of available pages in the `nbPages` response attribute. When `page` is null, the API response is not paginated. (optional) + /// Maximum number of hits per page. (optional, default to 100) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListIndicesResponse) + public async System.Threading.Tasks.Task> ListIndicesWithHttpInfoAsync(int? page = default(int?), int? hitsPerPage = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (hitsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "hitsPerPage", hitsPerPage)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/indexes", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ListIndices", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List userIDs. List the userIDs assigned to a multi-cluster application. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// Returns the requested page number. The page size is determined by the `hitsPerPage` parameter. You can see the number of available pages in the `nbPages` response attribute. When `page` is null, the API response is not paginated. (optional) + /// Maximum number of hits per page. (optional, default to 100) + /// ListUserIdsResponse + public ListUserIdsResponse ListUserIds(int? page = default(int?), int? hitsPerPage = default(int?)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = ListUserIdsWithHttpInfo(page, hitsPerPage); + return localVarResponse.Data; + } + + /// + /// List userIDs. List the userIDs assigned to a multi-cluster application. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// Returns the requested page number. The page size is determined by the `hitsPerPage` parameter. You can see the number of available pages in the `nbPages` response attribute. When `page` is null, the API response is not paginated. (optional) + /// Maximum number of hits per page. (optional, default to 100) + /// ApiResponse of ListUserIdsResponse + public Algolia.Search.Search.Client.ApiResponse ListUserIdsWithHttpInfo(int? page = default(int?), int? hitsPerPage = default(int?)) + { + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (hitsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "hitsPerPage", hitsPerPage)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Get("/1/clusters/mapping", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ListUserIds", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// List userIDs. List the userIDs assigned to a multi-cluster application. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// Returns the requested page number. The page size is determined by the `hitsPerPage` parameter. You can see the number of available pages in the `nbPages` response attribute. When `page` is null, the API response is not paginated. (optional) + /// Maximum number of hits per page. (optional, default to 100) + /// Cancellation Token to cancel the request. + /// Task of ListUserIdsResponse + public async System.Threading.Tasks.Task ListUserIdsAsync(int? page = default(int?), int? hitsPerPage = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await ListUserIdsWithHttpInfoAsync(page, hitsPerPage, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// List userIDs. List the userIDs assigned to a multi-cluster application. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. + /// + /// Thrown when fails to make API call + /// Returns the requested page number. The page size is determined by the `hitsPerPage` parameter. You can see the number of available pages in the `nbPages` response attribute. When `page` is null, the API response is not paginated. (optional) + /// Maximum number of hits per page. (optional, default to 100) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ListUserIdsResponse) + public async System.Threading.Tasks.Task> ListUserIdsWithHttpInfoAsync(int? page = default(int?), int? hitsPerPage = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (hitsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "hitsPerPage", hitsPerPage)); + } + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.GetAsync("/1/clusters/mapping", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ListUserIds", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Batch write operations on multiple indices. To reduce the time spent on network round trips, you can perform several write actions in a single request. It's a multi-index version of the [`batch` operation](#tag/Records/operation/batch). Actions are applied in the order they are specified. The supported actions are equivalent to the individual operations of the same name. + /// + /// Thrown when fails to make API call + /// + /// MultipleBatchResponse + public MultipleBatchResponse MultipleBatch(BatchParams batchParams) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = MultipleBatchWithHttpInfo(batchParams); + return localVarResponse.Data; + } + + /// + /// Batch write operations on multiple indices. To reduce the time spent on network round trips, you can perform several write actions in a single request. It's a multi-index version of the [`batch` operation](#tag/Records/operation/batch). Actions are applied in the order they are specified. The supported actions are equivalent to the individual operations of the same name. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of MultipleBatchResponse + public Algolia.Search.Search.Client.ApiResponse MultipleBatchWithHttpInfo(BatchParams batchParams) + { + // verify the required parameter 'batchParams' is set + if (batchParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'batchParams' when calling SearchClient->MultipleBatch"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = batchParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/*/batch", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("MultipleBatch", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Batch write operations on multiple indices. To reduce the time spent on network round trips, you can perform several write actions in a single request. It's a multi-index version of the [`batch` operation](#tag/Records/operation/batch). Actions are applied in the order they are specified. The supported actions are equivalent to the individual operations of the same name. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of MultipleBatchResponse + public async System.Threading.Tasks.Task MultipleBatchAsync(BatchParams batchParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await MultipleBatchWithHttpInfoAsync(batchParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Batch write operations on multiple indices. To reduce the time spent on network round trips, you can perform several write actions in a single request. It's a multi-index version of the [`batch` operation](#tag/Records/operation/batch). Actions are applied in the order they are specified. The supported actions are equivalent to the individual operations of the same name. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (MultipleBatchResponse) + public async System.Threading.Tasks.Task> MultipleBatchWithHttpInfoAsync(BatchParams batchParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'batchParams' is set + if (batchParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'batchParams' when calling SearchClient->MultipleBatch"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = batchParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/*/batch", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("MultipleBatch", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Copy, move, or rename an index. This `operation`, _copy_ or _move_, will copy or move a source index's (`IndexName`) records, settings, synonyms, and rules to a `destination` index. If the destination index exists, it will be replaced, except for index-specific API keys and analytics data. If the destination index doesn't exist, it will be created. The choice between moving or copying an index depends on your needs. Choose: - **Move** to rename an index. - **Copy** to create a new index with the same records and configuration as an existing one. > **Note**: When considering copying or moving, be aware of the [rate limitations](https://www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits) on these processes and the [impact on your analytics data](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/concepts/indices-analytics/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// UpdatedAtResponse + public UpdatedAtResponse OperationIndex(string indexName, OperationIndexParams operationIndexParams) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = OperationIndexWithHttpInfo(indexName, operationIndexParams); + return localVarResponse.Data; + } + + /// + /// Copy, move, or rename an index. This `operation`, _copy_ or _move_, will copy or move a source index's (`IndexName`) records, settings, synonyms, and rules to a `destination` index. If the destination index exists, it will be replaced, except for index-specific API keys and analytics data. If the destination index doesn't exist, it will be created. The choice between moving or copying an index depends on your needs. Choose: - **Move** to rename an index. - **Copy** to create a new index with the same records and configuration as an existing one. > **Note**: When considering copying or moving, be aware of the [rate limitations](https://www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits) on these processes and the [impact on your analytics data](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/concepts/indices-analytics/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// ApiResponse of UpdatedAtResponse + public Algolia.Search.Search.Client.ApiResponse OperationIndexWithHttpInfo(string indexName, OperationIndexParams operationIndexParams) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->OperationIndex"); + + // verify the required parameter 'operationIndexParams' is set + if (operationIndexParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'operationIndexParams' when calling SearchClient->OperationIndex"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.Data = operationIndexParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/{indexName}/operation", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("OperationIndex", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Copy, move, or rename an index. This `operation`, _copy_ or _move_, will copy or move a source index's (`IndexName`) records, settings, synonyms, and rules to a `destination` index. If the destination index exists, it will be replaced, except for index-specific API keys and analytics data. If the destination index doesn't exist, it will be created. The choice between moving or copying an index depends on your needs. Choose: - **Move** to rename an index. - **Copy** to create a new index with the same records and configuration as an existing one. > **Note**: When considering copying or moving, be aware of the [rate limitations](https://www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits) on these processes and the [impact on your analytics data](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/concepts/indices-analytics/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + public async System.Threading.Tasks.Task OperationIndexAsync(string indexName, OperationIndexParams operationIndexParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await OperationIndexWithHttpInfoAsync(indexName, operationIndexParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Copy, move, or rename an index. This `operation`, _copy_ or _move_, will copy or move a source index's (`IndexName`) records, settings, synonyms, and rules to a `destination` index. If the destination index exists, it will be replaced, except for index-specific API keys and analytics data. If the destination index doesn't exist, it will be created. The choice between moving or copying an index depends on your needs. Choose: - **Move** to rename an index. - **Copy** to create a new index with the same records and configuration as an existing one. > **Note**: When considering copying or moving, be aware of the [rate limitations](https://www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits) on these processes and the [impact on your analytics data](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/concepts/indices-analytics/). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + public async System.Threading.Tasks.Task> OperationIndexWithHttpInfoAsync(string indexName, OperationIndexParams operationIndexParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->OperationIndex"); + + // verify the required parameter 'operationIndexParams' is set + if (operationIndexParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'operationIndexParams' when calling SearchClient->OperationIndex"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.Data = operationIndexParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/{indexName}/operation", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("OperationIndex", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update record attributes. Add new attributes or update current ones in an existing record. You can use any first-level attribute but not nested attributes. If you specify a [nested attribute](https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/creating-and-using-nested-attributes/), the engine treats it as a replacement for its first-level ancestor. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Object with attributes to update. + /// Indicates whether to create a new record if it doesn't exist yet. (optional, default to true) + /// UpdatedAtWithObjectIdResponse + public UpdatedAtWithObjectIdResponse PartialUpdateObject(string indexName, string objectID, Dictionary attributesToUpdate, bool? createIfNotExists = default(bool?)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = PartialUpdateObjectWithHttpInfo(indexName, objectID, attributesToUpdate, createIfNotExists); + return localVarResponse.Data; + } + + /// + /// Update record attributes. Add new attributes or update current ones in an existing record. You can use any first-level attribute but not nested attributes. If you specify a [nested attribute](https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/creating-and-using-nested-attributes/), the engine treats it as a replacement for its first-level ancestor. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Object with attributes to update. + /// Indicates whether to create a new record if it doesn't exist yet. (optional, default to true) + /// ApiResponse of UpdatedAtWithObjectIdResponse + public Algolia.Search.Search.Client.ApiResponse PartialUpdateObjectWithHttpInfo(string indexName, string objectID, Dictionary attributesToUpdate, bool? createIfNotExists = default(bool?)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->PartialUpdateObject"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->PartialUpdateObject"); + + // verify the required parameter 'attributesToUpdate' is set + if (attributesToUpdate == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'attributesToUpdate' when calling SearchClient->PartialUpdateObject"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + if (createIfNotExists != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "createIfNotExists", createIfNotExists)); + } + localVarRequestOptions.Data = attributesToUpdate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/{indexName}/{objectID}/partial", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("PartialUpdateObject", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update record attributes. Add new attributes or update current ones in an existing record. You can use any first-level attribute but not nested attributes. If you specify a [nested attribute](https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/creating-and-using-nested-attributes/), the engine treats it as a replacement for its first-level ancestor. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Object with attributes to update. + /// Indicates whether to create a new record if it doesn't exist yet. (optional, default to true) + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtWithObjectIdResponse + public async System.Threading.Tasks.Task PartialUpdateObjectAsync(string indexName, string objectID, Dictionary attributesToUpdate, bool? createIfNotExists = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await PartialUpdateObjectWithHttpInfoAsync(indexName, objectID, attributesToUpdate, createIfNotExists, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Update record attributes. Add new attributes or update current ones in an existing record. You can use any first-level attribute but not nested attributes. If you specify a [nested attribute](https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/creating-and-using-nested-attributes/), the engine treats it as a replacement for its first-level ancestor. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique record (object) identifier. + /// Object with attributes to update. + /// Indicates whether to create a new record if it doesn't exist yet. (optional, default to true) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtWithObjectIdResponse) + public async System.Threading.Tasks.Task> PartialUpdateObjectWithHttpInfoAsync(string indexName, string objectID, Dictionary attributesToUpdate, bool? createIfNotExists = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->PartialUpdateObject"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->PartialUpdateObject"); + + // verify the required parameter 'attributesToUpdate' is set + if (attributesToUpdate == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'attributesToUpdate' when calling SearchClient->PartialUpdateObject"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + if (createIfNotExists != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "createIfNotExists", createIfNotExists)); + } + localVarRequestOptions.Data = attributesToUpdate; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/{indexName}/{objectID}/partial", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("PartialUpdateObject", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Post(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = PostWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.Search.Client.ApiResponse PostWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'path' when calling SearchClient->Post"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Search.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PostAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await PostWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PostWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'path' when calling SearchClient->Post"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Search.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Post", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Object + public Object Put(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = PutWithHttpInfo(path, parameters, body); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// ApiResponse of Object + public Algolia.Search.Search.Client.ApiResponse PutWithHttpInfo(string path, Dictionary parameters = default(Dictionary), Object body = default(Object)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'path' when calling SearchClient->Put"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Search.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1{path}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of Object + public async System.Threading.Tasks.Task PutAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await PutWithHttpInfoAsync(path, parameters, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API. + /// + /// Thrown when fails to make API call + /// Path of the endpoint, anything after \"/1\" must be specified. + /// Query parameters to apply to the current query. (optional) + /// Parameters to send with the custom request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Object) + public async System.Threading.Tasks.Task> PutWithHttpInfoAsync(string path, Dictionary parameters = default(Dictionary), Object body = default(Object), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'path' is set + if (path == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'path' when calling SearchClient->Put"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("path", Algolia.Search.Search.Client.ClientUtils.ParameterToString(path)); // path parameter + if (parameters != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "parameters", parameters)); + } + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1{path}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Put", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Remove userID. Remove a userID and its associated data from the multi-clusters. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// RemoveUserIdResponse + public RemoveUserIdResponse RemoveUserId(string userID) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = RemoveUserIdWithHttpInfo(userID); + return localVarResponse.Data; + } + + /// + /// Remove userID. Remove a userID and its associated data from the multi-clusters. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// ApiResponse of RemoveUserIdResponse + public Algolia.Search.Search.Client.ApiResponse RemoveUserIdWithHttpInfo(string userID) + { + // verify the required parameter 'userID' is set + if (userID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'userID' when calling SearchClient->RemoveUserId"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("userID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(userID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/1/clusters/mapping/{userID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("RemoveUserId", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Remove userID. Remove a userID and its associated data from the multi-clusters. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// Cancellation Token to cancel the request. + /// Task of RemoveUserIdResponse + public async System.Threading.Tasks.Task RemoveUserIdAsync(string userID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await RemoveUserIdWithHttpInfoAsync(userID, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Remove userID. Remove a userID and its associated data from the multi-clusters. + /// + /// Thrown when fails to make API call + /// userID to assign. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (RemoveUserIdResponse) + public async System.Threading.Tasks.Task> RemoveUserIdWithHttpInfoAsync(string userID, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'userID' is set + if (userID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'userID' when calling SearchClient->RemoveUserId"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("userID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(userID)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/1/clusters/mapping/{userID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("RemoveUserId", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Replace all sources. Replace all allowed sources. + /// + /// Thrown when fails to make API call + /// Allowed sources. + /// ReplaceSourceResponse + public ReplaceSourceResponse ReplaceSources(List source) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = ReplaceSourcesWithHttpInfo(source); + return localVarResponse.Data; + } + + /// + /// Replace all sources. Replace all allowed sources. + /// + /// Thrown when fails to make API call + /// Allowed sources. + /// ApiResponse of ReplaceSourceResponse + public Algolia.Search.Search.Client.ApiResponse ReplaceSourcesWithHttpInfo(List source) + { + // verify the required parameter 'source' is set + if (source == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'source' when calling SearchClient->ReplaceSources"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = source; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1/security/sources", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ReplaceSources", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Replace all sources. Replace all allowed sources. + /// + /// Thrown when fails to make API call + /// Allowed sources. + /// Cancellation Token to cancel the request. + /// Task of ReplaceSourceResponse + public async System.Threading.Tasks.Task ReplaceSourcesAsync(List source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await ReplaceSourcesWithHttpInfoAsync(source, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Replace all sources. Replace all allowed sources. + /// + /// Thrown when fails to make API call + /// Allowed sources. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ReplaceSourceResponse) + public async System.Threading.Tasks.Task> ReplaceSourcesWithHttpInfoAsync(List source, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'source' is set + if (source == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'source' when calling SearchClient->ReplaceSources"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = source; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1/security/sources", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("ReplaceSources", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Restore API key. Restore a deleted API key, along with its associated permissions. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// AddApiKeyResponse + public AddApiKeyResponse RestoreApiKey(string key) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = RestoreApiKeyWithHttpInfo(key); + return localVarResponse.Data; + } + + /// + /// Restore API key. Restore a deleted API key, along with its associated permissions. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// ApiResponse of AddApiKeyResponse + public Algolia.Search.Search.Client.ApiResponse RestoreApiKeyWithHttpInfo(string key) + { + // verify the required parameter 'key' is set + if (key == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'key' when calling SearchClient->RestoreApiKey"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("key", Algolia.Search.Search.Client.ClientUtils.ParameterToString(key)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/keys/{key}/restore", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("RestoreApiKey", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Restore API key. Restore a deleted API key, along with its associated permissions. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// Cancellation Token to cancel the request. + /// Task of AddApiKeyResponse + public async System.Threading.Tasks.Task RestoreApiKeyAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await RestoreApiKeyWithHttpInfoAsync(key, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Restore API key. Restore a deleted API key, along with its associated permissions. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (AddApiKeyResponse) + public async System.Threading.Tasks.Task> RestoreApiKeyWithHttpInfoAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'key' is set + if (key == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'key' when calling SearchClient->RestoreApiKey"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("key", Algolia.Search.Search.Client.ClientUtils.ParameterToString(key)); // path parameter + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/keys/{key}/restore", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("RestoreApiKey", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Add or update a record. Add a record (object) to an index or replace it. If the record doesn't contain an `objectID`, Algolia automatically adds it. If you use an existing `objectID`, the existing record is replaced with the new one. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// The Algolia record. + /// SaveObjectResponse + public SaveObjectResponse SaveObject(string indexName, Object body) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = SaveObjectWithHttpInfo(indexName, body); + return localVarResponse.Data; + } + + /// + /// Add or update a record. Add a record (object) to an index or replace it. If the record doesn't contain an `objectID`, Algolia automatically adds it. If you use an existing `objectID`, the existing record is replaced with the new one. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// The Algolia record. + /// ApiResponse of SaveObjectResponse + public Algolia.Search.Search.Client.ApiResponse SaveObjectWithHttpInfo(string indexName, Object body) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SaveObject"); + + // verify the required parameter 'body' is set + if (body == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'body' when calling SearchClient->SaveObject"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/{indexName}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SaveObject", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Add or update a record. Add a record (object) to an index or replace it. If the record doesn't contain an `objectID`, Algolia automatically adds it. If you use an existing `objectID`, the existing record is replaced with the new one. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// The Algolia record. + /// Cancellation Token to cancel the request. + /// Task of SaveObjectResponse + public async System.Threading.Tasks.Task SaveObjectAsync(string indexName, Object body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await SaveObjectWithHttpInfoAsync(indexName, body, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Add or update a record. Add a record (object) to an index or replace it. If the record doesn't contain an `objectID`, Algolia automatically adds it. If you use an existing `objectID`, the existing record is replaced with the new one. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// The Algolia record. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SaveObjectResponse) + public async System.Threading.Tasks.Task> SaveObjectWithHttpInfoAsync(string indexName, Object body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SaveObject"); + + // verify the required parameter 'body' is set + if (body == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'body' when calling SearchClient->SaveObject"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.Data = body; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/{indexName}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SaveObject", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Create or update a rule. To create or update more than one rule, use the [`batch` operation](#tag/Rules/operation/saveRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// UpdatedRuleResponse + public UpdatedRuleResponse SaveRule(string indexName, string objectID, Rule rule, bool? forwardToReplicas = default(bool?)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = SaveRuleWithHttpInfo(indexName, objectID, rule, forwardToReplicas); + return localVarResponse.Data; + } + + /// + /// Create or update a rule. To create or update more than one rule, use the [`batch` operation](#tag/Rules/operation/saveRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// ApiResponse of UpdatedRuleResponse + public Algolia.Search.Search.Client.ApiResponse SaveRuleWithHttpInfo(string indexName, string objectID, Rule rule, bool? forwardToReplicas = default(bool?)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SaveRule"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->SaveRule"); + + // verify the required parameter 'rule' is set + if (rule == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'rule' when calling SearchClient->SaveRule"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + localVarRequestOptions.Data = rule; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1/indexes/{indexName}/rules/{objectID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SaveRule", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Create or update a rule. To create or update more than one rule, use the [`batch` operation](#tag/Rules/operation/saveRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of UpdatedRuleResponse + public async System.Threading.Tasks.Task SaveRuleAsync(string indexName, string objectID, Rule rule, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await SaveRuleWithHttpInfoAsync(indexName, objectID, rule, forwardToReplicas, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Create or update a rule. To create or update more than one rule, use the [`batch` operation](#tag/Rules/operation/saveRules). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a rule object. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedRuleResponse) + public async System.Threading.Tasks.Task> SaveRuleWithHttpInfoAsync(string indexName, string objectID, Rule rule, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SaveRule"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->SaveRule"); + + // verify the required parameter 'rule' is set + if (rule == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'rule' when calling SearchClient->SaveRule"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + localVarRequestOptions.Data = rule; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1/indexes/{indexName}/rules/{objectID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SaveRule", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Save a batch of rules. Create or update multiple rules. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Indicates whether existing rules should be deleted before adding this batch. (optional) + /// UpdatedAtResponse + public UpdatedAtResponse SaveRules(string indexName, List rules, bool? forwardToReplicas = default(bool?), bool? clearExistingRules = default(bool?)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = SaveRulesWithHttpInfo(indexName, rules, forwardToReplicas, clearExistingRules); + return localVarResponse.Data; + } + + /// + /// Save a batch of rules. Create or update multiple rules. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Indicates whether existing rules should be deleted before adding this batch. (optional) + /// ApiResponse of UpdatedAtResponse + public Algolia.Search.Search.Client.ApiResponse SaveRulesWithHttpInfo(string indexName, List rules, bool? forwardToReplicas = default(bool?), bool? clearExistingRules = default(bool?)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SaveRules"); + + // verify the required parameter 'rules' is set + if (rules == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'rules' when calling SearchClient->SaveRules"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + if (clearExistingRules != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "clearExistingRules", clearExistingRules)); + } + localVarRequestOptions.Data = rules; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/{indexName}/rules/batch", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SaveRules", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Save a batch of rules. Create or update multiple rules. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Indicates whether existing rules should be deleted before adding this batch. (optional) + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + public async System.Threading.Tasks.Task SaveRulesAsync(string indexName, List rules, bool? forwardToReplicas = default(bool?), bool? clearExistingRules = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await SaveRulesWithHttpInfoAsync(indexName, rules, forwardToReplicas, clearExistingRules, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Save a batch of rules. Create or update multiple rules. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Indicates whether existing rules should be deleted before adding this batch. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + public async System.Threading.Tasks.Task> SaveRulesWithHttpInfoAsync(string indexName, List rules, bool? forwardToReplicas = default(bool?), bool? clearExistingRules = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SaveRules"); + + // verify the required parameter 'rules' is set + if (rules == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'rules' when calling SearchClient->SaveRules"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + if (clearExistingRules != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "clearExistingRules", clearExistingRules)); + } + localVarRequestOptions.Data = rules; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/{indexName}/rules/batch", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SaveRules", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Save a synonym. Add a [synonym](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms) to an index or replace it. If the synonym `objectID` doesn't exist, Algolia adds a new one. If you use an existing synonym `objectID`, the existing synonym is replaced with the new one. To add multiple synonyms in a single API request, use the [`batch` operation](#tag/Synonyms/operation/saveSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// SaveSynonymResponse + public SaveSynonymResponse SaveSynonym(string indexName, string objectID, SynonymHit synonymHit, bool? forwardToReplicas = default(bool?)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = SaveSynonymWithHttpInfo(indexName, objectID, synonymHit, forwardToReplicas); + return localVarResponse.Data; + } + + /// + /// Save a synonym. Add a [synonym](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms) to an index or replace it. If the synonym `objectID` doesn't exist, Algolia adds a new one. If you use an existing synonym `objectID`, the existing synonym is replaced with the new one. To add multiple synonyms in a single API request, use the [`batch` operation](#tag/Synonyms/operation/saveSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// ApiResponse of SaveSynonymResponse + public Algolia.Search.Search.Client.ApiResponse SaveSynonymWithHttpInfo(string indexName, string objectID, SynonymHit synonymHit, bool? forwardToReplicas = default(bool?)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SaveSynonym"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->SaveSynonym"); + + // verify the required parameter 'synonymHit' is set + if (synonymHit == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'synonymHit' when calling SearchClient->SaveSynonym"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + localVarRequestOptions.Data = synonymHit; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1/indexes/{indexName}/synonyms/{objectID}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SaveSynonym", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Save a synonym. Add a [synonym](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms) to an index or replace it. If the synonym `objectID` doesn't exist, Algolia adds a new one. If you use an existing synonym `objectID`, the existing synonym is replaced with the new one. To add multiple synonyms in a single API request, use the [`batch` operation](#tag/Synonyms/operation/saveSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of SaveSynonymResponse + public async System.Threading.Tasks.Task SaveSynonymAsync(string indexName, string objectID, SynonymHit synonymHit, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await SaveSynonymWithHttpInfoAsync(indexName, objectID, synonymHit, forwardToReplicas, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Save a synonym. Add a [synonym](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms) to an index or replace it. If the synonym `objectID` doesn't exist, Algolia adds a new one. If you use an existing synonym `objectID`, the existing synonym is replaced with the new one. To add multiple synonyms in a single API request, use the [`batch` operation](#tag/Synonyms/operation/saveSynonyms). + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Unique identifier of a synonym object. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SaveSynonymResponse) + public async System.Threading.Tasks.Task> SaveSynonymWithHttpInfoAsync(string indexName, string objectID, SynonymHit synonymHit, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SaveSynonym"); + + // verify the required parameter 'objectID' is set + if (objectID == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'objectID' when calling SearchClient->SaveSynonym"); + + // verify the required parameter 'synonymHit' is set + if (synonymHit == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'synonymHit' when calling SearchClient->SaveSynonym"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("objectID", Algolia.Search.Search.Client.ClientUtils.ParameterToString(objectID)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + localVarRequestOptions.Data = synonymHit; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1/indexes/{indexName}/synonyms/{objectID}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SaveSynonym", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Save a batch of synonyms. Create or update multiple synonyms. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Indicates whether to replace all synonyms in the index with the ones sent with this request. (optional) + /// UpdatedAtResponse + public UpdatedAtResponse SaveSynonyms(string indexName, List synonymHit, bool? forwardToReplicas = default(bool?), bool? replaceExistingSynonyms = default(bool?)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = SaveSynonymsWithHttpInfo(indexName, synonymHit, forwardToReplicas, replaceExistingSynonyms); + return localVarResponse.Data; + } + + /// + /// Save a batch of synonyms. Create or update multiple synonyms. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Indicates whether to replace all synonyms in the index with the ones sent with this request. (optional) + /// ApiResponse of UpdatedAtResponse + public Algolia.Search.Search.Client.ApiResponse SaveSynonymsWithHttpInfo(string indexName, List synonymHit, bool? forwardToReplicas = default(bool?), bool? replaceExistingSynonyms = default(bool?)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SaveSynonyms"); + + // verify the required parameter 'synonymHit' is set + if (synonymHit == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'synonymHit' when calling SearchClient->SaveSynonyms"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + if (replaceExistingSynonyms != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "replaceExistingSynonyms", replaceExistingSynonyms)); + } + localVarRequestOptions.Data = synonymHit; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/{indexName}/synonyms/batch", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SaveSynonyms", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Save a batch of synonyms. Create or update multiple synonyms. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Indicates whether to replace all synonyms in the index with the ones sent with this request. (optional) + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + public async System.Threading.Tasks.Task SaveSynonymsAsync(string indexName, List synonymHit, bool? forwardToReplicas = default(bool?), bool? replaceExistingSynonyms = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await SaveSynonymsWithHttpInfoAsync(indexName, synonymHit, forwardToReplicas, replaceExistingSynonyms, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Save a batch of synonyms. Create or update multiple synonyms. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Indicates whether to replace all synonyms in the index with the ones sent with this request. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + public async System.Threading.Tasks.Task> SaveSynonymsWithHttpInfoAsync(string indexName, List synonymHit, bool? forwardToReplicas = default(bool?), bool? replaceExistingSynonyms = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SaveSynonyms"); + + // verify the required parameter 'synonymHit' is set + if (synonymHit == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'synonymHit' when calling SearchClient->SaveSynonyms"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + if (replaceExistingSynonyms != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "replaceExistingSynonyms", replaceExistingSynonyms)); + } + localVarRequestOptions.Data = synonymHit; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/{indexName}/synonyms/batch", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SaveSynonyms", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search multiple indices. Send multiple search queries to one or more indices. + /// + /// Thrown when fails to make API call + /// Query requests and strategies. Results will be received in the same order as the queries. + /// SearchResponses + public SearchResponses Search(SearchMethodParams searchMethodParams) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = SearchWithHttpInfo(searchMethodParams); + return localVarResponse.Data; + } + + /// + /// Search multiple indices. Send multiple search queries to one or more indices. + /// + /// Thrown when fails to make API call + /// Query requests and strategies. Results will be received in the same order as the queries. + /// ApiResponse of SearchResponses + public Algolia.Search.Search.Client.ApiResponse SearchWithHttpInfo(SearchMethodParams searchMethodParams) + { + // verify the required parameter 'searchMethodParams' is set + if (searchMethodParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'searchMethodParams' when calling SearchClient->Search"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = searchMethodParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/*/queries", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Search", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search multiple indices. Send multiple search queries to one or more indices. + /// + /// Thrown when fails to make API call + /// Query requests and strategies. Results will be received in the same order as the queries. + /// Cancellation Token to cancel the request. + /// Task of SearchResponses + public async System.Threading.Tasks.Task SearchAsync(SearchMethodParams searchMethodParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await SearchWithHttpInfoAsync(searchMethodParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Search multiple indices. Send multiple search queries to one or more indices. + /// + /// Thrown when fails to make API call + /// Query requests and strategies. Results will be received in the same order as the queries. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SearchResponses) + public async System.Threading.Tasks.Task> SearchWithHttpInfoAsync(SearchMethodParams searchMethodParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'searchMethodParams' is set + if (searchMethodParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'searchMethodParams' when calling SearchClient->Search"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = searchMethodParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/*/queries", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Search", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search dictionary entries. Search for standard and [custom](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/) entries in the [stop words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plurals](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), or [segmentation (compounds)](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) dictionaries. + /// + /// Thrown when fails to make API call + /// Dictionary to search in. + /// + /// UpdatedAtResponse + public UpdatedAtResponse SearchDictionaryEntries(DictionaryType dictionaryName, SearchDictionaryEntriesParams searchDictionaryEntriesParams) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = SearchDictionaryEntriesWithHttpInfo(dictionaryName, searchDictionaryEntriesParams); + return localVarResponse.Data; + } + + /// + /// Search dictionary entries. Search for standard and [custom](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/) entries in the [stop words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plurals](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), or [segmentation (compounds)](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) dictionaries. + /// + /// Thrown when fails to make API call + /// Dictionary to search in. + /// + /// ApiResponse of UpdatedAtResponse + public Algolia.Search.Search.Client.ApiResponse SearchDictionaryEntriesWithHttpInfo(DictionaryType dictionaryName, SearchDictionaryEntriesParams searchDictionaryEntriesParams) + { + // verify the required parameter 'dictionaryName' is set + if (dictionaryName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'dictionaryName' when calling SearchClient->SearchDictionaryEntries"); + + // verify the required parameter 'searchDictionaryEntriesParams' is set + if (searchDictionaryEntriesParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'searchDictionaryEntriesParams' when calling SearchClient->SearchDictionaryEntries"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("dictionaryName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(dictionaryName)); // path parameter + localVarRequestOptions.Data = searchDictionaryEntriesParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/dictionaries/{dictionaryName}/search", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchDictionaryEntries", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search dictionary entries. Search for standard and [custom](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/) entries in the [stop words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plurals](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), or [segmentation (compounds)](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) dictionaries. + /// + /// Thrown when fails to make API call + /// Dictionary to search in. + /// + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + public async System.Threading.Tasks.Task SearchDictionaryEntriesAsync(DictionaryType dictionaryName, SearchDictionaryEntriesParams searchDictionaryEntriesParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await SearchDictionaryEntriesWithHttpInfoAsync(dictionaryName, searchDictionaryEntriesParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Search dictionary entries. Search for standard and [custom](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/) entries in the [stop words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-stop-words/), [plurals](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/), or [segmentation (compounds)](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) dictionaries. + /// + /// Thrown when fails to make API call + /// Dictionary to search in. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + public async System.Threading.Tasks.Task> SearchDictionaryEntriesWithHttpInfoAsync(DictionaryType dictionaryName, SearchDictionaryEntriesParams searchDictionaryEntriesParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'dictionaryName' is set + if (dictionaryName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'dictionaryName' when calling SearchClient->SearchDictionaryEntries"); + + // verify the required parameter 'searchDictionaryEntriesParams' is set + if (searchDictionaryEntriesParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'searchDictionaryEntriesParams' when calling SearchClient->SearchDictionaryEntries"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("dictionaryName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(dictionaryName)); // path parameter + localVarRequestOptions.Data = searchDictionaryEntriesParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/dictionaries/{dictionaryName}/search", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchDictionaryEntries", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search for facet values. [Search for a facet's values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values), optionally restricting the returned values to those contained in records matching other search criteria. > **Note**: Pagination isn't supported (`page` and `hitsPerPage` are ignored). By default, the engine returns a maximum of 10 values but you can adjust this with `maxFacetHits`. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Facet name. + /// (optional) + /// SearchForFacetValuesResponse + public SearchForFacetValuesResponse SearchForFacetValues(string indexName, string facetName, SearchForFacetValuesRequest searchForFacetValuesRequest = default(SearchForFacetValuesRequest)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = SearchForFacetValuesWithHttpInfo(indexName, facetName, searchForFacetValuesRequest); + return localVarResponse.Data; + } + + /// + /// Search for facet values. [Search for a facet's values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values), optionally restricting the returned values to those contained in records matching other search criteria. > **Note**: Pagination isn't supported (`page` and `hitsPerPage` are ignored). By default, the engine returns a maximum of 10 values but you can adjust this with `maxFacetHits`. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Facet name. + /// (optional) + /// ApiResponse of SearchForFacetValuesResponse + public Algolia.Search.Search.Client.ApiResponse SearchForFacetValuesWithHttpInfo(string indexName, string facetName, SearchForFacetValuesRequest searchForFacetValuesRequest = default(SearchForFacetValuesRequest)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SearchForFacetValues"); + + // verify the required parameter 'facetName' is set + if (facetName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'facetName' when calling SearchClient->SearchForFacetValues"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("facetName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(facetName)); // path parameter + localVarRequestOptions.Data = searchForFacetValuesRequest; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/{indexName}/facets/{facetName}/query", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchForFacetValues", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search for facet values. [Search for a facet's values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values), optionally restricting the returned values to those contained in records matching other search criteria. > **Note**: Pagination isn't supported (`page` and `hitsPerPage` are ignored). By default, the engine returns a maximum of 10 values but you can adjust this with `maxFacetHits`. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Facet name. + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of SearchForFacetValuesResponse + public async System.Threading.Tasks.Task SearchForFacetValuesAsync(string indexName, string facetName, SearchForFacetValuesRequest searchForFacetValuesRequest = default(SearchForFacetValuesRequest), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await SearchForFacetValuesWithHttpInfoAsync(indexName, facetName, searchForFacetValuesRequest, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Search for facet values. [Search for a facet's values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values), optionally restricting the returned values to those contained in records matching other search criteria. > **Note**: Pagination isn't supported (`page` and `hitsPerPage` are ignored). By default, the engine returns a maximum of 10 values but you can adjust this with `maxFacetHits`. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Facet name. + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SearchForFacetValuesResponse) + public async System.Threading.Tasks.Task> SearchForFacetValuesWithHttpInfoAsync(string indexName, string facetName, SearchForFacetValuesRequest searchForFacetValuesRequest = default(SearchForFacetValuesRequest), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SearchForFacetValues"); + + // verify the required parameter 'facetName' is set + if (facetName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'facetName' when calling SearchClient->SearchForFacetValues"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.PathParameters.Add("facetName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(facetName)); // path parameter + localVarRequestOptions.Data = searchForFacetValuesRequest; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/{indexName}/facets/{facetName}/query", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchForFacetValues", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search for rules. Search for rules in your index. You can control the search with parameters. To list all rules, send an empty request body. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// SearchRulesResponse + public SearchRulesResponse SearchRules(string indexName, SearchRulesParams searchRulesParams = default(SearchRulesParams)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = SearchRulesWithHttpInfo(indexName, searchRulesParams); + return localVarResponse.Data; + } + + /// + /// Search for rules. Search for rules in your index. You can control the search with parameters. To list all rules, send an empty request body. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// ApiResponse of SearchRulesResponse + public Algolia.Search.Search.Client.ApiResponse SearchRulesWithHttpInfo(string indexName, SearchRulesParams searchRulesParams = default(SearchRulesParams)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SearchRules"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.Data = searchRulesParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/{indexName}/rules/search", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchRules", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search for rules. Search for rules in your index. You can control the search with parameters. To list all rules, send an empty request body. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of SearchRulesResponse + public async System.Threading.Tasks.Task SearchRulesAsync(string indexName, SearchRulesParams searchRulesParams = default(SearchRulesParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await SearchRulesWithHttpInfoAsync(indexName, searchRulesParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Search for rules. Search for rules in your index. You can control the search with parameters. To list all rules, send an empty request body. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SearchRulesResponse) + public async System.Threading.Tasks.Task> SearchRulesWithHttpInfoAsync(string indexName, SearchRulesParams searchRulesParams = default(SearchRulesParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SearchRules"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.Data = searchRulesParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/{indexName}/rules/search", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchRules", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search an index. Return records that match the query. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// SearchResponse + public SearchResponse SearchSingleIndex(string indexName, SearchParams searchParams = default(SearchParams)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = SearchSingleIndexWithHttpInfo(indexName, searchParams); + return localVarResponse.Data; + } + + /// + /// Search an index. Return records that match the query. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// ApiResponse of SearchResponse + public Algolia.Search.Search.Client.ApiResponse SearchSingleIndexWithHttpInfo(string indexName, SearchParams searchParams = default(SearchParams)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SearchSingleIndex"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.Data = searchParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/{indexName}/query", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchSingleIndex", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search an index. Return records that match the query. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of SearchResponse + public async System.Threading.Tasks.Task SearchSingleIndexAsync(string indexName, SearchParams searchParams = default(SearchParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await SearchSingleIndexWithHttpInfoAsync(indexName, searchParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Search an index. Return records that match the query. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SearchResponse) + public async System.Threading.Tasks.Task> SearchSingleIndexWithHttpInfoAsync(string indexName, SearchParams searchParams = default(SearchParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SearchSingleIndex"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + localVarRequestOptions.Data = searchParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/{indexName}/query", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchSingleIndex", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search for synonyms. Search for synonyms in your index. You can control and filter the search with parameters. To get all synonyms, send an empty request body. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Search for specific [types of synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms). (optional) + /// Returns the requested page number (the first page is 0). Page size is set by `hitsPerPage`. When null, there's no pagination. (optional, default to 0) + /// Maximum number of hits per page. (optional, default to 100) + /// Body of the `searchSynonyms` operation. (optional) + /// SearchSynonymsResponse + public SearchSynonymsResponse SearchSynonyms(string indexName, SynonymType type = default(SynonymType), int? page = default(int?), int? hitsPerPage = default(int?), SearchSynonymsParams searchSynonymsParams = default(SearchSynonymsParams)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = SearchSynonymsWithHttpInfo(indexName, type, page, hitsPerPage, searchSynonymsParams); + return localVarResponse.Data; + } + + /// + /// Search for synonyms. Search for synonyms in your index. You can control and filter the search with parameters. To get all synonyms, send an empty request body. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Search for specific [types of synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms). (optional) + /// Returns the requested page number (the first page is 0). Page size is set by `hitsPerPage`. When null, there's no pagination. (optional, default to 0) + /// Maximum number of hits per page. (optional, default to 100) + /// Body of the `searchSynonyms` operation. (optional) + /// ApiResponse of SearchSynonymsResponse + public Algolia.Search.Search.Client.ApiResponse SearchSynonymsWithHttpInfo(string indexName, SynonymType type = default(SynonymType), int? page = default(int?), int? hitsPerPage = default(int?), SearchSynonymsParams searchSynonymsParams = default(SearchSynonymsParams)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SearchSynonyms"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + if (type != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "type", type)); + } + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (hitsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "hitsPerPage", hitsPerPage)); + } + localVarRequestOptions.Data = searchSynonymsParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/indexes/{indexName}/synonyms/search", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchSynonyms", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search for synonyms. Search for synonyms in your index. You can control and filter the search with parameters. To get all synonyms, send an empty request body. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Search for specific [types of synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms). (optional) + /// Returns the requested page number (the first page is 0). Page size is set by `hitsPerPage`. When null, there's no pagination. (optional, default to 0) + /// Maximum number of hits per page. (optional, default to 100) + /// Body of the `searchSynonyms` operation. (optional) + /// Cancellation Token to cancel the request. + /// Task of SearchSynonymsResponse + public async System.Threading.Tasks.Task SearchSynonymsAsync(string indexName, SynonymType type = default(SynonymType), int? page = default(int?), int? hitsPerPage = default(int?), SearchSynonymsParams searchSynonymsParams = default(SearchSynonymsParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await SearchSynonymsWithHttpInfoAsync(indexName, type, page, hitsPerPage, searchSynonymsParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Search for synonyms. Search for synonyms in your index. You can control and filter the search with parameters. To get all synonyms, send an empty request body. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// Search for specific [types of synonyms](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms). (optional) + /// Returns the requested page number (the first page is 0). Page size is set by `hitsPerPage`. When null, there's no pagination. (optional, default to 0) + /// Maximum number of hits per page. (optional, default to 100) + /// Body of the `searchSynonyms` operation. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SearchSynonymsResponse) + public async System.Threading.Tasks.Task> SearchSynonymsWithHttpInfoAsync(string indexName, SynonymType type = default(SynonymType), int? page = default(int?), int? hitsPerPage = default(int?), SearchSynonymsParams searchSynonymsParams = default(SearchSynonymsParams), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SearchSynonyms"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + if (type != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "type", type)); + } + if (page != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "page", page)); + } + if (hitsPerPage != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "hitsPerPage", hitsPerPage)); + } + localVarRequestOptions.Data = searchSynonymsParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/indexes/{indexName}/synonyms/search", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchSynonyms", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search for a user ID. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. To ensure rapid updates, the user IDs index isn't built at the same time as the mapping. Instead, it's built every 12 hours, at the same time as the update of user ID usage. For example, if you add or move a user ID, the search will show an old value until the next time the mapping is rebuilt (every 12 hours). + /// + /// Thrown when fails to make API call + /// + /// SearchUserIdsResponse + public SearchUserIdsResponse SearchUserIds(SearchUserIdsParams searchUserIdsParams) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = SearchUserIdsWithHttpInfo(searchUserIdsParams); + return localVarResponse.Data; + } + + /// + /// Search for a user ID. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. To ensure rapid updates, the user IDs index isn't built at the same time as the mapping. Instead, it's built every 12 hours, at the same time as the update of user ID usage. For example, if you add or move a user ID, the search will show an old value until the next time the mapping is rebuilt (every 12 hours). + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of SearchUserIdsResponse + public Algolia.Search.Search.Client.ApiResponse SearchUserIdsWithHttpInfo(SearchUserIdsParams searchUserIdsParams) + { + // verify the required parameter 'searchUserIdsParams' is set + if (searchUserIdsParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'searchUserIdsParams' when calling SearchClient->SearchUserIds"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = searchUserIdsParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Post("/1/clusters/mapping/search", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchUserIds", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Search for a user ID. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. To ensure rapid updates, the user IDs index isn't built at the same time as the mapping. Instead, it's built every 12 hours, at the same time as the update of user ID usage. For example, if you add or move a user ID, the search will show an old value until the next time the mapping is rebuilt (every 12 hours). + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of SearchUserIdsResponse + public async System.Threading.Tasks.Task SearchUserIdsAsync(SearchUserIdsParams searchUserIdsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await SearchUserIdsWithHttpInfoAsync(searchUserIdsParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Search for a user ID. Since it can take up to a few seconds to get the data from the different clusters, the response isn't real-time. To ensure rapid updates, the user IDs index isn't built at the same time as the mapping. Instead, it's built every 12 hours, at the same time as the update of user ID usage. For example, if you add or move a user ID, the search will show an old value until the next time the mapping is rebuilt (every 12 hours). + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (SearchUserIdsResponse) + public async System.Threading.Tasks.Task> SearchUserIdsWithHttpInfoAsync(SearchUserIdsParams searchUserIdsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'searchUserIdsParams' is set + if (searchUserIdsParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'searchUserIdsParams' when calling SearchClient->SearchUserIds"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = searchUserIdsParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PostAsync("/1/clusters/mapping/search", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SearchUserIds", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Set stop word settings. Set stop word settings for a specific language. + /// + /// Thrown when fails to make API call + /// + /// UpdatedAtResponse + public UpdatedAtResponse SetDictionarySettings(DictionarySettingsParams dictionarySettingsParams) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = SetDictionarySettingsWithHttpInfo(dictionarySettingsParams); + return localVarResponse.Data; + } + + /// + /// Set stop word settings. Set stop word settings for a specific language. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of UpdatedAtResponse + public Algolia.Search.Search.Client.ApiResponse SetDictionarySettingsWithHttpInfo(DictionarySettingsParams dictionarySettingsParams) + { + // verify the required parameter 'dictionarySettingsParams' is set + if (dictionarySettingsParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'dictionarySettingsParams' when calling SearchClient->SetDictionarySettings"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = dictionarySettingsParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1/dictionaries/*/settings", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SetDictionarySettings", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Set stop word settings. Set stop word settings for a specific language. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + public async System.Threading.Tasks.Task SetDictionarySettingsAsync(DictionarySettingsParams dictionarySettingsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await SetDictionarySettingsWithHttpInfoAsync(dictionarySettingsParams, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Set stop word settings. Set stop word settings for a specific language. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + public async System.Threading.Tasks.Task> SetDictionarySettingsWithHttpInfoAsync(DictionarySettingsParams dictionarySettingsParams, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'dictionarySettingsParams' is set + if (dictionarySettingsParams == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'dictionarySettingsParams' when calling SearchClient->SetDictionarySettings"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.Data = dictionarySettingsParams; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1/dictionaries/*/settings", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SetDictionarySettings", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update index settings. Update the specified [index settings](https://www.algolia.com/doc/api-reference/settings-api-parameters/). Specifying null for a setting resets it to its default value. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// UpdatedAtResponse + public UpdatedAtResponse SetSettings(string indexName, IndexSettings indexSettings, bool? forwardToReplicas = default(bool?)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = SetSettingsWithHttpInfo(indexName, indexSettings, forwardToReplicas); + return localVarResponse.Data; + } + + /// + /// Update index settings. Update the specified [index settings](https://www.algolia.com/doc/api-reference/settings-api-parameters/). Specifying null for a setting resets it to its default value. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// ApiResponse of UpdatedAtResponse + public Algolia.Search.Search.Client.ApiResponse SetSettingsWithHttpInfo(string indexName, IndexSettings indexSettings, bool? forwardToReplicas = default(bool?)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SetSettings"); + + // verify the required parameter 'indexSettings' is set + if (indexSettings == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexSettings' when calling SearchClient->SetSettings"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + localVarRequestOptions.Data = indexSettings; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1/indexes/{indexName}/settings", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SetSettings", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update index settings. Update the specified [index settings](https://www.algolia.com/doc/api-reference/settings-api-parameters/). Specifying null for a setting resets it to its default value. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of UpdatedAtResponse + public async System.Threading.Tasks.Task SetSettingsAsync(string indexName, IndexSettings indexSettings, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await SetSettingsWithHttpInfoAsync(indexName, indexSettings, forwardToReplicas, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Update index settings. Update the specified [index settings](https://www.algolia.com/doc/api-reference/settings-api-parameters/). Specifying null for a setting resets it to its default value. + /// + /// Thrown when fails to make API call + /// Index on which to perform the request. + /// + /// Indicates whether changed index settings are forwarded to the replica indices. (optional) + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdatedAtResponse) + public async System.Threading.Tasks.Task> SetSettingsWithHttpInfoAsync(string indexName, IndexSettings indexSettings, bool? forwardToReplicas = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'indexName' is set + if (indexName == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexName' when calling SearchClient->SetSettings"); + + // verify the required parameter 'indexSettings' is set + if (indexSettings == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'indexSettings' when calling SearchClient->SetSettings"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("indexName", Algolia.Search.Search.Client.ClientUtils.ParameterToString(indexName)); // path parameter + if (forwardToReplicas != null) + { + localVarRequestOptions.QueryParameters.Add(Algolia.Search.Search.Client.ClientUtils.ParameterToMultiMap("", "forwardToReplicas", forwardToReplicas)); + } + localVarRequestOptions.Data = indexSettings; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1/indexes/{indexName}/settings", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("SetSettings", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update an API key. Replace the permissions of an existing API key. Any unspecified parameter resets that permission to its default value. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// + /// UpdateApiKeyResponse + public UpdateApiKeyResponse UpdateApiKey(string key, ApiKey apiKey) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = UpdateApiKeyWithHttpInfo(key, apiKey); + return localVarResponse.Data; + } + + /// + /// Update an API key. Replace the permissions of an existing API key. Any unspecified parameter resets that permission to its default value. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// + /// ApiResponse of UpdateApiKeyResponse + public Algolia.Search.Search.Client.ApiResponse UpdateApiKeyWithHttpInfo(string key, ApiKey apiKey) + { + // verify the required parameter 'key' is set + if (key == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'key' when calling SearchClient->UpdateApiKey"); + + // verify the required parameter 'apiKey' is set + if (apiKey == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'apiKey' when calling SearchClient->UpdateApiKey"); + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("key", Algolia.Search.Search.Client.ClientUtils.ParameterToString(key)); // path parameter + localVarRequestOptions.Data = apiKey; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + var localVarResponse = this.Client.Put("/1/keys/{key}", localVarRequestOptions, this.Configuration); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateApiKey", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + /// + /// Update an API key. Replace the permissions of an existing API key. Any unspecified parameter resets that permission to its default value. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// + /// Cancellation Token to cancel the request. + /// Task of UpdateApiKeyResponse + public async System.Threading.Tasks.Task UpdateApiKeyAsync(string key, ApiKey apiKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + Algolia.Search.Search.Client.ApiResponse localVarResponse = await UpdateApiKeyWithHttpInfoAsync(key, apiKey, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Update an API key. Replace the permissions of an existing API key. Any unspecified parameter resets that permission to its default value. The request must be authenticated with the admin API key. + /// + /// Thrown when fails to make API call + /// API key. + /// + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (UpdateApiKeyResponse) + public async System.Threading.Tasks.Task> UpdateApiKeyWithHttpInfoAsync(string key, ApiKey apiKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'key' is set + if (key == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'key' when calling SearchClient->UpdateApiKey"); + + // verify the required parameter 'apiKey' is set + if (apiKey == null) + throw new Algolia.Search.Search.Client.ApiException(400, "Missing required parameter 'apiKey' when calling SearchClient->UpdateApiKey"); + + + Algolia.Search.Search.Client.RequestOptions localVarRequestOptions = new Algolia.Search.Search.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + + var localVarContentType = Algolia.Search.Search.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + + var localVarAccept = Algolia.Search.Search.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + + localVarRequestOptions.PathParameters.Add("key", Algolia.Search.Search.Client.ClientUtils.ParameterToString(key)); // path parameter + localVarRequestOptions.Data = apiKey; + + // authentication (apiKey) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-API-Key", this.Configuration.GetApiKeyWithPrefix("X-Algolia-API-Key")); + } + + // authentication (appId) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id"))) + { + localVarRequestOptions.HeaderParameters.Add("X-Algolia-Application-Id", this.Configuration.GetApiKeyWithPrefix("X-Algolia-Application-Id")); + } + + + // make the HTTP request + + var localVarResponse = await this.AsynchronousClient.PutAsync("/1/keys/{key}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateApiKey", localVarResponse); + if (_exception != null) throw _exception; + } + + return localVarResponse; + } + + } +} diff --git a/algoliasearch/Search/Client/ApiClient.cs b/algoliasearch/Search/Client/ApiClient.cs new file mode 100644 index 000000000..22c6a29b4 --- /dev/null +++ b/algoliasearch/Search/Client/ApiClient.cs @@ -0,0 +1,736 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs; +using System.Net.Http; +using System.Net.Http.Headers; + +namespace Algolia.Search.Search.Client +{ + /// + /// To Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec + { + private readonly IReadableConfiguration _configuration; + private static readonly string _contentType = "application/json"; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is Algolia.Search.Search.Models.AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((Algolia.Search.Search.Models.AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public async Task Deserialize(HttpResponseMessage response) + { + var result = (T)await Deserialize(response, typeof(T)).ConfigureAwait(false); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal async Task Deserialize(HttpResponseMessage response, Type type) + { + IList headers = response.Headers.Select(x => x.Key + "=" + x.Value).ToList(); + + if (type == typeof(byte[])) // return byte array + { + return await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + } + else if (type == typeof(FileParameter)) + { + return new FileParameter(await response.Content.ReadAsStreamAsync().ConfigureAwait(false)); + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + if (headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + File.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(await response.Content.ReadAsStringAsync().ConfigureAwait(false), null, System.Globalization.DateTimeStyles.RoundtripKind); + } + + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync().ConfigureAwait(false), type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public string RootElement { get; set; } + public string Namespace { get; set; } + public string DateFormat { get; set; } + + public string ContentType + { + get { return _contentType; } + set { throw new InvalidOperationException("Not allowed to set content type."); } + } + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + /// + /// The Dispose method will manage the HttpClient lifecycle when not passed by constructor. + /// + public partial class ApiClient : IDisposable, ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + + private readonly HttpClientHandler _httpClientHandler; + private readonly HttpClient _httpClient; + private readonly bool _disposeClient; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + public ApiClient() : + this(Algolia.Search.Search.Client.GlobalConfiguration.Instance.BasePath) + { + } + + /// + /// Initializes a new instance of the . + /// **IMPORTANT** This will also create an instance of HttpClient, which is less than ideal. + /// It's better to reuse the HttpClient and HttpClientHandler. + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = new HttpClientHandler(); + _httpClient = new HttpClient(_httpClientHandler, true); + _disposeClient = true; + _baseUrl = basePath; + } + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + /// An instance of HttpClient. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, HttpClientHandler handler = null) : + this(client, Algolia.Search.Search.Client.GlobalConfiguration.Instance.BasePath, handler) + { + } + + /// + /// Initializes a new instance of the . + /// + /// An instance of HttpClient. + /// The target service's base path in URL format. + /// An optional instance of HttpClientHandler that is used by HttpClient. + /// + /// + /// + /// Some configuration settings will not be applied without passing an HttpClientHandler. + /// The features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. + /// + public ApiClient(HttpClient client, string basePath, HttpClientHandler handler = null) + { + if (client == null) throw new ArgumentNullException("client cannot be null"); + if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("basePath cannot be empty"); + + _httpClientHandler = handler; + _httpClient = client; + _baseUrl = basePath; + } + + /// + /// Disposes resources if they were created by us + /// + public void Dispose() + { + if (_disposeClient) + { + _httpClient.Dispose(); + } + } + + /// Prepares multipart/form-data content + HttpContent PrepareMultipartFormDataContent(RequestOptions options) + { + string boundary = "---------" + Guid.NewGuid().ToString().ToUpperInvariant(); + var multipartContent = new MultipartFormDataContent(boundary); + foreach (var formParameter in options.FormParameters) + { + multipartContent.Add(new StringContent(formParameter.Value), formParameter.Key); + } + + if (options.FileParameters != null && options.FileParameters.Count > 0) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var content = new StreamContent(file.Content); + content.Headers.ContentType = new MediaTypeHeaderValue(file.ContentType); + multipartContent.Add(content, fileParam.Key, file.Name); + } + } + } + return multipartContent; + } + + /// + /// Provides all logic for constructing a new HttpRequestMessage. + /// At this point, all information for querying the service is known. Here, it is simply + /// mapped into the a HttpRequestMessage. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// [private] A new HttpRequestMessage instance. + /// + private HttpRequestMessage NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + WebRequestPathBuilder builder = new WebRequestPathBuilder(_baseUrl, path); + + builder.AddPathParameters(options.PathParameters); + + builder.AddQueryParameters(options.QueryParameters); + + HttpRequestMessage request = new HttpRequestMessage(method, builder.GetFullUri()); + + if (configuration.UserAgent != null) + { + request.Headers.TryAddWithoutValidation("User-Agent", configuration.UserAgent); + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.Headers.Add(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + // Todo make content headers actually content headers + request.Headers.TryAddWithoutValidation(headerParam.Key, value); + } + } + } + + List> contentList = new List>(); + + string contentType = null; + if (options.HeaderParameters != null && options.HeaderParameters.ContainsKey("Content-Type")) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes.FirstOrDefault(); + } + + if (contentType == "multipart/form-data") + { + request.Content = PrepareMultipartFormDataContent(options); + } + else if (contentType == "application/x-www-form-urlencoded") + { + request.Content = new FormUrlEncodedContent(options.FormParameters); + } + else + { + if (options.Data != null) + { + if (options.Data is FileParameter fp) + { + contentType = contentType ?? "application/octet-stream"; + + var streamContent = new StreamContent(fp.Content); + streamContent.Headers.ContentType = new MediaTypeHeaderValue(contentType); + request.Content = streamContent; + } + else + { + var serializer = new CustomJsonCodec(SerializerSettings, configuration); + request.Content = new StringContent(serializer.Serialize(options.Data), new UTF8Encoding(), + "application/json"); + } + } + } + + + + // TODO provide an alternative that allows cookies per request instead of per API client + if (options.Cookies != null && options.Cookies.Count > 0) + { + request.Properties["CookieContainer"] = options.Cookies; + } + + return request; + } + + partial void InterceptRequest(HttpRequestMessage req); + partial void InterceptResponse(HttpRequestMessage req, HttpResponseMessage response); + + private async Task> ToApiResponse(HttpResponseMessage response, object responseData, Uri uri) + { + T result = (T)responseData; + string rawContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ReasonPhrase, + Cookies = new List() + }; + + // process response headers, e.g. Access-Control-Allow-Methods + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + // process response content headers, e.g. Content-Type + if (response.Content.Headers != null) + { + foreach (var responseHeader in response.Content.Headers) + { + transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (_httpClientHandler != null && response != null) + { + try + { + foreach (Cookie cookie in _httpClientHandler.CookieContainer.GetCookies(uri)) + { + transformed.Cookies.Add(cookie); + } + } + catch (PlatformNotSupportedException) { } + } + + return transformed; + } + + private ApiResponse Exec(HttpRequestMessage req, IReadableConfiguration configuration) + { + return ExecAsync(req, configuration).GetAwaiter().GetResult(); + } + + private async Task> ExecAsync(HttpRequestMessage req, + IReadableConfiguration configuration, + System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + CancellationTokenSource timeoutTokenSource = null; + CancellationTokenSource finalTokenSource = null; + var deserializer = new CustomJsonCodec(SerializerSettings, configuration); + var finalToken = cancellationToken; + + try + { + if (configuration.Timeout > 0) + { + timeoutTokenSource = new CancellationTokenSource(configuration.Timeout); + finalTokenSource = CancellationTokenSource.CreateLinkedTokenSource(finalToken, timeoutTokenSource.Token); + finalToken = finalTokenSource.Token; + } + + if (configuration.Proxy != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Configuration `Proxy` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + _httpClientHandler.Proxy = configuration.Proxy; + } + + var cookieContainer = req.Properties.ContainsKey("CookieContainer") ? req.Properties["CookieContainer"] as List : null; + + if (cookieContainer != null) + { + if (_httpClientHandler == null) throw new InvalidOperationException("Request property `CookieContainer` not supported when the client is explicitly created without an HttpClientHandler, use the proper constructor."); + foreach (var cookie in cookieContainer) + { + _httpClientHandler.CookieContainer.Add(cookie); + } + } + + InterceptRequest(req); + + HttpResponseMessage response; + response = await _httpClient.SendAsync(req, finalToken).ConfigureAwait(false); + + if (!response.IsSuccessStatusCode) + { + return await ToApiResponse(response, default(T), req.RequestUri).ConfigureAwait(false); + } + + object responseData = await deserializer.Deserialize(response).ConfigureAwait(false); + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(Algolia.Search.Search.Models.AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + responseData = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + else if (typeof(T).Name == "Stream") // for binary response + { + responseData = (T)(object)await response.Content.ReadAsStreamAsync().ConfigureAwait(false); + } + + InterceptResponse(req, response); + + return await ToApiResponse(response, responseData, req.RequestUri).ConfigureAwait(false); + } + catch (OperationCanceledException original) + { + if (timeoutTokenSource != null && timeoutTokenSource.IsCancellationRequested) + { + throw new TaskCanceledException($"[{req.Method}] {req.RequestUri} was timeout.", + new TimeoutException(original.Message, original)); + } + throw; + } + finally + { + if (timeoutTokenSource != null) + { + timeoutTokenSource.Dispose(); + } + + if (finalTokenSource != null) + { + finalTokenSource.Dispose(); + } + } + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(new HttpMethod("PATCH"), path, options, config), config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(new HttpMethod("PATCH"), path, options, config), config); + } + #endregion ISynchronousClient + } +} diff --git a/algoliasearch/Search/Client/ApiException.cs b/algoliasearch/Search/Client/ApiException.cs new file mode 100644 index 000000000..c0d8f9359 --- /dev/null +++ b/algoliasearch/Search/Client/ApiException.cs @@ -0,0 +1,62 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.Search.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// Gets or sets the error code (HTTP status code) + /// + /// The error code (HTTP status code). + public int ErrorCode { get; set; } + + /// + /// Gets or sets the error content (body json object) + /// + /// The error content (Http response body). + public object ErrorContent { get; private set; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public ApiException() { } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + public ApiException(int errorCode, string message) : base(message) + { + this.ErrorCode = errorCode; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + /// Error content. + /// HTTP Headers. + public ApiException(int errorCode, string message, object errorContent = null, Multimap headers = null) : base(message) + { + this.ErrorCode = errorCode; + this.ErrorContent = errorContent; + this.Headers = headers; + } + } + +} diff --git a/algoliasearch/Search/Client/ApiResponse.cs b/algoliasearch/Search/Client/ApiResponse.cs new file mode 100644 index 000000000..c0cdd5c75 --- /dev/null +++ b/algoliasearch/Search/Client/ApiResponse.cs @@ -0,0 +1,160 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; + +namespace Algolia.Search.Search.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public interface IApiResponse + { + /// + /// The data type of + /// + Type ResponseType { get; } + + /// + /// The content of this response + /// + Object Content { get; } + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + Multimap Headers { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + List Cookies { get; set; } + + /// + /// The raw content of this response + /// + string RawContent { get; } + } + + /// + /// API Response + /// + public class ApiResponse : IApiResponse + { + #region Properties + + /// + /// Gets or sets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// Gets or sets the HTTP headers + /// + /// HTTP headers + public Multimap Headers { get; } + + /// + /// Gets or sets the data (parsed HTTP body) + /// + /// The data. + public T Data { get; } + + /// + /// Gets or sets any error text defined by the calling client. + /// + public string ErrorText { get; set; } + + /// + /// Gets or sets any cookies passed along on the response. + /// + public List Cookies { get; set; } + + /// + /// The content of this response + /// + public Type ResponseType + { + get { return typeof(T); } + } + + /// + /// The data type of + /// + public object Content + { + get { return Data; } + } + + /// + /// The raw content + /// + public string RawContent { get; } + + #endregion Properties + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data, string rawContent) + { + StatusCode = statusCode; + Headers = headers; + Data = data; + RawContent = rawContent; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// HTTP headers. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) : this(statusCode, headers, data, null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + /// Raw content. + public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Data (parsed HTTP body) + public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null) + { + } + + #endregion Constructors + } +} diff --git a/algoliasearch/Search/Client/ClientUtils.cs b/algoliasearch/Search/Client/ClientUtils.cs new file mode 100644 index 000000000..f1eeed2ce --- /dev/null +++ b/algoliasearch/Search/Client/ClientUtils.cs @@ -0,0 +1,244 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; + +namespace Algolia.Search.Search.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// Convert params to key/value pairs. + /// Use collectionFormat to properly format lists and collections. + /// + /// The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi + /// Key name. + /// Value object. + /// A multimap of keys with 1..n associated values. + public static Multimap ParameterToMultiMap(string collectionFormat, string name, object value) + { + var parameters = new Multimap(); + + if (value is ICollection collection && collectionFormat == "multi") + { + foreach (var item in collection) + { + parameters.Add(name, ParameterToString(item)); + } + } + else if (value is IDictionary dictionary) + { + if (collectionFormat == "deepObject") + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value)); + } + } + else + { + foreach (DictionaryEntry entry in dictionary) + { + parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value)); + } + } + } + else + { + parameters.Add(name, ParameterToString(value)); + } + + return parameters; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// An optional configuration instance, providing formatting options used in processing. + /// Formatted string. + public static string ParameterToString(object obj, IReadableConfiguration configuration = null) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); + if (obj is bool boolean) + return boolean ? "true" : "false"; + if (obj is ICollection collection) + { + List entries = new List(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry, configuration)); + return string.Join(",", entries); + } + if (obj is Enum && HasEnumMemberAttrValue(obj)) + return GetEnumMemberAttrValue(obj); + + return Convert.ToString(obj, CultureInfo.InvariantCulture); + } + + /// + /// Serializes the given object when not null. Otherwise return null. + /// + /// The object to serialize. + /// Serialized string. + public static string Serialize(object obj) + { + return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null; + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// Select the Accept header's value from the given accepts array: + /// if JSON exists in the given array, use it; + /// otherwise use all of them (joining into a string) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Is the Enum decorated with EnumMember Attribute + /// + /// + /// true if found + private static bool HasEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) return true; + return false; + } + + /// + /// Get the EnumMember value + /// + /// + /// EnumMember value as string otherwise null + private static string GetEnumMemberAttrValue(object enumVal) + { + if (enumVal == null) + throw new ArgumentNullException(nameof(enumVal)); + var enumType = enumVal.GetType(); + var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException()); + var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType().FirstOrDefault(); + if (attr != null) + { + return attr.Value; + } + return null; + } + } +} diff --git a/algoliasearch/Search/Client/Configuration.cs b/algoliasearch/Search/Client/Configuration.cs new file mode 100644 index 000000000..4f1d089de --- /dev/null +++ b/algoliasearch/Search/Client/Configuration.cs @@ -0,0 +1,645 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Net.Http; +using System.Net.Security; + +namespace Algolia.Search.Search.Client +{ + /// + /// Represents a set of configuration settings + /// + public class Configuration : IReadableConfiguration + { + #region Constants + + /// + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Identifier for ISO 8601 DateTime Format + /// + /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. + // ReSharper disable once InconsistentNaming + public const string ISO8601_DATETIME_FORMAT = "o"; + + #endregion Constants + + #region Static Members + + /// + /// Default creation of exceptions for a given method name and response object + /// + public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => + { + var status = (int)response.StatusCode; + if (status >= 400) + { + return new ApiException(status, + string.Format("Error calling {0}: {1}", methodName, response.RawContent), + response.RawContent, response.Headers); + } + return null; + }; + + #endregion Static Members + + #region Private Members + + /// + /// Defines the base path of the target API server. + /// Example: http://localhost:3000/v1/ + /// + private string _basePath; + + private bool _useDefaultCredentials = false; + + /// + /// Gets or sets the API key based on the authentication name. + /// This is the key and value comprising the "secret" for accessing an API. + /// + /// The API key. + private IDictionary _apiKey; + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + private IDictionary _apiKeyPrefix; + + private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + private string _tempFolderPath = Path.GetTempPath(); + + /// + /// Gets or sets the servers defined in the OpenAPI spec. + /// + /// The servers + private IList> _servers; + + /// + /// Gets or sets the operation servers defined in the OpenAPI spec. + /// + /// The operation servers + private IReadOnlyDictionary>> _operationServers; + + #endregion Private Members + + #region Constructors + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration() + { + Proxy = null; + UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); + BasePath = "https://myAppId.algolia.net"; + DefaultHeaders = new ConcurrentDictionary(); + ApiKey = new ConcurrentDictionary(); + ApiKeyPrefix = new ConcurrentDictionary(); + Servers = new List>() + { + { + new Dictionary { + {"url", "https://{appId}.algolia.net"}, + {"description", "No description provided"}, + { + "variables", new Dictionary { + { + "appId", new Dictionary { + {"description", "No description provided"}, + {"default_value", "myAppId"}, + } + } + } + } + } + }, + { + new Dictionary { + {"url", "https://{appId}-1.algolianet.com"}, + {"description", "No description provided"}, + { + "variables", new Dictionary { + { + "appId", new Dictionary { + {"description", "No description provided"}, + {"default_value", "myAppId"}, + } + } + } + } + } + }, + { + new Dictionary { + {"url", "https://{appId}-2.algolianet.com"}, + {"description", "No description provided"}, + { + "variables", new Dictionary { + { + "appId", new Dictionary { + {"description", "No description provided"}, + {"default_value", "myAppId"}, + } + } + } + } + } + }, + { + new Dictionary { + {"url", "https://{appId}-3.algolianet.com"}, + {"description", "No description provided"}, + { + "variables", new Dictionary { + { + "appId", new Dictionary { + {"description", "No description provided"}, + {"default_value", "myAppId"}, + } + } + } + } + } + }, + { + new Dictionary { + {"url", "https://{appId}-dsn.algolia.net"}, + {"description", "No description provided"}, + { + "variables", new Dictionary { + { + "appId", new Dictionary { + {"description", "No description provided"}, + {"default_value", "myAppId"}, + } + } + } + } + } + } + }; + OperationServers = new Dictionary>>() + { + }; + + // Setting Timeout has side effects (forces ApiClient creation). + Timeout = 100000; + } + + /// + /// Initializes a new instance of the class + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] + public Configuration( + IDictionary defaultHeaders, + IDictionary apiKey, + IDictionary apiKeyPrefix, + string basePath = "https://myAppId.algolia.net") : this() + { + if (string.IsNullOrWhiteSpace(basePath)) + throw new ArgumentException("The provided basePath is invalid.", "basePath"); + if (defaultHeaders == null) + throw new ArgumentNullException("defaultHeaders"); + if (apiKey == null) + throw new ArgumentNullException("apiKey"); + if (apiKeyPrefix == null) + throw new ArgumentNullException("apiKeyPrefix"); + + BasePath = basePath; + + foreach (var keyValuePair in defaultHeaders) + { + DefaultHeaders.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKey) + { + ApiKey.Add(keyValuePair); + } + + foreach (var keyValuePair in apiKeyPrefix) + { + ApiKeyPrefix.Add(keyValuePair); + } + } + + #endregion Constructors + + #region Properties + + /// + /// Gets or sets the base path for API access. + /// + public virtual string BasePath + { + get { return _basePath; } + set { _basePath = value; } + } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + public virtual bool UseDefaultCredentials + { + get { return _useDefaultCredentials; } + set { _useDefaultCredentials = value; } + } + + /// + /// Gets or sets the default header. + /// + [Obsolete("Use DefaultHeaders instead.")] + public virtual IDictionary DefaultHeader + { + get + { + return DefaultHeaders; + } + set + { + DefaultHeaders = value; + } + } + + /// + /// Gets or sets the default headers. + /// + public virtual IDictionary DefaultHeaders { get; set; } + + /// + /// Gets or sets the HTTP timeout (milliseconds) of ApiClient. Default to 100000 milliseconds. + /// + public virtual int Timeout { get; set; } + + /// + /// Gets or sets the proxy + /// + /// Proxy. + public virtual WebProxy Proxy { get; set; } + + /// + /// Gets or sets the HTTP user agent. + /// + /// Http user agent. + public virtual string UserAgent { get; set; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix(string apiKeyIdentifier) + { + string apiKeyValue; + ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue); + string apiKeyPrefix; + if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) + { + return apiKeyPrefix + " " + apiKeyValue; + } + + return apiKeyValue; + } + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public virtual string TempFolderPath + { + get { return _tempFolderPath; } + + set + { + if (string.IsNullOrEmpty(value)) + { + _tempFolderPath = Path.GetTempPath(); + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + { + Directory.CreateDirectory(value); + } + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + { + _tempFolderPath = value; + } + else + { + _tempFolderPath = value + Path.DirectorySeparatorChar; + } + } + } + + /// + /// Gets or sets the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public virtual string DateTimeFormat + { + get { return _dateTimeFormat; } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// Whatever you set here will be prepended to the value defined in AddApiKey. + /// + /// An example invocation here might be: + /// + /// ApiKeyPrefix["Authorization"] = "Bearer"; + /// + /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// + /// + /// OAuth2 workflows should set tokens via AccessToken. + /// + /// + /// The prefix of the API key. + public virtual IDictionary ApiKeyPrefix + { + get { return _apiKeyPrefix; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); + } + _apiKeyPrefix = value; + } + } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public virtual IDictionary ApiKey + { + get { return _apiKey; } + set + { + if (value == null) + { + throw new InvalidOperationException("ApiKey collection may not be null."); + } + _apiKey = value; + } + } + + /// + /// Gets or sets the servers. + /// + /// The servers. + public virtual IList> Servers + { + get { return _servers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Servers may not be null."); + } + _servers = value; + } + } + + /// + /// Gets or sets the operation servers. + /// + /// The operation servers. + public virtual IReadOnlyDictionary>> OperationServers + { + get { return _operationServers; } + set + { + if (value == null) + { + throw new InvalidOperationException("Operation servers may not be null."); + } + _operationServers = value; + } + } + + /// + /// Returns URL based on server settings without providing values + /// for the variables + /// + /// Array index of the server settings. + /// The server URL. + public string GetServerUrl(int index) + { + return GetServerUrl(Servers, index, null); + } + + /// + /// Returns URL based on server settings. + /// + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + public string GetServerUrl(int index, Dictionary inputVariables) + { + return GetServerUrl(Servers, index, inputVariables); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index) + { + return GetOperationServerUrl(operation, index, null); + } + + /// + /// Returns URL based on operation server settings. + /// + /// Operation associated with the request path. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The operation server URL. + public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables) + { + if (operation != null && OperationServers.TryGetValue(operation, out var operationServer)) + { + return GetServerUrl(operationServer, index, inputVariables); + } + + return null; + } + + /// + /// Returns URL based on server settings. + /// + /// Dictionary of server settings. + /// Array index of the server settings. + /// Dictionary of the variables and the corresponding values. + /// The server URL. + private string GetServerUrl(IList> servers, int index, Dictionary inputVariables) + { + if (index < 0 || index >= servers.Count) + { + throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}."); + } + + if (inputVariables == null) + { + inputVariables = new Dictionary(); + } + + IReadOnlyDictionary server = servers[index]; + string url = (string)server["url"]; + + if (server.ContainsKey("variables")) + { + // go through each variable and assign a value + foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"]) + { + + IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value); + + if (inputVariables.ContainsKey(variable.Key)) + { + if (((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) + { + url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); + } + else + { + throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}"); + } + } + else + { + // use default value + url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]); + } + } + } + + return url; + } + + /// + /// Gets and Sets the RemoteCertificateValidationCallback + /// + public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; } + + #endregion Properties + + #region Methods + + /// + /// Returns a string with essential information for debugging. + /// + public static string ToDebugReport() + { + string report = "C# SDK (Algolia.Search.Search) Debug Report:\n"; + report += " OS: " + System.Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + System.Environment.Version + "\n"; + report += " Version of the API: 1.0.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; + } + + /// + /// Add Api Key Header. + /// + /// Api Key name. + /// Api Key value. + /// + public void AddApiKey(string key, string value) + { + ApiKey[key] = value; + } + + /// + /// Sets the API key prefix. + /// + /// Api Key name. + /// Api Key value. + public void AddApiKeyPrefix(string key, string value) + { + ApiKeyPrefix[key] = value; + } + + #endregion Methods + + #region Static Members + /// + /// Merge configurations. + /// + /// First configuration. + /// Second configuration. + /// Merged configuration. + public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) + { + if (second == null) return first ?? GlobalConfiguration.Instance; + + Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + + foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; + foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; + foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value; + + var config = new Configuration + { + ApiKey = apiKey, + ApiKeyPrefix = apiKeyPrefix, + DefaultHeaders = defaultHeaders, + BasePath = second.BasePath ?? first.BasePath, + Timeout = second.Timeout, + Proxy = second.Proxy ?? first.Proxy, + UserAgent = second.UserAgent ?? first.UserAgent, + TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, + DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat, + UseDefaultCredentials = second.UseDefaultCredentials, + RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback, + }; + return config; + } + #endregion Static Members + } +} diff --git a/algoliasearch/Search/Client/ExceptionFactory.cs b/algoliasearch/Search/Client/ExceptionFactory.cs new file mode 100644 index 000000000..b18ea0a82 --- /dev/null +++ b/algoliasearch/Search/Client/ExceptionFactory.cs @@ -0,0 +1,16 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; + +namespace Algolia.Search.Search.Client +{ + /// + /// A delegate to ExceptionFactory method + /// + /// Method name + /// Response + /// Exceptions + public delegate Exception ExceptionFactory(string methodName, IApiResponse response); +} diff --git a/algoliasearch/Search/Client/FileParameter.cs b/algoliasearch/Search/Client/FileParameter.cs new file mode 100644 index 000000000..5b094d751 --- /dev/null +++ b/algoliasearch/Search/Client/FileParameter.cs @@ -0,0 +1,74 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.IO; + +namespace Algolia.Search.Search.Client +{ + + /// + /// Represents a File passed to the API as a Parameter, allows using different backends for files + /// + public class FileParameter + { + /// + /// The filename + /// + public string Name { get; set; } = "no_name_provided"; + + /// + /// The content type of the file + /// + public string ContentType { get; set; } = "application/octet-stream"; + + /// + /// The content of the file + /// + public Stream Content { get; set; } + + /// + /// Construct a FileParameter just from the contents, will extract the filename from a filestream + /// + /// The file content + public FileParameter(Stream content) + { + if (content is FileStream fs) + { + Name = fs.Name; + } + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The file content + public FileParameter(string filename, Stream content) + { + Name = filename; + Content = content; + } + + /// + /// Construct a FileParameter from name and content + /// + /// The filename + /// The content type of the file + /// The file content + public FileParameter(string filename, string contentType, Stream content) + { + Name = filename; + ContentType = contentType; + Content = content; + } + + /// + /// Implicit conversion of stream to file parameter. Useful for backwards compatibility. + /// + /// Stream to convert + /// FileParameter + public static implicit operator FileParameter(Stream s) => new FileParameter(s); + } +} diff --git a/algoliasearch/Search/Client/GlobalConfiguration.cs b/algoliasearch/Search/Client/GlobalConfiguration.cs new file mode 100644 index 000000000..80d302d70 --- /dev/null +++ b/algoliasearch/Search/Client/GlobalConfiguration.cs @@ -0,0 +1,61 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System.Collections.Generic; + +namespace Algolia.Search.Search.Client +{ + /// + /// provides a compile-time extension point for globally configuring + /// API Clients. + /// + /// + /// A customized implementation via partial class may reside in another file and may + /// be excluded from automatic generation via a .openapi-generator-ignore file. + /// + public partial class GlobalConfiguration : Configuration + { + #region Private Members + + private static readonly object GlobalConfigSync = new { }; + private static IReadableConfiguration _globalConfiguration; + + #endregion Private Members + + #region Constructors + + /// + private GlobalConfiguration() + { + } + + /// + public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath) + { + } + + static GlobalConfiguration() + { + Instance = new GlobalConfiguration(); + } + + #endregion Constructors + + /// + /// Gets or sets the default Configuration. + /// + /// Configuration. + public static IReadableConfiguration Instance + { + get { return _globalConfiguration; } + set + { + lock (GlobalConfigSync) + { + _globalConfiguration = value; + } + } + } + } +} diff --git a/algoliasearch/Search/Client/IAsynchronousClient.cs b/algoliasearch/Search/Client/IAsynchronousClient.cs new file mode 100644 index 000000000..25e2bb8b5 --- /dev/null +++ b/algoliasearch/Search/Client/IAsynchronousClient.cs @@ -0,0 +1,94 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Threading.Tasks; + +namespace Algolia.Search.Search.Client +{ + /// + /// Contract for Asynchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface IAsynchronousClient + { + /// + /// Executes a non-blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Executes a non-blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// Cancellation Token to cancel the request. + /// The return type. + /// A task eventually representing the response data, decorated with + Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } +} diff --git a/algoliasearch/Search/Client/IReadableConfiguration.cs b/algoliasearch/Search/Client/IReadableConfiguration.cs new file mode 100644 index 000000000..489664afb --- /dev/null +++ b/algoliasearch/Search/Client/IReadableConfiguration.cs @@ -0,0 +1,111 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; + +namespace Algolia.Search.Search.Client +{ + /// + /// Represents a readable-only configuration contract. + /// + public interface IReadableConfiguration + { + /// + /// Gets the API key. + /// + /// API key. + IDictionary ApiKey { get; } + + /// + /// Gets the API key prefix. + /// + /// API key prefix. + IDictionary ApiKeyPrefix { get; } + + /// + /// Gets the base path. + /// + /// Base path. + string BasePath { get; } + + /// + /// Gets the date time format. + /// + /// Date time format. + string DateTimeFormat { get; } + + /// + /// Gets the default header. + /// + /// Default header. + [Obsolete("Use DefaultHeaders instead.")] + IDictionary DefaultHeader { get; } + + /// + /// Gets the default headers. + /// + /// Default headers. + IDictionary DefaultHeaders { get; } + + /// + /// Gets the temp folder path. + /// + /// Temp folder path. + string TempFolderPath { get; } + + /// + /// Gets the HTTP connection timeout (in milliseconds) + /// + /// HTTP connection timeout. + int Timeout { get; } + + /// + /// Gets the proxy. + /// + /// Proxy. + WebProxy Proxy { get; } + + /// + /// Gets the user agent. + /// + /// User agent. + string UserAgent { get; } + + /// + /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. + /// + bool UseDefaultCredentials { get; } + + /// + /// Get the servers associated with the operation. + /// + /// Operation servers. + IReadOnlyDictionary>> OperationServers { get; } + + /// + /// Gets the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + string GetApiKeyWithPrefix(string apiKeyIdentifier); + + /// + /// Gets the Operation server url at the provided index. + /// + /// Operation server name. + /// Index of the operation server settings. + /// + string GetOperationServerUrl(string operation, int index); + + /// + /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and + /// overriding certificate errors in the scope of a request. + /// + RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; } + } +} diff --git a/algoliasearch/Search/Client/ISynchronousClient.cs b/algoliasearch/Search/Client/ISynchronousClient.cs new file mode 100644 index 000000000..523704407 --- /dev/null +++ b/algoliasearch/Search/Client/ISynchronousClient.cs @@ -0,0 +1,87 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.IO; + +namespace Algolia.Search.Search.Client +{ + /// + /// Contract for Synchronous RESTful API interactions. + /// + /// This interface allows consumers to provide a custom API accessor client. + /// + public interface ISynchronousClient + { + /// + /// Executes a blocking call to some using the GET http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the POST http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PUT http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the DELETE http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the HEAD http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the OPTIONS http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null); + + /// + /// Executes a blocking call to some using the PATCH http verb. + /// + /// The relative path to invoke. + /// The request parameters to pass along to the client. + /// Per-request configurable settings. + /// The return type. + /// The response data, decorated with + ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null); + } +} diff --git a/algoliasearch/Search/Client/Multimap.cs b/algoliasearch/Search/Client/Multimap.cs new file mode 100644 index 000000000..4791a75d7 --- /dev/null +++ b/algoliasearch/Search/Client/Multimap.cs @@ -0,0 +1,289 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Algolia.Search.Search.Client +{ + /// + /// A dictionary in which one key has many associated values. + /// + /// The type of the key + /// The type of the value associated with the key. + public class Multimap : IDictionary> + { + #region Private Fields + + private readonly Dictionary> _dictionary; + + #endregion Private Fields + + #region Constructors + + /// + /// Empty Constructor. + /// + public Multimap() + { + _dictionary = new Dictionary>(); + } + + /// + /// Constructor with comparer. + /// + /// + public Multimap(IEqualityComparer comparer) + { + _dictionary = new Dictionary>(comparer); + } + + #endregion Constructors + + #region Enumerators + + /// + /// To get the enumerator. + /// + /// Enumerator + public IEnumerator>> GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + /// + /// To get the enumerator. + /// + /// Enumerator + IEnumerator IEnumerable.GetEnumerator() + { + return _dictionary.GetEnumerator(); + } + + #endregion Enumerators + + #region Public Members + /// + /// Add values to Multimap + /// + /// Key value pair + public void Add(KeyValuePair> item) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + + /// + /// Add Multimap to Multimap + /// + /// Multimap + public void Add(Multimap multimap) + { + foreach (var item in multimap) + { + if (!TryAdd(item.Key, item.Value)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + + /// + /// Clear Multimap + /// + public void Clear() + { + _dictionary.Clear(); + } + + /// + /// Determines whether Multimap contains the specified item. + /// + /// Key value pair + /// Method needs to be implemented + /// true if the Multimap contains the item; otherwise, false. + public bool Contains(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Copy items of the Multimap to an array, + /// starting at a particular array index. + /// + /// The array that is the destination of the items copied + /// from Multimap. The array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + /// Method needs to be implemented + public void CopyTo(KeyValuePair>[] array, int arrayIndex) + { + throw new NotImplementedException(); + } + + /// + /// Removes the specified item from the Multimap. + /// + /// Key value pair + /// true if the item is successfully removed; otherwise, false. + /// Method needs to be implemented + public bool Remove(KeyValuePair> item) + { + throw new NotImplementedException(); + } + + /// + /// Gets the number of items contained in the Multimap. + /// + public int Count => _dictionary.Count; + + /// + /// Gets a value indicating whether the Multimap is read-only. + /// + public bool IsReadOnly => false; + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add the value to Multimap. + public void Add(TKey key, IList value) + { + if (value != null && value.Count > 0) + { + if (_dictionary.TryGetValue(key, out var list)) + { + foreach (var k in value) list.Add(k); + } + else + { + list = new List(value); + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add values to Multimap."); + } + } + } + + /// + /// Determines whether the Multimap contains an item with the specified key. + /// + /// The key to locate in the Multimap. + /// true if the Multimap contains an item with + /// the key; otherwise, false. + public bool ContainsKey(TKey key) + { + return _dictionary.ContainsKey(key); + } + + /// + /// Removes item with the specified key from the Multimap. + /// + /// The key to locate in the Multimap. + /// true if the item is successfully removed; otherwise, false. + public bool Remove(TKey key) + { + return TryRemove(key, out var _); + } + + /// + /// Gets the value associated with the specified key. + /// + /// The key whose value to get. + /// When this method returns, the value associated with the specified key, if the + /// key is found; otherwise, the default value for the type of the value parameter. + /// This parameter is passed uninitialized. + /// true if the object that implements Multimap contains + /// an item with the specified key; otherwise, false. + public bool TryGetValue(TKey key, out IList value) + { + return _dictionary.TryGetValue(key, out value); + } + + /// + /// Gets or sets the item with the specified key. + /// + /// The key of the item to get or set. + /// The value of the specified key. + public IList this[TKey key] + { + get => _dictionary[key]; + set => _dictionary[key] = value; + } + + /// + /// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap. + /// + public ICollection Keys => _dictionary.Keys; + + /// + /// Gets a System.Collections.Generic.ICollection containing the values of the Multimap. + /// + public ICollection> Values => _dictionary.Values; + + /// + /// Copy the items of the Multimap to an System.Array, + /// starting at a particular System.Array index. + /// + /// The one-dimensional System.Array that is the destination of the items copied + /// from Multimap. The System.Array must have zero-based indexing. + /// The zero-based index in array at which copying begins. + public void CopyTo(Array array, int index) + { + ((ICollection)_dictionary).CopyTo(array, index); + } + + /// + /// Adds an item with the provided key and value to the Multimap. + /// + /// The object to use as the key of the item to add. + /// The object to use as the value of the item to add. + /// Thrown when couldn't add value to Multimap. + public void Add(TKey key, TValue value) + { + if (value != null) + { + if (_dictionary.TryGetValue(key, out var list)) + { + list.Add(value); + } + else + { + list = new List { value }; + if (!TryAdd(key, list)) + throw new InvalidOperationException("Could not add value to Multimap."); + } + } + } + + #endregion Public Members + + #region Private Members + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryRemove(TKey key, out IList value) + { + _dictionary.TryGetValue(key, out value); + return _dictionary.Remove(key); + } + + /** + * Helper method to encapsulate generator differences between dictionary types. + */ + private bool TryAdd(TKey key, IList value) + { + try + { + _dictionary.Add(key, value); + } + catch (ArgumentException) + { + return false; + } + + return true; + } + #endregion Private Members + } +} diff --git a/algoliasearch/Search/Client/OpenAPIDateConverter.cs b/algoliasearch/Search/Client/OpenAPIDateConverter.cs new file mode 100644 index 000000000..5b94598e0 --- /dev/null +++ b/algoliasearch/Search/Client/OpenAPIDateConverter.cs @@ -0,0 +1,23 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using Newtonsoft.Json.Converters; + +namespace Algolia.Search.Search.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class OpenAPIDateConverter : IsoDateTimeConverter + { + /// + /// Initializes a new instance of the class. + /// + public OpenAPIDateConverter() + { + // full-date = date-fullyear "-" date-month "-" date-mday + DateTimeFormat = "yyyy-MM-dd"; + } + } +} diff --git a/algoliasearch/Search/Client/RequestOptions.cs b/algoliasearch/Search/Client/RequestOptions.cs new file mode 100644 index 000000000..406a0e54d --- /dev/null +++ b/algoliasearch/Search/Client/RequestOptions.cs @@ -0,0 +1,68 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; + +namespace Algolia.Search.Search.Client +{ + /// + /// A container for generalized request inputs. This type allows consumers to extend the request functionality + /// by abstracting away from the default (built-in) request framework (e.g. RestSharp). + /// + public class RequestOptions + { + /// + /// Parameters to be bound to path parts of the Request's URL + /// + public Dictionary PathParameters { get; set; } + + /// + /// Query parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap QueryParameters { get; set; } + + /// + /// Header parameters to be applied to the request. + /// Keys may have 1 or more values associated. + /// + public Multimap HeaderParameters { get; set; } + + /// + /// Form parameters to be sent along with the request. + /// + public Dictionary FormParameters { get; set; } + + /// + /// File parameters to be sent along with the request. + /// + public Multimap FileParameters { get; set; } + + /// + /// Cookies to be sent along with the request. + /// + public List Cookies { get; set; } + + /// + /// Any data associated with a request body. + /// + public Object Data { get; set; } + + /// + /// Constructs a new instance of + /// + public RequestOptions() + { + PathParameters = new Dictionary(); + QueryParameters = new Multimap(); + HeaderParameters = new Multimap(); + FormParameters = new Dictionary(); + FileParameters = new Multimap(); + Cookies = new List(); + } + } +} diff --git a/algoliasearch/Search/Client/WebRequestPathBuilder.cs b/algoliasearch/Search/Client/WebRequestPathBuilder.cs new file mode 100644 index 000000000..8a6d9fd81 --- /dev/null +++ b/algoliasearch/Search/Client/WebRequestPathBuilder.cs @@ -0,0 +1,47 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// +using System; +using System.Collections.Generic; + +namespace Algolia.Search.Search.Client +{ + /// + /// A URI builder + /// + class WebRequestPathBuilder + { + private string _baseUrl; + private string _path; + private string _query = "?"; + public WebRequestPathBuilder(string baseUrl, string path) + { + _baseUrl = baseUrl; + _path = path; + } + + public void AddPathParameters(Dictionary parameters) + { + foreach (var parameter in parameters) + { + _path = _path.Replace("{" + parameter.Key + "}", Uri.EscapeDataString(parameter.Value)); + } + } + + public void AddQueryParameters(Multimap parameters) + { + foreach (var parameter in parameters) + { + foreach (var value in parameter.Value) + { + _query = _query + parameter.Key + "=" + Uri.EscapeDataString(value) + "&"; + } + } + } + + public string GetFullUri() + { + return _baseUrl + _path + _query.Substring(0, _query.Length - 1); + } + } +} diff --git a/algoliasearch/Search/Models/AbstractOpenAPISchema.cs b/algoliasearch/Search/Models/AbstractOpenAPISchema.cs new file mode 100644 index 000000000..4581ae8d6 --- /dev/null +++ b/algoliasearch/Search/Models/AbstractOpenAPISchema.cs @@ -0,0 +1,70 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace Algolia.Search.Search.Models +{ + /// + /// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification + /// + public abstract partial class AbstractOpenAPISchema + { + /// + /// Custom JSON serializer + /// + static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Error, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Custom JSON serializer for objects with additional properties + /// + static public readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + MissingMemberHandling = MissingMemberHandling.Ignore, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Gets or Sets the actual instance + /// + public abstract Object ActualInstance { get; set; } + + /// + /// Gets or Sets IsNullable to indicate whether the instance is nullable + /// + public bool IsNullable { get; protected set; } + + /// + /// Gets or Sets the schema type, which can be either `oneOf` or `anyOf` + /// + public string SchemaType { get; protected set; } + + /// + /// Converts the instance into JSON string. + /// + public abstract string ToJson(); + } +} diff --git a/algoliasearch/Search/Models/Acl.cs b/algoliasearch/Search/Models/Acl.cs new file mode 100644 index 000000000..8b9e76a1f --- /dev/null +++ b/algoliasearch/Search/Models/Acl.cs @@ -0,0 +1,121 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// API key permissions: `addObject`: required to add or update records, copy or move an index. `analytics`: required to access the Analytics API. `browse`: required to view records `deleteIndex`: required to delete indices. `deleteObject`: required to delete records. `editSettings`: required to change index settings. `inference`: required to access the Inference API. `listIndexes`: required to list indices. `logs`: required to access logs of search and indexing operations. `recommendation`: required to access the Personalization and Recommend APIs. `search`: required to search records `seeUnretrievableAttributes`: required to retrieve [`unretrievableAttributes`](https://www.algolia.com/doc/api-reference/api-parameters/unretrievableAttributes/) for all operations that return records. `settings`: required to examine index settings. + /// + /// API key permissions: `addObject`: required to add or update records, copy or move an index. `analytics`: required to access the Analytics API. `browse`: required to view records `deleteIndex`: required to delete indices. `deleteObject`: required to delete records. `editSettings`: required to change index settings. `inference`: required to access the Inference API. `listIndexes`: required to list indices. `logs`: required to access logs of search and indexing operations. `recommendation`: required to access the Personalization and Recommend APIs. `search`: required to search records `seeUnretrievableAttributes`: required to retrieve [`unretrievableAttributes`](https://www.algolia.com/doc/api-reference/api-parameters/unretrievableAttributes/) for all operations that return records. `settings`: required to examine index settings. + [JsonConverter(typeof(StringEnumConverter))] + public enum Acl + { + /// + /// Enum AddObject for value: addObject + /// + [EnumMember(Value = "addObject")] + AddObject = 1, + + /// + /// Enum Analytics for value: analytics + /// + [EnumMember(Value = "analytics")] + Analytics = 2, + + /// + /// Enum Browse for value: browse + /// + [EnumMember(Value = "browse")] + Browse = 3, + + /// + /// Enum DeleteObject for value: deleteObject + /// + [EnumMember(Value = "deleteObject")] + DeleteObject = 4, + + /// + /// Enum DeleteIndex for value: deleteIndex + /// + [EnumMember(Value = "deleteIndex")] + DeleteIndex = 5, + + /// + /// Enum EditSettings for value: editSettings + /// + [EnumMember(Value = "editSettings")] + EditSettings = 6, + + /// + /// Enum Inference for value: inference + /// + [EnumMember(Value = "inference")] + Inference = 7, + + /// + /// Enum ListIndexes for value: listIndexes + /// + [EnumMember(Value = "listIndexes")] + ListIndexes = 8, + + /// + /// Enum Logs for value: logs + /// + [EnumMember(Value = "logs")] + Logs = 9, + + /// + /// Enum Personalization for value: personalization + /// + [EnumMember(Value = "personalization")] + Personalization = 10, + + /// + /// Enum Recommendation for value: recommendation + /// + [EnumMember(Value = "recommendation")] + Recommendation = 11, + + /// + /// Enum Search for value: search + /// + [EnumMember(Value = "search")] + Search = 12, + + /// + /// Enum SeeUnretrievableAttributes for value: seeUnretrievableAttributes + /// + [EnumMember(Value = "seeUnretrievableAttributes")] + SeeUnretrievableAttributes = 13, + + /// + /// Enum Settings for value: settings + /// + [EnumMember(Value = "settings")] + Settings = 14, + + /// + /// Enum Usage for value: usage + /// + [EnumMember(Value = "usage")] + Usage = 15 + } + +} diff --git a/algoliasearch/Search/Models/Action.cs b/algoliasearch/Search/Models/Action.cs new file mode 100644 index 000000000..2e453dc59 --- /dev/null +++ b/algoliasearch/Search/Models/Action.cs @@ -0,0 +1,73 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Type of batch operation. + /// + /// Type of batch operation. + [JsonConverter(typeof(StringEnumConverter))] + public enum Action + { + /// + /// Enum AddObject for value: addObject + /// + [EnumMember(Value = "addObject")] + AddObject = 1, + + /// + /// Enum UpdateObject for value: updateObject + /// + [EnumMember(Value = "updateObject")] + UpdateObject = 2, + + /// + /// Enum PartialUpdateObject for value: partialUpdateObject + /// + [EnumMember(Value = "partialUpdateObject")] + PartialUpdateObject = 3, + + /// + /// Enum PartialUpdateObjectNoCreate for value: partialUpdateObjectNoCreate + /// + [EnumMember(Value = "partialUpdateObjectNoCreate")] + PartialUpdateObjectNoCreate = 4, + + /// + /// Enum DeleteObject for value: deleteObject + /// + [EnumMember(Value = "deleteObject")] + DeleteObject = 5, + + /// + /// Enum Delete for value: delete + /// + [EnumMember(Value = "delete")] + Delete = 6, + + /// + /// Enum Clear for value: clear + /// + [EnumMember(Value = "clear")] + Clear = 7 + } + +} diff --git a/algoliasearch/Search/Models/AddApiKeyResponse.cs b/algoliasearch/Search/Models/AddApiKeyResponse.cs new file mode 100644 index 000000000..7a1a38775 --- /dev/null +++ b/algoliasearch/Search/Models/AddApiKeyResponse.cs @@ -0,0 +1,158 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// AddApiKeyResponse + /// + [DataContract(Name = "addApiKeyResponse")] + public partial class AddApiKeyResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AddApiKeyResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// API key. (required). + /// Timestamp of creation in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + public AddApiKeyResponse(string key = default(string), string createdAt = default(string)) + { + // to ensure "key" is required (not null) + if (key == null) + { + throw new ArgumentNullException("key is a required property for AddApiKeyResponse and cannot be null"); + } + this.Key = key; + // to ensure "createdAt" is required (not null) + if (createdAt == null) + { + throw new ArgumentNullException("createdAt is a required property for AddApiKeyResponse and cannot be null"); + } + this.CreatedAt = createdAt; + } + + /// + /// API key. + /// + /// API key. + [DataMember(Name = "key", IsRequired = true, EmitDefaultValue = true)] + public string Key { get; set; } + + /// + /// Timestamp of creation in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of creation in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public string CreatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AddApiKeyResponse {\n"); + sb.Append(" Key: ").Append(Key).Append("\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AddApiKeyResponse); + } + + /// + /// Returns true if AddApiKeyResponse instances are equal + /// + /// Instance of AddApiKeyResponse to be compared + /// Boolean + public bool Equals(AddApiKeyResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Key == input.Key || + (this.Key != null && + this.Key.Equals(input.Key)) + ) && + ( + this.CreatedAt == input.CreatedAt || + (this.CreatedAt != null && + this.CreatedAt.Equals(input.CreatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Key != null) + { + hashCode = (hashCode * 59) + this.Key.GetHashCode(); + } + if (this.CreatedAt != null) + { + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/AdvancedSyntaxFeatures.cs b/algoliasearch/Search/Models/AdvancedSyntaxFeatures.cs new file mode 100644 index 000000000..8180996e6 --- /dev/null +++ b/algoliasearch/Search/Models/AdvancedSyntaxFeatures.cs @@ -0,0 +1,42 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Defines advancedSyntaxFeatures + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AdvancedSyntaxFeatures + { + /// + /// Enum ExactPhrase for value: exactPhrase + /// + [EnumMember(Value = "exactPhrase")] + ExactPhrase = 1, + + /// + /// Enum ExcludeWords for value: excludeWords + /// + [EnumMember(Value = "excludeWords")] + ExcludeWords = 2 + } + +} diff --git a/algoliasearch/Search/Models/AlternativesAsExact.cs b/algoliasearch/Search/Models/AlternativesAsExact.cs new file mode 100644 index 000000000..5f8f24aa6 --- /dev/null +++ b/algoliasearch/Search/Models/AlternativesAsExact.cs @@ -0,0 +1,48 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Defines alternativesAsExact + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AlternativesAsExact + { + /// + /// Enum IgnorePlurals for value: ignorePlurals + /// + [EnumMember(Value = "ignorePlurals")] + IgnorePlurals = 1, + + /// + /// Enum SingleWordSynonym for value: singleWordSynonym + /// + [EnumMember(Value = "singleWordSynonym")] + SingleWordSynonym = 2, + + /// + /// Enum MultiWordsSynonym for value: multiWordsSynonym + /// + [EnumMember(Value = "multiWordsSynonym")] + MultiWordsSynonym = 3 + } + +} diff --git a/algoliasearch/Search/Models/Anchoring.cs b/algoliasearch/Search/Models/Anchoring.cs new file mode 100644 index 000000000..bc6f29da9 --- /dev/null +++ b/algoliasearch/Search/Models/Anchoring.cs @@ -0,0 +1,55 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Whether the pattern parameter matches the beginning (`startsWith`) or end (`endsWith`) of the query string, is an exact match (`is`), or a partial match (`contains`). + /// + /// Whether the pattern parameter matches the beginning (`startsWith`) or end (`endsWith`) of the query string, is an exact match (`is`), or a partial match (`contains`). + [JsonConverter(typeof(StringEnumConverter))] + public enum Anchoring + { + /// + /// Enum Is for value: is + /// + [EnumMember(Value = "is")] + Is = 1, + + /// + /// Enum StartsWith for value: startsWith + /// + [EnumMember(Value = "startsWith")] + StartsWith = 2, + + /// + /// Enum EndsWith for value: endsWith + /// + [EnumMember(Value = "endsWith")] + EndsWith = 3, + + /// + /// Enum Contains for value: contains + /// + [EnumMember(Value = "contains")] + Contains = 4 + } + +} diff --git a/algoliasearch/Search/Models/ApiKey.cs b/algoliasearch/Search/Models/ApiKey.cs new file mode 100644 index 000000000..374b5a788 --- /dev/null +++ b/algoliasearch/Search/Models/ApiKey.cs @@ -0,0 +1,260 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// API key object. + /// + [DataContract(Name = "apiKey")] + public partial class ApiKey : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ApiKey() { } + /// + /// Initializes a new instance of the class. + /// + /// [Permissions](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl) associated with the key. (required). + /// Description of an API key for you and your team members. (default to ""). + /// Restricts this API key to a list of indices or index patterns. If the list is empty, all indices are allowed. Specify either an exact index name or a pattern with a leading or trailing wildcard character (or both). For example: - `dev_*` matches all indices starting with \"dev_\" - `*_dev` matches all indices ending with \"_dev\" - `*_products_*` matches all indices containing \"_products_\". . + /// Maximum number of hits this API key can retrieve in one query. If zero, no limit is enforced. > **Note**: Use this parameter to protect you from third-party attempts to retrieve your entire content by massively querying the index. (default to 0). + /// Maximum number of API calls per hour allowed from a given IP address or [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/). Each time an API call is performed with this key, a check is performed. If there were more than the specified number of calls within the last hour, the API returns an error with the status code `429` (Too Many Requests). > **Note**: Use this parameter to protect you from third-party attempts to retrieve your entire content by massively querying the index. (default to 0). + /// Force some [query parameters](https://www.algolia.com/doc/api-reference/api-parameters/) to be applied for each query made with this API key. It's a URL-encoded query string. (default to ""). + /// Restrict this API key to specific [referrers](https://www.algolia.com/doc/guides/security/api-keys/in-depth/api-key-restrictions/#http-referrers). If empty, all referrers are allowed. For example: - `https://algolia.com/_*` matches all referrers starting with \"https://algolia.com/\" - `*.algolia.com` matches all referrers ending with \".algolia.com\" - `*algolia.com*` allows everything in the domain \"algolia.com\". . + /// Validity duration of a key (in seconds). The key will automatically be removed after this time has expired. The default value of 0 never expires. Short-lived API keys are useful to grant temporary access to your data. For example, in mobile apps, you can't [control when users update your app](https://www.algolia.com/doc/guides/security/security-best-practices/#use-secured-api-keys-in-mobile-apps). So instead of encoding keys into your app as you would for a web app, you should dynamically fetch them from your mobile app's backend. (default to 0). + public ApiKey(List acl = default(List), string description = @"", List indexes = default(List), int maxHitsPerQuery = 0, int maxQueriesPerIPPerHour = 0, string queryParameters = @"", List referers = default(List), int validity = 0) + { + // to ensure "acl" is required (not null) + if (acl == null) + { + throw new ArgumentNullException("acl is a required property for ApiKey and cannot be null"); + } + this.Acl = acl; + // use default value if no "description" provided + this.Description = description ?? @""; + this.Indexes = indexes; + this.MaxHitsPerQuery = maxHitsPerQuery; + this.MaxQueriesPerIPPerHour = maxQueriesPerIPPerHour; + // use default value if no "queryParameters" provided + this.QueryParameters = queryParameters ?? @""; + this.Referers = referers; + this.Validity = validity; + } + + /// + /// [Permissions](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl) associated with the key. + /// + /// [Permissions](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl) associated with the key. + [DataMember(Name = "acl", IsRequired = true, EmitDefaultValue = true)] + public List Acl { get; set; } + + /// + /// Description of an API key for you and your team members. + /// + /// Description of an API key for you and your team members. + [DataMember(Name = "description", EmitDefaultValue = false)] + public string Description { get; set; } + + /// + /// Restricts this API key to a list of indices or index patterns. If the list is empty, all indices are allowed. Specify either an exact index name or a pattern with a leading or trailing wildcard character (or both). For example: - `dev_*` matches all indices starting with \"dev_\" - `*_dev` matches all indices ending with \"_dev\" - `*_products_*` matches all indices containing \"_products_\". + /// + /// Restricts this API key to a list of indices or index patterns. If the list is empty, all indices are allowed. Specify either an exact index name or a pattern with a leading or trailing wildcard character (or both). For example: - `dev_*` matches all indices starting with \"dev_\" - `*_dev` matches all indices ending with \"_dev\" - `*_products_*` matches all indices containing \"_products_\". + [DataMember(Name = "indexes", EmitDefaultValue = false)] + public List Indexes { get; set; } + + /// + /// Maximum number of hits this API key can retrieve in one query. If zero, no limit is enforced. > **Note**: Use this parameter to protect you from third-party attempts to retrieve your entire content by massively querying the index. + /// + /// Maximum number of hits this API key can retrieve in one query. If zero, no limit is enforced. > **Note**: Use this parameter to protect you from third-party attempts to retrieve your entire content by massively querying the index. + [DataMember(Name = "maxHitsPerQuery", EmitDefaultValue = false)] + public int MaxHitsPerQuery { get; set; } + + /// + /// Maximum number of API calls per hour allowed from a given IP address or [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/). Each time an API call is performed with this key, a check is performed. If there were more than the specified number of calls within the last hour, the API returns an error with the status code `429` (Too Many Requests). > **Note**: Use this parameter to protect you from third-party attempts to retrieve your entire content by massively querying the index. + /// + /// Maximum number of API calls per hour allowed from a given IP address or [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/). Each time an API call is performed with this key, a check is performed. If there were more than the specified number of calls within the last hour, the API returns an error with the status code `429` (Too Many Requests). > **Note**: Use this parameter to protect you from third-party attempts to retrieve your entire content by massively querying the index. + [DataMember(Name = "maxQueriesPerIPPerHour", EmitDefaultValue = false)] + public int MaxQueriesPerIPPerHour { get; set; } + + /// + /// Force some [query parameters](https://www.algolia.com/doc/api-reference/api-parameters/) to be applied for each query made with this API key. It's a URL-encoded query string. + /// + /// Force some [query parameters](https://www.algolia.com/doc/api-reference/api-parameters/) to be applied for each query made with this API key. It's a URL-encoded query string. + [DataMember(Name = "queryParameters", EmitDefaultValue = false)] + public string QueryParameters { get; set; } + + /// + /// Restrict this API key to specific [referrers](https://www.algolia.com/doc/guides/security/api-keys/in-depth/api-key-restrictions/#http-referrers). If empty, all referrers are allowed. For example: - `https://algolia.com/_*` matches all referrers starting with \"https://algolia.com/\" - `*.algolia.com` matches all referrers ending with \".algolia.com\" - `*algolia.com*` allows everything in the domain \"algolia.com\". + /// + /// Restrict this API key to specific [referrers](https://www.algolia.com/doc/guides/security/api-keys/in-depth/api-key-restrictions/#http-referrers). If empty, all referrers are allowed. For example: - `https://algolia.com/_*` matches all referrers starting with \"https://algolia.com/\" - `*.algolia.com` matches all referrers ending with \".algolia.com\" - `*algolia.com*` allows everything in the domain \"algolia.com\". + [DataMember(Name = "referers", EmitDefaultValue = false)] + public List Referers { get; set; } + + /// + /// Validity duration of a key (in seconds). The key will automatically be removed after this time has expired. The default value of 0 never expires. Short-lived API keys are useful to grant temporary access to your data. For example, in mobile apps, you can't [control when users update your app](https://www.algolia.com/doc/guides/security/security-best-practices/#use-secured-api-keys-in-mobile-apps). So instead of encoding keys into your app as you would for a web app, you should dynamically fetch them from your mobile app's backend. + /// + /// Validity duration of a key (in seconds). The key will automatically be removed after this time has expired. The default value of 0 never expires. Short-lived API keys are useful to grant temporary access to your data. For example, in mobile apps, you can't [control when users update your app](https://www.algolia.com/doc/guides/security/security-best-practices/#use-secured-api-keys-in-mobile-apps). So instead of encoding keys into your app as you would for a web app, you should dynamically fetch them from your mobile app's backend. + [DataMember(Name = "validity", EmitDefaultValue = false)] + public int Validity { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ApiKey {\n"); + sb.Append(" Acl: ").Append(Acl).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append(" Indexes: ").Append(Indexes).Append("\n"); + sb.Append(" MaxHitsPerQuery: ").Append(MaxHitsPerQuery).Append("\n"); + sb.Append(" MaxQueriesPerIPPerHour: ").Append(MaxQueriesPerIPPerHour).Append("\n"); + sb.Append(" QueryParameters: ").Append(QueryParameters).Append("\n"); + sb.Append(" Referers: ").Append(Referers).Append("\n"); + sb.Append(" Validity: ").Append(Validity).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ApiKey); + } + + /// + /// Returns true if ApiKey instances are equal + /// + /// Instance of ApiKey to be compared + /// Boolean + public bool Equals(ApiKey input) + { + if (input == null) + { + return false; + } + return + ( + this.Acl == input.Acl || + this.Acl != null && + input.Acl != null && + this.Acl.SequenceEqual(input.Acl) + ) && + ( + this.Description == input.Description || + (this.Description != null && + this.Description.Equals(input.Description)) + ) && + ( + this.Indexes == input.Indexes || + this.Indexes != null && + input.Indexes != null && + this.Indexes.SequenceEqual(input.Indexes) + ) && + ( + this.MaxHitsPerQuery == input.MaxHitsPerQuery || + this.MaxHitsPerQuery.Equals(input.MaxHitsPerQuery) + ) && + ( + this.MaxQueriesPerIPPerHour == input.MaxQueriesPerIPPerHour || + this.MaxQueriesPerIPPerHour.Equals(input.MaxQueriesPerIPPerHour) + ) && + ( + this.QueryParameters == input.QueryParameters || + (this.QueryParameters != null && + this.QueryParameters.Equals(input.QueryParameters)) + ) && + ( + this.Referers == input.Referers || + this.Referers != null && + input.Referers != null && + this.Referers.SequenceEqual(input.Referers) + ) && + ( + this.Validity == input.Validity || + this.Validity.Equals(input.Validity) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Acl != null) + { + hashCode = (hashCode * 59) + this.Acl.GetHashCode(); + } + if (this.Description != null) + { + hashCode = (hashCode * 59) + this.Description.GetHashCode(); + } + if (this.Indexes != null) + { + hashCode = (hashCode * 59) + this.Indexes.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MaxHitsPerQuery.GetHashCode(); + hashCode = (hashCode * 59) + this.MaxQueriesPerIPPerHour.GetHashCode(); + if (this.QueryParameters != null) + { + hashCode = (hashCode * 59) + this.QueryParameters.GetHashCode(); + } + if (this.Referers != null) + { + hashCode = (hashCode * 59) + this.Referers.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Validity.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/AroundPrecision.cs b/algoliasearch/Search/Models/AroundPrecision.cs new file mode 100644 index 000000000..bde696b71 --- /dev/null +++ b/algoliasearch/Search/Models/AroundPrecision.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// Precision of a geographical search (in meters), to [group results that are more or less the same distance from a central point](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/in-depth/geo-ranking-precision/). + /// + [JsonConverter(typeof(AroundPrecisionJsonConverter))] + [DataContract(Name = "aroundPrecision")] + public partial class AroundPrecision : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of int. + public AroundPrecision(int actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<AroundPrecisionFromValueInner>. + public AroundPrecision(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(int)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, int"); + } + } + } + + /// + /// Get the actual instance of `int`. If the actual instance is not `int`, + /// the InvalidClassException will be thrown + /// + /// An instance of int + public int GetterInt() + { + return (int)this.ActualInstance; + } + + /// + /// Get the actual instance of `List<AroundPrecisionFromValueInner>`. If the actual instance is not `List<AroundPrecisionFromValueInner>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<AroundPrecisionFromValueInner> + public List GetterList() + { + return (List)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class AroundPrecision {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, AroundPrecision.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of AroundPrecision + /// + /// JSON string + /// An instance of AroundPrecision + public static AroundPrecision FromJson(string jsonString) + { + AroundPrecision newAroundPrecision = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newAroundPrecision; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newAroundPrecision = new AroundPrecision(JsonConvert.DeserializeObject>(jsonString, AroundPrecision.SerializerSettings)); + } + else + { + newAroundPrecision = new AroundPrecision(JsonConvert.DeserializeObject>(jsonString, AroundPrecision.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(int).GetProperty("AdditionalProperties") == null) + { + newAroundPrecision = new AroundPrecision(JsonConvert.DeserializeObject(jsonString, AroundPrecision.SerializerSettings)); + } + else + { + newAroundPrecision = new AroundPrecision(JsonConvert.DeserializeObject(jsonString, AroundPrecision.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("int"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into int: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newAroundPrecision; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AroundPrecision); + } + + /// + /// Returns true if AroundPrecision instances are equal + /// + /// Instance of AroundPrecision to be compared + /// Boolean + public bool Equals(AroundPrecision input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for AroundPrecision + /// + public class AroundPrecisionJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(AroundPrecision).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return AroundPrecision.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/AroundPrecisionFromValueInner.cs b/algoliasearch/Search/Models/AroundPrecisionFromValueInner.cs new file mode 100644 index 000000000..50de07cdf --- /dev/null +++ b/algoliasearch/Search/Models/AroundPrecisionFromValueInner.cs @@ -0,0 +1,133 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// AroundPrecisionFromValueInner + /// + [DataContract(Name = "aroundPrecisionFromValue_inner")] + public partial class AroundPrecisionFromValueInner : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// from. + /// value. + public AroundPrecisionFromValueInner(int from = default(int), int value = default(int)) + { + this.From = from; + this.Value = value; + } + + /// + /// Gets or Sets From + /// + [DataMember(Name = "from", EmitDefaultValue = false)] + public int From { get; set; } + + /// + /// Gets or Sets Value + /// + [DataMember(Name = "value", EmitDefaultValue = false)] + public int Value { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AroundPrecisionFromValueInner {\n"); + sb.Append(" From: ").Append(From).Append("\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AroundPrecisionFromValueInner); + } + + /// + /// Returns true if AroundPrecisionFromValueInner instances are equal + /// + /// Instance of AroundPrecisionFromValueInner to be compared + /// Boolean + public bool Equals(AroundPrecisionFromValueInner input) + { + if (input == null) + { + return false; + } + return + ( + this.From == input.From || + this.From.Equals(input.From) + ) && + ( + this.Value == input.Value || + this.Value.Equals(input.Value) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.From.GetHashCode(); + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/AroundRadius.cs b/algoliasearch/Search/Models/AroundRadius.cs new file mode 100644 index 000000000..6c83b800e --- /dev/null +++ b/algoliasearch/Search/Models/AroundRadius.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// [Maximum radius](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#increase-the-search-radius) for a geographical search (in meters). + /// + [JsonConverter(typeof(AroundRadiusJsonConverter))] + [DataContract(Name = "aroundRadius")] + public partial class AroundRadius : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of int. + public AroundRadius(int actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of AroundRadiusAll. + public AroundRadius(AroundRadiusAll actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(AroundRadiusAll)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(int)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: AroundRadiusAll, int"); + } + } + } + + /// + /// Get the actual instance of `int`. If the actual instance is not `int`, + /// the InvalidClassException will be thrown + /// + /// An instance of int + public int GetterInt() + { + return (int)this.ActualInstance; + } + + /// + /// Get the actual instance of `AroundRadiusAll`. If the actual instance is not `AroundRadiusAll`, + /// the InvalidClassException will be thrown + /// + /// An instance of AroundRadiusAll + public AroundRadiusAll GetterAroundRadiusAll() + { + return (AroundRadiusAll)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class AroundRadius {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, AroundRadius.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of AroundRadius + /// + /// JSON string + /// An instance of AroundRadius + public static AroundRadius FromJson(string jsonString) + { + AroundRadius newAroundRadius = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newAroundRadius; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(AroundRadiusAll).GetProperty("AdditionalProperties") == null) + { + newAroundRadius = new AroundRadius(JsonConvert.DeserializeObject(jsonString, AroundRadius.SerializerSettings)); + } + else + { + newAroundRadius = new AroundRadius(JsonConvert.DeserializeObject(jsonString, AroundRadius.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("AroundRadiusAll"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into AroundRadiusAll: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(int).GetProperty("AdditionalProperties") == null) + { + newAroundRadius = new AroundRadius(JsonConvert.DeserializeObject(jsonString, AroundRadius.SerializerSettings)); + } + else + { + newAroundRadius = new AroundRadius(JsonConvert.DeserializeObject(jsonString, AroundRadius.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("int"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into int: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newAroundRadius; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AroundRadius); + } + + /// + /// Returns true if AroundRadius instances are equal + /// + /// Instance of AroundRadius to be compared + /// Boolean + public bool Equals(AroundRadius input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for AroundRadius + /// + public class AroundRadiusJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(AroundRadius).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return AroundRadius.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/AroundRadiusAll.cs b/algoliasearch/Search/Models/AroundRadiusAll.cs new file mode 100644 index 000000000..b38a2c49b --- /dev/null +++ b/algoliasearch/Search/Models/AroundRadiusAll.cs @@ -0,0 +1,36 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Defines aroundRadiusAll + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AroundRadiusAll + { + /// + /// Enum All for value: all + /// + [EnumMember(Value = "all")] + All = 1 + } + +} diff --git a/algoliasearch/Search/Models/AssignUserIdParams.cs b/algoliasearch/Search/Models/AssignUserIdParams.cs new file mode 100644 index 000000000..36e59850a --- /dev/null +++ b/algoliasearch/Search/Models/AssignUserIdParams.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Assign userID parameters. + /// + [DataContract(Name = "assignUserIdParams")] + public partial class AssignUserIdParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AssignUserIdParams() { } + /// + /// Initializes a new instance of the class. + /// + /// Cluster name. (required). + public AssignUserIdParams(string cluster = default(string)) + { + // to ensure "cluster" is required (not null) + if (cluster == null) + { + throw new ArgumentNullException("cluster is a required property for AssignUserIdParams and cannot be null"); + } + this.Cluster = cluster; + } + + /// + /// Cluster name. + /// + /// Cluster name. + [DataMember(Name = "cluster", IsRequired = true, EmitDefaultValue = true)] + public string Cluster { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AssignUserIdParams {\n"); + sb.Append(" Cluster: ").Append(Cluster).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AssignUserIdParams); + } + + /// + /// Returns true if AssignUserIdParams instances are equal + /// + /// Instance of AssignUserIdParams to be compared + /// Boolean + public bool Equals(AssignUserIdParams input) + { + if (input == null) + { + return false; + } + return + ( + this.Cluster == input.Cluster || + (this.Cluster != null && + this.Cluster.Equals(input.Cluster)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Cluster != null) + { + hashCode = (hashCode * 59) + this.Cluster.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/AttributeToUpdate.cs b/algoliasearch/Search/Models/AttributeToUpdate.cs new file mode 100644 index 000000000..5d6308103 --- /dev/null +++ b/algoliasearch/Search/Models/AttributeToUpdate.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// AttributeToUpdate + /// + [JsonConverter(typeof(AttributeToUpdateJsonConverter))] + [DataContract(Name = "attributeToUpdate")] + public partial class AttributeToUpdate : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public AttributeToUpdate(string actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of BuiltInOperation. + public AttributeToUpdate(BuiltInOperation actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(BuiltInOperation)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: BuiltInOperation, string"); + } + } + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Get the actual instance of `BuiltInOperation`. If the actual instance is not `BuiltInOperation`, + /// the InvalidClassException will be thrown + /// + /// An instance of BuiltInOperation + public BuiltInOperation GetterBuiltInOperation() + { + return (BuiltInOperation)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class AttributeToUpdate {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, AttributeToUpdate.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of AttributeToUpdate + /// + /// JSON string + /// An instance of AttributeToUpdate + public static AttributeToUpdate FromJson(string jsonString) + { + AttributeToUpdate newAttributeToUpdate = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newAttributeToUpdate; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(BuiltInOperation).GetProperty("AdditionalProperties") == null) + { + newAttributeToUpdate = new AttributeToUpdate(JsonConvert.DeserializeObject(jsonString, AttributeToUpdate.SerializerSettings)); + } + else + { + newAttributeToUpdate = new AttributeToUpdate(JsonConvert.DeserializeObject(jsonString, AttributeToUpdate.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("BuiltInOperation"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into BuiltInOperation: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newAttributeToUpdate = new AttributeToUpdate(JsonConvert.DeserializeObject(jsonString, AttributeToUpdate.SerializerSettings)); + } + else + { + newAttributeToUpdate = new AttributeToUpdate(JsonConvert.DeserializeObject(jsonString, AttributeToUpdate.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newAttributeToUpdate; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AttributeToUpdate); + } + + /// + /// Returns true if AttributeToUpdate instances are equal + /// + /// Instance of AttributeToUpdate to be compared + /// Boolean + public bool Equals(AttributeToUpdate input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for AttributeToUpdate + /// + public class AttributeToUpdateJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(AttributeToUpdate).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return AttributeToUpdate.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/AutomaticFacetFilter.cs b/algoliasearch/Search/Models/AutomaticFacetFilter.cs new file mode 100644 index 000000000..1fc4fae05 --- /dev/null +++ b/algoliasearch/Search/Models/AutomaticFacetFilter.cs @@ -0,0 +1,164 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Automatic facet Filter. + /// + [DataContract(Name = "automaticFacetFilter")] + public partial class AutomaticFacetFilter : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected AutomaticFacetFilter() { } + /// + /// Initializes a new instance of the class. + /// + /// Attribute to filter on. This must match a facet placeholder in the Rule's pattern. (required). + /// Score for the filter. Typically used for optional or disjunctive filters. (default to 1). + /// Whether the filter is disjunctive (true) or conjunctive (false). (default to false). + public AutomaticFacetFilter(string facet = default(string), int score = 1, bool disjunctive = false) + { + // to ensure "facet" is required (not null) + if (facet == null) + { + throw new ArgumentNullException("facet is a required property for AutomaticFacetFilter and cannot be null"); + } + this.Facet = facet; + this.Score = score; + this.Disjunctive = disjunctive; + } + + /// + /// Attribute to filter on. This must match a facet placeholder in the Rule's pattern. + /// + /// Attribute to filter on. This must match a facet placeholder in the Rule's pattern. + [DataMember(Name = "facet", IsRequired = true, EmitDefaultValue = true)] + public string Facet { get; set; } + + /// + /// Score for the filter. Typically used for optional or disjunctive filters. + /// + /// Score for the filter. Typically used for optional or disjunctive filters. + [DataMember(Name = "score", EmitDefaultValue = false)] + public int Score { get; set; } + + /// + /// Whether the filter is disjunctive (true) or conjunctive (false). + /// + /// Whether the filter is disjunctive (true) or conjunctive (false). + [DataMember(Name = "disjunctive", EmitDefaultValue = true)] + public bool Disjunctive { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AutomaticFacetFilter {\n"); + sb.Append(" Facet: ").Append(Facet).Append("\n"); + sb.Append(" Score: ").Append(Score).Append("\n"); + sb.Append(" Disjunctive: ").Append(Disjunctive).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AutomaticFacetFilter); + } + + /// + /// Returns true if AutomaticFacetFilter instances are equal + /// + /// Instance of AutomaticFacetFilter to be compared + /// Boolean + public bool Equals(AutomaticFacetFilter input) + { + if (input == null) + { + return false; + } + return + ( + this.Facet == input.Facet || + (this.Facet != null && + this.Facet.Equals(input.Facet)) + ) && + ( + this.Score == input.Score || + this.Score.Equals(input.Score) + ) && + ( + this.Disjunctive == input.Disjunctive || + this.Disjunctive.Equals(input.Disjunctive) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Facet != null) + { + hashCode = (hashCode * 59) + this.Facet.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Score.GetHashCode(); + hashCode = (hashCode * 59) + this.Disjunctive.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/AutomaticFacetFilters.cs b/algoliasearch/Search/Models/AutomaticFacetFilters.cs new file mode 100644 index 000000000..dcd43238a --- /dev/null +++ b/algoliasearch/Search/Models/AutomaticFacetFilters.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// Names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern. + /// + [JsonConverter(typeof(AutomaticFacetFiltersJsonConverter))] + [DataContract(Name = "automaticFacetFilters")] + public partial class AutomaticFacetFilters : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<AutomaticFacetFilter>. + public AutomaticFacetFilters(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<string>. + public AutomaticFacetFilters(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, List"); + } + } + } + + /// + /// Get the actual instance of `List<AutomaticFacetFilter>`. If the actual instance is not `List<AutomaticFacetFilter>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<AutomaticFacetFilter> + public List GetterList() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `List<string>`. If the actual instance is not `List<string>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<string> + public List GetterListString() + { + return (List)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class AutomaticFacetFilters {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, AutomaticFacetFilters.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of AutomaticFacetFilters + /// + /// JSON string + /// An instance of AutomaticFacetFilters + public static AutomaticFacetFilters FromJson(string jsonString) + { + AutomaticFacetFilters newAutomaticFacetFilters = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newAutomaticFacetFilters; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newAutomaticFacetFilters = new AutomaticFacetFilters(JsonConvert.DeserializeObject>(jsonString, AutomaticFacetFilters.SerializerSettings)); + } + else + { + newAutomaticFacetFilters = new AutomaticFacetFilters(JsonConvert.DeserializeObject>(jsonString, AutomaticFacetFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newAutomaticFacetFilters = new AutomaticFacetFilters(JsonConvert.DeserializeObject>(jsonString, AutomaticFacetFilters.SerializerSettings)); + } + else + { + newAutomaticFacetFilters = new AutomaticFacetFilters(JsonConvert.DeserializeObject>(jsonString, AutomaticFacetFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newAutomaticFacetFilters; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as AutomaticFacetFilters); + } + + /// + /// Returns true if AutomaticFacetFilters instances are equal + /// + /// Instance of AutomaticFacetFilters to be compared + /// Boolean + public bool Equals(AutomaticFacetFilters input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for AutomaticFacetFilters + /// + public class AutomaticFacetFiltersJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(AutomaticFacetFilters).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return AutomaticFacetFilters.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/BaseGetApiKeyResponse.cs b/algoliasearch/Search/Models/BaseGetApiKeyResponse.cs new file mode 100644 index 000000000..2f8ed1dce --- /dev/null +++ b/algoliasearch/Search/Models/BaseGetApiKeyResponse.cs @@ -0,0 +1,144 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// BaseGetApiKeyResponse + /// + [DataContract(Name = "baseGetApiKeyResponse")] + public partial class BaseGetApiKeyResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BaseGetApiKeyResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// API key.. + /// Timestamp of creation in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). (required). + public BaseGetApiKeyResponse(string value = default(string), long createdAt = default(long)) + { + this.CreatedAt = createdAt; + this.Value = value; + } + + /// + /// API key. + /// + /// API key. + [DataMember(Name = "value", EmitDefaultValue = false)] + public string Value { get; set; } + + /// + /// Timestamp of creation in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). + /// + /// Timestamp of creation in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public long CreatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BaseGetApiKeyResponse {\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BaseGetApiKeyResponse); + } + + /// + /// Returns true if BaseGetApiKeyResponse instances are equal + /// + /// Instance of BaseGetApiKeyResponse to be compared + /// Boolean + public bool Equals(BaseGetApiKeyResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Value == input.Value || + (this.Value != null && + this.Value.Equals(input.Value)) + ) && + ( + this.CreatedAt == input.CreatedAt || + this.CreatedAt.Equals(input.CreatedAt) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Value != null) + { + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + } + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/BaseIndexSettings.cs b/algoliasearch/Search/Models/BaseIndexSettings.cs new file mode 100644 index 000000000..75982bf4b --- /dev/null +++ b/algoliasearch/Search/Models/BaseIndexSettings.cs @@ -0,0 +1,412 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// BaseIndexSettings + /// + [DataContract(Name = "baseIndexSettings")] + public partial class BaseIndexSettings : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Creates [replicas](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/), which are copies of a primary index with the same records but different settings.. + /// Maximum number of hits accessible through pagination. (default to 1000). + /// Attributes that can't be retrieved at query time.. + /// Words for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/).. + /// Attributes in your index to which [Japanese transliteration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#japanese-transliteration-and-type-ahead) applies. This will ensure that words indexed in Katakana or Kanji can also be searched in Hiragana.. + /// Attributes on which to split [camel case](https://wikipedia.org/wiki/Camel_case) words.. + /// Attributes in your index to which [word segmentation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) (decompounding) applies.. + /// Set the languages of your index, for language-specific processing steps such as [tokenization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/tokenization/) and [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/).. + /// Attributes for which you want to turn off [prefix matching](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#adjusting-prefix-search).. + /// Incidates whether the engine compresses arrays with exclusively non-negative integers. When enabled, the compressed arrays may be reordered. (default to false). + /// Numeric attributes that can be used as [numerical filters](https://www.algolia.com/doc/guides/managing-results/rules/detecting-intent/how-to/applying-a-custom-filter-for-a-specific-query/#numerical-filters).. + /// Controls which separators are added to an Algolia index as part of [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean). Separators are all non-letter characters except spaces and currency characters, such as $€£¥. (default to ""). + /// [Attributes used for searching](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/), including determining [if matches at the beginning of a word are important (ordered) or not (unordered)](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/how-to/configuring-searchable-attributes-the-right-way/#understanding-word-position). . + /// Lets you store custom data in your indices.. + /// A list of characters and their normalized replacements to override Algolia's default [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/).. + /// Name of the deduplication attribute to be used with Algolia's [_distinct_ feature](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/#introducing-algolias-distinct-feature).. + public BaseIndexSettings(List replicas = default(List), int paginationLimitedTo = 1000, List unretrievableAttributes = default(List), List disableTypoToleranceOnWords = default(List), List attributesToTransliterate = default(List), List camelCaseAttributes = default(List), Object decompoundedAttributes = default(Object), List indexLanguages = default(List), List disablePrefixOnAttributes = default(List), bool allowCompressionOfIntegerArray = false, List numericAttributesForFiltering = default(List), string separatorsToIndex = @"", List searchableAttributes = default(List), Object userData = default(Object), Dictionary> customNormalization = default(Dictionary>), string attributeForDistinct = default(string)) + { + this.Replicas = replicas; + this.PaginationLimitedTo = paginationLimitedTo; + this.UnretrievableAttributes = unretrievableAttributes; + this.DisableTypoToleranceOnWords = disableTypoToleranceOnWords; + this.AttributesToTransliterate = attributesToTransliterate; + this.CamelCaseAttributes = camelCaseAttributes; + this.DecompoundedAttributes = decompoundedAttributes; + this.IndexLanguages = indexLanguages; + this.DisablePrefixOnAttributes = disablePrefixOnAttributes; + this.AllowCompressionOfIntegerArray = allowCompressionOfIntegerArray; + this.NumericAttributesForFiltering = numericAttributesForFiltering; + // use default value if no "separatorsToIndex" provided + this.SeparatorsToIndex = separatorsToIndex ?? @""; + this.SearchableAttributes = searchableAttributes; + this.UserData = userData; + this.CustomNormalization = customNormalization; + this.AttributeForDistinct = attributeForDistinct; + } + + /// + /// Creates [replicas](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/), which are copies of a primary index with the same records but different settings. + /// + /// Creates [replicas](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/), which are copies of a primary index with the same records but different settings. + [DataMember(Name = "replicas", EmitDefaultValue = false)] + public List Replicas { get; set; } + + /// + /// Maximum number of hits accessible through pagination. + /// + /// Maximum number of hits accessible through pagination. + [DataMember(Name = "paginationLimitedTo", EmitDefaultValue = false)] + public int PaginationLimitedTo { get; set; } + + /// + /// Attributes that can't be retrieved at query time. + /// + /// Attributes that can't be retrieved at query time. + [DataMember(Name = "unretrievableAttributes", EmitDefaultValue = false)] + public List UnretrievableAttributes { get; set; } + + /// + /// Words for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + /// + /// Words for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + [DataMember(Name = "disableTypoToleranceOnWords", EmitDefaultValue = false)] + public List DisableTypoToleranceOnWords { get; set; } + + /// + /// Attributes in your index to which [Japanese transliteration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#japanese-transliteration-and-type-ahead) applies. This will ensure that words indexed in Katakana or Kanji can also be searched in Hiragana. + /// + /// Attributes in your index to which [Japanese transliteration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#japanese-transliteration-and-type-ahead) applies. This will ensure that words indexed in Katakana or Kanji can also be searched in Hiragana. + [DataMember(Name = "attributesToTransliterate", EmitDefaultValue = false)] + public List AttributesToTransliterate { get; set; } + + /// + /// Attributes on which to split [camel case](https://wikipedia.org/wiki/Camel_case) words. + /// + /// Attributes on which to split [camel case](https://wikipedia.org/wiki/Camel_case) words. + [DataMember(Name = "camelCaseAttributes", EmitDefaultValue = false)] + public List CamelCaseAttributes { get; set; } + + /// + /// Attributes in your index to which [word segmentation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) (decompounding) applies. + /// + /// Attributes in your index to which [word segmentation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) (decompounding) applies. + [DataMember(Name = "decompoundedAttributes", EmitDefaultValue = false)] + public Object DecompoundedAttributes { get; set; } + + /// + /// Set the languages of your index, for language-specific processing steps such as [tokenization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/tokenization/) and [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + /// + /// Set the languages of your index, for language-specific processing steps such as [tokenization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/tokenization/) and [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + [DataMember(Name = "indexLanguages", EmitDefaultValue = false)] + public List IndexLanguages { get; set; } + + /// + /// Attributes for which you want to turn off [prefix matching](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#adjusting-prefix-search). + /// + /// Attributes for which you want to turn off [prefix matching](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#adjusting-prefix-search). + [DataMember(Name = "disablePrefixOnAttributes", EmitDefaultValue = false)] + public List DisablePrefixOnAttributes { get; set; } + + /// + /// Incidates whether the engine compresses arrays with exclusively non-negative integers. When enabled, the compressed arrays may be reordered. + /// + /// Incidates whether the engine compresses arrays with exclusively non-negative integers. When enabled, the compressed arrays may be reordered. + [DataMember(Name = "allowCompressionOfIntegerArray", EmitDefaultValue = true)] + public bool AllowCompressionOfIntegerArray { get; set; } + + /// + /// Numeric attributes that can be used as [numerical filters](https://www.algolia.com/doc/guides/managing-results/rules/detecting-intent/how-to/applying-a-custom-filter-for-a-specific-query/#numerical-filters). + /// + /// Numeric attributes that can be used as [numerical filters](https://www.algolia.com/doc/guides/managing-results/rules/detecting-intent/how-to/applying-a-custom-filter-for-a-specific-query/#numerical-filters). + [DataMember(Name = "numericAttributesForFiltering", EmitDefaultValue = false)] + public List NumericAttributesForFiltering { get; set; } + + /// + /// Controls which separators are added to an Algolia index as part of [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean). Separators are all non-letter characters except spaces and currency characters, such as $€£¥. + /// + /// Controls which separators are added to an Algolia index as part of [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean). Separators are all non-letter characters except spaces and currency characters, such as $€£¥. + [DataMember(Name = "separatorsToIndex", EmitDefaultValue = false)] + public string SeparatorsToIndex { get; set; } + + /// + /// [Attributes used for searching](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/), including determining [if matches at the beginning of a word are important (ordered) or not (unordered)](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/how-to/configuring-searchable-attributes-the-right-way/#understanding-word-position). + /// + /// [Attributes used for searching](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/), including determining [if matches at the beginning of a word are important (ordered) or not (unordered)](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/how-to/configuring-searchable-attributes-the-right-way/#understanding-word-position). + [DataMember(Name = "searchableAttributes", EmitDefaultValue = false)] + public List SearchableAttributes { get; set; } + + /// + /// Lets you store custom data in your indices. + /// + /// Lets you store custom data in your indices. + [DataMember(Name = "userData", EmitDefaultValue = true)] + public Object UserData { get; set; } + + /// + /// A list of characters and their normalized replacements to override Algolia's default [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + /// + /// A list of characters and their normalized replacements to override Algolia's default [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + [DataMember(Name = "customNormalization", EmitDefaultValue = false)] + public Dictionary> CustomNormalization { get; set; } + + /// + /// Name of the deduplication attribute to be used with Algolia's [_distinct_ feature](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/#introducing-algolias-distinct-feature). + /// + /// Name of the deduplication attribute to be used with Algolia's [_distinct_ feature](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/#introducing-algolias-distinct-feature). + [DataMember(Name = "attributeForDistinct", EmitDefaultValue = false)] + public string AttributeForDistinct { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BaseIndexSettings {\n"); + sb.Append(" Replicas: ").Append(Replicas).Append("\n"); + sb.Append(" PaginationLimitedTo: ").Append(PaginationLimitedTo).Append("\n"); + sb.Append(" UnretrievableAttributes: ").Append(UnretrievableAttributes).Append("\n"); + sb.Append(" DisableTypoToleranceOnWords: ").Append(DisableTypoToleranceOnWords).Append("\n"); + sb.Append(" AttributesToTransliterate: ").Append(AttributesToTransliterate).Append("\n"); + sb.Append(" CamelCaseAttributes: ").Append(CamelCaseAttributes).Append("\n"); + sb.Append(" DecompoundedAttributes: ").Append(DecompoundedAttributes).Append("\n"); + sb.Append(" IndexLanguages: ").Append(IndexLanguages).Append("\n"); + sb.Append(" DisablePrefixOnAttributes: ").Append(DisablePrefixOnAttributes).Append("\n"); + sb.Append(" AllowCompressionOfIntegerArray: ").Append(AllowCompressionOfIntegerArray).Append("\n"); + sb.Append(" NumericAttributesForFiltering: ").Append(NumericAttributesForFiltering).Append("\n"); + sb.Append(" SeparatorsToIndex: ").Append(SeparatorsToIndex).Append("\n"); + sb.Append(" SearchableAttributes: ").Append(SearchableAttributes).Append("\n"); + sb.Append(" UserData: ").Append(UserData).Append("\n"); + sb.Append(" CustomNormalization: ").Append(CustomNormalization).Append("\n"); + sb.Append(" AttributeForDistinct: ").Append(AttributeForDistinct).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BaseIndexSettings); + } + + /// + /// Returns true if BaseIndexSettings instances are equal + /// + /// Instance of BaseIndexSettings to be compared + /// Boolean + public bool Equals(BaseIndexSettings input) + { + if (input == null) + { + return false; + } + return + ( + this.Replicas == input.Replicas || + this.Replicas != null && + input.Replicas != null && + this.Replicas.SequenceEqual(input.Replicas) + ) && + ( + this.PaginationLimitedTo == input.PaginationLimitedTo || + this.PaginationLimitedTo.Equals(input.PaginationLimitedTo) + ) && + ( + this.UnretrievableAttributes == input.UnretrievableAttributes || + this.UnretrievableAttributes != null && + input.UnretrievableAttributes != null && + this.UnretrievableAttributes.SequenceEqual(input.UnretrievableAttributes) + ) && + ( + this.DisableTypoToleranceOnWords == input.DisableTypoToleranceOnWords || + this.DisableTypoToleranceOnWords != null && + input.DisableTypoToleranceOnWords != null && + this.DisableTypoToleranceOnWords.SequenceEqual(input.DisableTypoToleranceOnWords) + ) && + ( + this.AttributesToTransliterate == input.AttributesToTransliterate || + this.AttributesToTransliterate != null && + input.AttributesToTransliterate != null && + this.AttributesToTransliterate.SequenceEqual(input.AttributesToTransliterate) + ) && + ( + this.CamelCaseAttributes == input.CamelCaseAttributes || + this.CamelCaseAttributes != null && + input.CamelCaseAttributes != null && + this.CamelCaseAttributes.SequenceEqual(input.CamelCaseAttributes) + ) && + ( + this.DecompoundedAttributes == input.DecompoundedAttributes || + (this.DecompoundedAttributes != null && + this.DecompoundedAttributes.Equals(input.DecompoundedAttributes)) + ) && + ( + this.IndexLanguages == input.IndexLanguages || + this.IndexLanguages != null && + input.IndexLanguages != null && + this.IndexLanguages.SequenceEqual(input.IndexLanguages) + ) && + ( + this.DisablePrefixOnAttributes == input.DisablePrefixOnAttributes || + this.DisablePrefixOnAttributes != null && + input.DisablePrefixOnAttributes != null && + this.DisablePrefixOnAttributes.SequenceEqual(input.DisablePrefixOnAttributes) + ) && + ( + this.AllowCompressionOfIntegerArray == input.AllowCompressionOfIntegerArray || + this.AllowCompressionOfIntegerArray.Equals(input.AllowCompressionOfIntegerArray) + ) && + ( + this.NumericAttributesForFiltering == input.NumericAttributesForFiltering || + this.NumericAttributesForFiltering != null && + input.NumericAttributesForFiltering != null && + this.NumericAttributesForFiltering.SequenceEqual(input.NumericAttributesForFiltering) + ) && + ( + this.SeparatorsToIndex == input.SeparatorsToIndex || + (this.SeparatorsToIndex != null && + this.SeparatorsToIndex.Equals(input.SeparatorsToIndex)) + ) && + ( + this.SearchableAttributes == input.SearchableAttributes || + this.SearchableAttributes != null && + input.SearchableAttributes != null && + this.SearchableAttributes.SequenceEqual(input.SearchableAttributes) + ) && + ( + this.UserData == input.UserData || + (this.UserData != null && + this.UserData.Equals(input.UserData)) + ) && + ( + this.CustomNormalization == input.CustomNormalization || + this.CustomNormalization != null && + input.CustomNormalization != null && + this.CustomNormalization.SequenceEqual(input.CustomNormalization) + ) && + ( + this.AttributeForDistinct == input.AttributeForDistinct || + (this.AttributeForDistinct != null && + this.AttributeForDistinct.Equals(input.AttributeForDistinct)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Replicas != null) + { + hashCode = (hashCode * 59) + this.Replicas.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PaginationLimitedTo.GetHashCode(); + if (this.UnretrievableAttributes != null) + { + hashCode = (hashCode * 59) + this.UnretrievableAttributes.GetHashCode(); + } + if (this.DisableTypoToleranceOnWords != null) + { + hashCode = (hashCode * 59) + this.DisableTypoToleranceOnWords.GetHashCode(); + } + if (this.AttributesToTransliterate != null) + { + hashCode = (hashCode * 59) + this.AttributesToTransliterate.GetHashCode(); + } + if (this.CamelCaseAttributes != null) + { + hashCode = (hashCode * 59) + this.CamelCaseAttributes.GetHashCode(); + } + if (this.DecompoundedAttributes != null) + { + hashCode = (hashCode * 59) + this.DecompoundedAttributes.GetHashCode(); + } + if (this.IndexLanguages != null) + { + hashCode = (hashCode * 59) + this.IndexLanguages.GetHashCode(); + } + if (this.DisablePrefixOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisablePrefixOnAttributes.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AllowCompressionOfIntegerArray.GetHashCode(); + if (this.NumericAttributesForFiltering != null) + { + hashCode = (hashCode * 59) + this.NumericAttributesForFiltering.GetHashCode(); + } + if (this.SeparatorsToIndex != null) + { + hashCode = (hashCode * 59) + this.SeparatorsToIndex.GetHashCode(); + } + if (this.SearchableAttributes != null) + { + hashCode = (hashCode * 59) + this.SearchableAttributes.GetHashCode(); + } + if (this.UserData != null) + { + hashCode = (hashCode * 59) + this.UserData.GetHashCode(); + } + if (this.CustomNormalization != null) + { + hashCode = (hashCode * 59) + this.CustomNormalization.GetHashCode(); + } + if (this.AttributeForDistinct != null) + { + hashCode = (hashCode * 59) + this.AttributeForDistinct.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/BaseSearchParams.cs b/algoliasearch/Search/Models/BaseSearchParams.cs new file mode 100644 index 000000000..06ca34683 --- /dev/null +++ b/algoliasearch/Search/Models/BaseSearchParams.cs @@ -0,0 +1,700 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// BaseSearchParams + /// + [DataContract(Name = "baseSearchParams")] + public partial class BaseSearchParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Text to search for in an index. (default to ""). + /// Overrides the query parameter and performs a more generic search. (default to ""). + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. (default to ""). + /// facetFilters. + /// optionalFilters. + /// numericFilters. + /// tagFilters. + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. (default to false). + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/).. + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values.. + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. (default to false). + /// Page to retrieve (the first page is `0`, not `1`). (default to 0). + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. (default to ""). + /// Search for entries around a location. The location is automatically computed from the requester's IP address. (default to false). + /// aroundRadius. + /// aroundPrecision. + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set.. + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries.. + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries.. + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). (default to 100). + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search.. + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). (default to false). + /// Enriches the API's response with information about how the query was processed.. + /// Whether to take into account an index's synonyms for a particular search. (default to true). + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). (default to false). + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). (default to true). + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).. + /// Whether to include or exclude a query from the processing-time percentile computation. (default to true). + /// Incidates whether this search will be considered in A/B testing. (default to true). + public BaseSearchParams(string query = @"", string similarQuery = @"", string filters = @"", FacetFilters facetFilters = default(FacetFilters), OptionalFilters optionalFilters = default(OptionalFilters), NumericFilters numericFilters = default(NumericFilters), TagFilters tagFilters = default(TagFilters), bool sumOrFiltersScores = false, List restrictSearchableAttributes = default(List), List facets = default(List), bool facetingAfterDistinct = false, int page = 0, int offset = default(int), int length = default(int), string aroundLatLng = @"", bool aroundLatLngViaIP = false, AroundRadius aroundRadius = default(AroundRadius), AroundPrecision aroundPrecision = default(AroundPrecision), int minimumAroundRadius = default(int), List> insideBoundingBox = default(List>), List> insidePolygon = default(List>), List naturalLanguages = default(List), List ruleContexts = default(List), int personalizationImpact = 100, string userToken = default(string), bool getRankingInfo = false, List explain = default(List), bool synonyms = true, bool clickAnalytics = false, bool analytics = true, List analyticsTags = default(List), bool percentileComputation = true, bool enableABTest = true) + { + // use default value if no "query" provided + this.Query = query ?? @""; + // use default value if no "similarQuery" provided + this.SimilarQuery = similarQuery ?? @""; + // use default value if no "filters" provided + this.Filters = filters ?? @""; + this.FacetFilters = facetFilters; + this.OptionalFilters = optionalFilters; + this.NumericFilters = numericFilters; + this.TagFilters = tagFilters; + this.SumOrFiltersScores = sumOrFiltersScores; + this.RestrictSearchableAttributes = restrictSearchableAttributes; + this.Facets = facets; + this.FacetingAfterDistinct = facetingAfterDistinct; + this.Page = page; + this.Offset = offset; + this.Length = length; + // use default value if no "aroundLatLng" provided + this.AroundLatLng = aroundLatLng ?? @""; + this.AroundLatLngViaIP = aroundLatLngViaIP; + this.AroundRadius = aroundRadius; + this.AroundPrecision = aroundPrecision; + this.MinimumAroundRadius = minimumAroundRadius; + this.InsideBoundingBox = insideBoundingBox; + this.InsidePolygon = insidePolygon; + this.NaturalLanguages = naturalLanguages; + this.RuleContexts = ruleContexts; + this.PersonalizationImpact = personalizationImpact; + this.UserToken = userToken; + this.GetRankingInfo = getRankingInfo; + this.Explain = explain; + this.Synonyms = synonyms; + this.ClickAnalytics = clickAnalytics; + this.Analytics = analytics; + this.AnalyticsTags = analyticsTags; + this.PercentileComputation = percentileComputation; + this.EnableABTest = enableABTest; + } + + /// + /// Text to search for in an index. + /// + /// Text to search for in an index. + [DataMember(Name = "query", EmitDefaultValue = false)] + public string Query { get; set; } + + /// + /// Overrides the query parameter and performs a more generic search. + /// + /// Overrides the query parameter and performs a more generic search. + [DataMember(Name = "similarQuery", EmitDefaultValue = false)] + public string SimilarQuery { get; set; } + + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + [DataMember(Name = "filters", EmitDefaultValue = false)] + public string Filters { get; set; } + + /// + /// Gets or Sets FacetFilters + /// + [DataMember(Name = "facetFilters", EmitDefaultValue = false)] + public FacetFilters FacetFilters { get; set; } + + /// + /// Gets or Sets OptionalFilters + /// + [DataMember(Name = "optionalFilters", EmitDefaultValue = false)] + public OptionalFilters OptionalFilters { get; set; } + + /// + /// Gets or Sets NumericFilters + /// + [DataMember(Name = "numericFilters", EmitDefaultValue = false)] + public NumericFilters NumericFilters { get; set; } + + /// + /// Gets or Sets TagFilters + /// + [DataMember(Name = "tagFilters", EmitDefaultValue = false)] + public TagFilters TagFilters { get; set; } + + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + [DataMember(Name = "sumOrFiltersScores", EmitDefaultValue = true)] + public bool SumOrFiltersScores { get; set; } + + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + [DataMember(Name = "restrictSearchableAttributes", EmitDefaultValue = false)] + public List RestrictSearchableAttributes { get; set; } + + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + [DataMember(Name = "facets", EmitDefaultValue = false)] + public List Facets { get; set; } + + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + [DataMember(Name = "facetingAfterDistinct", EmitDefaultValue = true)] + public bool FacetingAfterDistinct { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", EmitDefaultValue = false)] + public int Page { get; set; } + + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "offset", EmitDefaultValue = false)] + public int Offset { get; set; } + + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "length", EmitDefaultValue = false)] + public int Length { get; set; } + + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + [DataMember(Name = "aroundLatLngViaIP", EmitDefaultValue = true)] + public bool AroundLatLngViaIP { get; set; } + + /// + /// Gets or Sets AroundRadius + /// + [DataMember(Name = "aroundRadius", EmitDefaultValue = false)] + public AroundRadius AroundRadius { get; set; } + + /// + /// Gets or Sets AroundPrecision + /// + [DataMember(Name = "aroundPrecision", EmitDefaultValue = false)] + public AroundPrecision AroundPrecision { get; set; } + + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + [DataMember(Name = "minimumAroundRadius", EmitDefaultValue = false)] + public int MinimumAroundRadius { get; set; } + + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insideBoundingBox", EmitDefaultValue = false)] + public List> InsideBoundingBox { get; set; } + + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insidePolygon", EmitDefaultValue = false)] + public List> InsidePolygon { get; set; } + + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + [DataMember(Name = "naturalLanguages", EmitDefaultValue = false)] + public List NaturalLanguages { get; set; } + + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + [DataMember(Name = "ruleContexts", EmitDefaultValue = false)] + public List RuleContexts { get; set; } + + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + [DataMember(Name = "personalizationImpact", EmitDefaultValue = false)] + public int PersonalizationImpact { get; set; } + + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + [DataMember(Name = "userToken", EmitDefaultValue = false)] + public string UserToken { get; set; } + + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + [DataMember(Name = "getRankingInfo", EmitDefaultValue = true)] + public bool GetRankingInfo { get; set; } + + /// + /// Enriches the API's response with information about how the query was processed. + /// + /// Enriches the API's response with information about how the query was processed. + [DataMember(Name = "explain", EmitDefaultValue = false)] + public List Explain { get; set; } + + /// + /// Whether to take into account an index's synonyms for a particular search. + /// + /// Whether to take into account an index's synonyms for a particular search. + [DataMember(Name = "synonyms", EmitDefaultValue = true)] + public bool Synonyms { get; set; } + + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + [DataMember(Name = "clickAnalytics", EmitDefaultValue = true)] + public bool ClickAnalytics { get; set; } + + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + [DataMember(Name = "analytics", EmitDefaultValue = true)] + public bool Analytics { get; set; } + + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + [DataMember(Name = "analyticsTags", EmitDefaultValue = false)] + public List AnalyticsTags { get; set; } + + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + [DataMember(Name = "percentileComputation", EmitDefaultValue = true)] + public bool PercentileComputation { get; set; } + + /// + /// Incidates whether this search will be considered in A/B testing. + /// + /// Incidates whether this search will be considered in A/B testing. + [DataMember(Name = "enableABTest", EmitDefaultValue = true)] + public bool EnableABTest { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BaseSearchParams {\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" SimilarQuery: ").Append(SimilarQuery).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" FacetFilters: ").Append(FacetFilters).Append("\n"); + sb.Append(" OptionalFilters: ").Append(OptionalFilters).Append("\n"); + sb.Append(" NumericFilters: ").Append(NumericFilters).Append("\n"); + sb.Append(" TagFilters: ").Append(TagFilters).Append("\n"); + sb.Append(" SumOrFiltersScores: ").Append(SumOrFiltersScores).Append("\n"); + sb.Append(" RestrictSearchableAttributes: ").Append(RestrictSearchableAttributes).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" FacetingAfterDistinct: ").Append(FacetingAfterDistinct).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" Offset: ").Append(Offset).Append("\n"); + sb.Append(" Length: ").Append(Length).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AroundLatLngViaIP: ").Append(AroundLatLngViaIP).Append("\n"); + sb.Append(" AroundRadius: ").Append(AroundRadius).Append("\n"); + sb.Append(" AroundPrecision: ").Append(AroundPrecision).Append("\n"); + sb.Append(" MinimumAroundRadius: ").Append(MinimumAroundRadius).Append("\n"); + sb.Append(" InsideBoundingBox: ").Append(InsideBoundingBox).Append("\n"); + sb.Append(" InsidePolygon: ").Append(InsidePolygon).Append("\n"); + sb.Append(" NaturalLanguages: ").Append(NaturalLanguages).Append("\n"); + sb.Append(" RuleContexts: ").Append(RuleContexts).Append("\n"); + sb.Append(" PersonalizationImpact: ").Append(PersonalizationImpact).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" GetRankingInfo: ").Append(GetRankingInfo).Append("\n"); + sb.Append(" Explain: ").Append(Explain).Append("\n"); + sb.Append(" Synonyms: ").Append(Synonyms).Append("\n"); + sb.Append(" ClickAnalytics: ").Append(ClickAnalytics).Append("\n"); + sb.Append(" Analytics: ").Append(Analytics).Append("\n"); + sb.Append(" AnalyticsTags: ").Append(AnalyticsTags).Append("\n"); + sb.Append(" PercentileComputation: ").Append(PercentileComputation).Append("\n"); + sb.Append(" EnableABTest: ").Append(EnableABTest).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BaseSearchParams); + } + + /// + /// Returns true if BaseSearchParams instances are equal + /// + /// Instance of BaseSearchParams to be compared + /// Boolean + public bool Equals(BaseSearchParams input) + { + if (input == null) + { + return false; + } + return + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.SimilarQuery == input.SimilarQuery || + (this.SimilarQuery != null && + this.SimilarQuery.Equals(input.SimilarQuery)) + ) && + ( + this.Filters == input.Filters || + (this.Filters != null && + this.Filters.Equals(input.Filters)) + ) && + ( + this.FacetFilters == input.FacetFilters || + (this.FacetFilters != null && + this.FacetFilters.Equals(input.FacetFilters)) + ) && + ( + this.OptionalFilters == input.OptionalFilters || + (this.OptionalFilters != null && + this.OptionalFilters.Equals(input.OptionalFilters)) + ) && + ( + this.NumericFilters == input.NumericFilters || + (this.NumericFilters != null && + this.NumericFilters.Equals(input.NumericFilters)) + ) && + ( + this.TagFilters == input.TagFilters || + (this.TagFilters != null && + this.TagFilters.Equals(input.TagFilters)) + ) && + ( + this.SumOrFiltersScores == input.SumOrFiltersScores || + this.SumOrFiltersScores.Equals(input.SumOrFiltersScores) + ) && + ( + this.RestrictSearchableAttributes == input.RestrictSearchableAttributes || + this.RestrictSearchableAttributes != null && + input.RestrictSearchableAttributes != null && + this.RestrictSearchableAttributes.SequenceEqual(input.RestrictSearchableAttributes) + ) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && + ( + this.FacetingAfterDistinct == input.FacetingAfterDistinct || + this.FacetingAfterDistinct.Equals(input.FacetingAfterDistinct) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.Offset == input.Offset || + this.Offset.Equals(input.Offset) + ) && + ( + this.Length == input.Length || + this.Length.Equals(input.Length) + ) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && + ( + this.AroundLatLngViaIP == input.AroundLatLngViaIP || + this.AroundLatLngViaIP.Equals(input.AroundLatLngViaIP) + ) && + ( + this.AroundRadius == input.AroundRadius || + (this.AroundRadius != null && + this.AroundRadius.Equals(input.AroundRadius)) + ) && + ( + this.AroundPrecision == input.AroundPrecision || + (this.AroundPrecision != null && + this.AroundPrecision.Equals(input.AroundPrecision)) + ) && + ( + this.MinimumAroundRadius == input.MinimumAroundRadius || + this.MinimumAroundRadius.Equals(input.MinimumAroundRadius) + ) && + ( + this.InsideBoundingBox == input.InsideBoundingBox || + this.InsideBoundingBox != null && + input.InsideBoundingBox != null && + this.InsideBoundingBox.SequenceEqual(input.InsideBoundingBox) + ) && + ( + this.InsidePolygon == input.InsidePolygon || + this.InsidePolygon != null && + input.InsidePolygon != null && + this.InsidePolygon.SequenceEqual(input.InsidePolygon) + ) && + ( + this.NaturalLanguages == input.NaturalLanguages || + this.NaturalLanguages != null && + input.NaturalLanguages != null && + this.NaturalLanguages.SequenceEqual(input.NaturalLanguages) + ) && + ( + this.RuleContexts == input.RuleContexts || + this.RuleContexts != null && + input.RuleContexts != null && + this.RuleContexts.SequenceEqual(input.RuleContexts) + ) && + ( + this.PersonalizationImpact == input.PersonalizationImpact || + this.PersonalizationImpact.Equals(input.PersonalizationImpact) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.GetRankingInfo == input.GetRankingInfo || + this.GetRankingInfo.Equals(input.GetRankingInfo) + ) && + ( + this.Explain == input.Explain || + this.Explain != null && + input.Explain != null && + this.Explain.SequenceEqual(input.Explain) + ) && + ( + this.Synonyms == input.Synonyms || + this.Synonyms.Equals(input.Synonyms) + ) && + ( + this.ClickAnalytics == input.ClickAnalytics || + this.ClickAnalytics.Equals(input.ClickAnalytics) + ) && + ( + this.Analytics == input.Analytics || + this.Analytics.Equals(input.Analytics) + ) && + ( + this.AnalyticsTags == input.AnalyticsTags || + this.AnalyticsTags != null && + input.AnalyticsTags != null && + this.AnalyticsTags.SequenceEqual(input.AnalyticsTags) + ) && + ( + this.PercentileComputation == input.PercentileComputation || + this.PercentileComputation.Equals(input.PercentileComputation) + ) && + ( + this.EnableABTest == input.EnableABTest || + this.EnableABTest.Equals(input.EnableABTest) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.SimilarQuery != null) + { + hashCode = (hashCode * 59) + this.SimilarQuery.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.FacetFilters != null) + { + hashCode = (hashCode * 59) + this.FacetFilters.GetHashCode(); + } + if (this.OptionalFilters != null) + { + hashCode = (hashCode * 59) + this.OptionalFilters.GetHashCode(); + } + if (this.NumericFilters != null) + { + hashCode = (hashCode * 59) + this.NumericFilters.GetHashCode(); + } + if (this.TagFilters != null) + { + hashCode = (hashCode * 59) + this.TagFilters.GetHashCode(); + } + hashCode = (hashCode * 59) + this.SumOrFiltersScores.GetHashCode(); + if (this.RestrictSearchableAttributes != null) + { + hashCode = (hashCode * 59) + this.RestrictSearchableAttributes.GetHashCode(); + } + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + hashCode = (hashCode * 59) + this.FacetingAfterDistinct.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.Offset.GetHashCode(); + hashCode = (hashCode * 59) + this.Length.GetHashCode(); + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AroundLatLngViaIP.GetHashCode(); + if (this.AroundRadius != null) + { + hashCode = (hashCode * 59) + this.AroundRadius.GetHashCode(); + } + if (this.AroundPrecision != null) + { + hashCode = (hashCode * 59) + this.AroundPrecision.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MinimumAroundRadius.GetHashCode(); + if (this.InsideBoundingBox != null) + { + hashCode = (hashCode * 59) + this.InsideBoundingBox.GetHashCode(); + } + if (this.InsidePolygon != null) + { + hashCode = (hashCode * 59) + this.InsidePolygon.GetHashCode(); + } + if (this.NaturalLanguages != null) + { + hashCode = (hashCode * 59) + this.NaturalLanguages.GetHashCode(); + } + if (this.RuleContexts != null) + { + hashCode = (hashCode * 59) + this.RuleContexts.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PersonalizationImpact.GetHashCode(); + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.GetRankingInfo.GetHashCode(); + if (this.Explain != null) + { + hashCode = (hashCode * 59) + this.Explain.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Synonyms.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickAnalytics.GetHashCode(); + hashCode = (hashCode * 59) + this.Analytics.GetHashCode(); + if (this.AnalyticsTags != null) + { + hashCode = (hashCode * 59) + this.AnalyticsTags.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PercentileComputation.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableABTest.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Length (int) maximum + if (this.Length > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value less than or equal to 1000.", new[] { "Length" }); + } + + // Length (int) minimum + if (this.Length < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value greater than or equal to 1.", new[] { "Length" }); + } + + // MinimumAroundRadius (int) minimum + if (this.MinimumAroundRadius < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinimumAroundRadius, must be a value greater than or equal to 1.", new[] { "MinimumAroundRadius" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/BaseSearchParamsWithoutQuery.cs b/algoliasearch/Search/Models/BaseSearchParamsWithoutQuery.cs new file mode 100644 index 000000000..28551eba2 --- /dev/null +++ b/algoliasearch/Search/Models/BaseSearchParamsWithoutQuery.cs @@ -0,0 +1,680 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// BaseSearchParamsWithoutQuery + /// + [DataContract(Name = "baseSearchParamsWithoutQuery")] + public partial class BaseSearchParamsWithoutQuery : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Overrides the query parameter and performs a more generic search. (default to ""). + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. (default to ""). + /// facetFilters. + /// optionalFilters. + /// numericFilters. + /// tagFilters. + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. (default to false). + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/).. + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values.. + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. (default to false). + /// Page to retrieve (the first page is `0`, not `1`). (default to 0). + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. (default to ""). + /// Search for entries around a location. The location is automatically computed from the requester's IP address. (default to false). + /// aroundRadius. + /// aroundPrecision. + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set.. + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries.. + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries.. + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). (default to 100). + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search.. + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). (default to false). + /// Enriches the API's response with information about how the query was processed.. + /// Whether to take into account an index's synonyms for a particular search. (default to true). + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). (default to false). + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). (default to true). + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).. + /// Whether to include or exclude a query from the processing-time percentile computation. (default to true). + /// Incidates whether this search will be considered in A/B testing. (default to true). + public BaseSearchParamsWithoutQuery(string similarQuery = @"", string filters = @"", FacetFilters facetFilters = default(FacetFilters), OptionalFilters optionalFilters = default(OptionalFilters), NumericFilters numericFilters = default(NumericFilters), TagFilters tagFilters = default(TagFilters), bool sumOrFiltersScores = false, List restrictSearchableAttributes = default(List), List facets = default(List), bool facetingAfterDistinct = false, int page = 0, int offset = default(int), int length = default(int), string aroundLatLng = @"", bool aroundLatLngViaIP = false, AroundRadius aroundRadius = default(AroundRadius), AroundPrecision aroundPrecision = default(AroundPrecision), int minimumAroundRadius = default(int), List> insideBoundingBox = default(List>), List> insidePolygon = default(List>), List naturalLanguages = default(List), List ruleContexts = default(List), int personalizationImpact = 100, string userToken = default(string), bool getRankingInfo = false, List explain = default(List), bool synonyms = true, bool clickAnalytics = false, bool analytics = true, List analyticsTags = default(List), bool percentileComputation = true, bool enableABTest = true) + { + // use default value if no "similarQuery" provided + this.SimilarQuery = similarQuery ?? @""; + // use default value if no "filters" provided + this.Filters = filters ?? @""; + this.FacetFilters = facetFilters; + this.OptionalFilters = optionalFilters; + this.NumericFilters = numericFilters; + this.TagFilters = tagFilters; + this.SumOrFiltersScores = sumOrFiltersScores; + this.RestrictSearchableAttributes = restrictSearchableAttributes; + this.Facets = facets; + this.FacetingAfterDistinct = facetingAfterDistinct; + this.Page = page; + this.Offset = offset; + this.Length = length; + // use default value if no "aroundLatLng" provided + this.AroundLatLng = aroundLatLng ?? @""; + this.AroundLatLngViaIP = aroundLatLngViaIP; + this.AroundRadius = aroundRadius; + this.AroundPrecision = aroundPrecision; + this.MinimumAroundRadius = minimumAroundRadius; + this.InsideBoundingBox = insideBoundingBox; + this.InsidePolygon = insidePolygon; + this.NaturalLanguages = naturalLanguages; + this.RuleContexts = ruleContexts; + this.PersonalizationImpact = personalizationImpact; + this.UserToken = userToken; + this.GetRankingInfo = getRankingInfo; + this.Explain = explain; + this.Synonyms = synonyms; + this.ClickAnalytics = clickAnalytics; + this.Analytics = analytics; + this.AnalyticsTags = analyticsTags; + this.PercentileComputation = percentileComputation; + this.EnableABTest = enableABTest; + } + + /// + /// Overrides the query parameter and performs a more generic search. + /// + /// Overrides the query parameter and performs a more generic search. + [DataMember(Name = "similarQuery", EmitDefaultValue = false)] + public string SimilarQuery { get; set; } + + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + [DataMember(Name = "filters", EmitDefaultValue = false)] + public string Filters { get; set; } + + /// + /// Gets or Sets FacetFilters + /// + [DataMember(Name = "facetFilters", EmitDefaultValue = false)] + public FacetFilters FacetFilters { get; set; } + + /// + /// Gets or Sets OptionalFilters + /// + [DataMember(Name = "optionalFilters", EmitDefaultValue = false)] + public OptionalFilters OptionalFilters { get; set; } + + /// + /// Gets or Sets NumericFilters + /// + [DataMember(Name = "numericFilters", EmitDefaultValue = false)] + public NumericFilters NumericFilters { get; set; } + + /// + /// Gets or Sets TagFilters + /// + [DataMember(Name = "tagFilters", EmitDefaultValue = false)] + public TagFilters TagFilters { get; set; } + + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + [DataMember(Name = "sumOrFiltersScores", EmitDefaultValue = true)] + public bool SumOrFiltersScores { get; set; } + + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + [DataMember(Name = "restrictSearchableAttributes", EmitDefaultValue = false)] + public List RestrictSearchableAttributes { get; set; } + + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + [DataMember(Name = "facets", EmitDefaultValue = false)] + public List Facets { get; set; } + + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + [DataMember(Name = "facetingAfterDistinct", EmitDefaultValue = true)] + public bool FacetingAfterDistinct { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", EmitDefaultValue = false)] + public int Page { get; set; } + + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "offset", EmitDefaultValue = false)] + public int Offset { get; set; } + + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "length", EmitDefaultValue = false)] + public int Length { get; set; } + + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + [DataMember(Name = "aroundLatLngViaIP", EmitDefaultValue = true)] + public bool AroundLatLngViaIP { get; set; } + + /// + /// Gets or Sets AroundRadius + /// + [DataMember(Name = "aroundRadius", EmitDefaultValue = false)] + public AroundRadius AroundRadius { get; set; } + + /// + /// Gets or Sets AroundPrecision + /// + [DataMember(Name = "aroundPrecision", EmitDefaultValue = false)] + public AroundPrecision AroundPrecision { get; set; } + + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + [DataMember(Name = "minimumAroundRadius", EmitDefaultValue = false)] + public int MinimumAroundRadius { get; set; } + + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insideBoundingBox", EmitDefaultValue = false)] + public List> InsideBoundingBox { get; set; } + + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insidePolygon", EmitDefaultValue = false)] + public List> InsidePolygon { get; set; } + + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + [DataMember(Name = "naturalLanguages", EmitDefaultValue = false)] + public List NaturalLanguages { get; set; } + + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + [DataMember(Name = "ruleContexts", EmitDefaultValue = false)] + public List RuleContexts { get; set; } + + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + [DataMember(Name = "personalizationImpact", EmitDefaultValue = false)] + public int PersonalizationImpact { get; set; } + + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + [DataMember(Name = "userToken", EmitDefaultValue = false)] + public string UserToken { get; set; } + + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + [DataMember(Name = "getRankingInfo", EmitDefaultValue = true)] + public bool GetRankingInfo { get; set; } + + /// + /// Enriches the API's response with information about how the query was processed. + /// + /// Enriches the API's response with information about how the query was processed. + [DataMember(Name = "explain", EmitDefaultValue = false)] + public List Explain { get; set; } + + /// + /// Whether to take into account an index's synonyms for a particular search. + /// + /// Whether to take into account an index's synonyms for a particular search. + [DataMember(Name = "synonyms", EmitDefaultValue = true)] + public bool Synonyms { get; set; } + + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + [DataMember(Name = "clickAnalytics", EmitDefaultValue = true)] + public bool ClickAnalytics { get; set; } + + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + [DataMember(Name = "analytics", EmitDefaultValue = true)] + public bool Analytics { get; set; } + + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + [DataMember(Name = "analyticsTags", EmitDefaultValue = false)] + public List AnalyticsTags { get; set; } + + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + [DataMember(Name = "percentileComputation", EmitDefaultValue = true)] + public bool PercentileComputation { get; set; } + + /// + /// Incidates whether this search will be considered in A/B testing. + /// + /// Incidates whether this search will be considered in A/B testing. + [DataMember(Name = "enableABTest", EmitDefaultValue = true)] + public bool EnableABTest { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BaseSearchParamsWithoutQuery {\n"); + sb.Append(" SimilarQuery: ").Append(SimilarQuery).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" FacetFilters: ").Append(FacetFilters).Append("\n"); + sb.Append(" OptionalFilters: ").Append(OptionalFilters).Append("\n"); + sb.Append(" NumericFilters: ").Append(NumericFilters).Append("\n"); + sb.Append(" TagFilters: ").Append(TagFilters).Append("\n"); + sb.Append(" SumOrFiltersScores: ").Append(SumOrFiltersScores).Append("\n"); + sb.Append(" RestrictSearchableAttributes: ").Append(RestrictSearchableAttributes).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" FacetingAfterDistinct: ").Append(FacetingAfterDistinct).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" Offset: ").Append(Offset).Append("\n"); + sb.Append(" Length: ").Append(Length).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AroundLatLngViaIP: ").Append(AroundLatLngViaIP).Append("\n"); + sb.Append(" AroundRadius: ").Append(AroundRadius).Append("\n"); + sb.Append(" AroundPrecision: ").Append(AroundPrecision).Append("\n"); + sb.Append(" MinimumAroundRadius: ").Append(MinimumAroundRadius).Append("\n"); + sb.Append(" InsideBoundingBox: ").Append(InsideBoundingBox).Append("\n"); + sb.Append(" InsidePolygon: ").Append(InsidePolygon).Append("\n"); + sb.Append(" NaturalLanguages: ").Append(NaturalLanguages).Append("\n"); + sb.Append(" RuleContexts: ").Append(RuleContexts).Append("\n"); + sb.Append(" PersonalizationImpact: ").Append(PersonalizationImpact).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" GetRankingInfo: ").Append(GetRankingInfo).Append("\n"); + sb.Append(" Explain: ").Append(Explain).Append("\n"); + sb.Append(" Synonyms: ").Append(Synonyms).Append("\n"); + sb.Append(" ClickAnalytics: ").Append(ClickAnalytics).Append("\n"); + sb.Append(" Analytics: ").Append(Analytics).Append("\n"); + sb.Append(" AnalyticsTags: ").Append(AnalyticsTags).Append("\n"); + sb.Append(" PercentileComputation: ").Append(PercentileComputation).Append("\n"); + sb.Append(" EnableABTest: ").Append(EnableABTest).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BaseSearchParamsWithoutQuery); + } + + /// + /// Returns true if BaseSearchParamsWithoutQuery instances are equal + /// + /// Instance of BaseSearchParamsWithoutQuery to be compared + /// Boolean + public bool Equals(BaseSearchParamsWithoutQuery input) + { + if (input == null) + { + return false; + } + return + ( + this.SimilarQuery == input.SimilarQuery || + (this.SimilarQuery != null && + this.SimilarQuery.Equals(input.SimilarQuery)) + ) && + ( + this.Filters == input.Filters || + (this.Filters != null && + this.Filters.Equals(input.Filters)) + ) && + ( + this.FacetFilters == input.FacetFilters || + (this.FacetFilters != null && + this.FacetFilters.Equals(input.FacetFilters)) + ) && + ( + this.OptionalFilters == input.OptionalFilters || + (this.OptionalFilters != null && + this.OptionalFilters.Equals(input.OptionalFilters)) + ) && + ( + this.NumericFilters == input.NumericFilters || + (this.NumericFilters != null && + this.NumericFilters.Equals(input.NumericFilters)) + ) && + ( + this.TagFilters == input.TagFilters || + (this.TagFilters != null && + this.TagFilters.Equals(input.TagFilters)) + ) && + ( + this.SumOrFiltersScores == input.SumOrFiltersScores || + this.SumOrFiltersScores.Equals(input.SumOrFiltersScores) + ) && + ( + this.RestrictSearchableAttributes == input.RestrictSearchableAttributes || + this.RestrictSearchableAttributes != null && + input.RestrictSearchableAttributes != null && + this.RestrictSearchableAttributes.SequenceEqual(input.RestrictSearchableAttributes) + ) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && + ( + this.FacetingAfterDistinct == input.FacetingAfterDistinct || + this.FacetingAfterDistinct.Equals(input.FacetingAfterDistinct) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.Offset == input.Offset || + this.Offset.Equals(input.Offset) + ) && + ( + this.Length == input.Length || + this.Length.Equals(input.Length) + ) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && + ( + this.AroundLatLngViaIP == input.AroundLatLngViaIP || + this.AroundLatLngViaIP.Equals(input.AroundLatLngViaIP) + ) && + ( + this.AroundRadius == input.AroundRadius || + (this.AroundRadius != null && + this.AroundRadius.Equals(input.AroundRadius)) + ) && + ( + this.AroundPrecision == input.AroundPrecision || + (this.AroundPrecision != null && + this.AroundPrecision.Equals(input.AroundPrecision)) + ) && + ( + this.MinimumAroundRadius == input.MinimumAroundRadius || + this.MinimumAroundRadius.Equals(input.MinimumAroundRadius) + ) && + ( + this.InsideBoundingBox == input.InsideBoundingBox || + this.InsideBoundingBox != null && + input.InsideBoundingBox != null && + this.InsideBoundingBox.SequenceEqual(input.InsideBoundingBox) + ) && + ( + this.InsidePolygon == input.InsidePolygon || + this.InsidePolygon != null && + input.InsidePolygon != null && + this.InsidePolygon.SequenceEqual(input.InsidePolygon) + ) && + ( + this.NaturalLanguages == input.NaturalLanguages || + this.NaturalLanguages != null && + input.NaturalLanguages != null && + this.NaturalLanguages.SequenceEqual(input.NaturalLanguages) + ) && + ( + this.RuleContexts == input.RuleContexts || + this.RuleContexts != null && + input.RuleContexts != null && + this.RuleContexts.SequenceEqual(input.RuleContexts) + ) && + ( + this.PersonalizationImpact == input.PersonalizationImpact || + this.PersonalizationImpact.Equals(input.PersonalizationImpact) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.GetRankingInfo == input.GetRankingInfo || + this.GetRankingInfo.Equals(input.GetRankingInfo) + ) && + ( + this.Explain == input.Explain || + this.Explain != null && + input.Explain != null && + this.Explain.SequenceEqual(input.Explain) + ) && + ( + this.Synonyms == input.Synonyms || + this.Synonyms.Equals(input.Synonyms) + ) && + ( + this.ClickAnalytics == input.ClickAnalytics || + this.ClickAnalytics.Equals(input.ClickAnalytics) + ) && + ( + this.Analytics == input.Analytics || + this.Analytics.Equals(input.Analytics) + ) && + ( + this.AnalyticsTags == input.AnalyticsTags || + this.AnalyticsTags != null && + input.AnalyticsTags != null && + this.AnalyticsTags.SequenceEqual(input.AnalyticsTags) + ) && + ( + this.PercentileComputation == input.PercentileComputation || + this.PercentileComputation.Equals(input.PercentileComputation) + ) && + ( + this.EnableABTest == input.EnableABTest || + this.EnableABTest.Equals(input.EnableABTest) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SimilarQuery != null) + { + hashCode = (hashCode * 59) + this.SimilarQuery.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.FacetFilters != null) + { + hashCode = (hashCode * 59) + this.FacetFilters.GetHashCode(); + } + if (this.OptionalFilters != null) + { + hashCode = (hashCode * 59) + this.OptionalFilters.GetHashCode(); + } + if (this.NumericFilters != null) + { + hashCode = (hashCode * 59) + this.NumericFilters.GetHashCode(); + } + if (this.TagFilters != null) + { + hashCode = (hashCode * 59) + this.TagFilters.GetHashCode(); + } + hashCode = (hashCode * 59) + this.SumOrFiltersScores.GetHashCode(); + if (this.RestrictSearchableAttributes != null) + { + hashCode = (hashCode * 59) + this.RestrictSearchableAttributes.GetHashCode(); + } + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + hashCode = (hashCode * 59) + this.FacetingAfterDistinct.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.Offset.GetHashCode(); + hashCode = (hashCode * 59) + this.Length.GetHashCode(); + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AroundLatLngViaIP.GetHashCode(); + if (this.AroundRadius != null) + { + hashCode = (hashCode * 59) + this.AroundRadius.GetHashCode(); + } + if (this.AroundPrecision != null) + { + hashCode = (hashCode * 59) + this.AroundPrecision.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MinimumAroundRadius.GetHashCode(); + if (this.InsideBoundingBox != null) + { + hashCode = (hashCode * 59) + this.InsideBoundingBox.GetHashCode(); + } + if (this.InsidePolygon != null) + { + hashCode = (hashCode * 59) + this.InsidePolygon.GetHashCode(); + } + if (this.NaturalLanguages != null) + { + hashCode = (hashCode * 59) + this.NaturalLanguages.GetHashCode(); + } + if (this.RuleContexts != null) + { + hashCode = (hashCode * 59) + this.RuleContexts.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PersonalizationImpact.GetHashCode(); + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.GetRankingInfo.GetHashCode(); + if (this.Explain != null) + { + hashCode = (hashCode * 59) + this.Explain.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Synonyms.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickAnalytics.GetHashCode(); + hashCode = (hashCode * 59) + this.Analytics.GetHashCode(); + if (this.AnalyticsTags != null) + { + hashCode = (hashCode * 59) + this.AnalyticsTags.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PercentileComputation.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableABTest.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Length (int) maximum + if (this.Length > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value less than or equal to 1000.", new[] { "Length" }); + } + + // Length (int) minimum + if (this.Length < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value greater than or equal to 1.", new[] { "Length" }); + } + + // MinimumAroundRadius (int) minimum + if (this.MinimumAroundRadius < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinimumAroundRadius, must be a value greater than or equal to 1.", new[] { "MinimumAroundRadius" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/BaseSearchResponse.cs b/algoliasearch/Search/Models/BaseSearchResponse.cs new file mode 100644 index 000000000..52aed4f95 --- /dev/null +++ b/algoliasearch/Search/Models/BaseSearchResponse.cs @@ -0,0 +1,632 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// BaseSearchResponse + /// + [DataContract(Name = "baseSearchResponse")] + public partial class BaseSearchResponse : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BaseSearchResponse() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// A/B test ID. This is only included in the response for indices that are part of an A/B test.. + /// Variant ID. This is only included in the response for indices that are part of an A/B test.. + /// Computed geographical location.. + /// Automatically-computed radius.. + /// exhaustive. + /// See the `facetsCount` field of the `exhaustive` object in the response.. + /// See the `nbHits` field of the `exhaustive` object in the response.. + /// See the `typo` field of the `exhaustive` object in the response.. + /// Mapping of each facet name to the corresponding facet counts.. + /// Statistics for numerical facets.. + /// Number of hits per page. (required) (default to 20). + /// Index name used for the query.. + /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query.. + /// Warnings about the query.. + /// Number of hits the search query matched. (required). + /// Number of pages of results for the current query. (required). + /// Number of hits selected and sorted by the relevant sort algorithm.. + /// Page to retrieve (the first page is `0`, not `1`). (required) (default to 0). + /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched.. + /// Time the server took to process the request, in milliseconds. (required). + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues.. + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set.. + /// redirect. + /// renderingContent. + /// Time the server took to process the request, in milliseconds.. + /// Host name of the server that processed the request.. + /// Lets you store custom data in your indices.. + public BaseSearchResponse(int abTestID = default(int), int abTestVariantID = default(int), string aroundLatLng = default(string), string automaticRadius = default(string), Exhaustive exhaustive = default(Exhaustive), bool exhaustiveFacetsCount = default(bool), bool exhaustiveNbHits = default(bool), bool exhaustiveTypo = default(bool), Dictionary> facets = default(Dictionary>), Dictionary facetsStats = default(Dictionary), int hitsPerPage = 20, string index = default(string), string indexUsed = default(string), string message = default(string), int nbHits = default(int), int nbPages = default(int), int nbSortedHits = default(int), int page = 0, string parsedQuery = default(string), int processingTimeMS = default(int), Object processingTimingsMS = default(Object), string queryAfterRemoval = default(string), Redirect redirect = default(Redirect), RenderingContent renderingContent = default(RenderingContent), int serverTimeMS = default(int), string serverUsed = default(string), Object userData = default(Object)) : base() + { + this.HitsPerPage = hitsPerPage; + this.NbHits = nbHits; + this.NbPages = nbPages; + this.Page = page; + this.ProcessingTimeMS = processingTimeMS; + this.AbTestID = abTestID; + this.AbTestVariantID = abTestVariantID; + this.AroundLatLng = aroundLatLng; + this.AutomaticRadius = automaticRadius; + this.Exhaustive = exhaustive; + this.ExhaustiveFacetsCount = exhaustiveFacetsCount; + this.ExhaustiveNbHits = exhaustiveNbHits; + this.ExhaustiveTypo = exhaustiveTypo; + this.Facets = facets; + this.FacetsStats = facetsStats; + this.Index = index; + this.IndexUsed = indexUsed; + this.Message = message; + this.NbSortedHits = nbSortedHits; + this.ParsedQuery = parsedQuery; + this.ProcessingTimingsMS = processingTimingsMS; + this.QueryAfterRemoval = queryAfterRemoval; + this.Redirect = redirect; + this.RenderingContent = renderingContent; + this.ServerTimeMS = serverTimeMS; + this.ServerUsed = serverUsed; + this.UserData = userData; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// A/B test ID. This is only included in the response for indices that are part of an A/B test. + /// + /// A/B test ID. This is only included in the response for indices that are part of an A/B test. + [DataMember(Name = "abTestID", EmitDefaultValue = false)] + public int AbTestID { get; set; } + + /// + /// Variant ID. This is only included in the response for indices that are part of an A/B test. + /// + /// Variant ID. This is only included in the response for indices that are part of an A/B test. + [DataMember(Name = "abTestVariantID", EmitDefaultValue = false)] + public int AbTestVariantID { get; set; } + + /// + /// Computed geographical location. + /// + /// Computed geographical location. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Automatically-computed radius. + /// + /// Automatically-computed radius. + [DataMember(Name = "automaticRadius", EmitDefaultValue = false)] + public string AutomaticRadius { get; set; } + + /// + /// Gets or Sets Exhaustive + /// + [DataMember(Name = "exhaustive", EmitDefaultValue = false)] + public Exhaustive Exhaustive { get; set; } + + /// + /// See the `facetsCount` field of the `exhaustive` object in the response. + /// + /// See the `facetsCount` field of the `exhaustive` object in the response. + [DataMember(Name = "exhaustiveFacetsCount", EmitDefaultValue = true)] + [Obsolete] + public bool ExhaustiveFacetsCount { get; set; } + + /// + /// See the `nbHits` field of the `exhaustive` object in the response. + /// + /// See the `nbHits` field of the `exhaustive` object in the response. + [DataMember(Name = "exhaustiveNbHits", EmitDefaultValue = true)] + [Obsolete] + public bool ExhaustiveNbHits { get; set; } + + /// + /// See the `typo` field of the `exhaustive` object in the response. + /// + /// See the `typo` field of the `exhaustive` object in the response. + [DataMember(Name = "exhaustiveTypo", EmitDefaultValue = true)] + [Obsolete] + public bool ExhaustiveTypo { get; set; } + + /// + /// Mapping of each facet name to the corresponding facet counts. + /// + /// Mapping of each facet name to the corresponding facet counts. + [DataMember(Name = "facets", EmitDefaultValue = false)] + public Dictionary> Facets { get; set; } + + /// + /// Statistics for numerical facets. + /// + /// Statistics for numerical facets. + [DataMember(Name = "facets_stats", EmitDefaultValue = false)] + public Dictionary FacetsStats { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", IsRequired = true, EmitDefaultValue = true)] + public int HitsPerPage { get; set; } + + /// + /// Index name used for the query. + /// + /// Index name used for the query. + [DataMember(Name = "index", EmitDefaultValue = false)] + public string Index { get; set; } + + /// + /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. + /// + /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. + [DataMember(Name = "indexUsed", EmitDefaultValue = false)] + public string IndexUsed { get; set; } + + /// + /// Warnings about the query. + /// + /// Warnings about the query. + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Number of hits the search query matched. + /// + /// Number of hits the search query matched. + [DataMember(Name = "nbHits", IsRequired = true, EmitDefaultValue = true)] + public int NbHits { get; set; } + + /// + /// Number of pages of results for the current query. + /// + /// Number of pages of results for the current query. + [DataMember(Name = "nbPages", IsRequired = true, EmitDefaultValue = true)] + public int NbPages { get; set; } + + /// + /// Number of hits selected and sorted by the relevant sort algorithm. + /// + /// Number of hits selected and sorted by the relevant sort algorithm. + [DataMember(Name = "nbSortedHits", EmitDefaultValue = false)] + public int NbSortedHits { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", IsRequired = true, EmitDefaultValue = true)] + public int Page { get; set; } + + /// + /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. + /// + /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. + [DataMember(Name = "parsedQuery", EmitDefaultValue = false)] + public string ParsedQuery { get; set; } + + /// + /// Time the server took to process the request, in milliseconds. + /// + /// Time the server took to process the request, in milliseconds. + [DataMember(Name = "processingTimeMS", IsRequired = true, EmitDefaultValue = true)] + public int ProcessingTimeMS { get; set; } + + /// + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + /// + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + [DataMember(Name = "processingTimingsMS", EmitDefaultValue = false)] + public Object ProcessingTimingsMS { get; set; } + + /// + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + /// + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + [DataMember(Name = "queryAfterRemoval", EmitDefaultValue = false)] + public string QueryAfterRemoval { get; set; } + + /// + /// Gets or Sets Redirect + /// + [DataMember(Name = "redirect", EmitDefaultValue = false)] + public Redirect Redirect { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Time the server took to process the request, in milliseconds. + /// + /// Time the server took to process the request, in milliseconds. + [DataMember(Name = "serverTimeMS", EmitDefaultValue = false)] + public int ServerTimeMS { get; set; } + + /// + /// Host name of the server that processed the request. + /// + /// Host name of the server that processed the request. + [DataMember(Name = "serverUsed", EmitDefaultValue = false)] + public string ServerUsed { get; set; } + + /// + /// Lets you store custom data in your indices. + /// + /// Lets you store custom data in your indices. + [DataMember(Name = "userData", EmitDefaultValue = true)] + public Object UserData { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BaseSearchResponse {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" AbTestID: ").Append(AbTestID).Append("\n"); + sb.Append(" AbTestVariantID: ").Append(AbTestVariantID).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AutomaticRadius: ").Append(AutomaticRadius).Append("\n"); + sb.Append(" Exhaustive: ").Append(Exhaustive).Append("\n"); + sb.Append(" ExhaustiveFacetsCount: ").Append(ExhaustiveFacetsCount).Append("\n"); + sb.Append(" ExhaustiveNbHits: ").Append(ExhaustiveNbHits).Append("\n"); + sb.Append(" ExhaustiveTypo: ").Append(ExhaustiveTypo).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" FacetsStats: ").Append(FacetsStats).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" IndexUsed: ").Append(IndexUsed).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" NbPages: ").Append(NbPages).Append("\n"); + sb.Append(" NbSortedHits: ").Append(NbSortedHits).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" ParsedQuery: ").Append(ParsedQuery).Append("\n"); + sb.Append(" ProcessingTimeMS: ").Append(ProcessingTimeMS).Append("\n"); + sb.Append(" ProcessingTimingsMS: ").Append(ProcessingTimingsMS).Append("\n"); + sb.Append(" QueryAfterRemoval: ").Append(QueryAfterRemoval).Append("\n"); + sb.Append(" Redirect: ").Append(Redirect).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append(" ServerTimeMS: ").Append(ServerTimeMS).Append("\n"); + sb.Append(" ServerUsed: ").Append(ServerUsed).Append("\n"); + sb.Append(" UserData: ").Append(UserData).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BaseSearchResponse); + } + + /// + /// Returns true if BaseSearchResponse instances are equal + /// + /// Instance of BaseSearchResponse to be compared + /// Boolean + public bool Equals(BaseSearchResponse input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.AbTestID == input.AbTestID || + this.AbTestID.Equals(input.AbTestID) + ) && base.Equals(input) && + ( + this.AbTestVariantID == input.AbTestVariantID || + this.AbTestVariantID.Equals(input.AbTestVariantID) + ) && base.Equals(input) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && base.Equals(input) && + ( + this.AutomaticRadius == input.AutomaticRadius || + (this.AutomaticRadius != null && + this.AutomaticRadius.Equals(input.AutomaticRadius)) + ) && base.Equals(input) && + ( + this.Exhaustive == input.Exhaustive || + (this.Exhaustive != null && + this.Exhaustive.Equals(input.Exhaustive)) + ) && base.Equals(input) && + ( + this.ExhaustiveFacetsCount == input.ExhaustiveFacetsCount || + this.ExhaustiveFacetsCount.Equals(input.ExhaustiveFacetsCount) + ) && base.Equals(input) && + ( + this.ExhaustiveNbHits == input.ExhaustiveNbHits || + this.ExhaustiveNbHits.Equals(input.ExhaustiveNbHits) + ) && base.Equals(input) && + ( + this.ExhaustiveTypo == input.ExhaustiveTypo || + this.ExhaustiveTypo.Equals(input.ExhaustiveTypo) + ) && base.Equals(input) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && base.Equals(input) && + ( + this.FacetsStats == input.FacetsStats || + this.FacetsStats != null && + input.FacetsStats != null && + this.FacetsStats.SequenceEqual(input.FacetsStats) + ) && base.Equals(input) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && base.Equals(input) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && base.Equals(input) && + ( + this.IndexUsed == input.IndexUsed || + (this.IndexUsed != null && + this.IndexUsed.Equals(input.IndexUsed)) + ) && base.Equals(input) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) && base.Equals(input) && + ( + this.NbHits == input.NbHits || + this.NbHits.Equals(input.NbHits) + ) && base.Equals(input) && + ( + this.NbPages == input.NbPages || + this.NbPages.Equals(input.NbPages) + ) && base.Equals(input) && + ( + this.NbSortedHits == input.NbSortedHits || + this.NbSortedHits.Equals(input.NbSortedHits) + ) && base.Equals(input) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && base.Equals(input) && + ( + this.ParsedQuery == input.ParsedQuery || + (this.ParsedQuery != null && + this.ParsedQuery.Equals(input.ParsedQuery)) + ) && base.Equals(input) && + ( + this.ProcessingTimeMS == input.ProcessingTimeMS || + this.ProcessingTimeMS.Equals(input.ProcessingTimeMS) + ) && base.Equals(input) && + ( + this.ProcessingTimingsMS == input.ProcessingTimingsMS || + (this.ProcessingTimingsMS != null && + this.ProcessingTimingsMS.Equals(input.ProcessingTimingsMS)) + ) && base.Equals(input) && + ( + this.QueryAfterRemoval == input.QueryAfterRemoval || + (this.QueryAfterRemoval != null && + this.QueryAfterRemoval.Equals(input.QueryAfterRemoval)) + ) && base.Equals(input) && + ( + this.Redirect == input.Redirect || + (this.Redirect != null && + this.Redirect.Equals(input.Redirect)) + ) && base.Equals(input) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ) && base.Equals(input) && + ( + this.ServerTimeMS == input.ServerTimeMS || + this.ServerTimeMS.Equals(input.ServerTimeMS) + ) && base.Equals(input) && + ( + this.ServerUsed == input.ServerUsed || + (this.ServerUsed != null && + this.ServerUsed.Equals(input.ServerUsed)) + ) && base.Equals(input) && + ( + this.UserData == input.UserData || + (this.UserData != null && + this.UserData.Equals(input.UserData)) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + hashCode = (hashCode * 59) + this.AbTestID.GetHashCode(); + hashCode = (hashCode * 59) + this.AbTestVariantID.GetHashCode(); + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + if (this.AutomaticRadius != null) + { + hashCode = (hashCode * 59) + this.AutomaticRadius.GetHashCode(); + } + if (this.Exhaustive != null) + { + hashCode = (hashCode * 59) + this.Exhaustive.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ExhaustiveFacetsCount.GetHashCode(); + hashCode = (hashCode * 59) + this.ExhaustiveNbHits.GetHashCode(); + hashCode = (hashCode * 59) + this.ExhaustiveTypo.GetHashCode(); + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + if (this.FacetsStats != null) + { + hashCode = (hashCode * 59) + this.FacetsStats.GetHashCode(); + } + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.IndexUsed != null) + { + hashCode = (hashCode * 59) + this.IndexUsed.GetHashCode(); + } + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NbHits.GetHashCode(); + hashCode = (hashCode * 59) + this.NbPages.GetHashCode(); + hashCode = (hashCode * 59) + this.NbSortedHits.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + if (this.ParsedQuery != null) + { + hashCode = (hashCode * 59) + this.ParsedQuery.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ProcessingTimeMS.GetHashCode(); + if (this.ProcessingTimingsMS != null) + { + hashCode = (hashCode * 59) + this.ProcessingTimingsMS.GetHashCode(); + } + if (this.QueryAfterRemoval != null) + { + hashCode = (hashCode * 59) + this.QueryAfterRemoval.GetHashCode(); + } + if (this.Redirect != null) + { + hashCode = (hashCode * 59) + this.Redirect.GetHashCode(); + } + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ServerTimeMS.GetHashCode(); + if (this.ServerUsed != null) + { + hashCode = (hashCode * 59) + this.ServerUsed.GetHashCode(); + } + if (this.UserData != null) + { + hashCode = (hashCode * 59) + this.UserData.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + // AbTestVariantID (int) minimum + if (this.AbTestVariantID < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for AbTestVariantID, must be a value greater than or equal to 1.", new[] { "AbTestVariantID" }); + } + + if (this.AroundLatLng != null) + { + // AroundLatLng (string) pattern + Regex regexAroundLatLng = new Regex(@"^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$", RegexOptions.CultureInvariant); + if (!regexAroundLatLng.Match(this.AroundLatLng).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for AroundLatLng, must match a pattern of " + regexAroundLatLng, new[] { "AroundLatLng" }); + } + } + + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/BatchAssignUserIdsParams.cs b/algoliasearch/Search/Models/BatchAssignUserIdsParams.cs new file mode 100644 index 000000000..3d4cc428f --- /dev/null +++ b/algoliasearch/Search/Models/BatchAssignUserIdsParams.cs @@ -0,0 +1,159 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Assign userID parameters. + /// + [DataContract(Name = "batchAssignUserIdsParams")] + public partial class BatchAssignUserIdsParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BatchAssignUserIdsParams() { } + /// + /// Initializes a new instance of the class. + /// + /// Cluster name. (required). + /// User IDs to assign. (required). + public BatchAssignUserIdsParams(string cluster = default(string), List users = default(List)) + { + // to ensure "cluster" is required (not null) + if (cluster == null) + { + throw new ArgumentNullException("cluster is a required property for BatchAssignUserIdsParams and cannot be null"); + } + this.Cluster = cluster; + // to ensure "users" is required (not null) + if (users == null) + { + throw new ArgumentNullException("users is a required property for BatchAssignUserIdsParams and cannot be null"); + } + this.Users = users; + } + + /// + /// Cluster name. + /// + /// Cluster name. + [DataMember(Name = "cluster", IsRequired = true, EmitDefaultValue = true)] + public string Cluster { get; set; } + + /// + /// User IDs to assign. + /// + /// User IDs to assign. + [DataMember(Name = "users", IsRequired = true, EmitDefaultValue = true)] + public List Users { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BatchAssignUserIdsParams {\n"); + sb.Append(" Cluster: ").Append(Cluster).Append("\n"); + sb.Append(" Users: ").Append(Users).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BatchAssignUserIdsParams); + } + + /// + /// Returns true if BatchAssignUserIdsParams instances are equal + /// + /// Instance of BatchAssignUserIdsParams to be compared + /// Boolean + public bool Equals(BatchAssignUserIdsParams input) + { + if (input == null) + { + return false; + } + return + ( + this.Cluster == input.Cluster || + (this.Cluster != null && + this.Cluster.Equals(input.Cluster)) + ) && + ( + this.Users == input.Users || + this.Users != null && + input.Users != null && + this.Users.SequenceEqual(input.Users) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Cluster != null) + { + hashCode = (hashCode * 59) + this.Cluster.GetHashCode(); + } + if (this.Users != null) + { + hashCode = (hashCode * 59) + this.Users.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/BatchDictionaryEntriesParams.cs b/algoliasearch/Search/Models/BatchDictionaryEntriesParams.cs new file mode 100644 index 000000000..150728ae6 --- /dev/null +++ b/algoliasearch/Search/Models/BatchDictionaryEntriesParams.cs @@ -0,0 +1,150 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// `batchDictionaryEntries` parameters. + /// + [DataContract(Name = "batchDictionaryEntriesParams")] + public partial class BatchDictionaryEntriesParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BatchDictionaryEntriesParams() { } + /// + /// Initializes a new instance of the class. + /// + /// Incidates whether to replace all custom entries in the dictionary with the ones sent with this request. (default to false). + /// Operations to batch. (required). + public BatchDictionaryEntriesParams(bool clearExistingDictionaryEntries = false, List requests = default(List)) + { + // to ensure "requests" is required (not null) + if (requests == null) + { + throw new ArgumentNullException("requests is a required property for BatchDictionaryEntriesParams and cannot be null"); + } + this.Requests = requests; + this.ClearExistingDictionaryEntries = clearExistingDictionaryEntries; + } + + /// + /// Incidates whether to replace all custom entries in the dictionary with the ones sent with this request. + /// + /// Incidates whether to replace all custom entries in the dictionary with the ones sent with this request. + [DataMember(Name = "clearExistingDictionaryEntries", EmitDefaultValue = true)] + public bool ClearExistingDictionaryEntries { get; set; } + + /// + /// Operations to batch. + /// + /// Operations to batch. + [DataMember(Name = "requests", IsRequired = true, EmitDefaultValue = true)] + public List Requests { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BatchDictionaryEntriesParams {\n"); + sb.Append(" ClearExistingDictionaryEntries: ").Append(ClearExistingDictionaryEntries).Append("\n"); + sb.Append(" Requests: ").Append(Requests).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BatchDictionaryEntriesParams); + } + + /// + /// Returns true if BatchDictionaryEntriesParams instances are equal + /// + /// Instance of BatchDictionaryEntriesParams to be compared + /// Boolean + public bool Equals(BatchDictionaryEntriesParams input) + { + if (input == null) + { + return false; + } + return + ( + this.ClearExistingDictionaryEntries == input.ClearExistingDictionaryEntries || + this.ClearExistingDictionaryEntries.Equals(input.ClearExistingDictionaryEntries) + ) && + ( + this.Requests == input.Requests || + this.Requests != null && + input.Requests != null && + this.Requests.SequenceEqual(input.Requests) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.ClearExistingDictionaryEntries.GetHashCode(); + if (this.Requests != null) + { + hashCode = (hashCode * 59) + this.Requests.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/BatchDictionaryEntriesRequest.cs b/algoliasearch/Search/Models/BatchDictionaryEntriesRequest.cs new file mode 100644 index 000000000..4f197cd5a --- /dev/null +++ b/algoliasearch/Search/Models/BatchDictionaryEntriesRequest.cs @@ -0,0 +1,147 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// BatchDictionaryEntriesRequest + /// + [DataContract(Name = "batchDictionaryEntriesRequest")] + public partial class BatchDictionaryEntriesRequest : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Action + /// + [DataMember(Name = "action", IsRequired = true, EmitDefaultValue = true)] + public DictionaryAction Action { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BatchDictionaryEntriesRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// action (required). + /// body (required). + public BatchDictionaryEntriesRequest(DictionaryAction action = default(DictionaryAction), DictionaryEntry body = default(DictionaryEntry)) + { + this.Action = action; + // to ensure "body" is required (not null) + if (body == null) + { + throw new ArgumentNullException("body is a required property for BatchDictionaryEntriesRequest and cannot be null"); + } + this.Body = body; + } + + /// + /// Gets or Sets Body + /// + [DataMember(Name = "body", IsRequired = true, EmitDefaultValue = true)] + public DictionaryEntry Body { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BatchDictionaryEntriesRequest {\n"); + sb.Append(" Action: ").Append(Action).Append("\n"); + sb.Append(" Body: ").Append(Body).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BatchDictionaryEntriesRequest); + } + + /// + /// Returns true if BatchDictionaryEntriesRequest instances are equal + /// + /// Instance of BatchDictionaryEntriesRequest to be compared + /// Boolean + public bool Equals(BatchDictionaryEntriesRequest input) + { + if (input == null) + { + return false; + } + return + ( + this.Action == input.Action || + this.Action.Equals(input.Action) + ) && + ( + this.Body == input.Body || + (this.Body != null && + this.Body.Equals(input.Body)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Action.GetHashCode(); + if (this.Body != null) + { + hashCode = (hashCode * 59) + this.Body.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/BatchParams.cs b/algoliasearch/Search/Models/BatchParams.cs new file mode 100644 index 000000000..a0ed6ca20 --- /dev/null +++ b/algoliasearch/Search/Models/BatchParams.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Batch parameters. + /// + [DataContract(Name = "batchParams")] + public partial class BatchParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BatchParams() { } + /// + /// Initializes a new instance of the class. + /// + /// requests (required). + public BatchParams(List requests = default(List)) + { + // to ensure "requests" is required (not null) + if (requests == null) + { + throw new ArgumentNullException("requests is a required property for BatchParams and cannot be null"); + } + this.Requests = requests; + } + + /// + /// Gets or Sets Requests + /// + [DataMember(Name = "requests", IsRequired = true, EmitDefaultValue = true)] + public List Requests { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BatchParams {\n"); + sb.Append(" Requests: ").Append(Requests).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BatchParams); + } + + /// + /// Returns true if BatchParams instances are equal + /// + /// Instance of BatchParams to be compared + /// Boolean + public bool Equals(BatchParams input) + { + if (input == null) + { + return false; + } + return + ( + this.Requests == input.Requests || + this.Requests != null && + input.Requests != null && + this.Requests.SequenceEqual(input.Requests) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Requests != null) + { + hashCode = (hashCode * 59) + this.Requests.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/BatchRequest.cs b/algoliasearch/Search/Models/BatchRequest.cs new file mode 100644 index 000000000..78712ccaa --- /dev/null +++ b/algoliasearch/Search/Models/BatchRequest.cs @@ -0,0 +1,148 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// BatchRequest + /// + [DataContract(Name = "batchRequest")] + public partial class BatchRequest : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Action + /// + [DataMember(Name = "action", IsRequired = true, EmitDefaultValue = true)] + public Action Action { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BatchRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// action (required). + /// Operation arguments (varies with specified `action`). (required). + public BatchRequest(Action action = default(Action), Object body = default(Object)) + { + this.Action = action; + // to ensure "body" is required (not null) + if (body == null) + { + throw new ArgumentNullException("body is a required property for BatchRequest and cannot be null"); + } + this.Body = body; + } + + /// + /// Operation arguments (varies with specified `action`). + /// + /// Operation arguments (varies with specified `action`). + [DataMember(Name = "body", IsRequired = true, EmitDefaultValue = true)] + public Object Body { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BatchRequest {\n"); + sb.Append(" Action: ").Append(Action).Append("\n"); + sb.Append(" Body: ").Append(Body).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BatchRequest); + } + + /// + /// Returns true if BatchRequest instances are equal + /// + /// Instance of BatchRequest to be compared + /// Boolean + public bool Equals(BatchRequest input) + { + if (input == null) + { + return false; + } + return + ( + this.Action == input.Action || + this.Action.Equals(input.Action) + ) && + ( + this.Body == input.Body || + (this.Body != null && + this.Body.Equals(input.Body)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Action.GetHashCode(); + if (this.Body != null) + { + hashCode = (hashCode * 59) + this.Body.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/BatchResponse.cs b/algoliasearch/Search/Models/BatchResponse.cs new file mode 100644 index 000000000..9656fff8b --- /dev/null +++ b/algoliasearch/Search/Models/BatchResponse.cs @@ -0,0 +1,150 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// BatchResponse + /// + [DataContract(Name = "batchResponse")] + public partial class BatchResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BatchResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. (required). + /// Unique object (record) identifiers. (required). + public BatchResponse(long taskID = default(long), List objectIDs = default(List)) + { + this.TaskID = taskID; + // to ensure "objectIDs" is required (not null) + if (objectIDs == null) + { + throw new ArgumentNullException("objectIDs is a required property for BatchResponse and cannot be null"); + } + this.ObjectIDs = objectIDs; + } + + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + [DataMember(Name = "taskID", IsRequired = true, EmitDefaultValue = true)] + public long TaskID { get; set; } + + /// + /// Unique object (record) identifiers. + /// + /// Unique object (record) identifiers. + [DataMember(Name = "objectIDs", IsRequired = true, EmitDefaultValue = true)] + public List ObjectIDs { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BatchResponse {\n"); + sb.Append(" TaskID: ").Append(TaskID).Append("\n"); + sb.Append(" ObjectIDs: ").Append(ObjectIDs).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BatchResponse); + } + + /// + /// Returns true if BatchResponse instances are equal + /// + /// Instance of BatchResponse to be compared + /// Boolean + public bool Equals(BatchResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.TaskID == input.TaskID || + this.TaskID.Equals(input.TaskID) + ) && + ( + this.ObjectIDs == input.ObjectIDs || + this.ObjectIDs != null && + input.ObjectIDs != null && + this.ObjectIDs.SequenceEqual(input.ObjectIDs) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.TaskID.GetHashCode(); + if (this.ObjectIDs != null) + { + hashCode = (hashCode * 59) + this.ObjectIDs.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/BatchWriteParams.cs b/algoliasearch/Search/Models/BatchWriteParams.cs new file mode 100644 index 000000000..9dd56c88f --- /dev/null +++ b/algoliasearch/Search/Models/BatchWriteParams.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Batch parameters. + /// + [DataContract(Name = "batchWriteParams")] + public partial class BatchWriteParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BatchWriteParams() { } + /// + /// Initializes a new instance of the class. + /// + /// requests (required). + public BatchWriteParams(List requests = default(List)) + { + // to ensure "requests" is required (not null) + if (requests == null) + { + throw new ArgumentNullException("requests is a required property for BatchWriteParams and cannot be null"); + } + this.Requests = requests; + } + + /// + /// Gets or Sets Requests + /// + [DataMember(Name = "requests", IsRequired = true, EmitDefaultValue = true)] + public List Requests { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BatchWriteParams {\n"); + sb.Append(" Requests: ").Append(Requests).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BatchWriteParams); + } + + /// + /// Returns true if BatchWriteParams instances are equal + /// + /// Instance of BatchWriteParams to be compared + /// Boolean + public bool Equals(BatchWriteParams input) + { + if (input == null) + { + return false; + } + return + ( + this.Requests == input.Requests || + this.Requests != null && + input.Requests != null && + this.Requests.SequenceEqual(input.Requests) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Requests != null) + { + hashCode = (hashCode * 59) + this.Requests.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/BrowseParams.cs b/algoliasearch/Search/Models/BrowseParams.cs new file mode 100644 index 000000000..ab9047f35 --- /dev/null +++ b/algoliasearch/Search/Models/BrowseParams.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// BrowseParams + /// + [JsonConverter(typeof(BrowseParamsJsonConverter))] + [DataContract(Name = "browseParams")] + public partial class BrowseParams : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SearchParamsString. + public BrowseParams(SearchParamsString actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of BrowseParamsObject. + public BrowseParams(BrowseParamsObject actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(BrowseParamsObject)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SearchParamsString)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: BrowseParamsObject, SearchParamsString"); + } + } + } + + /// + /// Get the actual instance of `SearchParamsString`. If the actual instance is not `SearchParamsString`, + /// the InvalidClassException will be thrown + /// + /// An instance of SearchParamsString + public SearchParamsString GetterSearchParamsString() + { + return (SearchParamsString)this.ActualInstance; + } + + /// + /// Get the actual instance of `BrowseParamsObject`. If the actual instance is not `BrowseParamsObject`, + /// the InvalidClassException will be thrown + /// + /// An instance of BrowseParamsObject + public BrowseParamsObject GetterBrowseParamsObject() + { + return (BrowseParamsObject)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class BrowseParams {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, BrowseParams.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of BrowseParams + /// + /// JSON string + /// An instance of BrowseParams + public static BrowseParams FromJson(string jsonString) + { + BrowseParams newBrowseParams = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newBrowseParams; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(BrowseParamsObject).GetProperty("AdditionalProperties") == null) + { + newBrowseParams = new BrowseParams(JsonConvert.DeserializeObject(jsonString, BrowseParams.SerializerSettings)); + } + else + { + newBrowseParams = new BrowseParams(JsonConvert.DeserializeObject(jsonString, BrowseParams.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("BrowseParamsObject"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into BrowseParamsObject: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SearchParamsString).GetProperty("AdditionalProperties") == null) + { + newBrowseParams = new BrowseParams(JsonConvert.DeserializeObject(jsonString, BrowseParams.SerializerSettings)); + } + else + { + newBrowseParams = new BrowseParams(JsonConvert.DeserializeObject(jsonString, BrowseParams.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SearchParamsString"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SearchParamsString: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newBrowseParams; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BrowseParams); + } + + /// + /// Returns true if BrowseParams instances are equal + /// + /// Instance of BrowseParams to be compared + /// Boolean + public bool Equals(BrowseParams input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for BrowseParams + /// + public class BrowseParamsJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(BrowseParams).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return BrowseParams.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/BrowseParamsObject.cs b/algoliasearch/Search/Models/BrowseParamsObject.cs new file mode 100644 index 000000000..9cc358513 --- /dev/null +++ b/algoliasearch/Search/Models/BrowseParamsObject.cs @@ -0,0 +1,1531 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// BrowseParamsObject + /// + [DataContract(Name = "browseParamsObject")] + public partial class BrowseParamsObject : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets QueryType + /// + [DataMember(Name = "queryType", EmitDefaultValue = false)] + public QueryType? QueryType { get; set; } + + /// + /// Gets or Sets RemoveWordsIfNoResults + /// + [DataMember(Name = "removeWordsIfNoResults", EmitDefaultValue = false)] + public RemoveWordsIfNoResults? RemoveWordsIfNoResults { get; set; } + + /// + /// Gets or Sets Mode + /// + [DataMember(Name = "mode", EmitDefaultValue = false)] + public Mode? Mode { get; set; } + + /// + /// Gets or Sets ExactOnSingleWordQuery + /// + [DataMember(Name = "exactOnSingleWordQuery", EmitDefaultValue = false)] + public ExactOnSingleWordQuery? ExactOnSingleWordQuery { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Text to search for in an index. (default to ""). + /// Overrides the query parameter and performs a more generic search. (default to ""). + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. (default to ""). + /// facetFilters. + /// optionalFilters. + /// numericFilters. + /// tagFilters. + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. (default to false). + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/).. + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values.. + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. (default to false). + /// Page to retrieve (the first page is `0`, not `1`). (default to 0). + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. (default to ""). + /// Search for entries around a location. The location is automatically computed from the requester's IP address. (default to false). + /// aroundRadius. + /// aroundPrecision. + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set.. + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries.. + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries.. + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). (default to 100). + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search.. + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). (default to false). + /// Enriches the API's response with information about how the query was processed.. + /// Whether to take into account an index's synonyms for a particular search. (default to true). + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). (default to false). + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). (default to true). + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).. + /// Whether to include or exclude a query from the processing-time percentile computation. (default to true). + /// Incidates whether this search will be considered in A/B testing. (default to true). + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. . + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes.. + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/).. + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. . + /// Relevancy threshold below which less relevant results aren't included in the results. (default to 100). + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`).. + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. . + /// HTML string to insert before the highlighted parts in all highlight and snippet results. (default to "<em>"). + /// HTML string to insert after the highlighted parts in all highlight and snippet results. (default to "</em>"). + /// String used as an ellipsis indicator when a snippet is truncated. (default to "…"). + /// Restrict highlighting and snippeting to items that matched the query. (default to false). + /// Number of hits per page. (default to 20). + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 4). + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 8). + /// typoTolerance. + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. (default to true). + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/).. + /// ignorePlurals. + /// removeStopWords. + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). (default to ""). + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection.. + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. (default to true). + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. (default to true). + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. (default to false). + /// queryType. + /// removeWordsIfNoResults. + /// mode. + /// semanticSearch. + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). (default to false). + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query.. + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// exactOnSingleWordQuery. + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled.. + /// distinct. + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. (default to false). + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). (default to 1). + /// Attributes to include in the API response for search and browse queries.. + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). (default to 10). + /// Maximum number of facet values to return for each facet. (default to 100). + /// Controls how facet values are fetched. (default to "count"). + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. (default to false). + /// renderingContent. + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). (default to true). + /// reRankingApplyFilter. + /// Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. Pass this value to the subsequent browse call to get the next page of results. When the end of the index has been reached, `cursor` is absent from the response. . + public BrowseParamsObject(string query = @"", string similarQuery = @"", string filters = @"", FacetFilters facetFilters = default(FacetFilters), OptionalFilters optionalFilters = default(OptionalFilters), NumericFilters numericFilters = default(NumericFilters), TagFilters tagFilters = default(TagFilters), bool sumOrFiltersScores = false, List restrictSearchableAttributes = default(List), List facets = default(List), bool facetingAfterDistinct = false, int page = 0, int offset = default(int), int length = default(int), string aroundLatLng = @"", bool aroundLatLngViaIP = false, AroundRadius aroundRadius = default(AroundRadius), AroundPrecision aroundPrecision = default(AroundPrecision), int minimumAroundRadius = default(int), List> insideBoundingBox = default(List>), List> insidePolygon = default(List>), List naturalLanguages = default(List), List ruleContexts = default(List), int personalizationImpact = 100, string userToken = default(string), bool getRankingInfo = false, List explain = default(List), bool synonyms = true, bool clickAnalytics = false, bool analytics = true, List analyticsTags = default(List), bool percentileComputation = true, bool enableABTest = true, List attributesForFaceting = default(List), List attributesToRetrieve = default(List), List ranking = default(List), List customRanking = default(List), int relevancyStrictness = 100, List attributesToHighlight = default(List), List attributesToSnippet = default(List), string highlightPreTag = @"", string highlightPostTag = @"", string snippetEllipsisText = @"…", bool restrictHighlightAndSnippetArrays = false, int hitsPerPage = 20, int minWordSizefor1Typo = 4, int minWordSizefor2Typos = 8, TypoTolerance typoTolerance = default(TypoTolerance), bool allowTyposOnNumericTokens = true, List disableTypoToleranceOnAttributes = default(List), IgnorePlurals ignorePlurals = default(IgnorePlurals), RemoveStopWords removeStopWords = default(RemoveStopWords), string keepDiacriticsOnCharacters = @"", List queryLanguages = default(List), bool decompoundQuery = true, bool enableRules = true, bool enablePersonalization = false, QueryType? queryType = default(QueryType?), RemoveWordsIfNoResults? removeWordsIfNoResults = default(RemoveWordsIfNoResults?), Mode? mode = default(Mode?), SemanticSearch semanticSearch = default(SemanticSearch), bool advancedSyntax = false, List optionalWords = default(List), List disableExactOnAttributes = default(List), ExactOnSingleWordQuery? exactOnSingleWordQuery = default(ExactOnSingleWordQuery?), List alternativesAsExact = default(List), List advancedSyntaxFeatures = default(List), Distinct distinct = default(Distinct), bool replaceSynonymsInHighlight = false, int minProximity = 1, List responseFields = default(List), int maxFacetHits = 10, int maxValuesPerFacet = 100, string sortFacetValuesBy = @"count", bool attributeCriteriaComputedByMinProximity = false, RenderingContent renderingContent = default(RenderingContent), bool enableReRanking = true, ReRankingApplyFilter reRankingApplyFilter = default(ReRankingApplyFilter), string cursor = default(string)) + { + // use default value if no "query" provided + this.Query = query ?? @""; + // use default value if no "similarQuery" provided + this.SimilarQuery = similarQuery ?? @""; + // use default value if no "filters" provided + this.Filters = filters ?? @""; + this.FacetFilters = facetFilters; + this.OptionalFilters = optionalFilters; + this.NumericFilters = numericFilters; + this.TagFilters = tagFilters; + this.SumOrFiltersScores = sumOrFiltersScores; + this.RestrictSearchableAttributes = restrictSearchableAttributes; + this.Facets = facets; + this.FacetingAfterDistinct = facetingAfterDistinct; + this.Page = page; + this.Offset = offset; + this.Length = length; + // use default value if no "aroundLatLng" provided + this.AroundLatLng = aroundLatLng ?? @""; + this.AroundLatLngViaIP = aroundLatLngViaIP; + this.AroundRadius = aroundRadius; + this.AroundPrecision = aroundPrecision; + this.MinimumAroundRadius = minimumAroundRadius; + this.InsideBoundingBox = insideBoundingBox; + this.InsidePolygon = insidePolygon; + this.NaturalLanguages = naturalLanguages; + this.RuleContexts = ruleContexts; + this.PersonalizationImpact = personalizationImpact; + this.UserToken = userToken; + this.GetRankingInfo = getRankingInfo; + this.Explain = explain; + this.Synonyms = synonyms; + this.ClickAnalytics = clickAnalytics; + this.Analytics = analytics; + this.AnalyticsTags = analyticsTags; + this.PercentileComputation = percentileComputation; + this.EnableABTest = enableABTest; + this.AttributesForFaceting = attributesForFaceting; + this.AttributesToRetrieve = attributesToRetrieve; + this.Ranking = ranking; + this.CustomRanking = customRanking; + this.RelevancyStrictness = relevancyStrictness; + this.AttributesToHighlight = attributesToHighlight; + this.AttributesToSnippet = attributesToSnippet; + // use default value if no "highlightPreTag" provided + this.HighlightPreTag = highlightPreTag ?? @""; + // use default value if no "highlightPostTag" provided + this.HighlightPostTag = highlightPostTag ?? @""; + // use default value if no "snippetEllipsisText" provided + this.SnippetEllipsisText = snippetEllipsisText ?? @"…"; + this.RestrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + this.HitsPerPage = hitsPerPage; + this.MinWordSizefor1Typo = minWordSizefor1Typo; + this.MinWordSizefor2Typos = minWordSizefor2Typos; + this.TypoTolerance = typoTolerance; + this.AllowTyposOnNumericTokens = allowTyposOnNumericTokens; + this.DisableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + this.IgnorePlurals = ignorePlurals; + this.RemoveStopWords = removeStopWords; + // use default value if no "keepDiacriticsOnCharacters" provided + this.KeepDiacriticsOnCharacters = keepDiacriticsOnCharacters ?? @""; + this.QueryLanguages = queryLanguages; + this.DecompoundQuery = decompoundQuery; + this.EnableRules = enableRules; + this.EnablePersonalization = enablePersonalization; + this.QueryType = queryType; + this.RemoveWordsIfNoResults = removeWordsIfNoResults; + this.Mode = mode; + this.SemanticSearch = semanticSearch; + this.AdvancedSyntax = advancedSyntax; + this.OptionalWords = optionalWords; + this.DisableExactOnAttributes = disableExactOnAttributes; + this.ExactOnSingleWordQuery = exactOnSingleWordQuery; + this.AlternativesAsExact = alternativesAsExact; + this.AdvancedSyntaxFeatures = advancedSyntaxFeatures; + this.Distinct = distinct; + this.ReplaceSynonymsInHighlight = replaceSynonymsInHighlight; + this.MinProximity = minProximity; + this.ResponseFields = responseFields; + this.MaxFacetHits = maxFacetHits; + this.MaxValuesPerFacet = maxValuesPerFacet; + // use default value if no "sortFacetValuesBy" provided + this.SortFacetValuesBy = sortFacetValuesBy ?? @"count"; + this.AttributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + this.RenderingContent = renderingContent; + this.EnableReRanking = enableReRanking; + this.ReRankingApplyFilter = reRankingApplyFilter; + this.Cursor = cursor; + } + + /// + /// Text to search for in an index. + /// + /// Text to search for in an index. + [DataMember(Name = "query", EmitDefaultValue = false)] + public string Query { get; set; } + + /// + /// Overrides the query parameter and performs a more generic search. + /// + /// Overrides the query parameter and performs a more generic search. + [DataMember(Name = "similarQuery", EmitDefaultValue = false)] + public string SimilarQuery { get; set; } + + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + [DataMember(Name = "filters", EmitDefaultValue = false)] + public string Filters { get; set; } + + /// + /// Gets or Sets FacetFilters + /// + [DataMember(Name = "facetFilters", EmitDefaultValue = false)] + public FacetFilters FacetFilters { get; set; } + + /// + /// Gets or Sets OptionalFilters + /// + [DataMember(Name = "optionalFilters", EmitDefaultValue = false)] + public OptionalFilters OptionalFilters { get; set; } + + /// + /// Gets or Sets NumericFilters + /// + [DataMember(Name = "numericFilters", EmitDefaultValue = false)] + public NumericFilters NumericFilters { get; set; } + + /// + /// Gets or Sets TagFilters + /// + [DataMember(Name = "tagFilters", EmitDefaultValue = false)] + public TagFilters TagFilters { get; set; } + + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + [DataMember(Name = "sumOrFiltersScores", EmitDefaultValue = true)] + public bool SumOrFiltersScores { get; set; } + + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + [DataMember(Name = "restrictSearchableAttributes", EmitDefaultValue = false)] + public List RestrictSearchableAttributes { get; set; } + + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + [DataMember(Name = "facets", EmitDefaultValue = false)] + public List Facets { get; set; } + + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + [DataMember(Name = "facetingAfterDistinct", EmitDefaultValue = true)] + public bool FacetingAfterDistinct { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", EmitDefaultValue = false)] + public int Page { get; set; } + + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "offset", EmitDefaultValue = false)] + public int Offset { get; set; } + + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "length", EmitDefaultValue = false)] + public int Length { get; set; } + + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + [DataMember(Name = "aroundLatLngViaIP", EmitDefaultValue = true)] + public bool AroundLatLngViaIP { get; set; } + + /// + /// Gets or Sets AroundRadius + /// + [DataMember(Name = "aroundRadius", EmitDefaultValue = false)] + public AroundRadius AroundRadius { get; set; } + + /// + /// Gets or Sets AroundPrecision + /// + [DataMember(Name = "aroundPrecision", EmitDefaultValue = false)] + public AroundPrecision AroundPrecision { get; set; } + + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + [DataMember(Name = "minimumAroundRadius", EmitDefaultValue = false)] + public int MinimumAroundRadius { get; set; } + + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insideBoundingBox", EmitDefaultValue = false)] + public List> InsideBoundingBox { get; set; } + + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insidePolygon", EmitDefaultValue = false)] + public List> InsidePolygon { get; set; } + + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + [DataMember(Name = "naturalLanguages", EmitDefaultValue = false)] + public List NaturalLanguages { get; set; } + + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + [DataMember(Name = "ruleContexts", EmitDefaultValue = false)] + public List RuleContexts { get; set; } + + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + [DataMember(Name = "personalizationImpact", EmitDefaultValue = false)] + public int PersonalizationImpact { get; set; } + + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + [DataMember(Name = "userToken", EmitDefaultValue = false)] + public string UserToken { get; set; } + + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + [DataMember(Name = "getRankingInfo", EmitDefaultValue = true)] + public bool GetRankingInfo { get; set; } + + /// + /// Enriches the API's response with information about how the query was processed. + /// + /// Enriches the API's response with information about how the query was processed. + [DataMember(Name = "explain", EmitDefaultValue = false)] + public List Explain { get; set; } + + /// + /// Whether to take into account an index's synonyms for a particular search. + /// + /// Whether to take into account an index's synonyms for a particular search. + [DataMember(Name = "synonyms", EmitDefaultValue = true)] + public bool Synonyms { get; set; } + + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + [DataMember(Name = "clickAnalytics", EmitDefaultValue = true)] + public bool ClickAnalytics { get; set; } + + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + [DataMember(Name = "analytics", EmitDefaultValue = true)] + public bool Analytics { get; set; } + + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + [DataMember(Name = "analyticsTags", EmitDefaultValue = false)] + public List AnalyticsTags { get; set; } + + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + [DataMember(Name = "percentileComputation", EmitDefaultValue = true)] + public bool PercentileComputation { get; set; } + + /// + /// Incidates whether this search will be considered in A/B testing. + /// + /// Incidates whether this search will be considered in A/B testing. + [DataMember(Name = "enableABTest", EmitDefaultValue = true)] + public bool EnableABTest { get; set; } + + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + [DataMember(Name = "attributesForFaceting", EmitDefaultValue = false)] + public List AttributesForFaceting { get; set; } + + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + [DataMember(Name = "attributesToRetrieve", EmitDefaultValue = false)] + public List AttributesToRetrieve { get; set; } + + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + [DataMember(Name = "ranking", EmitDefaultValue = false)] + public List Ranking { get; set; } + + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + [DataMember(Name = "customRanking", EmitDefaultValue = false)] + public List CustomRanking { get; set; } + + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + [DataMember(Name = "relevancyStrictness", EmitDefaultValue = false)] + public int RelevancyStrictness { get; set; } + + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + [DataMember(Name = "attributesToHighlight", EmitDefaultValue = false)] + public List AttributesToHighlight { get; set; } + + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + [DataMember(Name = "attributesToSnippet", EmitDefaultValue = false)] + public List AttributesToSnippet { get; set; } + + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPreTag", EmitDefaultValue = false)] + public string HighlightPreTag { get; set; } + + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPostTag", EmitDefaultValue = false)] + public string HighlightPostTag { get; set; } + + /// + /// String used as an ellipsis indicator when a snippet is truncated. + /// + /// String used as an ellipsis indicator when a snippet is truncated. + [DataMember(Name = "snippetEllipsisText", EmitDefaultValue = false)] + public string SnippetEllipsisText { get; set; } + + /// + /// Restrict highlighting and snippeting to items that matched the query. + /// + /// Restrict highlighting and snippeting to items that matched the query. + [DataMember(Name = "restrictHighlightAndSnippetArrays", EmitDefaultValue = true)] + public bool RestrictHighlightAndSnippetArrays { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", EmitDefaultValue = false)] + public int HitsPerPage { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor1Typo", EmitDefaultValue = false)] + public int MinWordSizefor1Typo { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor2Typos", EmitDefaultValue = false)] + public int MinWordSizefor2Typos { get; set; } + + /// + /// Gets or Sets TypoTolerance + /// + [DataMember(Name = "typoTolerance", EmitDefaultValue = false)] + public TypoTolerance TypoTolerance { get; set; } + + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + [DataMember(Name = "allowTyposOnNumericTokens", EmitDefaultValue = true)] + public bool AllowTyposOnNumericTokens { get; set; } + + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + [DataMember(Name = "disableTypoToleranceOnAttributes", EmitDefaultValue = false)] + public List DisableTypoToleranceOnAttributes { get; set; } + + /// + /// Gets or Sets IgnorePlurals + /// + [DataMember(Name = "ignorePlurals", EmitDefaultValue = false)] + public IgnorePlurals IgnorePlurals { get; set; } + + /// + /// Gets or Sets RemoveStopWords + /// + [DataMember(Name = "removeStopWords", EmitDefaultValue = false)] + public RemoveStopWords RemoveStopWords { get; set; } + + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + [DataMember(Name = "keepDiacriticsOnCharacters", EmitDefaultValue = false)] + public string KeepDiacriticsOnCharacters { get; set; } + + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + [DataMember(Name = "queryLanguages", EmitDefaultValue = false)] + public List QueryLanguages { get; set; } + + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + [DataMember(Name = "decompoundQuery", EmitDefaultValue = true)] + public bool DecompoundQuery { get; set; } + + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + [DataMember(Name = "enableRules", EmitDefaultValue = true)] + public bool EnableRules { get; set; } + + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + [DataMember(Name = "enablePersonalization", EmitDefaultValue = true)] + public bool EnablePersonalization { get; set; } + + /// + /// Gets or Sets SemanticSearch + /// + [DataMember(Name = "semanticSearch", EmitDefaultValue = false)] + public SemanticSearch SemanticSearch { get; set; } + + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + [DataMember(Name = "advancedSyntax", EmitDefaultValue = true)] + public bool AdvancedSyntax { get; set; } + + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + [DataMember(Name = "optionalWords", EmitDefaultValue = false)] + public List OptionalWords { get; set; } + + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "disableExactOnAttributes", EmitDefaultValue = false)] + public List DisableExactOnAttributes { get; set; } + + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "alternativesAsExact", EmitDefaultValue = false)] + public List AlternativesAsExact { get; set; } + + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + [DataMember(Name = "advancedSyntaxFeatures", EmitDefaultValue = false)] + public List AdvancedSyntaxFeatures { get; set; } + + /// + /// Gets or Sets Distinct + /// + [DataMember(Name = "distinct", EmitDefaultValue = false)] + public Distinct Distinct { get; set; } + + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + [DataMember(Name = "replaceSynonymsInHighlight", EmitDefaultValue = true)] + public bool ReplaceSynonymsInHighlight { get; set; } + + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + [DataMember(Name = "minProximity", EmitDefaultValue = false)] + public int MinProximity { get; set; } + + /// + /// Attributes to include in the API response for search and browse queries. + /// + /// Attributes to include in the API response for search and browse queries. + [DataMember(Name = "responseFields", EmitDefaultValue = false)] + public List ResponseFields { get; set; } + + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + [DataMember(Name = "maxFacetHits", EmitDefaultValue = false)] + public int MaxFacetHits { get; set; } + + /// + /// Maximum number of facet values to return for each facet. + /// + /// Maximum number of facet values to return for each facet. + [DataMember(Name = "maxValuesPerFacet", EmitDefaultValue = false)] + public int MaxValuesPerFacet { get; set; } + + /// + /// Controls how facet values are fetched. + /// + /// Controls how facet values are fetched. + [DataMember(Name = "sortFacetValuesBy", EmitDefaultValue = false)] + public string SortFacetValuesBy { get; set; } + + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + [DataMember(Name = "attributeCriteriaComputedByMinProximity", EmitDefaultValue = true)] + public bool AttributeCriteriaComputedByMinProximity { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + [DataMember(Name = "enableReRanking", EmitDefaultValue = true)] + public bool EnableReRanking { get; set; } + + /// + /// Gets or Sets ReRankingApplyFilter + /// + [DataMember(Name = "reRankingApplyFilter", EmitDefaultValue = true)] + public ReRankingApplyFilter ReRankingApplyFilter { get; set; } + + /// + /// Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. Pass this value to the subsequent browse call to get the next page of results. When the end of the index has been reached, `cursor` is absent from the response. + /// + /// Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. Pass this value to the subsequent browse call to get the next page of results. When the end of the index has been reached, `cursor` is absent from the response. + [DataMember(Name = "cursor", EmitDefaultValue = false)] + public string Cursor { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BrowseParamsObject {\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" SimilarQuery: ").Append(SimilarQuery).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" FacetFilters: ").Append(FacetFilters).Append("\n"); + sb.Append(" OptionalFilters: ").Append(OptionalFilters).Append("\n"); + sb.Append(" NumericFilters: ").Append(NumericFilters).Append("\n"); + sb.Append(" TagFilters: ").Append(TagFilters).Append("\n"); + sb.Append(" SumOrFiltersScores: ").Append(SumOrFiltersScores).Append("\n"); + sb.Append(" RestrictSearchableAttributes: ").Append(RestrictSearchableAttributes).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" FacetingAfterDistinct: ").Append(FacetingAfterDistinct).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" Offset: ").Append(Offset).Append("\n"); + sb.Append(" Length: ").Append(Length).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AroundLatLngViaIP: ").Append(AroundLatLngViaIP).Append("\n"); + sb.Append(" AroundRadius: ").Append(AroundRadius).Append("\n"); + sb.Append(" AroundPrecision: ").Append(AroundPrecision).Append("\n"); + sb.Append(" MinimumAroundRadius: ").Append(MinimumAroundRadius).Append("\n"); + sb.Append(" InsideBoundingBox: ").Append(InsideBoundingBox).Append("\n"); + sb.Append(" InsidePolygon: ").Append(InsidePolygon).Append("\n"); + sb.Append(" NaturalLanguages: ").Append(NaturalLanguages).Append("\n"); + sb.Append(" RuleContexts: ").Append(RuleContexts).Append("\n"); + sb.Append(" PersonalizationImpact: ").Append(PersonalizationImpact).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" GetRankingInfo: ").Append(GetRankingInfo).Append("\n"); + sb.Append(" Explain: ").Append(Explain).Append("\n"); + sb.Append(" Synonyms: ").Append(Synonyms).Append("\n"); + sb.Append(" ClickAnalytics: ").Append(ClickAnalytics).Append("\n"); + sb.Append(" Analytics: ").Append(Analytics).Append("\n"); + sb.Append(" AnalyticsTags: ").Append(AnalyticsTags).Append("\n"); + sb.Append(" PercentileComputation: ").Append(PercentileComputation).Append("\n"); + sb.Append(" EnableABTest: ").Append(EnableABTest).Append("\n"); + sb.Append(" AttributesForFaceting: ").Append(AttributesForFaceting).Append("\n"); + sb.Append(" AttributesToRetrieve: ").Append(AttributesToRetrieve).Append("\n"); + sb.Append(" Ranking: ").Append(Ranking).Append("\n"); + sb.Append(" CustomRanking: ").Append(CustomRanking).Append("\n"); + sb.Append(" RelevancyStrictness: ").Append(RelevancyStrictness).Append("\n"); + sb.Append(" AttributesToHighlight: ").Append(AttributesToHighlight).Append("\n"); + sb.Append(" AttributesToSnippet: ").Append(AttributesToSnippet).Append("\n"); + sb.Append(" HighlightPreTag: ").Append(HighlightPreTag).Append("\n"); + sb.Append(" HighlightPostTag: ").Append(HighlightPostTag).Append("\n"); + sb.Append(" SnippetEllipsisText: ").Append(SnippetEllipsisText).Append("\n"); + sb.Append(" RestrictHighlightAndSnippetArrays: ").Append(RestrictHighlightAndSnippetArrays).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" MinWordSizefor1Typo: ").Append(MinWordSizefor1Typo).Append("\n"); + sb.Append(" MinWordSizefor2Typos: ").Append(MinWordSizefor2Typos).Append("\n"); + sb.Append(" TypoTolerance: ").Append(TypoTolerance).Append("\n"); + sb.Append(" AllowTyposOnNumericTokens: ").Append(AllowTyposOnNumericTokens).Append("\n"); + sb.Append(" DisableTypoToleranceOnAttributes: ").Append(DisableTypoToleranceOnAttributes).Append("\n"); + sb.Append(" IgnorePlurals: ").Append(IgnorePlurals).Append("\n"); + sb.Append(" RemoveStopWords: ").Append(RemoveStopWords).Append("\n"); + sb.Append(" KeepDiacriticsOnCharacters: ").Append(KeepDiacriticsOnCharacters).Append("\n"); + sb.Append(" QueryLanguages: ").Append(QueryLanguages).Append("\n"); + sb.Append(" DecompoundQuery: ").Append(DecompoundQuery).Append("\n"); + sb.Append(" EnableRules: ").Append(EnableRules).Append("\n"); + sb.Append(" EnablePersonalization: ").Append(EnablePersonalization).Append("\n"); + sb.Append(" QueryType: ").Append(QueryType).Append("\n"); + sb.Append(" RemoveWordsIfNoResults: ").Append(RemoveWordsIfNoResults).Append("\n"); + sb.Append(" Mode: ").Append(Mode).Append("\n"); + sb.Append(" SemanticSearch: ").Append(SemanticSearch).Append("\n"); + sb.Append(" AdvancedSyntax: ").Append(AdvancedSyntax).Append("\n"); + sb.Append(" OptionalWords: ").Append(OptionalWords).Append("\n"); + sb.Append(" DisableExactOnAttributes: ").Append(DisableExactOnAttributes).Append("\n"); + sb.Append(" ExactOnSingleWordQuery: ").Append(ExactOnSingleWordQuery).Append("\n"); + sb.Append(" AlternativesAsExact: ").Append(AlternativesAsExact).Append("\n"); + sb.Append(" AdvancedSyntaxFeatures: ").Append(AdvancedSyntaxFeatures).Append("\n"); + sb.Append(" Distinct: ").Append(Distinct).Append("\n"); + sb.Append(" ReplaceSynonymsInHighlight: ").Append(ReplaceSynonymsInHighlight).Append("\n"); + sb.Append(" MinProximity: ").Append(MinProximity).Append("\n"); + sb.Append(" ResponseFields: ").Append(ResponseFields).Append("\n"); + sb.Append(" MaxFacetHits: ").Append(MaxFacetHits).Append("\n"); + sb.Append(" MaxValuesPerFacet: ").Append(MaxValuesPerFacet).Append("\n"); + sb.Append(" SortFacetValuesBy: ").Append(SortFacetValuesBy).Append("\n"); + sb.Append(" AttributeCriteriaComputedByMinProximity: ").Append(AttributeCriteriaComputedByMinProximity).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append(" EnableReRanking: ").Append(EnableReRanking).Append("\n"); + sb.Append(" ReRankingApplyFilter: ").Append(ReRankingApplyFilter).Append("\n"); + sb.Append(" Cursor: ").Append(Cursor).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BrowseParamsObject); + } + + /// + /// Returns true if BrowseParamsObject instances are equal + /// + /// Instance of BrowseParamsObject to be compared + /// Boolean + public bool Equals(BrowseParamsObject input) + { + if (input == null) + { + return false; + } + return + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.SimilarQuery == input.SimilarQuery || + (this.SimilarQuery != null && + this.SimilarQuery.Equals(input.SimilarQuery)) + ) && + ( + this.Filters == input.Filters || + (this.Filters != null && + this.Filters.Equals(input.Filters)) + ) && + ( + this.FacetFilters == input.FacetFilters || + (this.FacetFilters != null && + this.FacetFilters.Equals(input.FacetFilters)) + ) && + ( + this.OptionalFilters == input.OptionalFilters || + (this.OptionalFilters != null && + this.OptionalFilters.Equals(input.OptionalFilters)) + ) && + ( + this.NumericFilters == input.NumericFilters || + (this.NumericFilters != null && + this.NumericFilters.Equals(input.NumericFilters)) + ) && + ( + this.TagFilters == input.TagFilters || + (this.TagFilters != null && + this.TagFilters.Equals(input.TagFilters)) + ) && + ( + this.SumOrFiltersScores == input.SumOrFiltersScores || + this.SumOrFiltersScores.Equals(input.SumOrFiltersScores) + ) && + ( + this.RestrictSearchableAttributes == input.RestrictSearchableAttributes || + this.RestrictSearchableAttributes != null && + input.RestrictSearchableAttributes != null && + this.RestrictSearchableAttributes.SequenceEqual(input.RestrictSearchableAttributes) + ) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && + ( + this.FacetingAfterDistinct == input.FacetingAfterDistinct || + this.FacetingAfterDistinct.Equals(input.FacetingAfterDistinct) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.Offset == input.Offset || + this.Offset.Equals(input.Offset) + ) && + ( + this.Length == input.Length || + this.Length.Equals(input.Length) + ) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && + ( + this.AroundLatLngViaIP == input.AroundLatLngViaIP || + this.AroundLatLngViaIP.Equals(input.AroundLatLngViaIP) + ) && + ( + this.AroundRadius == input.AroundRadius || + (this.AroundRadius != null && + this.AroundRadius.Equals(input.AroundRadius)) + ) && + ( + this.AroundPrecision == input.AroundPrecision || + (this.AroundPrecision != null && + this.AroundPrecision.Equals(input.AroundPrecision)) + ) && + ( + this.MinimumAroundRadius == input.MinimumAroundRadius || + this.MinimumAroundRadius.Equals(input.MinimumAroundRadius) + ) && + ( + this.InsideBoundingBox == input.InsideBoundingBox || + this.InsideBoundingBox != null && + input.InsideBoundingBox != null && + this.InsideBoundingBox.SequenceEqual(input.InsideBoundingBox) + ) && + ( + this.InsidePolygon == input.InsidePolygon || + this.InsidePolygon != null && + input.InsidePolygon != null && + this.InsidePolygon.SequenceEqual(input.InsidePolygon) + ) && + ( + this.NaturalLanguages == input.NaturalLanguages || + this.NaturalLanguages != null && + input.NaturalLanguages != null && + this.NaturalLanguages.SequenceEqual(input.NaturalLanguages) + ) && + ( + this.RuleContexts == input.RuleContexts || + this.RuleContexts != null && + input.RuleContexts != null && + this.RuleContexts.SequenceEqual(input.RuleContexts) + ) && + ( + this.PersonalizationImpact == input.PersonalizationImpact || + this.PersonalizationImpact.Equals(input.PersonalizationImpact) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.GetRankingInfo == input.GetRankingInfo || + this.GetRankingInfo.Equals(input.GetRankingInfo) + ) && + ( + this.Explain == input.Explain || + this.Explain != null && + input.Explain != null && + this.Explain.SequenceEqual(input.Explain) + ) && + ( + this.Synonyms == input.Synonyms || + this.Synonyms.Equals(input.Synonyms) + ) && + ( + this.ClickAnalytics == input.ClickAnalytics || + this.ClickAnalytics.Equals(input.ClickAnalytics) + ) && + ( + this.Analytics == input.Analytics || + this.Analytics.Equals(input.Analytics) + ) && + ( + this.AnalyticsTags == input.AnalyticsTags || + this.AnalyticsTags != null && + input.AnalyticsTags != null && + this.AnalyticsTags.SequenceEqual(input.AnalyticsTags) + ) && + ( + this.PercentileComputation == input.PercentileComputation || + this.PercentileComputation.Equals(input.PercentileComputation) + ) && + ( + this.EnableABTest == input.EnableABTest || + this.EnableABTest.Equals(input.EnableABTest) + ) && + ( + this.AttributesForFaceting == input.AttributesForFaceting || + this.AttributesForFaceting != null && + input.AttributesForFaceting != null && + this.AttributesForFaceting.SequenceEqual(input.AttributesForFaceting) + ) && + ( + this.AttributesToRetrieve == input.AttributesToRetrieve || + this.AttributesToRetrieve != null && + input.AttributesToRetrieve != null && + this.AttributesToRetrieve.SequenceEqual(input.AttributesToRetrieve) + ) && + ( + this.Ranking == input.Ranking || + this.Ranking != null && + input.Ranking != null && + this.Ranking.SequenceEqual(input.Ranking) + ) && + ( + this.CustomRanking == input.CustomRanking || + this.CustomRanking != null && + input.CustomRanking != null && + this.CustomRanking.SequenceEqual(input.CustomRanking) + ) && + ( + this.RelevancyStrictness == input.RelevancyStrictness || + this.RelevancyStrictness.Equals(input.RelevancyStrictness) + ) && + ( + this.AttributesToHighlight == input.AttributesToHighlight || + this.AttributesToHighlight != null && + input.AttributesToHighlight != null && + this.AttributesToHighlight.SequenceEqual(input.AttributesToHighlight) + ) && + ( + this.AttributesToSnippet == input.AttributesToSnippet || + this.AttributesToSnippet != null && + input.AttributesToSnippet != null && + this.AttributesToSnippet.SequenceEqual(input.AttributesToSnippet) + ) && + ( + this.HighlightPreTag == input.HighlightPreTag || + (this.HighlightPreTag != null && + this.HighlightPreTag.Equals(input.HighlightPreTag)) + ) && + ( + this.HighlightPostTag == input.HighlightPostTag || + (this.HighlightPostTag != null && + this.HighlightPostTag.Equals(input.HighlightPostTag)) + ) && + ( + this.SnippetEllipsisText == input.SnippetEllipsisText || + (this.SnippetEllipsisText != null && + this.SnippetEllipsisText.Equals(input.SnippetEllipsisText)) + ) && + ( + this.RestrictHighlightAndSnippetArrays == input.RestrictHighlightAndSnippetArrays || + this.RestrictHighlightAndSnippetArrays.Equals(input.RestrictHighlightAndSnippetArrays) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && + ( + this.MinWordSizefor1Typo == input.MinWordSizefor1Typo || + this.MinWordSizefor1Typo.Equals(input.MinWordSizefor1Typo) + ) && + ( + this.MinWordSizefor2Typos == input.MinWordSizefor2Typos || + this.MinWordSizefor2Typos.Equals(input.MinWordSizefor2Typos) + ) && + ( + this.TypoTolerance == input.TypoTolerance || + (this.TypoTolerance != null && + this.TypoTolerance.Equals(input.TypoTolerance)) + ) && + ( + this.AllowTyposOnNumericTokens == input.AllowTyposOnNumericTokens || + this.AllowTyposOnNumericTokens.Equals(input.AllowTyposOnNumericTokens) + ) && + ( + this.DisableTypoToleranceOnAttributes == input.DisableTypoToleranceOnAttributes || + this.DisableTypoToleranceOnAttributes != null && + input.DisableTypoToleranceOnAttributes != null && + this.DisableTypoToleranceOnAttributes.SequenceEqual(input.DisableTypoToleranceOnAttributes) + ) && + ( + this.IgnorePlurals == input.IgnorePlurals || + (this.IgnorePlurals != null && + this.IgnorePlurals.Equals(input.IgnorePlurals)) + ) && + ( + this.RemoveStopWords == input.RemoveStopWords || + (this.RemoveStopWords != null && + this.RemoveStopWords.Equals(input.RemoveStopWords)) + ) && + ( + this.KeepDiacriticsOnCharacters == input.KeepDiacriticsOnCharacters || + (this.KeepDiacriticsOnCharacters != null && + this.KeepDiacriticsOnCharacters.Equals(input.KeepDiacriticsOnCharacters)) + ) && + ( + this.QueryLanguages == input.QueryLanguages || + this.QueryLanguages != null && + input.QueryLanguages != null && + this.QueryLanguages.SequenceEqual(input.QueryLanguages) + ) && + ( + this.DecompoundQuery == input.DecompoundQuery || + this.DecompoundQuery.Equals(input.DecompoundQuery) + ) && + ( + this.EnableRules == input.EnableRules || + this.EnableRules.Equals(input.EnableRules) + ) && + ( + this.EnablePersonalization == input.EnablePersonalization || + this.EnablePersonalization.Equals(input.EnablePersonalization) + ) && + ( + this.QueryType == input.QueryType || + this.QueryType.Equals(input.QueryType) + ) && + ( + this.RemoveWordsIfNoResults == input.RemoveWordsIfNoResults || + this.RemoveWordsIfNoResults.Equals(input.RemoveWordsIfNoResults) + ) && + ( + this.Mode == input.Mode || + this.Mode.Equals(input.Mode) + ) && + ( + this.SemanticSearch == input.SemanticSearch || + (this.SemanticSearch != null && + this.SemanticSearch.Equals(input.SemanticSearch)) + ) && + ( + this.AdvancedSyntax == input.AdvancedSyntax || + this.AdvancedSyntax.Equals(input.AdvancedSyntax) + ) && + ( + this.OptionalWords == input.OptionalWords || + this.OptionalWords != null && + input.OptionalWords != null && + this.OptionalWords.SequenceEqual(input.OptionalWords) + ) && + ( + this.DisableExactOnAttributes == input.DisableExactOnAttributes || + this.DisableExactOnAttributes != null && + input.DisableExactOnAttributes != null && + this.DisableExactOnAttributes.SequenceEqual(input.DisableExactOnAttributes) + ) && + ( + this.ExactOnSingleWordQuery == input.ExactOnSingleWordQuery || + this.ExactOnSingleWordQuery.Equals(input.ExactOnSingleWordQuery) + ) && + ( + this.AlternativesAsExact == input.AlternativesAsExact || + this.AlternativesAsExact != null && + input.AlternativesAsExact != null && + this.AlternativesAsExact.SequenceEqual(input.AlternativesAsExact) + ) && + ( + this.AdvancedSyntaxFeatures == input.AdvancedSyntaxFeatures || + this.AdvancedSyntaxFeatures != null && + input.AdvancedSyntaxFeatures != null && + this.AdvancedSyntaxFeatures.SequenceEqual(input.AdvancedSyntaxFeatures) + ) && + ( + this.Distinct == input.Distinct || + (this.Distinct != null && + this.Distinct.Equals(input.Distinct)) + ) && + ( + this.ReplaceSynonymsInHighlight == input.ReplaceSynonymsInHighlight || + this.ReplaceSynonymsInHighlight.Equals(input.ReplaceSynonymsInHighlight) + ) && + ( + this.MinProximity == input.MinProximity || + this.MinProximity.Equals(input.MinProximity) + ) && + ( + this.ResponseFields == input.ResponseFields || + this.ResponseFields != null && + input.ResponseFields != null && + this.ResponseFields.SequenceEqual(input.ResponseFields) + ) && + ( + this.MaxFacetHits == input.MaxFacetHits || + this.MaxFacetHits.Equals(input.MaxFacetHits) + ) && + ( + this.MaxValuesPerFacet == input.MaxValuesPerFacet || + this.MaxValuesPerFacet.Equals(input.MaxValuesPerFacet) + ) && + ( + this.SortFacetValuesBy == input.SortFacetValuesBy || + (this.SortFacetValuesBy != null && + this.SortFacetValuesBy.Equals(input.SortFacetValuesBy)) + ) && + ( + this.AttributeCriteriaComputedByMinProximity == input.AttributeCriteriaComputedByMinProximity || + this.AttributeCriteriaComputedByMinProximity.Equals(input.AttributeCriteriaComputedByMinProximity) + ) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ) && + ( + this.EnableReRanking == input.EnableReRanking || + this.EnableReRanking.Equals(input.EnableReRanking) + ) && + ( + this.ReRankingApplyFilter == input.ReRankingApplyFilter || + (this.ReRankingApplyFilter != null && + this.ReRankingApplyFilter.Equals(input.ReRankingApplyFilter)) + ) && + ( + this.Cursor == input.Cursor || + (this.Cursor != null && + this.Cursor.Equals(input.Cursor)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.SimilarQuery != null) + { + hashCode = (hashCode * 59) + this.SimilarQuery.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.FacetFilters != null) + { + hashCode = (hashCode * 59) + this.FacetFilters.GetHashCode(); + } + if (this.OptionalFilters != null) + { + hashCode = (hashCode * 59) + this.OptionalFilters.GetHashCode(); + } + if (this.NumericFilters != null) + { + hashCode = (hashCode * 59) + this.NumericFilters.GetHashCode(); + } + if (this.TagFilters != null) + { + hashCode = (hashCode * 59) + this.TagFilters.GetHashCode(); + } + hashCode = (hashCode * 59) + this.SumOrFiltersScores.GetHashCode(); + if (this.RestrictSearchableAttributes != null) + { + hashCode = (hashCode * 59) + this.RestrictSearchableAttributes.GetHashCode(); + } + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + hashCode = (hashCode * 59) + this.FacetingAfterDistinct.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.Offset.GetHashCode(); + hashCode = (hashCode * 59) + this.Length.GetHashCode(); + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AroundLatLngViaIP.GetHashCode(); + if (this.AroundRadius != null) + { + hashCode = (hashCode * 59) + this.AroundRadius.GetHashCode(); + } + if (this.AroundPrecision != null) + { + hashCode = (hashCode * 59) + this.AroundPrecision.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MinimumAroundRadius.GetHashCode(); + if (this.InsideBoundingBox != null) + { + hashCode = (hashCode * 59) + this.InsideBoundingBox.GetHashCode(); + } + if (this.InsidePolygon != null) + { + hashCode = (hashCode * 59) + this.InsidePolygon.GetHashCode(); + } + if (this.NaturalLanguages != null) + { + hashCode = (hashCode * 59) + this.NaturalLanguages.GetHashCode(); + } + if (this.RuleContexts != null) + { + hashCode = (hashCode * 59) + this.RuleContexts.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PersonalizationImpact.GetHashCode(); + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.GetRankingInfo.GetHashCode(); + if (this.Explain != null) + { + hashCode = (hashCode * 59) + this.Explain.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Synonyms.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickAnalytics.GetHashCode(); + hashCode = (hashCode * 59) + this.Analytics.GetHashCode(); + if (this.AnalyticsTags != null) + { + hashCode = (hashCode * 59) + this.AnalyticsTags.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PercentileComputation.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableABTest.GetHashCode(); + if (this.AttributesForFaceting != null) + { + hashCode = (hashCode * 59) + this.AttributesForFaceting.GetHashCode(); + } + if (this.AttributesToRetrieve != null) + { + hashCode = (hashCode * 59) + this.AttributesToRetrieve.GetHashCode(); + } + if (this.Ranking != null) + { + hashCode = (hashCode * 59) + this.Ranking.GetHashCode(); + } + if (this.CustomRanking != null) + { + hashCode = (hashCode * 59) + this.CustomRanking.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RelevancyStrictness.GetHashCode(); + if (this.AttributesToHighlight != null) + { + hashCode = (hashCode * 59) + this.AttributesToHighlight.GetHashCode(); + } + if (this.AttributesToSnippet != null) + { + hashCode = (hashCode * 59) + this.AttributesToSnippet.GetHashCode(); + } + if (this.HighlightPreTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPreTag.GetHashCode(); + } + if (this.HighlightPostTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPostTag.GetHashCode(); + } + if (this.SnippetEllipsisText != null) + { + hashCode = (hashCode * 59) + this.SnippetEllipsisText.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RestrictHighlightAndSnippetArrays.GetHashCode(); + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor1Typo.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor2Typos.GetHashCode(); + if (this.TypoTolerance != null) + { + hashCode = (hashCode * 59) + this.TypoTolerance.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AllowTyposOnNumericTokens.GetHashCode(); + if (this.DisableTypoToleranceOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableTypoToleranceOnAttributes.GetHashCode(); + } + if (this.IgnorePlurals != null) + { + hashCode = (hashCode * 59) + this.IgnorePlurals.GetHashCode(); + } + if (this.RemoveStopWords != null) + { + hashCode = (hashCode * 59) + this.RemoveStopWords.GetHashCode(); + } + if (this.KeepDiacriticsOnCharacters != null) + { + hashCode = (hashCode * 59) + this.KeepDiacriticsOnCharacters.GetHashCode(); + } + if (this.QueryLanguages != null) + { + hashCode = (hashCode * 59) + this.QueryLanguages.GetHashCode(); + } + hashCode = (hashCode * 59) + this.DecompoundQuery.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableRules.GetHashCode(); + hashCode = (hashCode * 59) + this.EnablePersonalization.GetHashCode(); + hashCode = (hashCode * 59) + this.QueryType.GetHashCode(); + hashCode = (hashCode * 59) + this.RemoveWordsIfNoResults.GetHashCode(); + hashCode = (hashCode * 59) + this.Mode.GetHashCode(); + if (this.SemanticSearch != null) + { + hashCode = (hashCode * 59) + this.SemanticSearch.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AdvancedSyntax.GetHashCode(); + if (this.OptionalWords != null) + { + hashCode = (hashCode * 59) + this.OptionalWords.GetHashCode(); + } + if (this.DisableExactOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableExactOnAttributes.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ExactOnSingleWordQuery.GetHashCode(); + if (this.AlternativesAsExact != null) + { + hashCode = (hashCode * 59) + this.AlternativesAsExact.GetHashCode(); + } + if (this.AdvancedSyntaxFeatures != null) + { + hashCode = (hashCode * 59) + this.AdvancedSyntaxFeatures.GetHashCode(); + } + if (this.Distinct != null) + { + hashCode = (hashCode * 59) + this.Distinct.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ReplaceSynonymsInHighlight.GetHashCode(); + hashCode = (hashCode * 59) + this.MinProximity.GetHashCode(); + if (this.ResponseFields != null) + { + hashCode = (hashCode * 59) + this.ResponseFields.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MaxFacetHits.GetHashCode(); + hashCode = (hashCode * 59) + this.MaxValuesPerFacet.GetHashCode(); + if (this.SortFacetValuesBy != null) + { + hashCode = (hashCode * 59) + this.SortFacetValuesBy.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AttributeCriteriaComputedByMinProximity.GetHashCode(); + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EnableReRanking.GetHashCode(); + if (this.ReRankingApplyFilter != null) + { + hashCode = (hashCode * 59) + this.ReRankingApplyFilter.GetHashCode(); + } + if (this.Cursor != null) + { + hashCode = (hashCode * 59) + this.Cursor.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Length (int) maximum + if (this.Length > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value less than or equal to 1000.", new[] { "Length" }); + } + + // Length (int) minimum + if (this.Length < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value greater than or equal to 1.", new[] { "Length" }); + } + + // MinimumAroundRadius (int) minimum + if (this.MinimumAroundRadius < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinimumAroundRadius, must be a value greater than or equal to 1.", new[] { "MinimumAroundRadius" }); + } + + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + // MinProximity (int) maximum + if (this.MinProximity > (int)7) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value less than or equal to 7.", new[] { "MinProximity" }); + } + + // MinProximity (int) minimum + if (this.MinProximity < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value greater than or equal to 1.", new[] { "MinProximity" }); + } + + // MaxFacetHits (int) maximum + if (this.MaxFacetHits > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MaxFacetHits, must be a value less than or equal to 100.", new[] { "MaxFacetHits" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/BrowseResponse.cs b/algoliasearch/Search/Models/BrowseResponse.cs new file mode 100644 index 000000000..eee48cc92 --- /dev/null +++ b/algoliasearch/Search/Models/BrowseResponse.cs @@ -0,0 +1,696 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// BrowseResponse + /// + [DataContract(Name = "browseResponse")] + public partial class BrowseResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BrowseResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// A/B test ID. This is only included in the response for indices that are part of an A/B test.. + /// Variant ID. This is only included in the response for indices that are part of an A/B test.. + /// Computed geographical location.. + /// Automatically-computed radius.. + /// exhaustive. + /// See the `facetsCount` field of the `exhaustive` object in the response.. + /// See the `nbHits` field of the `exhaustive` object in the response.. + /// See the `typo` field of the `exhaustive` object in the response.. + /// Mapping of each facet name to the corresponding facet counts.. + /// Statistics for numerical facets.. + /// Number of hits per page. (required) (default to 20). + /// Index name used for the query.. + /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query.. + /// Warnings about the query.. + /// Number of hits the search query matched. (required). + /// Number of pages of results for the current query. (required). + /// Number of hits selected and sorted by the relevant sort algorithm.. + /// Page to retrieve (the first page is `0`, not `1`). (required) (default to 0). + /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched.. + /// Time the server took to process the request, in milliseconds. (required). + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues.. + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set.. + /// redirect. + /// renderingContent. + /// Time the server took to process the request, in milliseconds.. + /// Host name of the server that processed the request.. + /// Lets you store custom data in your indices.. + /// hits (required). + /// Text to search for in an index. (required) (default to ""). + /// URL-encoded string of all search parameters. (required). + /// Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. Pass this value to the subsequent browse call to get the next page of results. When the end of the index has been reached, `cursor` is absent from the response. . + public BrowseResponse(int abTestID = default(int), int abTestVariantID = default(int), string aroundLatLng = default(string), string automaticRadius = default(string), Exhaustive exhaustive = default(Exhaustive), bool exhaustiveFacetsCount = default(bool), bool exhaustiveNbHits = default(bool), bool exhaustiveTypo = default(bool), Dictionary> facets = default(Dictionary>), Dictionary facetsStats = default(Dictionary), int hitsPerPage = 20, string index = default(string), string indexUsed = default(string), string message = default(string), int nbHits = default(int), int nbPages = default(int), int nbSortedHits = default(int), int page = 0, string parsedQuery = default(string), int processingTimeMS = default(int), Object processingTimingsMS = default(Object), string queryAfterRemoval = default(string), Redirect redirect = default(Redirect), RenderingContent renderingContent = default(RenderingContent), int serverTimeMS = default(int), string serverUsed = default(string), Object userData = default(Object), List hits = default(List), string query = @"", string varParams = default(string), string cursor = default(string)) + { + this.HitsPerPage = hitsPerPage; + this.NbHits = nbHits; + this.NbPages = nbPages; + this.Page = page; + this.ProcessingTimeMS = processingTimeMS; + // to ensure "hits" is required (not null) + if (hits == null) + { + throw new ArgumentNullException("hits is a required property for BrowseResponse and cannot be null"); + } + this.Hits = hits; + // to ensure "query" is required (not null) + if (query == null) + { + throw new ArgumentNullException("query is a required property for BrowseResponse and cannot be null"); + } + this.Query = query; + // to ensure "varParams" is required (not null) + if (varParams == null) + { + throw new ArgumentNullException("varParams is a required property for BrowseResponse and cannot be null"); + } + this.VarParams = varParams; + this.AbTestID = abTestID; + this.AbTestVariantID = abTestVariantID; + this.AroundLatLng = aroundLatLng; + this.AutomaticRadius = automaticRadius; + this.Exhaustive = exhaustive; + this.ExhaustiveFacetsCount = exhaustiveFacetsCount; + this.ExhaustiveNbHits = exhaustiveNbHits; + this.ExhaustiveTypo = exhaustiveTypo; + this.Facets = facets; + this.FacetsStats = facetsStats; + this.Index = index; + this.IndexUsed = indexUsed; + this.Message = message; + this.NbSortedHits = nbSortedHits; + this.ParsedQuery = parsedQuery; + this.ProcessingTimingsMS = processingTimingsMS; + this.QueryAfterRemoval = queryAfterRemoval; + this.Redirect = redirect; + this.RenderingContent = renderingContent; + this.ServerTimeMS = serverTimeMS; + this.ServerUsed = serverUsed; + this.UserData = userData; + this.Cursor = cursor; + } + + /// + /// A/B test ID. This is only included in the response for indices that are part of an A/B test. + /// + /// A/B test ID. This is only included in the response for indices that are part of an A/B test. + [DataMember(Name = "abTestID", EmitDefaultValue = false)] + public int AbTestID { get; set; } + + /// + /// Variant ID. This is only included in the response for indices that are part of an A/B test. + /// + /// Variant ID. This is only included in the response for indices that are part of an A/B test. + [DataMember(Name = "abTestVariantID", EmitDefaultValue = false)] + public int AbTestVariantID { get; set; } + + /// + /// Computed geographical location. + /// + /// Computed geographical location. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Automatically-computed radius. + /// + /// Automatically-computed radius. + [DataMember(Name = "automaticRadius", EmitDefaultValue = false)] + public string AutomaticRadius { get; set; } + + /// + /// Gets or Sets Exhaustive + /// + [DataMember(Name = "exhaustive", EmitDefaultValue = false)] + public Exhaustive Exhaustive { get; set; } + + /// + /// See the `facetsCount` field of the `exhaustive` object in the response. + /// + /// See the `facetsCount` field of the `exhaustive` object in the response. + [DataMember(Name = "exhaustiveFacetsCount", EmitDefaultValue = true)] + [Obsolete] + public bool ExhaustiveFacetsCount { get; set; } + + /// + /// See the `nbHits` field of the `exhaustive` object in the response. + /// + /// See the `nbHits` field of the `exhaustive` object in the response. + [DataMember(Name = "exhaustiveNbHits", EmitDefaultValue = true)] + [Obsolete] + public bool ExhaustiveNbHits { get; set; } + + /// + /// See the `typo` field of the `exhaustive` object in the response. + /// + /// See the `typo` field of the `exhaustive` object in the response. + [DataMember(Name = "exhaustiveTypo", EmitDefaultValue = true)] + [Obsolete] + public bool ExhaustiveTypo { get; set; } + + /// + /// Mapping of each facet name to the corresponding facet counts. + /// + /// Mapping of each facet name to the corresponding facet counts. + [DataMember(Name = "facets", EmitDefaultValue = false)] + public Dictionary> Facets { get; set; } + + /// + /// Statistics for numerical facets. + /// + /// Statistics for numerical facets. + [DataMember(Name = "facets_stats", EmitDefaultValue = false)] + public Dictionary FacetsStats { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", IsRequired = true, EmitDefaultValue = true)] + public int HitsPerPage { get; set; } + + /// + /// Index name used for the query. + /// + /// Index name used for the query. + [DataMember(Name = "index", EmitDefaultValue = false)] + public string Index { get; set; } + + /// + /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. + /// + /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. + [DataMember(Name = "indexUsed", EmitDefaultValue = false)] + public string IndexUsed { get; set; } + + /// + /// Warnings about the query. + /// + /// Warnings about the query. + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Number of hits the search query matched. + /// + /// Number of hits the search query matched. + [DataMember(Name = "nbHits", IsRequired = true, EmitDefaultValue = true)] + public int NbHits { get; set; } + + /// + /// Number of pages of results for the current query. + /// + /// Number of pages of results for the current query. + [DataMember(Name = "nbPages", IsRequired = true, EmitDefaultValue = true)] + public int NbPages { get; set; } + + /// + /// Number of hits selected and sorted by the relevant sort algorithm. + /// + /// Number of hits selected and sorted by the relevant sort algorithm. + [DataMember(Name = "nbSortedHits", EmitDefaultValue = false)] + public int NbSortedHits { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", IsRequired = true, EmitDefaultValue = true)] + public int Page { get; set; } + + /// + /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. + /// + /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. + [DataMember(Name = "parsedQuery", EmitDefaultValue = false)] + public string ParsedQuery { get; set; } + + /// + /// Time the server took to process the request, in milliseconds. + /// + /// Time the server took to process the request, in milliseconds. + [DataMember(Name = "processingTimeMS", IsRequired = true, EmitDefaultValue = true)] + public int ProcessingTimeMS { get; set; } + + /// + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + /// + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + [DataMember(Name = "processingTimingsMS", EmitDefaultValue = false)] + public Object ProcessingTimingsMS { get; set; } + + /// + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + /// + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + [DataMember(Name = "queryAfterRemoval", EmitDefaultValue = false)] + public string QueryAfterRemoval { get; set; } + + /// + /// Gets or Sets Redirect + /// + [DataMember(Name = "redirect", EmitDefaultValue = false)] + public Redirect Redirect { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Time the server took to process the request, in milliseconds. + /// + /// Time the server took to process the request, in milliseconds. + [DataMember(Name = "serverTimeMS", EmitDefaultValue = false)] + public int ServerTimeMS { get; set; } + + /// + /// Host name of the server that processed the request. + /// + /// Host name of the server that processed the request. + [DataMember(Name = "serverUsed", EmitDefaultValue = false)] + public string ServerUsed { get; set; } + + /// + /// Lets you store custom data in your indices. + /// + /// Lets you store custom data in your indices. + [DataMember(Name = "userData", EmitDefaultValue = false)] + public Object UserData { get; set; } + + /// + /// Gets or Sets Hits + /// + [DataMember(Name = "hits", IsRequired = true, EmitDefaultValue = true)] + public List Hits { get; set; } + + /// + /// Text to search for in an index. + /// + /// Text to search for in an index. + [DataMember(Name = "query", IsRequired = true, EmitDefaultValue = true)] + public string Query { get; set; } + + /// + /// URL-encoded string of all search parameters. + /// + /// URL-encoded string of all search parameters. + [DataMember(Name = "params", IsRequired = true, EmitDefaultValue = true)] + public string VarParams { get; set; } + + /// + /// Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. Pass this value to the subsequent browse call to get the next page of results. When the end of the index has been reached, `cursor` is absent from the response. + /// + /// Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. Pass this value to the subsequent browse call to get the next page of results. When the end of the index has been reached, `cursor` is absent from the response. + [DataMember(Name = "cursor", EmitDefaultValue = false)] + public string Cursor { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BrowseResponse {\n"); + sb.Append(" AbTestID: ").Append(AbTestID).Append("\n"); + sb.Append(" AbTestVariantID: ").Append(AbTestVariantID).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AutomaticRadius: ").Append(AutomaticRadius).Append("\n"); + sb.Append(" Exhaustive: ").Append(Exhaustive).Append("\n"); + sb.Append(" ExhaustiveFacetsCount: ").Append(ExhaustiveFacetsCount).Append("\n"); + sb.Append(" ExhaustiveNbHits: ").Append(ExhaustiveNbHits).Append("\n"); + sb.Append(" ExhaustiveTypo: ").Append(ExhaustiveTypo).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" FacetsStats: ").Append(FacetsStats).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" IndexUsed: ").Append(IndexUsed).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" NbPages: ").Append(NbPages).Append("\n"); + sb.Append(" NbSortedHits: ").Append(NbSortedHits).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" ParsedQuery: ").Append(ParsedQuery).Append("\n"); + sb.Append(" ProcessingTimeMS: ").Append(ProcessingTimeMS).Append("\n"); + sb.Append(" ProcessingTimingsMS: ").Append(ProcessingTimingsMS).Append("\n"); + sb.Append(" QueryAfterRemoval: ").Append(QueryAfterRemoval).Append("\n"); + sb.Append(" Redirect: ").Append(Redirect).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append(" ServerTimeMS: ").Append(ServerTimeMS).Append("\n"); + sb.Append(" ServerUsed: ").Append(ServerUsed).Append("\n"); + sb.Append(" UserData: ").Append(UserData).Append("\n"); + sb.Append(" Hits: ").Append(Hits).Append("\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" VarParams: ").Append(VarParams).Append("\n"); + sb.Append(" Cursor: ").Append(Cursor).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BrowseResponse); + } + + /// + /// Returns true if BrowseResponse instances are equal + /// + /// Instance of BrowseResponse to be compared + /// Boolean + public bool Equals(BrowseResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.AbTestID == input.AbTestID || + this.AbTestID.Equals(input.AbTestID) + ) && + ( + this.AbTestVariantID == input.AbTestVariantID || + this.AbTestVariantID.Equals(input.AbTestVariantID) + ) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && + ( + this.AutomaticRadius == input.AutomaticRadius || + (this.AutomaticRadius != null && + this.AutomaticRadius.Equals(input.AutomaticRadius)) + ) && + ( + this.Exhaustive == input.Exhaustive || + (this.Exhaustive != null && + this.Exhaustive.Equals(input.Exhaustive)) + ) && + ( + this.ExhaustiveFacetsCount == input.ExhaustiveFacetsCount || + this.ExhaustiveFacetsCount.Equals(input.ExhaustiveFacetsCount) + ) && + ( + this.ExhaustiveNbHits == input.ExhaustiveNbHits || + this.ExhaustiveNbHits.Equals(input.ExhaustiveNbHits) + ) && + ( + this.ExhaustiveTypo == input.ExhaustiveTypo || + this.ExhaustiveTypo.Equals(input.ExhaustiveTypo) + ) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && + ( + this.FacetsStats == input.FacetsStats || + this.FacetsStats != null && + input.FacetsStats != null && + this.FacetsStats.SequenceEqual(input.FacetsStats) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.IndexUsed == input.IndexUsed || + (this.IndexUsed != null && + this.IndexUsed.Equals(input.IndexUsed)) + ) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) && + ( + this.NbHits == input.NbHits || + this.NbHits.Equals(input.NbHits) + ) && + ( + this.NbPages == input.NbPages || + this.NbPages.Equals(input.NbPages) + ) && + ( + this.NbSortedHits == input.NbSortedHits || + this.NbSortedHits.Equals(input.NbSortedHits) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.ParsedQuery == input.ParsedQuery || + (this.ParsedQuery != null && + this.ParsedQuery.Equals(input.ParsedQuery)) + ) && + ( + this.ProcessingTimeMS == input.ProcessingTimeMS || + this.ProcessingTimeMS.Equals(input.ProcessingTimeMS) + ) && + ( + this.ProcessingTimingsMS == input.ProcessingTimingsMS || + (this.ProcessingTimingsMS != null && + this.ProcessingTimingsMS.Equals(input.ProcessingTimingsMS)) + ) && + ( + this.QueryAfterRemoval == input.QueryAfterRemoval || + (this.QueryAfterRemoval != null && + this.QueryAfterRemoval.Equals(input.QueryAfterRemoval)) + ) && + ( + this.Redirect == input.Redirect || + (this.Redirect != null && + this.Redirect.Equals(input.Redirect)) + ) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ) && + ( + this.ServerTimeMS == input.ServerTimeMS || + this.ServerTimeMS.Equals(input.ServerTimeMS) + ) && + ( + this.ServerUsed == input.ServerUsed || + (this.ServerUsed != null && + this.ServerUsed.Equals(input.ServerUsed)) + ) && + ( + this.UserData == input.UserData || + (this.UserData != null && + this.UserData.Equals(input.UserData)) + ) && + ( + this.Hits == input.Hits || + this.Hits != null && + input.Hits != null && + this.Hits.SequenceEqual(input.Hits) + ) && + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.VarParams == input.VarParams || + (this.VarParams != null && + this.VarParams.Equals(input.VarParams)) + ) && + ( + this.Cursor == input.Cursor || + (this.Cursor != null && + this.Cursor.Equals(input.Cursor)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.AbTestID.GetHashCode(); + hashCode = (hashCode * 59) + this.AbTestVariantID.GetHashCode(); + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + if (this.AutomaticRadius != null) + { + hashCode = (hashCode * 59) + this.AutomaticRadius.GetHashCode(); + } + if (this.Exhaustive != null) + { + hashCode = (hashCode * 59) + this.Exhaustive.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ExhaustiveFacetsCount.GetHashCode(); + hashCode = (hashCode * 59) + this.ExhaustiveNbHits.GetHashCode(); + hashCode = (hashCode * 59) + this.ExhaustiveTypo.GetHashCode(); + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + if (this.FacetsStats != null) + { + hashCode = (hashCode * 59) + this.FacetsStats.GetHashCode(); + } + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.IndexUsed != null) + { + hashCode = (hashCode * 59) + this.IndexUsed.GetHashCode(); + } + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NbHits.GetHashCode(); + hashCode = (hashCode * 59) + this.NbPages.GetHashCode(); + hashCode = (hashCode * 59) + this.NbSortedHits.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + if (this.ParsedQuery != null) + { + hashCode = (hashCode * 59) + this.ParsedQuery.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ProcessingTimeMS.GetHashCode(); + if (this.ProcessingTimingsMS != null) + { + hashCode = (hashCode * 59) + this.ProcessingTimingsMS.GetHashCode(); + } + if (this.QueryAfterRemoval != null) + { + hashCode = (hashCode * 59) + this.QueryAfterRemoval.GetHashCode(); + } + if (this.Redirect != null) + { + hashCode = (hashCode * 59) + this.Redirect.GetHashCode(); + } + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ServerTimeMS.GetHashCode(); + if (this.ServerUsed != null) + { + hashCode = (hashCode * 59) + this.ServerUsed.GetHashCode(); + } + if (this.UserData != null) + { + hashCode = (hashCode * 59) + this.UserData.GetHashCode(); + } + if (this.Hits != null) + { + hashCode = (hashCode * 59) + this.Hits.GetHashCode(); + } + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.VarParams != null) + { + hashCode = (hashCode * 59) + this.VarParams.GetHashCode(); + } + if (this.Cursor != null) + { + hashCode = (hashCode * 59) + this.Cursor.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // AbTestVariantID (int) minimum + if (this.AbTestVariantID < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for AbTestVariantID, must be a value greater than or equal to 1.", new[] { "AbTestVariantID" }); + } + + if (this.AroundLatLng != null) + { + // AroundLatLng (string) pattern + Regex regexAroundLatLng = new Regex(@"^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$", RegexOptions.CultureInvariant); + if (!regexAroundLatLng.Match(this.AroundLatLng).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for AroundLatLng, must match a pattern of " + regexAroundLatLng, new[] { "AroundLatLng" }); + } + } + + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/BuiltInOperation.cs b/algoliasearch/Search/Models/BuiltInOperation.cs new file mode 100644 index 000000000..ca773fe35 --- /dev/null +++ b/algoliasearch/Search/Models/BuiltInOperation.cs @@ -0,0 +1,148 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// To update an attribute without pushing the entire record, you can use these built-in operations. + /// + [DataContract(Name = "builtInOperation")] + public partial class BuiltInOperation : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Operation + /// + [DataMember(Name = "_operation", IsRequired = true, EmitDefaultValue = true)] + public BuiltInOperationType Operation { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected BuiltInOperation() { } + /// + /// Initializes a new instance of the class. + /// + /// operation (required). + /// Value that corresponds to the operation, for example an `Increment` or `Decrement` step, `Add` or `Remove` value. (required). + public BuiltInOperation(BuiltInOperationType operation = default(BuiltInOperationType), string value = default(string)) + { + this.Operation = operation; + // to ensure "value" is required (not null) + if (value == null) + { + throw new ArgumentNullException("value is a required property for BuiltInOperation and cannot be null"); + } + this.Value = value; + } + + /// + /// Value that corresponds to the operation, for example an `Increment` or `Decrement` step, `Add` or `Remove` value. + /// + /// Value that corresponds to the operation, for example an `Increment` or `Decrement` step, `Add` or `Remove` value. + [DataMember(Name = "value", IsRequired = true, EmitDefaultValue = true)] + public string Value { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BuiltInOperation {\n"); + sb.Append(" Operation: ").Append(Operation).Append("\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as BuiltInOperation); + } + + /// + /// Returns true if BuiltInOperation instances are equal + /// + /// Instance of BuiltInOperation to be compared + /// Boolean + public bool Equals(BuiltInOperation input) + { + if (input == null) + { + return false; + } + return + ( + this.Operation == input.Operation || + this.Operation.Equals(input.Operation) + ) && + ( + this.Value == input.Value || + (this.Value != null && + this.Value.Equals(input.Value)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Operation.GetHashCode(); + if (this.Value != null) + { + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/BuiltInOperationType.cs b/algoliasearch/Search/Models/BuiltInOperationType.cs new file mode 100644 index 000000000..272a3064d --- /dev/null +++ b/algoliasearch/Search/Models/BuiltInOperationType.cs @@ -0,0 +1,73 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Operation to apply to the attribute. + /// + /// Operation to apply to the attribute. + [JsonConverter(typeof(StringEnumConverter))] + public enum BuiltInOperationType + { + /// + /// Enum Increment for value: Increment + /// + [EnumMember(Value = "Increment")] + Increment = 1, + + /// + /// Enum Decrement for value: Decrement + /// + [EnumMember(Value = "Decrement")] + Decrement = 2, + + /// + /// Enum Add for value: Add + /// + [EnumMember(Value = "Add")] + Add = 3, + + /// + /// Enum Remove for value: Remove + /// + [EnumMember(Value = "Remove")] + Remove = 4, + + /// + /// Enum AddUnique for value: AddUnique + /// + [EnumMember(Value = "AddUnique")] + AddUnique = 5, + + /// + /// Enum IncrementFrom for value: IncrementFrom + /// + [EnumMember(Value = "IncrementFrom")] + IncrementFrom = 6, + + /// + /// Enum IncrementSet for value: IncrementSet + /// + [EnumMember(Value = "IncrementSet")] + IncrementSet = 7 + } + +} diff --git a/algoliasearch/Search/Models/Condition.cs b/algoliasearch/Search/Models/Condition.cs new file mode 100644 index 000000000..ffc366a96 --- /dev/null +++ b/algoliasearch/Search/Models/Condition.cs @@ -0,0 +1,172 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Condition + /// + [DataContract(Name = "condition")] + public partial class Condition : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Anchoring + /// + [DataMember(Name = "anchoring", EmitDefaultValue = false)] + public Anchoring? Anchoring { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Query pattern syntax.. + /// anchoring. + /// Whether the pattern matches on plurals, synonyms, and typos. (default to false). + /// Rule context format: [A-Za-z0-9_-]+).. + public Condition(string pattern = default(string), Anchoring? anchoring = default(Anchoring?), bool alternatives = false, string context = default(string)) + { + this.Pattern = pattern; + this.Anchoring = anchoring; + this.Alternatives = alternatives; + this.Context = context; + } + + /// + /// Query pattern syntax. + /// + /// Query pattern syntax. + [DataMember(Name = "pattern", EmitDefaultValue = false)] + public string Pattern { get; set; } + + /// + /// Whether the pattern matches on plurals, synonyms, and typos. + /// + /// Whether the pattern matches on plurals, synonyms, and typos. + [DataMember(Name = "alternatives", EmitDefaultValue = true)] + public bool Alternatives { get; set; } + + /// + /// Rule context format: [A-Za-z0-9_-]+). + /// + /// Rule context format: [A-Za-z0-9_-]+). + [DataMember(Name = "context", EmitDefaultValue = false)] + public string Context { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Condition {\n"); + sb.Append(" Pattern: ").Append(Pattern).Append("\n"); + sb.Append(" Anchoring: ").Append(Anchoring).Append("\n"); + sb.Append(" Alternatives: ").Append(Alternatives).Append("\n"); + sb.Append(" Context: ").Append(Context).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Condition); + } + + /// + /// Returns true if Condition instances are equal + /// + /// Instance of Condition to be compared + /// Boolean + public bool Equals(Condition input) + { + if (input == null) + { + return false; + } + return + ( + this.Pattern == input.Pattern || + (this.Pattern != null && + this.Pattern.Equals(input.Pattern)) + ) && + ( + this.Anchoring == input.Anchoring || + this.Anchoring.Equals(input.Anchoring) + ) && + ( + this.Alternatives == input.Alternatives || + this.Alternatives.Equals(input.Alternatives) + ) && + ( + this.Context == input.Context || + (this.Context != null && + this.Context.Equals(input.Context)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Pattern != null) + { + hashCode = (hashCode * 59) + this.Pattern.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Anchoring.GetHashCode(); + hashCode = (hashCode * 59) + this.Alternatives.GetHashCode(); + if (this.Context != null) + { + hashCode = (hashCode * 59) + this.Context.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/Consequence.cs b/algoliasearch/Search/Models/Consequence.cs new file mode 100644 index 000000000..3cf538c39 --- /dev/null +++ b/algoliasearch/Search/Models/Consequence.cs @@ -0,0 +1,197 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// [Consequences](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/#consequences) of a rule. + /// + [DataContract(Name = "consequence")] + public partial class Consequence : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// varParams. + /// Records to promote.. + /// Only use in combination with the `promote` consequence. When `true`, promoted results will be restricted to match the filters of the current search. When `false`, the promoted results will show up regardless of the filters. (default to false). + /// Records to hide. By default, you can hide up to 50 records per rule.. + /// Custom JSON object that will be appended to the userData array in the response. This object isn't interpreted by the API. It's limited to 1kB of minified JSON.. + public Consequence(ConsequenceParams varParams = default(ConsequenceParams), List promote = default(List), bool filterPromotes = false, List hide = default(List), Object userData = default(Object)) + { + this.VarParams = varParams; + this.Promote = promote; + this.FilterPromotes = filterPromotes; + this.Hide = hide; + this.UserData = userData; + } + + /// + /// Gets or Sets VarParams + /// + [DataMember(Name = "params", EmitDefaultValue = false)] + public ConsequenceParams VarParams { get; set; } + + /// + /// Records to promote. + /// + /// Records to promote. + [DataMember(Name = "promote", EmitDefaultValue = false)] + public List Promote { get; set; } + + /// + /// Only use in combination with the `promote` consequence. When `true`, promoted results will be restricted to match the filters of the current search. When `false`, the promoted results will show up regardless of the filters. + /// + /// Only use in combination with the `promote` consequence. When `true`, promoted results will be restricted to match the filters of the current search. When `false`, the promoted results will show up regardless of the filters. + [DataMember(Name = "filterPromotes", EmitDefaultValue = true)] + public bool FilterPromotes { get; set; } + + /// + /// Records to hide. By default, you can hide up to 50 records per rule. + /// + /// Records to hide. By default, you can hide up to 50 records per rule. + [DataMember(Name = "hide", EmitDefaultValue = false)] + public List Hide { get; set; } + + /// + /// Custom JSON object that will be appended to the userData array in the response. This object isn't interpreted by the API. It's limited to 1kB of minified JSON. + /// + /// Custom JSON object that will be appended to the userData array in the response. This object isn't interpreted by the API. It's limited to 1kB of minified JSON. + [DataMember(Name = "userData", EmitDefaultValue = true)] + public Object UserData { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Consequence {\n"); + sb.Append(" VarParams: ").Append(VarParams).Append("\n"); + sb.Append(" Promote: ").Append(Promote).Append("\n"); + sb.Append(" FilterPromotes: ").Append(FilterPromotes).Append("\n"); + sb.Append(" Hide: ").Append(Hide).Append("\n"); + sb.Append(" UserData: ").Append(UserData).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Consequence); + } + + /// + /// Returns true if Consequence instances are equal + /// + /// Instance of Consequence to be compared + /// Boolean + public bool Equals(Consequence input) + { + if (input == null) + { + return false; + } + return + ( + this.VarParams == input.VarParams || + (this.VarParams != null && + this.VarParams.Equals(input.VarParams)) + ) && + ( + this.Promote == input.Promote || + this.Promote != null && + input.Promote != null && + this.Promote.SequenceEqual(input.Promote) + ) && + ( + this.FilterPromotes == input.FilterPromotes || + this.FilterPromotes.Equals(input.FilterPromotes) + ) && + ( + this.Hide == input.Hide || + this.Hide != null && + input.Hide != null && + this.Hide.SequenceEqual(input.Hide) + ) && + ( + this.UserData == input.UserData || + (this.UserData != null && + this.UserData.Equals(input.UserData)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.VarParams != null) + { + hashCode = (hashCode * 59) + this.VarParams.GetHashCode(); + } + if (this.Promote != null) + { + hashCode = (hashCode * 59) + this.Promote.GetHashCode(); + } + hashCode = (hashCode * 59) + this.FilterPromotes.GetHashCode(); + if (this.Hide != null) + { + hashCode = (hashCode * 59) + this.Hide.GetHashCode(); + } + if (this.UserData != null) + { + hashCode = (hashCode * 59) + this.UserData.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/ConsequenceHide.cs b/algoliasearch/Search/Models/ConsequenceHide.cs new file mode 100644 index 000000000..a5ade0286 --- /dev/null +++ b/algoliasearch/Search/Models/ConsequenceHide.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Unique identifier of the record to hide. + /// + [DataContract(Name = "consequenceHide")] + public partial class ConsequenceHide : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ConsequenceHide() { } + /// + /// Initializes a new instance of the class. + /// + /// Unique object identifier. (required). + public ConsequenceHide(string objectID = default(string)) + { + // to ensure "objectID" is required (not null) + if (objectID == null) + { + throw new ArgumentNullException("objectID is a required property for ConsequenceHide and cannot be null"); + } + this.ObjectID = objectID; + } + + /// + /// Unique object identifier. + /// + /// Unique object identifier. + [DataMember(Name = "objectID", IsRequired = true, EmitDefaultValue = true)] + public string ObjectID { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ConsequenceHide {\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ConsequenceHide); + } + + /// + /// Returns true if ConsequenceHide instances are equal + /// + /// Instance of ConsequenceHide to be compared + /// Boolean + public bool Equals(ConsequenceHide input) + { + if (input == null) + { + return false; + } + return + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/ConsequenceParams.cs b/algoliasearch/Search/Models/ConsequenceParams.cs new file mode 100644 index 000000000..e665a3b80 --- /dev/null +++ b/algoliasearch/Search/Models/ConsequenceParams.cs @@ -0,0 +1,1546 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// ConsequenceParams + /// + [DataContract(Name = "consequenceParams")] + public partial class ConsequenceParams : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets QueryType + /// + [DataMember(Name = "queryType", EmitDefaultValue = false)] + public QueryType? QueryType { get; set; } + + /// + /// Gets or Sets RemoveWordsIfNoResults + /// + [DataMember(Name = "removeWordsIfNoResults", EmitDefaultValue = false)] + public RemoveWordsIfNoResults? RemoveWordsIfNoResults { get; set; } + + /// + /// Gets or Sets Mode + /// + [DataMember(Name = "mode", EmitDefaultValue = false)] + public Mode? Mode { get; set; } + + /// + /// Gets or Sets ExactOnSingleWordQuery + /// + [DataMember(Name = "exactOnSingleWordQuery", EmitDefaultValue = false)] + public ExactOnSingleWordQuery? ExactOnSingleWordQuery { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Overrides the query parameter and performs a more generic search. (default to ""). + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. (default to ""). + /// facetFilters. + /// optionalFilters. + /// numericFilters. + /// tagFilters. + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. (default to false). + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/).. + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values.. + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. (default to false). + /// Page to retrieve (the first page is `0`, not `1`). (default to 0). + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. (default to ""). + /// Search for entries around a location. The location is automatically computed from the requester's IP address. (default to false). + /// aroundRadius. + /// aroundPrecision. + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set.. + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries.. + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries.. + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). (default to 100). + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search.. + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). (default to false). + /// Enriches the API's response with information about how the query was processed.. + /// Whether to take into account an index's synonyms for a particular search. (default to true). + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). (default to false). + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). (default to true). + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).. + /// Whether to include or exclude a query from the processing-time percentile computation. (default to true). + /// Incidates whether this search will be considered in A/B testing. (default to true). + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. . + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes.. + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/).. + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. . + /// Relevancy threshold below which less relevant results aren't included in the results. (default to 100). + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`).. + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. . + /// HTML string to insert before the highlighted parts in all highlight and snippet results. (default to "<em>"). + /// HTML string to insert after the highlighted parts in all highlight and snippet results. (default to "</em>"). + /// String used as an ellipsis indicator when a snippet is truncated. (default to "…"). + /// Restrict highlighting and snippeting to items that matched the query. (default to false). + /// Number of hits per page. (default to 20). + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 4). + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 8). + /// typoTolerance. + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. (default to true). + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/).. + /// ignorePlurals. + /// removeStopWords. + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). (default to ""). + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection.. + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. (default to true). + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. (default to true). + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. (default to false). + /// queryType. + /// removeWordsIfNoResults. + /// mode. + /// semanticSearch. + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). (default to false). + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query.. + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// exactOnSingleWordQuery. + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled.. + /// distinct. + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. (default to false). + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). (default to 1). + /// Attributes to include in the API response for search and browse queries.. + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). (default to 10). + /// Maximum number of facet values to return for each facet. (default to 100). + /// Controls how facet values are fetched. (default to "count"). + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. (default to false). + /// renderingContent. + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). (default to true). + /// reRankingApplyFilter. + /// query. + /// automaticFacetFilters. + /// automaticOptionalFacetFilters. + public ConsequenceParams(string similarQuery = @"", string filters = @"", FacetFilters facetFilters = default(FacetFilters), OptionalFilters optionalFilters = default(OptionalFilters), NumericFilters numericFilters = default(NumericFilters), TagFilters tagFilters = default(TagFilters), bool sumOrFiltersScores = false, List restrictSearchableAttributes = default(List), List facets = default(List), bool facetingAfterDistinct = false, int page = 0, int offset = default(int), int length = default(int), string aroundLatLng = @"", bool aroundLatLngViaIP = false, AroundRadius aroundRadius = default(AroundRadius), AroundPrecision aroundPrecision = default(AroundPrecision), int minimumAroundRadius = default(int), List> insideBoundingBox = default(List>), List> insidePolygon = default(List>), List naturalLanguages = default(List), List ruleContexts = default(List), int personalizationImpact = 100, string userToken = default(string), bool getRankingInfo = false, List explain = default(List), bool synonyms = true, bool clickAnalytics = false, bool analytics = true, List analyticsTags = default(List), bool percentileComputation = true, bool enableABTest = true, List attributesForFaceting = default(List), List attributesToRetrieve = default(List), List ranking = default(List), List customRanking = default(List), int relevancyStrictness = 100, List attributesToHighlight = default(List), List attributesToSnippet = default(List), string highlightPreTag = @"", string highlightPostTag = @"", string snippetEllipsisText = @"…", bool restrictHighlightAndSnippetArrays = false, int hitsPerPage = 20, int minWordSizefor1Typo = 4, int minWordSizefor2Typos = 8, TypoTolerance typoTolerance = default(TypoTolerance), bool allowTyposOnNumericTokens = true, List disableTypoToleranceOnAttributes = default(List), IgnorePlurals ignorePlurals = default(IgnorePlurals), RemoveStopWords removeStopWords = default(RemoveStopWords), string keepDiacriticsOnCharacters = @"", List queryLanguages = default(List), bool decompoundQuery = true, bool enableRules = true, bool enablePersonalization = false, QueryType? queryType = default(QueryType?), RemoveWordsIfNoResults? removeWordsIfNoResults = default(RemoveWordsIfNoResults?), Mode? mode = default(Mode?), SemanticSearch semanticSearch = default(SemanticSearch), bool advancedSyntax = false, List optionalWords = default(List), List disableExactOnAttributes = default(List), ExactOnSingleWordQuery? exactOnSingleWordQuery = default(ExactOnSingleWordQuery?), List alternativesAsExact = default(List), List advancedSyntaxFeatures = default(List), Distinct distinct = default(Distinct), bool replaceSynonymsInHighlight = false, int minProximity = 1, List responseFields = default(List), int maxFacetHits = 10, int maxValuesPerFacet = 100, string sortFacetValuesBy = @"count", bool attributeCriteriaComputedByMinProximity = false, RenderingContent renderingContent = default(RenderingContent), bool enableReRanking = true, ReRankingApplyFilter reRankingApplyFilter = default(ReRankingApplyFilter), ConsequenceQuery query = default(ConsequenceQuery), AutomaticFacetFilters automaticFacetFilters = default(AutomaticFacetFilters), AutomaticFacetFilters automaticOptionalFacetFilters = default(AutomaticFacetFilters)) + { + // use default value if no "similarQuery" provided + this.SimilarQuery = similarQuery ?? @""; + // use default value if no "filters" provided + this.Filters = filters ?? @""; + this.FacetFilters = facetFilters; + this.OptionalFilters = optionalFilters; + this.NumericFilters = numericFilters; + this.TagFilters = tagFilters; + this.SumOrFiltersScores = sumOrFiltersScores; + this.RestrictSearchableAttributes = restrictSearchableAttributes; + this.Facets = facets; + this.FacetingAfterDistinct = facetingAfterDistinct; + this.Page = page; + this.Offset = offset; + this.Length = length; + // use default value if no "aroundLatLng" provided + this.AroundLatLng = aroundLatLng ?? @""; + this.AroundLatLngViaIP = aroundLatLngViaIP; + this.AroundRadius = aroundRadius; + this.AroundPrecision = aroundPrecision; + this.MinimumAroundRadius = minimumAroundRadius; + this.InsideBoundingBox = insideBoundingBox; + this.InsidePolygon = insidePolygon; + this.NaturalLanguages = naturalLanguages; + this.RuleContexts = ruleContexts; + this.PersonalizationImpact = personalizationImpact; + this.UserToken = userToken; + this.GetRankingInfo = getRankingInfo; + this.Explain = explain; + this.Synonyms = synonyms; + this.ClickAnalytics = clickAnalytics; + this.Analytics = analytics; + this.AnalyticsTags = analyticsTags; + this.PercentileComputation = percentileComputation; + this.EnableABTest = enableABTest; + this.AttributesForFaceting = attributesForFaceting; + this.AttributesToRetrieve = attributesToRetrieve; + this.Ranking = ranking; + this.CustomRanking = customRanking; + this.RelevancyStrictness = relevancyStrictness; + this.AttributesToHighlight = attributesToHighlight; + this.AttributesToSnippet = attributesToSnippet; + // use default value if no "highlightPreTag" provided + this.HighlightPreTag = highlightPreTag ?? @""; + // use default value if no "highlightPostTag" provided + this.HighlightPostTag = highlightPostTag ?? @""; + // use default value if no "snippetEllipsisText" provided + this.SnippetEllipsisText = snippetEllipsisText ?? @"…"; + this.RestrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + this.HitsPerPage = hitsPerPage; + this.MinWordSizefor1Typo = minWordSizefor1Typo; + this.MinWordSizefor2Typos = minWordSizefor2Typos; + this.TypoTolerance = typoTolerance; + this.AllowTyposOnNumericTokens = allowTyposOnNumericTokens; + this.DisableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + this.IgnorePlurals = ignorePlurals; + this.RemoveStopWords = removeStopWords; + // use default value if no "keepDiacriticsOnCharacters" provided + this.KeepDiacriticsOnCharacters = keepDiacriticsOnCharacters ?? @""; + this.QueryLanguages = queryLanguages; + this.DecompoundQuery = decompoundQuery; + this.EnableRules = enableRules; + this.EnablePersonalization = enablePersonalization; + this.QueryType = queryType; + this.RemoveWordsIfNoResults = removeWordsIfNoResults; + this.Mode = mode; + this.SemanticSearch = semanticSearch; + this.AdvancedSyntax = advancedSyntax; + this.OptionalWords = optionalWords; + this.DisableExactOnAttributes = disableExactOnAttributes; + this.ExactOnSingleWordQuery = exactOnSingleWordQuery; + this.AlternativesAsExact = alternativesAsExact; + this.AdvancedSyntaxFeatures = advancedSyntaxFeatures; + this.Distinct = distinct; + this.ReplaceSynonymsInHighlight = replaceSynonymsInHighlight; + this.MinProximity = minProximity; + this.ResponseFields = responseFields; + this.MaxFacetHits = maxFacetHits; + this.MaxValuesPerFacet = maxValuesPerFacet; + // use default value if no "sortFacetValuesBy" provided + this.SortFacetValuesBy = sortFacetValuesBy ?? @"count"; + this.AttributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + this.RenderingContent = renderingContent; + this.EnableReRanking = enableReRanking; + this.ReRankingApplyFilter = reRankingApplyFilter; + this.Query = query; + this.AutomaticFacetFilters = automaticFacetFilters; + this.AutomaticOptionalFacetFilters = automaticOptionalFacetFilters; + } + + /// + /// Overrides the query parameter and performs a more generic search. + /// + /// Overrides the query parameter and performs a more generic search. + [DataMember(Name = "similarQuery", EmitDefaultValue = false)] + public string SimilarQuery { get; set; } + + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + [DataMember(Name = "filters", EmitDefaultValue = false)] + public string Filters { get; set; } + + /// + /// Gets or Sets FacetFilters + /// + [DataMember(Name = "facetFilters", EmitDefaultValue = false)] + public FacetFilters FacetFilters { get; set; } + + /// + /// Gets or Sets OptionalFilters + /// + [DataMember(Name = "optionalFilters", EmitDefaultValue = false)] + public OptionalFilters OptionalFilters { get; set; } + + /// + /// Gets or Sets NumericFilters + /// + [DataMember(Name = "numericFilters", EmitDefaultValue = false)] + public NumericFilters NumericFilters { get; set; } + + /// + /// Gets or Sets TagFilters + /// + [DataMember(Name = "tagFilters", EmitDefaultValue = false)] + public TagFilters TagFilters { get; set; } + + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + [DataMember(Name = "sumOrFiltersScores", EmitDefaultValue = true)] + public bool SumOrFiltersScores { get; set; } + + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + [DataMember(Name = "restrictSearchableAttributes", EmitDefaultValue = false)] + public List RestrictSearchableAttributes { get; set; } + + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + [DataMember(Name = "facets", EmitDefaultValue = false)] + public List Facets { get; set; } + + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + [DataMember(Name = "facetingAfterDistinct", EmitDefaultValue = true)] + public bool FacetingAfterDistinct { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", EmitDefaultValue = false)] + public int Page { get; set; } + + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "offset", EmitDefaultValue = false)] + public int Offset { get; set; } + + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "length", EmitDefaultValue = false)] + public int Length { get; set; } + + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + [DataMember(Name = "aroundLatLngViaIP", EmitDefaultValue = true)] + public bool AroundLatLngViaIP { get; set; } + + /// + /// Gets or Sets AroundRadius + /// + [DataMember(Name = "aroundRadius", EmitDefaultValue = false)] + public AroundRadius AroundRadius { get; set; } + + /// + /// Gets or Sets AroundPrecision + /// + [DataMember(Name = "aroundPrecision", EmitDefaultValue = false)] + public AroundPrecision AroundPrecision { get; set; } + + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + [DataMember(Name = "minimumAroundRadius", EmitDefaultValue = false)] + public int MinimumAroundRadius { get; set; } + + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insideBoundingBox", EmitDefaultValue = false)] + public List> InsideBoundingBox { get; set; } + + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insidePolygon", EmitDefaultValue = false)] + public List> InsidePolygon { get; set; } + + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + [DataMember(Name = "naturalLanguages", EmitDefaultValue = false)] + public List NaturalLanguages { get; set; } + + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + [DataMember(Name = "ruleContexts", EmitDefaultValue = false)] + public List RuleContexts { get; set; } + + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + [DataMember(Name = "personalizationImpact", EmitDefaultValue = false)] + public int PersonalizationImpact { get; set; } + + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + [DataMember(Name = "userToken", EmitDefaultValue = false)] + public string UserToken { get; set; } + + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + [DataMember(Name = "getRankingInfo", EmitDefaultValue = true)] + public bool GetRankingInfo { get; set; } + + /// + /// Enriches the API's response with information about how the query was processed. + /// + /// Enriches the API's response with information about how the query was processed. + [DataMember(Name = "explain", EmitDefaultValue = false)] + public List Explain { get; set; } + + /// + /// Whether to take into account an index's synonyms for a particular search. + /// + /// Whether to take into account an index's synonyms for a particular search. + [DataMember(Name = "synonyms", EmitDefaultValue = true)] + public bool Synonyms { get; set; } + + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + [DataMember(Name = "clickAnalytics", EmitDefaultValue = true)] + public bool ClickAnalytics { get; set; } + + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + [DataMember(Name = "analytics", EmitDefaultValue = true)] + public bool Analytics { get; set; } + + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + [DataMember(Name = "analyticsTags", EmitDefaultValue = false)] + public List AnalyticsTags { get; set; } + + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + [DataMember(Name = "percentileComputation", EmitDefaultValue = true)] + public bool PercentileComputation { get; set; } + + /// + /// Incidates whether this search will be considered in A/B testing. + /// + /// Incidates whether this search will be considered in A/B testing. + [DataMember(Name = "enableABTest", EmitDefaultValue = true)] + public bool EnableABTest { get; set; } + + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + [DataMember(Name = "attributesForFaceting", EmitDefaultValue = false)] + public List AttributesForFaceting { get; set; } + + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + [DataMember(Name = "attributesToRetrieve", EmitDefaultValue = false)] + public List AttributesToRetrieve { get; set; } + + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + [DataMember(Name = "ranking", EmitDefaultValue = false)] + public List Ranking { get; set; } + + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + [DataMember(Name = "customRanking", EmitDefaultValue = false)] + public List CustomRanking { get; set; } + + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + [DataMember(Name = "relevancyStrictness", EmitDefaultValue = false)] + public int RelevancyStrictness { get; set; } + + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + [DataMember(Name = "attributesToHighlight", EmitDefaultValue = false)] + public List AttributesToHighlight { get; set; } + + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + [DataMember(Name = "attributesToSnippet", EmitDefaultValue = false)] + public List AttributesToSnippet { get; set; } + + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPreTag", EmitDefaultValue = false)] + public string HighlightPreTag { get; set; } + + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPostTag", EmitDefaultValue = false)] + public string HighlightPostTag { get; set; } + + /// + /// String used as an ellipsis indicator when a snippet is truncated. + /// + /// String used as an ellipsis indicator when a snippet is truncated. + [DataMember(Name = "snippetEllipsisText", EmitDefaultValue = false)] + public string SnippetEllipsisText { get; set; } + + /// + /// Restrict highlighting and snippeting to items that matched the query. + /// + /// Restrict highlighting and snippeting to items that matched the query. + [DataMember(Name = "restrictHighlightAndSnippetArrays", EmitDefaultValue = true)] + public bool RestrictHighlightAndSnippetArrays { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", EmitDefaultValue = false)] + public int HitsPerPage { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor1Typo", EmitDefaultValue = false)] + public int MinWordSizefor1Typo { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor2Typos", EmitDefaultValue = false)] + public int MinWordSizefor2Typos { get; set; } + + /// + /// Gets or Sets TypoTolerance + /// + [DataMember(Name = "typoTolerance", EmitDefaultValue = false)] + public TypoTolerance TypoTolerance { get; set; } + + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + [DataMember(Name = "allowTyposOnNumericTokens", EmitDefaultValue = true)] + public bool AllowTyposOnNumericTokens { get; set; } + + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + [DataMember(Name = "disableTypoToleranceOnAttributes", EmitDefaultValue = false)] + public List DisableTypoToleranceOnAttributes { get; set; } + + /// + /// Gets or Sets IgnorePlurals + /// + [DataMember(Name = "ignorePlurals", EmitDefaultValue = false)] + public IgnorePlurals IgnorePlurals { get; set; } + + /// + /// Gets or Sets RemoveStopWords + /// + [DataMember(Name = "removeStopWords", EmitDefaultValue = false)] + public RemoveStopWords RemoveStopWords { get; set; } + + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + [DataMember(Name = "keepDiacriticsOnCharacters", EmitDefaultValue = false)] + public string KeepDiacriticsOnCharacters { get; set; } + + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + [DataMember(Name = "queryLanguages", EmitDefaultValue = false)] + public List QueryLanguages { get; set; } + + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + [DataMember(Name = "decompoundQuery", EmitDefaultValue = true)] + public bool DecompoundQuery { get; set; } + + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + [DataMember(Name = "enableRules", EmitDefaultValue = true)] + public bool EnableRules { get; set; } + + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + [DataMember(Name = "enablePersonalization", EmitDefaultValue = true)] + public bool EnablePersonalization { get; set; } + + /// + /// Gets or Sets SemanticSearch + /// + [DataMember(Name = "semanticSearch", EmitDefaultValue = false)] + public SemanticSearch SemanticSearch { get; set; } + + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + [DataMember(Name = "advancedSyntax", EmitDefaultValue = true)] + public bool AdvancedSyntax { get; set; } + + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + [DataMember(Name = "optionalWords", EmitDefaultValue = false)] + public List OptionalWords { get; set; } + + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "disableExactOnAttributes", EmitDefaultValue = false)] + public List DisableExactOnAttributes { get; set; } + + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "alternativesAsExact", EmitDefaultValue = false)] + public List AlternativesAsExact { get; set; } + + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + [DataMember(Name = "advancedSyntaxFeatures", EmitDefaultValue = false)] + public List AdvancedSyntaxFeatures { get; set; } + + /// + /// Gets or Sets Distinct + /// + [DataMember(Name = "distinct", EmitDefaultValue = false)] + public Distinct Distinct { get; set; } + + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + [DataMember(Name = "replaceSynonymsInHighlight", EmitDefaultValue = true)] + public bool ReplaceSynonymsInHighlight { get; set; } + + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + [DataMember(Name = "minProximity", EmitDefaultValue = false)] + public int MinProximity { get; set; } + + /// + /// Attributes to include in the API response for search and browse queries. + /// + /// Attributes to include in the API response for search and browse queries. + [DataMember(Name = "responseFields", EmitDefaultValue = false)] + public List ResponseFields { get; set; } + + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + [DataMember(Name = "maxFacetHits", EmitDefaultValue = false)] + public int MaxFacetHits { get; set; } + + /// + /// Maximum number of facet values to return for each facet. + /// + /// Maximum number of facet values to return for each facet. + [DataMember(Name = "maxValuesPerFacet", EmitDefaultValue = false)] + public int MaxValuesPerFacet { get; set; } + + /// + /// Controls how facet values are fetched. + /// + /// Controls how facet values are fetched. + [DataMember(Name = "sortFacetValuesBy", EmitDefaultValue = false)] + public string SortFacetValuesBy { get; set; } + + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + [DataMember(Name = "attributeCriteriaComputedByMinProximity", EmitDefaultValue = true)] + public bool AttributeCriteriaComputedByMinProximity { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + [DataMember(Name = "enableReRanking", EmitDefaultValue = true)] + public bool EnableReRanking { get; set; } + + /// + /// Gets or Sets ReRankingApplyFilter + /// + [DataMember(Name = "reRankingApplyFilter", EmitDefaultValue = true)] + public ReRankingApplyFilter ReRankingApplyFilter { get; set; } + + /// + /// Gets or Sets Query + /// + [DataMember(Name = "query", EmitDefaultValue = false)] + public ConsequenceQuery Query { get; set; } + + /// + /// Gets or Sets AutomaticFacetFilters + /// + [DataMember(Name = "automaticFacetFilters", EmitDefaultValue = false)] + public AutomaticFacetFilters AutomaticFacetFilters { get; set; } + + /// + /// Gets or Sets AutomaticOptionalFacetFilters + /// + [DataMember(Name = "automaticOptionalFacetFilters", EmitDefaultValue = false)] + public AutomaticFacetFilters AutomaticOptionalFacetFilters { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ConsequenceParams {\n"); + sb.Append(" SimilarQuery: ").Append(SimilarQuery).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" FacetFilters: ").Append(FacetFilters).Append("\n"); + sb.Append(" OptionalFilters: ").Append(OptionalFilters).Append("\n"); + sb.Append(" NumericFilters: ").Append(NumericFilters).Append("\n"); + sb.Append(" TagFilters: ").Append(TagFilters).Append("\n"); + sb.Append(" SumOrFiltersScores: ").Append(SumOrFiltersScores).Append("\n"); + sb.Append(" RestrictSearchableAttributes: ").Append(RestrictSearchableAttributes).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" FacetingAfterDistinct: ").Append(FacetingAfterDistinct).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" Offset: ").Append(Offset).Append("\n"); + sb.Append(" Length: ").Append(Length).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AroundLatLngViaIP: ").Append(AroundLatLngViaIP).Append("\n"); + sb.Append(" AroundRadius: ").Append(AroundRadius).Append("\n"); + sb.Append(" AroundPrecision: ").Append(AroundPrecision).Append("\n"); + sb.Append(" MinimumAroundRadius: ").Append(MinimumAroundRadius).Append("\n"); + sb.Append(" InsideBoundingBox: ").Append(InsideBoundingBox).Append("\n"); + sb.Append(" InsidePolygon: ").Append(InsidePolygon).Append("\n"); + sb.Append(" NaturalLanguages: ").Append(NaturalLanguages).Append("\n"); + sb.Append(" RuleContexts: ").Append(RuleContexts).Append("\n"); + sb.Append(" PersonalizationImpact: ").Append(PersonalizationImpact).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" GetRankingInfo: ").Append(GetRankingInfo).Append("\n"); + sb.Append(" Explain: ").Append(Explain).Append("\n"); + sb.Append(" Synonyms: ").Append(Synonyms).Append("\n"); + sb.Append(" ClickAnalytics: ").Append(ClickAnalytics).Append("\n"); + sb.Append(" Analytics: ").Append(Analytics).Append("\n"); + sb.Append(" AnalyticsTags: ").Append(AnalyticsTags).Append("\n"); + sb.Append(" PercentileComputation: ").Append(PercentileComputation).Append("\n"); + sb.Append(" EnableABTest: ").Append(EnableABTest).Append("\n"); + sb.Append(" AttributesForFaceting: ").Append(AttributesForFaceting).Append("\n"); + sb.Append(" AttributesToRetrieve: ").Append(AttributesToRetrieve).Append("\n"); + sb.Append(" Ranking: ").Append(Ranking).Append("\n"); + sb.Append(" CustomRanking: ").Append(CustomRanking).Append("\n"); + sb.Append(" RelevancyStrictness: ").Append(RelevancyStrictness).Append("\n"); + sb.Append(" AttributesToHighlight: ").Append(AttributesToHighlight).Append("\n"); + sb.Append(" AttributesToSnippet: ").Append(AttributesToSnippet).Append("\n"); + sb.Append(" HighlightPreTag: ").Append(HighlightPreTag).Append("\n"); + sb.Append(" HighlightPostTag: ").Append(HighlightPostTag).Append("\n"); + sb.Append(" SnippetEllipsisText: ").Append(SnippetEllipsisText).Append("\n"); + sb.Append(" RestrictHighlightAndSnippetArrays: ").Append(RestrictHighlightAndSnippetArrays).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" MinWordSizefor1Typo: ").Append(MinWordSizefor1Typo).Append("\n"); + sb.Append(" MinWordSizefor2Typos: ").Append(MinWordSizefor2Typos).Append("\n"); + sb.Append(" TypoTolerance: ").Append(TypoTolerance).Append("\n"); + sb.Append(" AllowTyposOnNumericTokens: ").Append(AllowTyposOnNumericTokens).Append("\n"); + sb.Append(" DisableTypoToleranceOnAttributes: ").Append(DisableTypoToleranceOnAttributes).Append("\n"); + sb.Append(" IgnorePlurals: ").Append(IgnorePlurals).Append("\n"); + sb.Append(" RemoveStopWords: ").Append(RemoveStopWords).Append("\n"); + sb.Append(" KeepDiacriticsOnCharacters: ").Append(KeepDiacriticsOnCharacters).Append("\n"); + sb.Append(" QueryLanguages: ").Append(QueryLanguages).Append("\n"); + sb.Append(" DecompoundQuery: ").Append(DecompoundQuery).Append("\n"); + sb.Append(" EnableRules: ").Append(EnableRules).Append("\n"); + sb.Append(" EnablePersonalization: ").Append(EnablePersonalization).Append("\n"); + sb.Append(" QueryType: ").Append(QueryType).Append("\n"); + sb.Append(" RemoveWordsIfNoResults: ").Append(RemoveWordsIfNoResults).Append("\n"); + sb.Append(" Mode: ").Append(Mode).Append("\n"); + sb.Append(" SemanticSearch: ").Append(SemanticSearch).Append("\n"); + sb.Append(" AdvancedSyntax: ").Append(AdvancedSyntax).Append("\n"); + sb.Append(" OptionalWords: ").Append(OptionalWords).Append("\n"); + sb.Append(" DisableExactOnAttributes: ").Append(DisableExactOnAttributes).Append("\n"); + sb.Append(" ExactOnSingleWordQuery: ").Append(ExactOnSingleWordQuery).Append("\n"); + sb.Append(" AlternativesAsExact: ").Append(AlternativesAsExact).Append("\n"); + sb.Append(" AdvancedSyntaxFeatures: ").Append(AdvancedSyntaxFeatures).Append("\n"); + sb.Append(" Distinct: ").Append(Distinct).Append("\n"); + sb.Append(" ReplaceSynonymsInHighlight: ").Append(ReplaceSynonymsInHighlight).Append("\n"); + sb.Append(" MinProximity: ").Append(MinProximity).Append("\n"); + sb.Append(" ResponseFields: ").Append(ResponseFields).Append("\n"); + sb.Append(" MaxFacetHits: ").Append(MaxFacetHits).Append("\n"); + sb.Append(" MaxValuesPerFacet: ").Append(MaxValuesPerFacet).Append("\n"); + sb.Append(" SortFacetValuesBy: ").Append(SortFacetValuesBy).Append("\n"); + sb.Append(" AttributeCriteriaComputedByMinProximity: ").Append(AttributeCriteriaComputedByMinProximity).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append(" EnableReRanking: ").Append(EnableReRanking).Append("\n"); + sb.Append(" ReRankingApplyFilter: ").Append(ReRankingApplyFilter).Append("\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" AutomaticFacetFilters: ").Append(AutomaticFacetFilters).Append("\n"); + sb.Append(" AutomaticOptionalFacetFilters: ").Append(AutomaticOptionalFacetFilters).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ConsequenceParams); + } + + /// + /// Returns true if ConsequenceParams instances are equal + /// + /// Instance of ConsequenceParams to be compared + /// Boolean + public bool Equals(ConsequenceParams input) + { + if (input == null) + { + return false; + } + return + ( + this.SimilarQuery == input.SimilarQuery || + (this.SimilarQuery != null && + this.SimilarQuery.Equals(input.SimilarQuery)) + ) && + ( + this.Filters == input.Filters || + (this.Filters != null && + this.Filters.Equals(input.Filters)) + ) && + ( + this.FacetFilters == input.FacetFilters || + (this.FacetFilters != null && + this.FacetFilters.Equals(input.FacetFilters)) + ) && + ( + this.OptionalFilters == input.OptionalFilters || + (this.OptionalFilters != null && + this.OptionalFilters.Equals(input.OptionalFilters)) + ) && + ( + this.NumericFilters == input.NumericFilters || + (this.NumericFilters != null && + this.NumericFilters.Equals(input.NumericFilters)) + ) && + ( + this.TagFilters == input.TagFilters || + (this.TagFilters != null && + this.TagFilters.Equals(input.TagFilters)) + ) && + ( + this.SumOrFiltersScores == input.SumOrFiltersScores || + this.SumOrFiltersScores.Equals(input.SumOrFiltersScores) + ) && + ( + this.RestrictSearchableAttributes == input.RestrictSearchableAttributes || + this.RestrictSearchableAttributes != null && + input.RestrictSearchableAttributes != null && + this.RestrictSearchableAttributes.SequenceEqual(input.RestrictSearchableAttributes) + ) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && + ( + this.FacetingAfterDistinct == input.FacetingAfterDistinct || + this.FacetingAfterDistinct.Equals(input.FacetingAfterDistinct) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.Offset == input.Offset || + this.Offset.Equals(input.Offset) + ) && + ( + this.Length == input.Length || + this.Length.Equals(input.Length) + ) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && + ( + this.AroundLatLngViaIP == input.AroundLatLngViaIP || + this.AroundLatLngViaIP.Equals(input.AroundLatLngViaIP) + ) && + ( + this.AroundRadius == input.AroundRadius || + (this.AroundRadius != null && + this.AroundRadius.Equals(input.AroundRadius)) + ) && + ( + this.AroundPrecision == input.AroundPrecision || + (this.AroundPrecision != null && + this.AroundPrecision.Equals(input.AroundPrecision)) + ) && + ( + this.MinimumAroundRadius == input.MinimumAroundRadius || + this.MinimumAroundRadius.Equals(input.MinimumAroundRadius) + ) && + ( + this.InsideBoundingBox == input.InsideBoundingBox || + this.InsideBoundingBox != null && + input.InsideBoundingBox != null && + this.InsideBoundingBox.SequenceEqual(input.InsideBoundingBox) + ) && + ( + this.InsidePolygon == input.InsidePolygon || + this.InsidePolygon != null && + input.InsidePolygon != null && + this.InsidePolygon.SequenceEqual(input.InsidePolygon) + ) && + ( + this.NaturalLanguages == input.NaturalLanguages || + this.NaturalLanguages != null && + input.NaturalLanguages != null && + this.NaturalLanguages.SequenceEqual(input.NaturalLanguages) + ) && + ( + this.RuleContexts == input.RuleContexts || + this.RuleContexts != null && + input.RuleContexts != null && + this.RuleContexts.SequenceEqual(input.RuleContexts) + ) && + ( + this.PersonalizationImpact == input.PersonalizationImpact || + this.PersonalizationImpact.Equals(input.PersonalizationImpact) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.GetRankingInfo == input.GetRankingInfo || + this.GetRankingInfo.Equals(input.GetRankingInfo) + ) && + ( + this.Explain == input.Explain || + this.Explain != null && + input.Explain != null && + this.Explain.SequenceEqual(input.Explain) + ) && + ( + this.Synonyms == input.Synonyms || + this.Synonyms.Equals(input.Synonyms) + ) && + ( + this.ClickAnalytics == input.ClickAnalytics || + this.ClickAnalytics.Equals(input.ClickAnalytics) + ) && + ( + this.Analytics == input.Analytics || + this.Analytics.Equals(input.Analytics) + ) && + ( + this.AnalyticsTags == input.AnalyticsTags || + this.AnalyticsTags != null && + input.AnalyticsTags != null && + this.AnalyticsTags.SequenceEqual(input.AnalyticsTags) + ) && + ( + this.PercentileComputation == input.PercentileComputation || + this.PercentileComputation.Equals(input.PercentileComputation) + ) && + ( + this.EnableABTest == input.EnableABTest || + this.EnableABTest.Equals(input.EnableABTest) + ) && + ( + this.AttributesForFaceting == input.AttributesForFaceting || + this.AttributesForFaceting != null && + input.AttributesForFaceting != null && + this.AttributesForFaceting.SequenceEqual(input.AttributesForFaceting) + ) && + ( + this.AttributesToRetrieve == input.AttributesToRetrieve || + this.AttributesToRetrieve != null && + input.AttributesToRetrieve != null && + this.AttributesToRetrieve.SequenceEqual(input.AttributesToRetrieve) + ) && + ( + this.Ranking == input.Ranking || + this.Ranking != null && + input.Ranking != null && + this.Ranking.SequenceEqual(input.Ranking) + ) && + ( + this.CustomRanking == input.CustomRanking || + this.CustomRanking != null && + input.CustomRanking != null && + this.CustomRanking.SequenceEqual(input.CustomRanking) + ) && + ( + this.RelevancyStrictness == input.RelevancyStrictness || + this.RelevancyStrictness.Equals(input.RelevancyStrictness) + ) && + ( + this.AttributesToHighlight == input.AttributesToHighlight || + this.AttributesToHighlight != null && + input.AttributesToHighlight != null && + this.AttributesToHighlight.SequenceEqual(input.AttributesToHighlight) + ) && + ( + this.AttributesToSnippet == input.AttributesToSnippet || + this.AttributesToSnippet != null && + input.AttributesToSnippet != null && + this.AttributesToSnippet.SequenceEqual(input.AttributesToSnippet) + ) && + ( + this.HighlightPreTag == input.HighlightPreTag || + (this.HighlightPreTag != null && + this.HighlightPreTag.Equals(input.HighlightPreTag)) + ) && + ( + this.HighlightPostTag == input.HighlightPostTag || + (this.HighlightPostTag != null && + this.HighlightPostTag.Equals(input.HighlightPostTag)) + ) && + ( + this.SnippetEllipsisText == input.SnippetEllipsisText || + (this.SnippetEllipsisText != null && + this.SnippetEllipsisText.Equals(input.SnippetEllipsisText)) + ) && + ( + this.RestrictHighlightAndSnippetArrays == input.RestrictHighlightAndSnippetArrays || + this.RestrictHighlightAndSnippetArrays.Equals(input.RestrictHighlightAndSnippetArrays) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && + ( + this.MinWordSizefor1Typo == input.MinWordSizefor1Typo || + this.MinWordSizefor1Typo.Equals(input.MinWordSizefor1Typo) + ) && + ( + this.MinWordSizefor2Typos == input.MinWordSizefor2Typos || + this.MinWordSizefor2Typos.Equals(input.MinWordSizefor2Typos) + ) && + ( + this.TypoTolerance == input.TypoTolerance || + (this.TypoTolerance != null && + this.TypoTolerance.Equals(input.TypoTolerance)) + ) && + ( + this.AllowTyposOnNumericTokens == input.AllowTyposOnNumericTokens || + this.AllowTyposOnNumericTokens.Equals(input.AllowTyposOnNumericTokens) + ) && + ( + this.DisableTypoToleranceOnAttributes == input.DisableTypoToleranceOnAttributes || + this.DisableTypoToleranceOnAttributes != null && + input.DisableTypoToleranceOnAttributes != null && + this.DisableTypoToleranceOnAttributes.SequenceEqual(input.DisableTypoToleranceOnAttributes) + ) && + ( + this.IgnorePlurals == input.IgnorePlurals || + (this.IgnorePlurals != null && + this.IgnorePlurals.Equals(input.IgnorePlurals)) + ) && + ( + this.RemoveStopWords == input.RemoveStopWords || + (this.RemoveStopWords != null && + this.RemoveStopWords.Equals(input.RemoveStopWords)) + ) && + ( + this.KeepDiacriticsOnCharacters == input.KeepDiacriticsOnCharacters || + (this.KeepDiacriticsOnCharacters != null && + this.KeepDiacriticsOnCharacters.Equals(input.KeepDiacriticsOnCharacters)) + ) && + ( + this.QueryLanguages == input.QueryLanguages || + this.QueryLanguages != null && + input.QueryLanguages != null && + this.QueryLanguages.SequenceEqual(input.QueryLanguages) + ) && + ( + this.DecompoundQuery == input.DecompoundQuery || + this.DecompoundQuery.Equals(input.DecompoundQuery) + ) && + ( + this.EnableRules == input.EnableRules || + this.EnableRules.Equals(input.EnableRules) + ) && + ( + this.EnablePersonalization == input.EnablePersonalization || + this.EnablePersonalization.Equals(input.EnablePersonalization) + ) && + ( + this.QueryType == input.QueryType || + this.QueryType.Equals(input.QueryType) + ) && + ( + this.RemoveWordsIfNoResults == input.RemoveWordsIfNoResults || + this.RemoveWordsIfNoResults.Equals(input.RemoveWordsIfNoResults) + ) && + ( + this.Mode == input.Mode || + this.Mode.Equals(input.Mode) + ) && + ( + this.SemanticSearch == input.SemanticSearch || + (this.SemanticSearch != null && + this.SemanticSearch.Equals(input.SemanticSearch)) + ) && + ( + this.AdvancedSyntax == input.AdvancedSyntax || + this.AdvancedSyntax.Equals(input.AdvancedSyntax) + ) && + ( + this.OptionalWords == input.OptionalWords || + this.OptionalWords != null && + input.OptionalWords != null && + this.OptionalWords.SequenceEqual(input.OptionalWords) + ) && + ( + this.DisableExactOnAttributes == input.DisableExactOnAttributes || + this.DisableExactOnAttributes != null && + input.DisableExactOnAttributes != null && + this.DisableExactOnAttributes.SequenceEqual(input.DisableExactOnAttributes) + ) && + ( + this.ExactOnSingleWordQuery == input.ExactOnSingleWordQuery || + this.ExactOnSingleWordQuery.Equals(input.ExactOnSingleWordQuery) + ) && + ( + this.AlternativesAsExact == input.AlternativesAsExact || + this.AlternativesAsExact != null && + input.AlternativesAsExact != null && + this.AlternativesAsExact.SequenceEqual(input.AlternativesAsExact) + ) && + ( + this.AdvancedSyntaxFeatures == input.AdvancedSyntaxFeatures || + this.AdvancedSyntaxFeatures != null && + input.AdvancedSyntaxFeatures != null && + this.AdvancedSyntaxFeatures.SequenceEqual(input.AdvancedSyntaxFeatures) + ) && + ( + this.Distinct == input.Distinct || + (this.Distinct != null && + this.Distinct.Equals(input.Distinct)) + ) && + ( + this.ReplaceSynonymsInHighlight == input.ReplaceSynonymsInHighlight || + this.ReplaceSynonymsInHighlight.Equals(input.ReplaceSynonymsInHighlight) + ) && + ( + this.MinProximity == input.MinProximity || + this.MinProximity.Equals(input.MinProximity) + ) && + ( + this.ResponseFields == input.ResponseFields || + this.ResponseFields != null && + input.ResponseFields != null && + this.ResponseFields.SequenceEqual(input.ResponseFields) + ) && + ( + this.MaxFacetHits == input.MaxFacetHits || + this.MaxFacetHits.Equals(input.MaxFacetHits) + ) && + ( + this.MaxValuesPerFacet == input.MaxValuesPerFacet || + this.MaxValuesPerFacet.Equals(input.MaxValuesPerFacet) + ) && + ( + this.SortFacetValuesBy == input.SortFacetValuesBy || + (this.SortFacetValuesBy != null && + this.SortFacetValuesBy.Equals(input.SortFacetValuesBy)) + ) && + ( + this.AttributeCriteriaComputedByMinProximity == input.AttributeCriteriaComputedByMinProximity || + this.AttributeCriteriaComputedByMinProximity.Equals(input.AttributeCriteriaComputedByMinProximity) + ) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ) && + ( + this.EnableReRanking == input.EnableReRanking || + this.EnableReRanking.Equals(input.EnableReRanking) + ) && + ( + this.ReRankingApplyFilter == input.ReRankingApplyFilter || + (this.ReRankingApplyFilter != null && + this.ReRankingApplyFilter.Equals(input.ReRankingApplyFilter)) + ) && + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.AutomaticFacetFilters == input.AutomaticFacetFilters || + (this.AutomaticFacetFilters != null && + this.AutomaticFacetFilters.Equals(input.AutomaticFacetFilters)) + ) && + ( + this.AutomaticOptionalFacetFilters == input.AutomaticOptionalFacetFilters || + (this.AutomaticOptionalFacetFilters != null && + this.AutomaticOptionalFacetFilters.Equals(input.AutomaticOptionalFacetFilters)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SimilarQuery != null) + { + hashCode = (hashCode * 59) + this.SimilarQuery.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.FacetFilters != null) + { + hashCode = (hashCode * 59) + this.FacetFilters.GetHashCode(); + } + if (this.OptionalFilters != null) + { + hashCode = (hashCode * 59) + this.OptionalFilters.GetHashCode(); + } + if (this.NumericFilters != null) + { + hashCode = (hashCode * 59) + this.NumericFilters.GetHashCode(); + } + if (this.TagFilters != null) + { + hashCode = (hashCode * 59) + this.TagFilters.GetHashCode(); + } + hashCode = (hashCode * 59) + this.SumOrFiltersScores.GetHashCode(); + if (this.RestrictSearchableAttributes != null) + { + hashCode = (hashCode * 59) + this.RestrictSearchableAttributes.GetHashCode(); + } + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + hashCode = (hashCode * 59) + this.FacetingAfterDistinct.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.Offset.GetHashCode(); + hashCode = (hashCode * 59) + this.Length.GetHashCode(); + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AroundLatLngViaIP.GetHashCode(); + if (this.AroundRadius != null) + { + hashCode = (hashCode * 59) + this.AroundRadius.GetHashCode(); + } + if (this.AroundPrecision != null) + { + hashCode = (hashCode * 59) + this.AroundPrecision.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MinimumAroundRadius.GetHashCode(); + if (this.InsideBoundingBox != null) + { + hashCode = (hashCode * 59) + this.InsideBoundingBox.GetHashCode(); + } + if (this.InsidePolygon != null) + { + hashCode = (hashCode * 59) + this.InsidePolygon.GetHashCode(); + } + if (this.NaturalLanguages != null) + { + hashCode = (hashCode * 59) + this.NaturalLanguages.GetHashCode(); + } + if (this.RuleContexts != null) + { + hashCode = (hashCode * 59) + this.RuleContexts.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PersonalizationImpact.GetHashCode(); + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.GetRankingInfo.GetHashCode(); + if (this.Explain != null) + { + hashCode = (hashCode * 59) + this.Explain.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Synonyms.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickAnalytics.GetHashCode(); + hashCode = (hashCode * 59) + this.Analytics.GetHashCode(); + if (this.AnalyticsTags != null) + { + hashCode = (hashCode * 59) + this.AnalyticsTags.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PercentileComputation.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableABTest.GetHashCode(); + if (this.AttributesForFaceting != null) + { + hashCode = (hashCode * 59) + this.AttributesForFaceting.GetHashCode(); + } + if (this.AttributesToRetrieve != null) + { + hashCode = (hashCode * 59) + this.AttributesToRetrieve.GetHashCode(); + } + if (this.Ranking != null) + { + hashCode = (hashCode * 59) + this.Ranking.GetHashCode(); + } + if (this.CustomRanking != null) + { + hashCode = (hashCode * 59) + this.CustomRanking.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RelevancyStrictness.GetHashCode(); + if (this.AttributesToHighlight != null) + { + hashCode = (hashCode * 59) + this.AttributesToHighlight.GetHashCode(); + } + if (this.AttributesToSnippet != null) + { + hashCode = (hashCode * 59) + this.AttributesToSnippet.GetHashCode(); + } + if (this.HighlightPreTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPreTag.GetHashCode(); + } + if (this.HighlightPostTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPostTag.GetHashCode(); + } + if (this.SnippetEllipsisText != null) + { + hashCode = (hashCode * 59) + this.SnippetEllipsisText.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RestrictHighlightAndSnippetArrays.GetHashCode(); + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor1Typo.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor2Typos.GetHashCode(); + if (this.TypoTolerance != null) + { + hashCode = (hashCode * 59) + this.TypoTolerance.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AllowTyposOnNumericTokens.GetHashCode(); + if (this.DisableTypoToleranceOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableTypoToleranceOnAttributes.GetHashCode(); + } + if (this.IgnorePlurals != null) + { + hashCode = (hashCode * 59) + this.IgnorePlurals.GetHashCode(); + } + if (this.RemoveStopWords != null) + { + hashCode = (hashCode * 59) + this.RemoveStopWords.GetHashCode(); + } + if (this.KeepDiacriticsOnCharacters != null) + { + hashCode = (hashCode * 59) + this.KeepDiacriticsOnCharacters.GetHashCode(); + } + if (this.QueryLanguages != null) + { + hashCode = (hashCode * 59) + this.QueryLanguages.GetHashCode(); + } + hashCode = (hashCode * 59) + this.DecompoundQuery.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableRules.GetHashCode(); + hashCode = (hashCode * 59) + this.EnablePersonalization.GetHashCode(); + hashCode = (hashCode * 59) + this.QueryType.GetHashCode(); + hashCode = (hashCode * 59) + this.RemoveWordsIfNoResults.GetHashCode(); + hashCode = (hashCode * 59) + this.Mode.GetHashCode(); + if (this.SemanticSearch != null) + { + hashCode = (hashCode * 59) + this.SemanticSearch.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AdvancedSyntax.GetHashCode(); + if (this.OptionalWords != null) + { + hashCode = (hashCode * 59) + this.OptionalWords.GetHashCode(); + } + if (this.DisableExactOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableExactOnAttributes.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ExactOnSingleWordQuery.GetHashCode(); + if (this.AlternativesAsExact != null) + { + hashCode = (hashCode * 59) + this.AlternativesAsExact.GetHashCode(); + } + if (this.AdvancedSyntaxFeatures != null) + { + hashCode = (hashCode * 59) + this.AdvancedSyntaxFeatures.GetHashCode(); + } + if (this.Distinct != null) + { + hashCode = (hashCode * 59) + this.Distinct.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ReplaceSynonymsInHighlight.GetHashCode(); + hashCode = (hashCode * 59) + this.MinProximity.GetHashCode(); + if (this.ResponseFields != null) + { + hashCode = (hashCode * 59) + this.ResponseFields.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MaxFacetHits.GetHashCode(); + hashCode = (hashCode * 59) + this.MaxValuesPerFacet.GetHashCode(); + if (this.SortFacetValuesBy != null) + { + hashCode = (hashCode * 59) + this.SortFacetValuesBy.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AttributeCriteriaComputedByMinProximity.GetHashCode(); + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EnableReRanking.GetHashCode(); + if (this.ReRankingApplyFilter != null) + { + hashCode = (hashCode * 59) + this.ReRankingApplyFilter.GetHashCode(); + } + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.AutomaticFacetFilters != null) + { + hashCode = (hashCode * 59) + this.AutomaticFacetFilters.GetHashCode(); + } + if (this.AutomaticOptionalFacetFilters != null) + { + hashCode = (hashCode * 59) + this.AutomaticOptionalFacetFilters.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Length (int) maximum + if (this.Length > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value less than or equal to 1000.", new[] { "Length" }); + } + + // Length (int) minimum + if (this.Length < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value greater than or equal to 1.", new[] { "Length" }); + } + + // MinimumAroundRadius (int) minimum + if (this.MinimumAroundRadius < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinimumAroundRadius, must be a value greater than or equal to 1.", new[] { "MinimumAroundRadius" }); + } + + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + // MinProximity (int) maximum + if (this.MinProximity > (int)7) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value less than or equal to 7.", new[] { "MinProximity" }); + } + + // MinProximity (int) minimum + if (this.MinProximity < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value greater than or equal to 1.", new[] { "MinProximity" }); + } + + // MaxFacetHits (int) maximum + if (this.MaxFacetHits > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MaxFacetHits, must be a value less than or equal to 100.", new[] { "MaxFacetHits" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/ConsequenceQuery.cs b/algoliasearch/Search/Models/ConsequenceQuery.cs new file mode 100644 index 000000000..1bc782e8e --- /dev/null +++ b/algoliasearch/Search/Models/ConsequenceQuery.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// When providing a string, it replaces the entire query string. When providing an object, it describes incremental edits to be made to the query string (but you can't do both). + /// + [JsonConverter(typeof(ConsequenceQueryJsonConverter))] + [DataContract(Name = "consequenceQuery")] + public partial class ConsequenceQuery : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of ConsequenceQueryObject. + public ConsequenceQuery(ConsequenceQueryObject actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public ConsequenceQuery(string actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(ConsequenceQueryObject)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: ConsequenceQueryObject, string"); + } + } + } + + /// + /// Get the actual instance of `ConsequenceQueryObject`. If the actual instance is not `ConsequenceQueryObject`, + /// the InvalidClassException will be thrown + /// + /// An instance of ConsequenceQueryObject + public ConsequenceQueryObject GetterConsequenceQueryObject() + { + return (ConsequenceQueryObject)this.ActualInstance; + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class ConsequenceQuery {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, ConsequenceQuery.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of ConsequenceQuery + /// + /// JSON string + /// An instance of ConsequenceQuery + public static ConsequenceQuery FromJson(string jsonString) + { + ConsequenceQuery newConsequenceQuery = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newConsequenceQuery; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(ConsequenceQueryObject).GetProperty("AdditionalProperties") == null) + { + newConsequenceQuery = new ConsequenceQuery(JsonConvert.DeserializeObject(jsonString, ConsequenceQuery.SerializerSettings)); + } + else + { + newConsequenceQuery = new ConsequenceQuery(JsonConvert.DeserializeObject(jsonString, ConsequenceQuery.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("ConsequenceQueryObject"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into ConsequenceQueryObject: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newConsequenceQuery = new ConsequenceQuery(JsonConvert.DeserializeObject(jsonString, ConsequenceQuery.SerializerSettings)); + } + else + { + newConsequenceQuery = new ConsequenceQuery(JsonConvert.DeserializeObject(jsonString, ConsequenceQuery.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newConsequenceQuery; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ConsequenceQuery); + } + + /// + /// Returns true if ConsequenceQuery instances are equal + /// + /// Instance of ConsequenceQuery to be compared + /// Boolean + public bool Equals(ConsequenceQuery input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for ConsequenceQuery + /// + public class ConsequenceQueryJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(ConsequenceQuery).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return ConsequenceQuery.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/ConsequenceQueryObject.cs b/algoliasearch/Search/Models/ConsequenceQueryObject.cs new file mode 100644 index 000000000..0851b7259 --- /dev/null +++ b/algoliasearch/Search/Models/ConsequenceQueryObject.cs @@ -0,0 +1,145 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// ConsequenceQueryObject + /// + [DataContract(Name = "consequenceQueryObject")] + public partial class ConsequenceQueryObject : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Words to remove.. + /// Edits to apply.. + public ConsequenceQueryObject(List remove = default(List), List edits = default(List)) + { + this.Remove = remove; + this.Edits = edits; + } + + /// + /// Words to remove. + /// + /// Words to remove. + [DataMember(Name = "remove", EmitDefaultValue = false)] + public List Remove { get; set; } + + /// + /// Edits to apply. + /// + /// Edits to apply. + [DataMember(Name = "edits", EmitDefaultValue = false)] + public List Edits { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ConsequenceQueryObject {\n"); + sb.Append(" Remove: ").Append(Remove).Append("\n"); + sb.Append(" Edits: ").Append(Edits).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ConsequenceQueryObject); + } + + /// + /// Returns true if ConsequenceQueryObject instances are equal + /// + /// Instance of ConsequenceQueryObject to be compared + /// Boolean + public bool Equals(ConsequenceQueryObject input) + { + if (input == null) + { + return false; + } + return + ( + this.Remove == input.Remove || + this.Remove != null && + input.Remove != null && + this.Remove.SequenceEqual(input.Remove) + ) && + ( + this.Edits == input.Edits || + this.Edits != null && + input.Edits != null && + this.Edits.SequenceEqual(input.Edits) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Remove != null) + { + hashCode = (hashCode * 59) + this.Remove.GetHashCode(); + } + if (this.Edits != null) + { + hashCode = (hashCode * 59) + this.Edits.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/CreatedAtResponse.cs b/algoliasearch/Search/Models/CreatedAtResponse.cs new file mode 100644 index 000000000..294d66dd1 --- /dev/null +++ b/algoliasearch/Search/Models/CreatedAtResponse.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Response and creation timestamp. + /// + [DataContract(Name = "createdAtResponse")] + public partial class CreatedAtResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected CreatedAtResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Timestamp of creation in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + public CreatedAtResponse(string createdAt = default(string)) + { + // to ensure "createdAt" is required (not null) + if (createdAt == null) + { + throw new ArgumentNullException("createdAt is a required property for CreatedAtResponse and cannot be null"); + } + this.CreatedAt = createdAt; + } + + /// + /// Timestamp of creation in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of creation in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public string CreatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class CreatedAtResponse {\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as CreatedAtResponse); + } + + /// + /// Returns true if CreatedAtResponse instances are equal + /// + /// Instance of CreatedAtResponse to be compared + /// Boolean + public bool Equals(CreatedAtResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.CreatedAt == input.CreatedAt || + (this.CreatedAt != null && + this.CreatedAt.Equals(input.CreatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.CreatedAt != null) + { + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/Cursor.cs b/algoliasearch/Search/Models/Cursor.cs new file mode 100644 index 000000000..6e46fdf3f --- /dev/null +++ b/algoliasearch/Search/Models/Cursor.cs @@ -0,0 +1,124 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Cursor + /// + [DataContract(Name = "cursor")] + public partial class Cursor : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. Pass this value to the subsequent browse call to get the next page of results. When the end of the index has been reached, `cursor` is absent from the response. . + public Cursor(string varCursor = default(string)) + { + this.VarCursor = varCursor; + } + + /// + /// Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. Pass this value to the subsequent browse call to get the next page of results. When the end of the index has been reached, `cursor` is absent from the response. + /// + /// Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. Pass this value to the subsequent browse call to get the next page of results. When the end of the index has been reached, `cursor` is absent from the response. + [DataMember(Name = "cursor", EmitDefaultValue = false)] + public string VarCursor { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Cursor {\n"); + sb.Append(" VarCursor: ").Append(VarCursor).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Cursor); + } + + /// + /// Returns true if Cursor instances are equal + /// + /// Instance of Cursor to be compared + /// Boolean + public bool Equals(Cursor input) + { + if (input == null) + { + return false; + } + return + ( + this.VarCursor == input.VarCursor || + (this.VarCursor != null && + this.VarCursor.Equals(input.VarCursor)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.VarCursor != null) + { + hashCode = (hashCode * 59) + this.VarCursor.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/DeleteApiKeyResponse.cs b/algoliasearch/Search/Models/DeleteApiKeyResponse.cs new file mode 100644 index 000000000..a1bb63d5f --- /dev/null +++ b/algoliasearch/Search/Models/DeleteApiKeyResponse.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// DeleteApiKeyResponse + /// + [DataContract(Name = "deleteApiKeyResponse")] + public partial class DeleteApiKeyResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DeleteApiKeyResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + public DeleteApiKeyResponse(string deletedAt = default(string)) + { + // to ensure "deletedAt" is required (not null) + if (deletedAt == null) + { + throw new ArgumentNullException("deletedAt is a required property for DeleteApiKeyResponse and cannot be null"); + } + this.DeletedAt = deletedAt; + } + + /// + /// Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "deletedAt", IsRequired = true, EmitDefaultValue = true)] + public string DeletedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DeleteApiKeyResponse {\n"); + sb.Append(" DeletedAt: ").Append(DeletedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DeleteApiKeyResponse); + } + + /// + /// Returns true if DeleteApiKeyResponse instances are equal + /// + /// Instance of DeleteApiKeyResponse to be compared + /// Boolean + public bool Equals(DeleteApiKeyResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.DeletedAt == input.DeletedAt || + (this.DeletedAt != null && + this.DeletedAt.Equals(input.DeletedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.DeletedAt != null) + { + hashCode = (hashCode * 59) + this.DeletedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/DeleteByParams.cs b/algoliasearch/Search/Models/DeleteByParams.cs new file mode 100644 index 000000000..05b0558f8 --- /dev/null +++ b/algoliasearch/Search/Models/DeleteByParams.cs @@ -0,0 +1,257 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// DeleteByParams + /// + [DataContract(Name = "deleteByParams")] + public partial class DeleteByParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// facetFilters. + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. (default to ""). + /// numericFilters. + /// tagFilters. + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. (default to ""). + /// aroundRadius. + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + public DeleteByParams(FacetFilters facetFilters = default(FacetFilters), string filters = @"", NumericFilters numericFilters = default(NumericFilters), TagFilters tagFilters = default(TagFilters), string aroundLatLng = @"", AroundRadius aroundRadius = default(AroundRadius), List> insideBoundingBox = default(List>), List> insidePolygon = default(List>)) + { + this.FacetFilters = facetFilters; + // use default value if no "filters" provided + this.Filters = filters ?? @""; + this.NumericFilters = numericFilters; + this.TagFilters = tagFilters; + // use default value if no "aroundLatLng" provided + this.AroundLatLng = aroundLatLng ?? @""; + this.AroundRadius = aroundRadius; + this.InsideBoundingBox = insideBoundingBox; + this.InsidePolygon = insidePolygon; + } + + /// + /// Gets or Sets FacetFilters + /// + [DataMember(Name = "facetFilters", EmitDefaultValue = false)] + public FacetFilters FacetFilters { get; set; } + + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + [DataMember(Name = "filters", EmitDefaultValue = false)] + public string Filters { get; set; } + + /// + /// Gets or Sets NumericFilters + /// + [DataMember(Name = "numericFilters", EmitDefaultValue = false)] + public NumericFilters NumericFilters { get; set; } + + /// + /// Gets or Sets TagFilters + /// + [DataMember(Name = "tagFilters", EmitDefaultValue = false)] + public TagFilters TagFilters { get; set; } + + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Gets or Sets AroundRadius + /// + [DataMember(Name = "aroundRadius", EmitDefaultValue = false)] + public AroundRadius AroundRadius { get; set; } + + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insideBoundingBox", EmitDefaultValue = false)] + public List> InsideBoundingBox { get; set; } + + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insidePolygon", EmitDefaultValue = false)] + public List> InsidePolygon { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DeleteByParams {\n"); + sb.Append(" FacetFilters: ").Append(FacetFilters).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" NumericFilters: ").Append(NumericFilters).Append("\n"); + sb.Append(" TagFilters: ").Append(TagFilters).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AroundRadius: ").Append(AroundRadius).Append("\n"); + sb.Append(" InsideBoundingBox: ").Append(InsideBoundingBox).Append("\n"); + sb.Append(" InsidePolygon: ").Append(InsidePolygon).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DeleteByParams); + } + + /// + /// Returns true if DeleteByParams instances are equal + /// + /// Instance of DeleteByParams to be compared + /// Boolean + public bool Equals(DeleteByParams input) + { + if (input == null) + { + return false; + } + return + ( + this.FacetFilters == input.FacetFilters || + (this.FacetFilters != null && + this.FacetFilters.Equals(input.FacetFilters)) + ) && + ( + this.Filters == input.Filters || + (this.Filters != null && + this.Filters.Equals(input.Filters)) + ) && + ( + this.NumericFilters == input.NumericFilters || + (this.NumericFilters != null && + this.NumericFilters.Equals(input.NumericFilters)) + ) && + ( + this.TagFilters == input.TagFilters || + (this.TagFilters != null && + this.TagFilters.Equals(input.TagFilters)) + ) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && + ( + this.AroundRadius == input.AroundRadius || + (this.AroundRadius != null && + this.AroundRadius.Equals(input.AroundRadius)) + ) && + ( + this.InsideBoundingBox == input.InsideBoundingBox || + this.InsideBoundingBox != null && + input.InsideBoundingBox != null && + this.InsideBoundingBox.SequenceEqual(input.InsideBoundingBox) + ) && + ( + this.InsidePolygon == input.InsidePolygon || + this.InsidePolygon != null && + input.InsidePolygon != null && + this.InsidePolygon.SequenceEqual(input.InsidePolygon) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.FacetFilters != null) + { + hashCode = (hashCode * 59) + this.FacetFilters.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.NumericFilters != null) + { + hashCode = (hashCode * 59) + this.NumericFilters.GetHashCode(); + } + if (this.TagFilters != null) + { + hashCode = (hashCode * 59) + this.TagFilters.GetHashCode(); + } + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + if (this.AroundRadius != null) + { + hashCode = (hashCode * 59) + this.AroundRadius.GetHashCode(); + } + if (this.InsideBoundingBox != null) + { + hashCode = (hashCode * 59) + this.InsideBoundingBox.GetHashCode(); + } + if (this.InsidePolygon != null) + { + hashCode = (hashCode * 59) + this.InsidePolygon.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/DeleteSourceResponse.cs b/algoliasearch/Search/Models/DeleteSourceResponse.cs new file mode 100644 index 000000000..89ed3caf1 --- /dev/null +++ b/algoliasearch/Search/Models/DeleteSourceResponse.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// DeleteSourceResponse + /// + [DataContract(Name = "deleteSourceResponse")] + public partial class DeleteSourceResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DeleteSourceResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + public DeleteSourceResponse(string deletedAt = default(string)) + { + // to ensure "deletedAt" is required (not null) + if (deletedAt == null) + { + throw new ArgumentNullException("deletedAt is a required property for DeleteSourceResponse and cannot be null"); + } + this.DeletedAt = deletedAt; + } + + /// + /// Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "deletedAt", IsRequired = true, EmitDefaultValue = true)] + public string DeletedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DeleteSourceResponse {\n"); + sb.Append(" DeletedAt: ").Append(DeletedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DeleteSourceResponse); + } + + /// + /// Returns true if DeleteSourceResponse instances are equal + /// + /// Instance of DeleteSourceResponse to be compared + /// Boolean + public bool Equals(DeleteSourceResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.DeletedAt == input.DeletedAt || + (this.DeletedAt != null && + this.DeletedAt.Equals(input.DeletedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.DeletedAt != null) + { + hashCode = (hashCode * 59) + this.DeletedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/DeletedAtResponse.cs b/algoliasearch/Search/Models/DeletedAtResponse.cs new file mode 100644 index 000000000..fe9d3f62d --- /dev/null +++ b/algoliasearch/Search/Models/DeletedAtResponse.cs @@ -0,0 +1,149 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Response, taskID, and deletion timestamp. + /// + [DataContract(Name = "deletedAtResponse")] + public partial class DeletedAtResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DeletedAtResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. (required). + /// Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + public DeletedAtResponse(long taskID = default(long), string deletedAt = default(string)) + { + this.TaskID = taskID; + // to ensure "deletedAt" is required (not null) + if (deletedAt == null) + { + throw new ArgumentNullException("deletedAt is a required property for DeletedAtResponse and cannot be null"); + } + this.DeletedAt = deletedAt; + } + + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + [DataMember(Name = "taskID", IsRequired = true, EmitDefaultValue = true)] + public long TaskID { get; set; } + + /// + /// Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "deletedAt", IsRequired = true, EmitDefaultValue = true)] + public string DeletedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DeletedAtResponse {\n"); + sb.Append(" TaskID: ").Append(TaskID).Append("\n"); + sb.Append(" DeletedAt: ").Append(DeletedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DeletedAtResponse); + } + + /// + /// Returns true if DeletedAtResponse instances are equal + /// + /// Instance of DeletedAtResponse to be compared + /// Boolean + public bool Equals(DeletedAtResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.TaskID == input.TaskID || + this.TaskID.Equals(input.TaskID) + ) && + ( + this.DeletedAt == input.DeletedAt || + (this.DeletedAt != null && + this.DeletedAt.Equals(input.DeletedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.TaskID.GetHashCode(); + if (this.DeletedAt != null) + { + hashCode = (hashCode * 59) + this.DeletedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/DictionaryAction.cs b/algoliasearch/Search/Models/DictionaryAction.cs new file mode 100644 index 000000000..6a42c6d10 --- /dev/null +++ b/algoliasearch/Search/Models/DictionaryAction.cs @@ -0,0 +1,43 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Actions to perform. + /// + /// Actions to perform. + [JsonConverter(typeof(StringEnumConverter))] + public enum DictionaryAction + { + /// + /// Enum AddEntry for value: addEntry + /// + [EnumMember(Value = "addEntry")] + AddEntry = 1, + + /// + /// Enum DeleteEntry for value: deleteEntry + /// + [EnumMember(Value = "deleteEntry")] + DeleteEntry = 2 + } + +} diff --git a/algoliasearch/Search/Models/DictionaryEntry.cs b/algoliasearch/Search/Models/DictionaryEntry.cs new file mode 100644 index 000000000..b78dbe88f --- /dev/null +++ b/algoliasearch/Search/Models/DictionaryEntry.cs @@ -0,0 +1,258 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Dictionary entry. + /// + [DataContract(Name = "dictionaryEntry")] + public partial class DictionaryEntry : Dictionary, IEquatable, IValidatableObject + { + + /// + /// Gets or Sets State + /// + [DataMember(Name = "state", EmitDefaultValue = false)] + public DictionaryEntryState? State { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DictionaryEntry() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// Unique identifier for a dictionary object. (required). + /// [Supported language ISO code](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/). (required). + /// Dictionary entry word. Usage depends on the type of dictionary entry. **`stopwordEntry`** The stop word you want to add or update. If the entry already exists in Algolia's standard dictionary, you can override its behavior by adding it to the custom dictionary and setting its `state` to `disabled`. **`compoundEntry`** When `decomposition` is empty: adds `word` as a compound atom. For example, atom “kino” decomposes the query “kopfkino” into \"kopf\" and \"kino\". When `decomposition` isn't empty: creates a decomposition exception. For example, when decomposition is set to the [\"hund\", \"hutte\"] exception, \"hundehutte\" decomposes into “hund” and “hutte”, discarding the linking \"e\". . + /// Compound dictionary [word declensions](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/). If the entry already exists in Algolia's standard dictionary, you can override its behavior by adding it to the custom dictionary and setting its `state` to `disabled`. . + /// For compound entries, governs the behavior of the `word` parameter.. + /// state. + public DictionaryEntry(string objectID = default(string), string language = default(string), string word = default(string), List words = default(List), List decomposition = default(List), DictionaryEntryState? state = default(DictionaryEntryState?)) : base() + { + // to ensure "objectID" is required (not null) + if (objectID == null) + { + throw new ArgumentNullException("objectID is a required property for DictionaryEntry and cannot be null"); + } + this.ObjectID = objectID; + // to ensure "language" is required (not null) + if (language == null) + { + throw new ArgumentNullException("language is a required property for DictionaryEntry and cannot be null"); + } + this.Language = language; + this.Word = word; + this.Words = words; + this.Decomposition = decomposition; + this.State = state; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Unique identifier for a dictionary object. + /// + /// Unique identifier for a dictionary object. + [DataMember(Name = "objectID", IsRequired = true, EmitDefaultValue = true)] + public string ObjectID { get; set; } + + /// + /// [Supported language ISO code](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/). + /// + /// [Supported language ISO code](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/). + [DataMember(Name = "language", IsRequired = true, EmitDefaultValue = true)] + public string Language { get; set; } + + /// + /// Dictionary entry word. Usage depends on the type of dictionary entry. **`stopwordEntry`** The stop word you want to add or update. If the entry already exists in Algolia's standard dictionary, you can override its behavior by adding it to the custom dictionary and setting its `state` to `disabled`. **`compoundEntry`** When `decomposition` is empty: adds `word` as a compound atom. For example, atom “kino” decomposes the query “kopfkino” into \"kopf\" and \"kino\". When `decomposition` isn't empty: creates a decomposition exception. For example, when decomposition is set to the [\"hund\", \"hutte\"] exception, \"hundehutte\" decomposes into “hund” and “hutte”, discarding the linking \"e\". + /// + /// Dictionary entry word. Usage depends on the type of dictionary entry. **`stopwordEntry`** The stop word you want to add or update. If the entry already exists in Algolia's standard dictionary, you can override its behavior by adding it to the custom dictionary and setting its `state` to `disabled`. **`compoundEntry`** When `decomposition` is empty: adds `word` as a compound atom. For example, atom “kino” decomposes the query “kopfkino” into \"kopf\" and \"kino\". When `decomposition` isn't empty: creates a decomposition exception. For example, when decomposition is set to the [\"hund\", \"hutte\"] exception, \"hundehutte\" decomposes into “hund” and “hutte”, discarding the linking \"e\". + [DataMember(Name = "word", EmitDefaultValue = false)] + public string Word { get; set; } + + /// + /// Compound dictionary [word declensions](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/). If the entry already exists in Algolia's standard dictionary, you can override its behavior by adding it to the custom dictionary and setting its `state` to `disabled`. + /// + /// Compound dictionary [word declensions](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-plurals-and-other-declensions/). If the entry already exists in Algolia's standard dictionary, you can override its behavior by adding it to the custom dictionary and setting its `state` to `disabled`. + [DataMember(Name = "words", EmitDefaultValue = false)] + public List Words { get; set; } + + /// + /// For compound entries, governs the behavior of the `word` parameter. + /// + /// For compound entries, governs the behavior of the `word` parameter. + [DataMember(Name = "decomposition", EmitDefaultValue = false)] + public List Decomposition { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DictionaryEntry {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append(" Language: ").Append(Language).Append("\n"); + sb.Append(" Word: ").Append(Word).Append("\n"); + sb.Append(" Words: ").Append(Words).Append("\n"); + sb.Append(" Decomposition: ").Append(Decomposition).Append("\n"); + sb.Append(" State: ").Append(State).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DictionaryEntry); + } + + /// + /// Returns true if DictionaryEntry instances are equal + /// + /// Instance of DictionaryEntry to be compared + /// Boolean + public bool Equals(DictionaryEntry input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ) && base.Equals(input) && + ( + this.Language == input.Language || + (this.Language != null && + this.Language.Equals(input.Language)) + ) && base.Equals(input) && + ( + this.Word == input.Word || + (this.Word != null && + this.Word.Equals(input.Word)) + ) && base.Equals(input) && + ( + this.Words == input.Words || + this.Words != null && + input.Words != null && + this.Words.SequenceEqual(input.Words) + ) && base.Equals(input) && + ( + this.Decomposition == input.Decomposition || + this.Decomposition != null && + input.Decomposition != null && + this.Decomposition.SequenceEqual(input.Decomposition) + ) && base.Equals(input) && + ( + this.State == input.State || + this.State.Equals(input.State) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + if (this.Language != null) + { + hashCode = (hashCode * 59) + this.Language.GetHashCode(); + } + if (this.Word != null) + { + hashCode = (hashCode * 59) + this.Word.GetHashCode(); + } + if (this.Words != null) + { + hashCode = (hashCode * 59) + this.Words.GetHashCode(); + } + if (this.Decomposition != null) + { + hashCode = (hashCode * 59) + this.Decomposition.GetHashCode(); + } + hashCode = (hashCode * 59) + this.State.GetHashCode(); + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/DictionaryEntryState.cs b/algoliasearch/Search/Models/DictionaryEntryState.cs new file mode 100644 index 000000000..82669fadf --- /dev/null +++ b/algoliasearch/Search/Models/DictionaryEntryState.cs @@ -0,0 +1,43 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Indicates whether a dictionary entry is active (`enabled`) or inactive (`disabled`). + /// + /// Indicates whether a dictionary entry is active (`enabled`) or inactive (`disabled`). + [JsonConverter(typeof(StringEnumConverter))] + public enum DictionaryEntryState + { + /// + /// Enum Enabled for value: enabled + /// + [EnumMember(Value = "enabled")] + Enabled = 1, + + /// + /// Enum Disabled for value: disabled + /// + [EnumMember(Value = "disabled")] + Disabled = 2 + } + +} diff --git a/algoliasearch/Search/Models/DictionaryLanguage.cs b/algoliasearch/Search/Models/DictionaryLanguage.cs new file mode 100644 index 000000000..cecc3c7a1 --- /dev/null +++ b/algoliasearch/Search/Models/DictionaryLanguage.cs @@ -0,0 +1,120 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Custom entries for a dictionary. + /// + [DataContract(Name = "dictionaryLanguage")] + public partial class DictionaryLanguage : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// If `0`, the dictionary hasn't been customized and only contains standard entries provided by Algolia. If `null`, that feature isn't available or isn't supported for that language. . + public DictionaryLanguage(int nbCustomEntries = default(int)) + { + this.NbCustomEntries = nbCustomEntries; + } + + /// + /// If `0`, the dictionary hasn't been customized and only contains standard entries provided by Algolia. If `null`, that feature isn't available or isn't supported for that language. + /// + /// If `0`, the dictionary hasn't been customized and only contains standard entries provided by Algolia. If `null`, that feature isn't available or isn't supported for that language. + [DataMember(Name = "nbCustomEntries", EmitDefaultValue = false)] + public int NbCustomEntries { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DictionaryLanguage {\n"); + sb.Append(" NbCustomEntries: ").Append(NbCustomEntries).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DictionaryLanguage); + } + + /// + /// Returns true if DictionaryLanguage instances are equal + /// + /// Instance of DictionaryLanguage to be compared + /// Boolean + public bool Equals(DictionaryLanguage input) + { + if (input == null) + { + return false; + } + return + ( + this.NbCustomEntries == input.NbCustomEntries || + this.NbCustomEntries.Equals(input.NbCustomEntries) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.NbCustomEntries.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/DictionarySettingsParams.cs b/algoliasearch/Search/Models/DictionarySettingsParams.cs new file mode 100644 index 000000000..0e0344e36 --- /dev/null +++ b/algoliasearch/Search/Models/DictionarySettingsParams.cs @@ -0,0 +1,133 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Enable or turn off the built-in Algolia stop words for a specific language. + /// + [DataContract(Name = "dictionarySettingsParams")] + public partial class DictionarySettingsParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected DictionarySettingsParams() { } + /// + /// Initializes a new instance of the class. + /// + /// disableStandardEntries (required). + public DictionarySettingsParams(StandardEntries disableStandardEntries = default(StandardEntries)) + { + // to ensure "disableStandardEntries" is required (not null) + if (disableStandardEntries == null) + { + throw new ArgumentNullException("disableStandardEntries is a required property for DictionarySettingsParams and cannot be null"); + } + this.DisableStandardEntries = disableStandardEntries; + } + + /// + /// Gets or Sets DisableStandardEntries + /// + [DataMember(Name = "disableStandardEntries", IsRequired = true, EmitDefaultValue = true)] + public StandardEntries DisableStandardEntries { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DictionarySettingsParams {\n"); + sb.Append(" DisableStandardEntries: ").Append(DisableStandardEntries).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as DictionarySettingsParams); + } + + /// + /// Returns true if DictionarySettingsParams instances are equal + /// + /// Instance of DictionarySettingsParams to be compared + /// Boolean + public bool Equals(DictionarySettingsParams input) + { + if (input == null) + { + return false; + } + return + ( + this.DisableStandardEntries == input.DisableStandardEntries || + (this.DisableStandardEntries != null && + this.DisableStandardEntries.Equals(input.DisableStandardEntries)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.DisableStandardEntries != null) + { + hashCode = (hashCode * 59) + this.DisableStandardEntries.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/DictionaryType.cs b/algoliasearch/Search/Models/DictionaryType.cs new file mode 100644 index 000000000..0e1349254 --- /dev/null +++ b/algoliasearch/Search/Models/DictionaryType.cs @@ -0,0 +1,48 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Defines dictionaryType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DictionaryType + { + /// + /// Enum Plurals for value: plurals + /// + [EnumMember(Value = "plurals")] + Plurals = 1, + + /// + /// Enum Stopwords for value: stopwords + /// + [EnumMember(Value = "stopwords")] + Stopwords = 2, + + /// + /// Enum Compounds for value: compounds + /// + [EnumMember(Value = "compounds")] + Compounds = 3 + } + +} diff --git a/algoliasearch/Search/Models/Distinct.cs b/algoliasearch/Search/Models/Distinct.cs new file mode 100644 index 000000000..b41809d60 --- /dev/null +++ b/algoliasearch/Search/Models/Distinct.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// Enables [deduplication or grouping of results (Algolia's _distinct_ feature](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/#introducing-algolias-distinct-feature)). + /// + [JsonConverter(typeof(DistinctJsonConverter))] + [DataContract(Name = "distinct")] + public partial class Distinct : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of bool. + public Distinct(bool actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of int. + public Distinct(int actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(bool)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(int)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: bool, int"); + } + } + } + + /// + /// Get the actual instance of `bool`. If the actual instance is not `bool`, + /// the InvalidClassException will be thrown + /// + /// An instance of bool + public bool GetterBool() + { + return (bool)this.ActualInstance; + } + + /// + /// Get the actual instance of `int`. If the actual instance is not `int`, + /// the InvalidClassException will be thrown + /// + /// An instance of int + public int GetterInt() + { + return (int)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Distinct {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, Distinct.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of Distinct + /// + /// JSON string + /// An instance of Distinct + public static Distinct FromJson(string jsonString) + { + Distinct newDistinct = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newDistinct; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(bool).GetProperty("AdditionalProperties") == null) + { + newDistinct = new Distinct(JsonConvert.DeserializeObject(jsonString, Distinct.SerializerSettings)); + } + else + { + newDistinct = new Distinct(JsonConvert.DeserializeObject(jsonString, Distinct.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("bool"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into bool: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(int).GetProperty("AdditionalProperties") == null) + { + newDistinct = new Distinct(JsonConvert.DeserializeObject(jsonString, Distinct.SerializerSettings)); + } + else + { + newDistinct = new Distinct(JsonConvert.DeserializeObject(jsonString, Distinct.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("int"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into int: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newDistinct; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Distinct); + } + + /// + /// Returns true if Distinct instances are equal + /// + /// Instance of Distinct to be compared + /// Boolean + public bool Equals(Distinct input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for Distinct + /// + public class DistinctJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(Distinct).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return Distinct.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/Edit.cs b/algoliasearch/Search/Models/Edit.cs new file mode 100644 index 000000000..f05de969e --- /dev/null +++ b/algoliasearch/Search/Models/Edit.cs @@ -0,0 +1,157 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Edit + /// + [DataContract(Name = "edit")] + public partial class Edit : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", EmitDefaultValue = false)] + public EditType? Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// type. + /// Text or patterns to remove from the query string.. + /// Text that should be inserted in place of the removed text inside the query string.. + public Edit(EditType? type = default(EditType?), string delete = default(string), string insert = default(string)) + { + this.Type = type; + this.Delete = delete; + this.Insert = insert; + } + + /// + /// Text or patterns to remove from the query string. + /// + /// Text or patterns to remove from the query string. + [DataMember(Name = "delete", EmitDefaultValue = false)] + public string Delete { get; set; } + + /// + /// Text that should be inserted in place of the removed text inside the query string. + /// + /// Text that should be inserted in place of the removed text inside the query string. + [DataMember(Name = "insert", EmitDefaultValue = false)] + public string Insert { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Edit {\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Delete: ").Append(Delete).Append("\n"); + sb.Append(" Insert: ").Append(Insert).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Edit); + } + + /// + /// Returns true if Edit instances are equal + /// + /// Instance of Edit to be compared + /// Boolean + public bool Equals(Edit input) + { + if (input == null) + { + return false; + } + return + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.Delete == input.Delete || + (this.Delete != null && + this.Delete.Equals(input.Delete)) + ) && + ( + this.Insert == input.Insert || + (this.Insert != null && + this.Insert.Equals(input.Insert)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.Delete != null) + { + hashCode = (hashCode * 59) + this.Delete.GetHashCode(); + } + if (this.Insert != null) + { + hashCode = (hashCode * 59) + this.Insert.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/EditType.cs b/algoliasearch/Search/Models/EditType.cs new file mode 100644 index 000000000..4db2d8508 --- /dev/null +++ b/algoliasearch/Search/Models/EditType.cs @@ -0,0 +1,43 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Type of edit. + /// + /// Type of edit. + [JsonConverter(typeof(StringEnumConverter))] + public enum EditType + { + /// + /// Enum Remove for value: remove + /// + [EnumMember(Value = "remove")] + Remove = 1, + + /// + /// Enum Replace for value: replace + /// + [EnumMember(Value = "replace")] + Replace = 2 + } + +} diff --git a/algoliasearch/Search/Models/ErrorBase.cs b/algoliasearch/Search/Models/ErrorBase.cs new file mode 100644 index 000000000..86426b461 --- /dev/null +++ b/algoliasearch/Search/Models/ErrorBase.cs @@ -0,0 +1,147 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Error. + /// + [DataContract(Name = "ErrorBase")] + public partial class ErrorBase : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// message. + public ErrorBase(string message = default(string)) : base() + { + this.Message = message; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Message + /// + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ErrorBase {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ErrorBase); + } + + /// + /// Returns true if ErrorBase instances are equal + /// + /// Instance of ErrorBase to be compared + /// Boolean + public bool Equals(ErrorBase input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/ExactOnSingleWordQuery.cs b/algoliasearch/Search/Models/ExactOnSingleWordQuery.cs new file mode 100644 index 000000000..e9ff35590 --- /dev/null +++ b/algoliasearch/Search/Models/ExactOnSingleWordQuery.cs @@ -0,0 +1,49 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Determines how the [Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes) is computed when the query contains only one word. + /// + /// Determines how the [Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes) is computed when the query contains only one word. + [JsonConverter(typeof(StringEnumConverter))] + public enum ExactOnSingleWordQuery + { + /// + /// Enum Attribute for value: attribute + /// + [EnumMember(Value = "attribute")] + Attribute = 1, + + /// + /// Enum None for value: none + /// + [EnumMember(Value = "none")] + None = 2, + + /// + /// Enum Word for value: word + /// + [EnumMember(Value = "word")] + Word = 3 + } + +} diff --git a/algoliasearch/Search/Models/Exhaustive.cs b/algoliasearch/Search/Models/Exhaustive.cs new file mode 100644 index 000000000..9e891d490 --- /dev/null +++ b/algoliasearch/Search/Models/Exhaustive.cs @@ -0,0 +1,180 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Whether certain properties of the search response are calculated exhaustive (exact) or approximated. + /// + [DataContract(Name = "exhaustive")] + public partial class Exhaustive : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-).. + /// The value is `false` if not all facet values are retrieved.. + /// Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query.. + /// Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large.. + /// Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled.. + public Exhaustive(bool facetsCount = default(bool), bool facetValues = default(bool), bool nbHits = default(bool), bool rulesMatch = default(bool), bool typo = default(bool)) + { + this.FacetsCount = facetsCount; + this.FacetValues = facetValues; + this.NbHits = nbHits; + this.RulesMatch = rulesMatch; + this.Typo = typo; + } + + /// + /// Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + /// + /// Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + [DataMember(Name = "facetsCount", EmitDefaultValue = true)] + public bool FacetsCount { get; set; } + + /// + /// The value is `false` if not all facet values are retrieved. + /// + /// The value is `false` if not all facet values are retrieved. + [DataMember(Name = "facetValues", EmitDefaultValue = true)] + public bool FacetValues { get; set; } + + /// + /// Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query. + /// + /// Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query. + [DataMember(Name = "nbHits", EmitDefaultValue = true)] + public bool NbHits { get; set; } + + /// + /// Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large. + /// + /// Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large. + [DataMember(Name = "rulesMatch", EmitDefaultValue = true)] + public bool RulesMatch { get; set; } + + /// + /// Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. + /// + /// Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled. + [DataMember(Name = "typo", EmitDefaultValue = true)] + public bool Typo { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Exhaustive {\n"); + sb.Append(" FacetsCount: ").Append(FacetsCount).Append("\n"); + sb.Append(" FacetValues: ").Append(FacetValues).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" RulesMatch: ").Append(RulesMatch).Append("\n"); + sb.Append(" Typo: ").Append(Typo).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Exhaustive); + } + + /// + /// Returns true if Exhaustive instances are equal + /// + /// Instance of Exhaustive to be compared + /// Boolean + public bool Equals(Exhaustive input) + { + if (input == null) + { + return false; + } + return + ( + this.FacetsCount == input.FacetsCount || + this.FacetsCount.Equals(input.FacetsCount) + ) && + ( + this.FacetValues == input.FacetValues || + this.FacetValues.Equals(input.FacetValues) + ) && + ( + this.NbHits == input.NbHits || + this.NbHits.Equals(input.NbHits) + ) && + ( + this.RulesMatch == input.RulesMatch || + this.RulesMatch.Equals(input.RulesMatch) + ) && + ( + this.Typo == input.Typo || + this.Typo.Equals(input.Typo) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.FacetsCount.GetHashCode(); + hashCode = (hashCode * 59) + this.FacetValues.GetHashCode(); + hashCode = (hashCode * 59) + this.NbHits.GetHashCode(); + hashCode = (hashCode * 59) + this.RulesMatch.GetHashCode(); + hashCode = (hashCode * 59) + this.Typo.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/FacetFilters.cs b/algoliasearch/Search/Models/FacetFilters.cs new file mode 100644 index 000000000..b327899b6 --- /dev/null +++ b/algoliasearch/Search/Models/FacetFilters.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// [Filter hits by facet value](https://www.algolia.com/doc/api-reference/api-parameters/facetFilters/). + /// + [JsonConverter(typeof(FacetFiltersJsonConverter))] + [DataContract(Name = "facetFilters")] + public partial class FacetFilters : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<MixedSearchFilters>. + public FacetFilters(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public FacetFilters(string actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, string"); + } + } + } + + /// + /// Get the actual instance of `List<MixedSearchFilters>`. If the actual instance is not `List<MixedSearchFilters>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<MixedSearchFilters> + public List GetterList() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class FacetFilters {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, FacetFilters.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of FacetFilters + /// + /// JSON string + /// An instance of FacetFilters + public static FacetFilters FromJson(string jsonString) + { + FacetFilters newFacetFilters = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newFacetFilters; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newFacetFilters = new FacetFilters(JsonConvert.DeserializeObject>(jsonString, FacetFilters.SerializerSettings)); + } + else + { + newFacetFilters = new FacetFilters(JsonConvert.DeserializeObject>(jsonString, FacetFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newFacetFilters = new FacetFilters(JsonConvert.DeserializeObject(jsonString, FacetFilters.SerializerSettings)); + } + else + { + newFacetFilters = new FacetFilters(JsonConvert.DeserializeObject(jsonString, FacetFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newFacetFilters; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FacetFilters); + } + + /// + /// Returns true if FacetFilters instances are equal + /// + /// Instance of FacetFilters to be compared + /// Boolean + public bool Equals(FacetFilters input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for FacetFilters + /// + public class FacetFiltersJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(FacetFilters).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return FacetFilters.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/FacetHits.cs b/algoliasearch/Search/Models/FacetHits.cs new file mode 100644 index 000000000..049975e66 --- /dev/null +++ b/algoliasearch/Search/Models/FacetHits.cs @@ -0,0 +1,173 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// FacetHits + /// + [DataContract(Name = "facetHits")] + public partial class FacetHits : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected FacetHits() { } + /// + /// Initializes a new instance of the class. + /// + /// Facet value. (required). + /// Markup text with `facetQuery` matches highlighted. (required). + /// Number of records containing this facet value. This takes into account the extra search parameters specified in the query. Like for a regular search query, the [counts may not be exhaustive](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). (required). + public FacetHits(string value = default(string), string highlighted = default(string), int count = default(int)) + { + // to ensure "value" is required (not null) + if (value == null) + { + throw new ArgumentNullException("value is a required property for FacetHits and cannot be null"); + } + this.Value = value; + // to ensure "highlighted" is required (not null) + if (highlighted == null) + { + throw new ArgumentNullException("highlighted is a required property for FacetHits and cannot be null"); + } + this.Highlighted = highlighted; + this.Count = count; + } + + /// + /// Facet value. + /// + /// Facet value. + [DataMember(Name = "value", IsRequired = true, EmitDefaultValue = true)] + public string Value { get; set; } + + /// + /// Markup text with `facetQuery` matches highlighted. + /// + /// Markup text with `facetQuery` matches highlighted. + [DataMember(Name = "highlighted", IsRequired = true, EmitDefaultValue = true)] + public string Highlighted { get; set; } + + /// + /// Number of records containing this facet value. This takes into account the extra search parameters specified in the query. Like for a regular search query, the [counts may not be exhaustive](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + /// + /// Number of records containing this facet value. This takes into account the extra search parameters specified in the query. Like for a regular search query, the [counts may not be exhaustive](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + [DataMember(Name = "count", IsRequired = true, EmitDefaultValue = true)] + public int Count { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FacetHits {\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append(" Highlighted: ").Append(Highlighted).Append("\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FacetHits); + } + + /// + /// Returns true if FacetHits instances are equal + /// + /// Instance of FacetHits to be compared + /// Boolean + public bool Equals(FacetHits input) + { + if (input == null) + { + return false; + } + return + ( + this.Value == input.Value || + (this.Value != null && + this.Value.Equals(input.Value)) + ) && + ( + this.Highlighted == input.Highlighted || + (this.Highlighted != null && + this.Highlighted.Equals(input.Highlighted)) + ) && + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Value != null) + { + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + } + if (this.Highlighted != null) + { + hashCode = (hashCode * 59) + this.Highlighted.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/FacetOrdering.cs b/algoliasearch/Search/Models/FacetOrdering.cs new file mode 100644 index 000000000..ae1cf3e92 --- /dev/null +++ b/algoliasearch/Search/Models/FacetOrdering.cs @@ -0,0 +1,143 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Defines the ordering of facets (widgets). + /// + [DataContract(Name = "facetOrdering")] + public partial class FacetOrdering : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// facets. + /// Ordering of facet values within an individual facet.. + public FacetOrdering(Facets facets = default(Facets), Dictionary values = default(Dictionary)) + { + this.Facets = facets; + this.Values = values; + } + + /// + /// Gets or Sets Facets + /// + [DataMember(Name = "facets", EmitDefaultValue = false)] + public Facets Facets { get; set; } + + /// + /// Ordering of facet values within an individual facet. + /// + /// Ordering of facet values within an individual facet. + [DataMember(Name = "values", EmitDefaultValue = false)] + public Dictionary Values { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FacetOrdering {\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" Values: ").Append(Values).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FacetOrdering); + } + + /// + /// Returns true if FacetOrdering instances are equal + /// + /// Instance of FacetOrdering to be compared + /// Boolean + public bool Equals(FacetOrdering input) + { + if (input == null) + { + return false; + } + return + ( + this.Facets == input.Facets || + (this.Facets != null && + this.Facets.Equals(input.Facets)) + ) && + ( + this.Values == input.Values || + this.Values != null && + input.Values != null && + this.Values.SequenceEqual(input.Values) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + if (this.Values != null) + { + hashCode = (hashCode * 59) + this.Values.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/Facets.cs b/algoliasearch/Search/Models/Facets.cs new file mode 100644 index 000000000..4cc8e0356 --- /dev/null +++ b/algoliasearch/Search/Models/Facets.cs @@ -0,0 +1,125 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Ordering of facets (widgets). + /// + [DataContract(Name = "facets")] + public partial class Facets : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Pinned order of facet lists.. + public Facets(List order = default(List)) + { + this.Order = order; + } + + /// + /// Pinned order of facet lists. + /// + /// Pinned order of facet lists. + [DataMember(Name = "order", EmitDefaultValue = false)] + public List Order { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Facets {\n"); + sb.Append(" Order: ").Append(Order).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Facets); + } + + /// + /// Returns true if Facets instances are equal + /// + /// Instance of Facets to be compared + /// Boolean + public bool Equals(Facets input) + { + if (input == null) + { + return false; + } + return + ( + this.Order == input.Order || + this.Order != null && + input.Order != null && + this.Order.SequenceEqual(input.Order) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Order != null) + { + hashCode = (hashCode * 59) + this.Order.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/FacetsStats.cs b/algoliasearch/Search/Models/FacetsStats.cs new file mode 100644 index 000000000..2f413876d --- /dev/null +++ b/algoliasearch/Search/Models/FacetsStats.cs @@ -0,0 +1,165 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// FacetsStats + /// + [DataContract(Name = "facetsStats")] + public partial class FacetsStats : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Minimum value in the results.. + /// Maximum value in the results.. + /// Average facet value in the results.. + /// Sum of all values in the results.. + public FacetsStats(double min = default(double), double max = default(double), double avg = default(double), double sum = default(double)) + { + this.Min = min; + this.Max = max; + this.Avg = avg; + this.Sum = sum; + } + + /// + /// Minimum value in the results. + /// + /// Minimum value in the results. + [DataMember(Name = "min", EmitDefaultValue = false)] + public double Min { get; set; } + + /// + /// Maximum value in the results. + /// + /// Maximum value in the results. + [DataMember(Name = "max", EmitDefaultValue = false)] + public double Max { get; set; } + + /// + /// Average facet value in the results. + /// + /// Average facet value in the results. + [DataMember(Name = "avg", EmitDefaultValue = false)] + public double Avg { get; set; } + + /// + /// Sum of all values in the results. + /// + /// Sum of all values in the results. + [DataMember(Name = "sum", EmitDefaultValue = false)] + public double Sum { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FacetsStats {\n"); + sb.Append(" Min: ").Append(Min).Append("\n"); + sb.Append(" Max: ").Append(Max).Append("\n"); + sb.Append(" Avg: ").Append(Avg).Append("\n"); + sb.Append(" Sum: ").Append(Sum).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FacetsStats); + } + + /// + /// Returns true if FacetsStats instances are equal + /// + /// Instance of FacetsStats to be compared + /// Boolean + public bool Equals(FacetsStats input) + { + if (input == null) + { + return false; + } + return + ( + this.Min == input.Min || + this.Min.Equals(input.Min) + ) && + ( + this.Max == input.Max || + this.Max.Equals(input.Max) + ) && + ( + this.Avg == input.Avg || + this.Avg.Equals(input.Avg) + ) && + ( + this.Sum == input.Sum || + this.Sum.Equals(input.Sum) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Min.GetHashCode(); + hashCode = (hashCode * 59) + this.Max.GetHashCode(); + hashCode = (hashCode * 59) + this.Avg.GetHashCode(); + hashCode = (hashCode * 59) + this.Sum.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/FetchedIndex.cs b/algoliasearch/Search/Models/FetchedIndex.cs new file mode 100644 index 000000000..e8540c1c5 --- /dev/null +++ b/algoliasearch/Search/Models/FetchedIndex.cs @@ -0,0 +1,311 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// FetchedIndex + /// + [DataContract(Name = "fetchedIndex")] + public partial class FetchedIndex : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected FetchedIndex() { } + /// + /// Initializes a new instance of the class. + /// + /// Index name. (required). + /// Index creation date. An empty string means that the index has no records. (required). + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + /// Number of records contained in the index. (required). + /// Number of bytes of the index in minified format. (required). + /// Number of bytes of the index binary file. (required). + /// Last build time. (required). + /// Number of pending indexing operations. This value is deprecated and should not be used. (required) (default to 0). + /// A boolean which says whether the index has pending tasks. This value is deprecated and should not be used. (required) (default to false). + /// Only present if the index is a replica. Contains the name of the related primary index.. + /// Only present if the index is a primary index with replicas. Contains the names of all linked replicas.. + public FetchedIndex(string name = default(string), string createdAt = default(string), string updatedAt = default(string), int entries = default(int), int dataSize = default(int), int fileSize = default(int), int lastBuildTimeS = default(int), int numberOfPendingTasks = 0, bool pendingTask = false, string primary = default(string), List replicas = default(List)) + { + // to ensure "name" is required (not null) + if (name == null) + { + throw new ArgumentNullException("name is a required property for FetchedIndex and cannot be null"); + } + this.Name = name; + // to ensure "createdAt" is required (not null) + if (createdAt == null) + { + throw new ArgumentNullException("createdAt is a required property for FetchedIndex and cannot be null"); + } + this.CreatedAt = createdAt; + // to ensure "updatedAt" is required (not null) + if (updatedAt == null) + { + throw new ArgumentNullException("updatedAt is a required property for FetchedIndex and cannot be null"); + } + this.UpdatedAt = updatedAt; + this.Entries = entries; + this.DataSize = dataSize; + this.FileSize = fileSize; + this.LastBuildTimeS = lastBuildTimeS; + this.NumberOfPendingTasks = numberOfPendingTasks; + this.PendingTask = pendingTask; + this.Primary = primary; + this.Replicas = replicas; + } + + /// + /// Index name. + /// + /// Index name. + [DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)] + public string Name { get; set; } + + /// + /// Index creation date. An empty string means that the index has no records. + /// + /// Index creation date. An empty string means that the index has no records. + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public string CreatedAt { get; set; } + + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "updatedAt", IsRequired = true, EmitDefaultValue = true)] + public string UpdatedAt { get; set; } + + /// + /// Number of records contained in the index. + /// + /// Number of records contained in the index. + [DataMember(Name = "entries", IsRequired = true, EmitDefaultValue = true)] + public int Entries { get; set; } + + /// + /// Number of bytes of the index in minified format. + /// + /// Number of bytes of the index in minified format. + [DataMember(Name = "dataSize", IsRequired = true, EmitDefaultValue = true)] + public int DataSize { get; set; } + + /// + /// Number of bytes of the index binary file. + /// + /// Number of bytes of the index binary file. + [DataMember(Name = "fileSize", IsRequired = true, EmitDefaultValue = true)] + public int FileSize { get; set; } + + /// + /// Last build time. + /// + /// Last build time. + [DataMember(Name = "lastBuildTimeS", IsRequired = true, EmitDefaultValue = true)] + public int LastBuildTimeS { get; set; } + + /// + /// Number of pending indexing operations. This value is deprecated and should not be used. + /// + /// Number of pending indexing operations. This value is deprecated and should not be used. + [DataMember(Name = "numberOfPendingTasks", IsRequired = true, EmitDefaultValue = true)] + public int NumberOfPendingTasks { get; set; } + + /// + /// A boolean which says whether the index has pending tasks. This value is deprecated and should not be used. + /// + /// A boolean which says whether the index has pending tasks. This value is deprecated and should not be used. + [DataMember(Name = "pendingTask", IsRequired = true, EmitDefaultValue = true)] + public bool PendingTask { get; set; } + + /// + /// Only present if the index is a replica. Contains the name of the related primary index. + /// + /// Only present if the index is a replica. Contains the name of the related primary index. + [DataMember(Name = "primary", EmitDefaultValue = false)] + public string Primary { get; set; } + + /// + /// Only present if the index is a primary index with replicas. Contains the names of all linked replicas. + /// + /// Only present if the index is a primary index with replicas. Contains the names of all linked replicas. + [DataMember(Name = "replicas", EmitDefaultValue = false)] + public List Replicas { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FetchedIndex {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append(" Entries: ").Append(Entries).Append("\n"); + sb.Append(" DataSize: ").Append(DataSize).Append("\n"); + sb.Append(" FileSize: ").Append(FileSize).Append("\n"); + sb.Append(" LastBuildTimeS: ").Append(LastBuildTimeS).Append("\n"); + sb.Append(" NumberOfPendingTasks: ").Append(NumberOfPendingTasks).Append("\n"); + sb.Append(" PendingTask: ").Append(PendingTask).Append("\n"); + sb.Append(" Primary: ").Append(Primary).Append("\n"); + sb.Append(" Replicas: ").Append(Replicas).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FetchedIndex); + } + + /// + /// Returns true if FetchedIndex instances are equal + /// + /// Instance of FetchedIndex to be compared + /// Boolean + public bool Equals(FetchedIndex input) + { + if (input == null) + { + return false; + } + return + ( + this.Name == input.Name || + (this.Name != null && + this.Name.Equals(input.Name)) + ) && + ( + this.CreatedAt == input.CreatedAt || + (this.CreatedAt != null && + this.CreatedAt.Equals(input.CreatedAt)) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ) && + ( + this.Entries == input.Entries || + this.Entries.Equals(input.Entries) + ) && + ( + this.DataSize == input.DataSize || + this.DataSize.Equals(input.DataSize) + ) && + ( + this.FileSize == input.FileSize || + this.FileSize.Equals(input.FileSize) + ) && + ( + this.LastBuildTimeS == input.LastBuildTimeS || + this.LastBuildTimeS.Equals(input.LastBuildTimeS) + ) && + ( + this.NumberOfPendingTasks == input.NumberOfPendingTasks || + this.NumberOfPendingTasks.Equals(input.NumberOfPendingTasks) + ) && + ( + this.PendingTask == input.PendingTask || + this.PendingTask.Equals(input.PendingTask) + ) && + ( + this.Primary == input.Primary || + (this.Primary != null && + this.Primary.Equals(input.Primary)) + ) && + ( + this.Replicas == input.Replicas || + this.Replicas != null && + input.Replicas != null && + this.Replicas.SequenceEqual(input.Replicas) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Name != null) + { + hashCode = (hashCode * 59) + this.Name.GetHashCode(); + } + if (this.CreatedAt != null) + { + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + } + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Entries.GetHashCode(); + hashCode = (hashCode * 59) + this.DataSize.GetHashCode(); + hashCode = (hashCode * 59) + this.FileSize.GetHashCode(); + hashCode = (hashCode * 59) + this.LastBuildTimeS.GetHashCode(); + hashCode = (hashCode * 59) + this.NumberOfPendingTasks.GetHashCode(); + hashCode = (hashCode * 59) + this.PendingTask.GetHashCode(); + if (this.Primary != null) + { + hashCode = (hashCode * 59) + this.Primary.GetHashCode(); + } + if (this.Replicas != null) + { + hashCode = (hashCode * 59) + this.Replicas.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/GetApiKeyResponse.cs b/algoliasearch/Search/Models/GetApiKeyResponse.cs new file mode 100644 index 000000000..12c2f268b --- /dev/null +++ b/algoliasearch/Search/Models/GetApiKeyResponse.cs @@ -0,0 +1,294 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// GetApiKeyResponse + /// + [DataContract(Name = "getApiKeyResponse")] + public partial class GetApiKeyResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetApiKeyResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// API key.. + /// Timestamp of creation in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). (required). + /// [Permissions](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl) associated with the key. (required). + /// Description of an API key for you and your team members. (default to ""). + /// Restricts this API key to a list of indices or index patterns. If the list is empty, all indices are allowed. Specify either an exact index name or a pattern with a leading or trailing wildcard character (or both). For example: - `dev_*` matches all indices starting with \"dev_\" - `*_dev` matches all indices ending with \"_dev\" - `*_products_*` matches all indices containing \"_products_\". . + /// Maximum number of hits this API key can retrieve in one query. If zero, no limit is enforced. > **Note**: Use this parameter to protect you from third-party attempts to retrieve your entire content by massively querying the index. (default to 0). + /// Maximum number of API calls per hour allowed from a given IP address or [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/). Each time an API call is performed with this key, a check is performed. If there were more than the specified number of calls within the last hour, the API returns an error with the status code `429` (Too Many Requests). > **Note**: Use this parameter to protect you from third-party attempts to retrieve your entire content by massively querying the index. (default to 0). + /// Force some [query parameters](https://www.algolia.com/doc/api-reference/api-parameters/) to be applied for each query made with this API key. It's a URL-encoded query string. (default to ""). + /// Restrict this API key to specific [referrers](https://www.algolia.com/doc/guides/security/api-keys/in-depth/api-key-restrictions/#http-referrers). If empty, all referrers are allowed. For example: - `https://algolia.com/_*` matches all referrers starting with \"https://algolia.com/\" - `*.algolia.com` matches all referrers ending with \".algolia.com\" - `*algolia.com*` allows everything in the domain \"algolia.com\". . + /// Validity duration of a key (in seconds). The key will automatically be removed after this time has expired. The default value of 0 never expires. Short-lived API keys are useful to grant temporary access to your data. For example, in mobile apps, you can't [control when users update your app](https://www.algolia.com/doc/guides/security/security-best-practices/#use-secured-api-keys-in-mobile-apps). So instead of encoding keys into your app as you would for a web app, you should dynamically fetch them from your mobile app's backend. (default to 0). + public GetApiKeyResponse(string value = default(string), long createdAt = default(long), List acl = default(List), string description = @"", List indexes = default(List), int maxHitsPerQuery = 0, int maxQueriesPerIPPerHour = 0, string queryParameters = @"", List referers = default(List), int validity = 0) + { + this.CreatedAt = createdAt; + // to ensure "acl" is required (not null) + if (acl == null) + { + throw new ArgumentNullException("acl is a required property for GetApiKeyResponse and cannot be null"); + } + this.Acl = acl; + this.Value = value; + // use default value if no "description" provided + this.Description = description ?? @""; + this.Indexes = indexes; + this.MaxHitsPerQuery = maxHitsPerQuery; + this.MaxQueriesPerIPPerHour = maxQueriesPerIPPerHour; + // use default value if no "queryParameters" provided + this.QueryParameters = queryParameters ?? @""; + this.Referers = referers; + this.Validity = validity; + } + + /// + /// API key. + /// + /// API key. + [DataMember(Name = "value", EmitDefaultValue = false)] + public string Value { get; set; } + + /// + /// Timestamp of creation in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). + /// + /// Timestamp of creation in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public long CreatedAt { get; set; } + + /// + /// [Permissions](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl) associated with the key. + /// + /// [Permissions](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl) associated with the key. + [DataMember(Name = "acl", IsRequired = true, EmitDefaultValue = true)] + public List Acl { get; set; } + + /// + /// Description of an API key for you and your team members. + /// + /// Description of an API key for you and your team members. + [DataMember(Name = "description", EmitDefaultValue = false)] + public string Description { get; set; } + + /// + /// Restricts this API key to a list of indices or index patterns. If the list is empty, all indices are allowed. Specify either an exact index name or a pattern with a leading or trailing wildcard character (or both). For example: - `dev_*` matches all indices starting with \"dev_\" - `*_dev` matches all indices ending with \"_dev\" - `*_products_*` matches all indices containing \"_products_\". + /// + /// Restricts this API key to a list of indices or index patterns. If the list is empty, all indices are allowed. Specify either an exact index name or a pattern with a leading or trailing wildcard character (or both). For example: - `dev_*` matches all indices starting with \"dev_\" - `*_dev` matches all indices ending with \"_dev\" - `*_products_*` matches all indices containing \"_products_\". + [DataMember(Name = "indexes", EmitDefaultValue = false)] + public List Indexes { get; set; } + + /// + /// Maximum number of hits this API key can retrieve in one query. If zero, no limit is enforced. > **Note**: Use this parameter to protect you from third-party attempts to retrieve your entire content by massively querying the index. + /// + /// Maximum number of hits this API key can retrieve in one query. If zero, no limit is enforced. > **Note**: Use this parameter to protect you from third-party attempts to retrieve your entire content by massively querying the index. + [DataMember(Name = "maxHitsPerQuery", EmitDefaultValue = false)] + public int MaxHitsPerQuery { get; set; } + + /// + /// Maximum number of API calls per hour allowed from a given IP address or [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/). Each time an API call is performed with this key, a check is performed. If there were more than the specified number of calls within the last hour, the API returns an error with the status code `429` (Too Many Requests). > **Note**: Use this parameter to protect you from third-party attempts to retrieve your entire content by massively querying the index. + /// + /// Maximum number of API calls per hour allowed from a given IP address or [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/). Each time an API call is performed with this key, a check is performed. If there were more than the specified number of calls within the last hour, the API returns an error with the status code `429` (Too Many Requests). > **Note**: Use this parameter to protect you from third-party attempts to retrieve your entire content by massively querying the index. + [DataMember(Name = "maxQueriesPerIPPerHour", EmitDefaultValue = false)] + public int MaxQueriesPerIPPerHour { get; set; } + + /// + /// Force some [query parameters](https://www.algolia.com/doc/api-reference/api-parameters/) to be applied for each query made with this API key. It's a URL-encoded query string. + /// + /// Force some [query parameters](https://www.algolia.com/doc/api-reference/api-parameters/) to be applied for each query made with this API key. It's a URL-encoded query string. + [DataMember(Name = "queryParameters", EmitDefaultValue = false)] + public string QueryParameters { get; set; } + + /// + /// Restrict this API key to specific [referrers](https://www.algolia.com/doc/guides/security/api-keys/in-depth/api-key-restrictions/#http-referrers). If empty, all referrers are allowed. For example: - `https://algolia.com/_*` matches all referrers starting with \"https://algolia.com/\" - `*.algolia.com` matches all referrers ending with \".algolia.com\" - `*algolia.com*` allows everything in the domain \"algolia.com\". + /// + /// Restrict this API key to specific [referrers](https://www.algolia.com/doc/guides/security/api-keys/in-depth/api-key-restrictions/#http-referrers). If empty, all referrers are allowed. For example: - `https://algolia.com/_*` matches all referrers starting with \"https://algolia.com/\" - `*.algolia.com` matches all referrers ending with \".algolia.com\" - `*algolia.com*` allows everything in the domain \"algolia.com\". + [DataMember(Name = "referers", EmitDefaultValue = false)] + public List Referers { get; set; } + + /// + /// Validity duration of a key (in seconds). The key will automatically be removed after this time has expired. The default value of 0 never expires. Short-lived API keys are useful to grant temporary access to your data. For example, in mobile apps, you can't [control when users update your app](https://www.algolia.com/doc/guides/security/security-best-practices/#use-secured-api-keys-in-mobile-apps). So instead of encoding keys into your app as you would for a web app, you should dynamically fetch them from your mobile app's backend. + /// + /// Validity duration of a key (in seconds). The key will automatically be removed after this time has expired. The default value of 0 never expires. Short-lived API keys are useful to grant temporary access to your data. For example, in mobile apps, you can't [control when users update your app](https://www.algolia.com/doc/guides/security/security-best-practices/#use-secured-api-keys-in-mobile-apps). So instead of encoding keys into your app as you would for a web app, you should dynamically fetch them from your mobile app's backend. + [DataMember(Name = "validity", EmitDefaultValue = false)] + public int Validity { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetApiKeyResponse {\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append(" Acl: ").Append(Acl).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append(" Indexes: ").Append(Indexes).Append("\n"); + sb.Append(" MaxHitsPerQuery: ").Append(MaxHitsPerQuery).Append("\n"); + sb.Append(" MaxQueriesPerIPPerHour: ").Append(MaxQueriesPerIPPerHour).Append("\n"); + sb.Append(" QueryParameters: ").Append(QueryParameters).Append("\n"); + sb.Append(" Referers: ").Append(Referers).Append("\n"); + sb.Append(" Validity: ").Append(Validity).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetApiKeyResponse); + } + + /// + /// Returns true if GetApiKeyResponse instances are equal + /// + /// Instance of GetApiKeyResponse to be compared + /// Boolean + public bool Equals(GetApiKeyResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Value == input.Value || + (this.Value != null && + this.Value.Equals(input.Value)) + ) && + ( + this.CreatedAt == input.CreatedAt || + this.CreatedAt.Equals(input.CreatedAt) + ) && + ( + this.Acl == input.Acl || + this.Acl != null && + input.Acl != null && + this.Acl.SequenceEqual(input.Acl) + ) && + ( + this.Description == input.Description || + (this.Description != null && + this.Description.Equals(input.Description)) + ) && + ( + this.Indexes == input.Indexes || + this.Indexes != null && + input.Indexes != null && + this.Indexes.SequenceEqual(input.Indexes) + ) && + ( + this.MaxHitsPerQuery == input.MaxHitsPerQuery || + this.MaxHitsPerQuery.Equals(input.MaxHitsPerQuery) + ) && + ( + this.MaxQueriesPerIPPerHour == input.MaxQueriesPerIPPerHour || + this.MaxQueriesPerIPPerHour.Equals(input.MaxQueriesPerIPPerHour) + ) && + ( + this.QueryParameters == input.QueryParameters || + (this.QueryParameters != null && + this.QueryParameters.Equals(input.QueryParameters)) + ) && + ( + this.Referers == input.Referers || + this.Referers != null && + input.Referers != null && + this.Referers.SequenceEqual(input.Referers) + ) && + ( + this.Validity == input.Validity || + this.Validity.Equals(input.Validity) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Value != null) + { + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + } + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + if (this.Acl != null) + { + hashCode = (hashCode * 59) + this.Acl.GetHashCode(); + } + if (this.Description != null) + { + hashCode = (hashCode * 59) + this.Description.GetHashCode(); + } + if (this.Indexes != null) + { + hashCode = (hashCode * 59) + this.Indexes.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MaxHitsPerQuery.GetHashCode(); + hashCode = (hashCode * 59) + this.MaxQueriesPerIPPerHour.GetHashCode(); + if (this.QueryParameters != null) + { + hashCode = (hashCode * 59) + this.QueryParameters.GetHashCode(); + } + if (this.Referers != null) + { + hashCode = (hashCode * 59) + this.Referers.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Validity.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/GetDictionarySettingsResponse.cs b/algoliasearch/Search/Models/GetDictionarySettingsResponse.cs new file mode 100644 index 000000000..247c90950 --- /dev/null +++ b/algoliasearch/Search/Models/GetDictionarySettingsResponse.cs @@ -0,0 +1,133 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// GetDictionarySettingsResponse + /// + [DataContract(Name = "getDictionarySettingsResponse")] + public partial class GetDictionarySettingsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetDictionarySettingsResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// disableStandardEntries (required). + public GetDictionarySettingsResponse(StandardEntries disableStandardEntries = default(StandardEntries)) + { + // to ensure "disableStandardEntries" is required (not null) + if (disableStandardEntries == null) + { + throw new ArgumentNullException("disableStandardEntries is a required property for GetDictionarySettingsResponse and cannot be null"); + } + this.DisableStandardEntries = disableStandardEntries; + } + + /// + /// Gets or Sets DisableStandardEntries + /// + [DataMember(Name = "disableStandardEntries", IsRequired = true, EmitDefaultValue = true)] + public StandardEntries DisableStandardEntries { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetDictionarySettingsResponse {\n"); + sb.Append(" DisableStandardEntries: ").Append(DisableStandardEntries).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetDictionarySettingsResponse); + } + + /// + /// Returns true if GetDictionarySettingsResponse instances are equal + /// + /// Instance of GetDictionarySettingsResponse to be compared + /// Boolean + public bool Equals(GetDictionarySettingsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.DisableStandardEntries == input.DisableStandardEntries || + (this.DisableStandardEntries != null && + this.DisableStandardEntries.Equals(input.DisableStandardEntries)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.DisableStandardEntries != null) + { + hashCode = (hashCode * 59) + this.DisableStandardEntries.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/GetLogsResponse.cs b/algoliasearch/Search/Models/GetLogsResponse.cs new file mode 100644 index 000000000..515d1db67 --- /dev/null +++ b/algoliasearch/Search/Models/GetLogsResponse.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// GetLogsResponse + /// + [DataContract(Name = "getLogsResponse")] + public partial class GetLogsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetLogsResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// logs (required). + public GetLogsResponse(List logs = default(List)) + { + // to ensure "logs" is required (not null) + if (logs == null) + { + throw new ArgumentNullException("logs is a required property for GetLogsResponse and cannot be null"); + } + this.Logs = logs; + } + + /// + /// Gets or Sets Logs + /// + [DataMember(Name = "logs", IsRequired = true, EmitDefaultValue = true)] + public List Logs { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetLogsResponse {\n"); + sb.Append(" Logs: ").Append(Logs).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetLogsResponse); + } + + /// + /// Returns true if GetLogsResponse instances are equal + /// + /// Instance of GetLogsResponse to be compared + /// Boolean + public bool Equals(GetLogsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Logs == input.Logs || + this.Logs != null && + input.Logs != null && + this.Logs.SequenceEqual(input.Logs) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Logs != null) + { + hashCode = (hashCode * 59) + this.Logs.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/GetObjectsParams.cs b/algoliasearch/Search/Models/GetObjectsParams.cs new file mode 100644 index 000000000..90e7d0c47 --- /dev/null +++ b/algoliasearch/Search/Models/GetObjectsParams.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Request parameters. + /// + [DataContract(Name = "getObjectsParams")] + public partial class GetObjectsParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetObjectsParams() { } + /// + /// Initializes a new instance of the class. + /// + /// requests (required). + public GetObjectsParams(List requests = default(List)) + { + // to ensure "requests" is required (not null) + if (requests == null) + { + throw new ArgumentNullException("requests is a required property for GetObjectsParams and cannot be null"); + } + this.Requests = requests; + } + + /// + /// Gets or Sets Requests + /// + [DataMember(Name = "requests", IsRequired = true, EmitDefaultValue = true)] + public List Requests { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetObjectsParams {\n"); + sb.Append(" Requests: ").Append(Requests).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetObjectsParams); + } + + /// + /// Returns true if GetObjectsParams instances are equal + /// + /// Instance of GetObjectsParams to be compared + /// Boolean + public bool Equals(GetObjectsParams input) + { + if (input == null) + { + return false; + } + return + ( + this.Requests == input.Requests || + this.Requests != null && + input.Requests != null && + this.Requests.SequenceEqual(input.Requests) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Requests != null) + { + hashCode = (hashCode * 59) + this.Requests.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/GetObjectsRequest.cs b/algoliasearch/Search/Models/GetObjectsRequest.cs new file mode 100644 index 000000000..9ee873a78 --- /dev/null +++ b/algoliasearch/Search/Models/GetObjectsRequest.cs @@ -0,0 +1,178 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Record retrieval operation. + /// + [DataContract(Name = "getObjectsRequest")] + public partial class GetObjectsRequest : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetObjectsRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// Attributes to retrieve. If not specified, all retrievable attributes are returned.. + /// Record's objectID. (required). + /// Name of the index containing the required records. (required). + public GetObjectsRequest(List attributesToRetrieve = default(List), string objectID = default(string), string indexName = default(string)) + { + // to ensure "objectID" is required (not null) + if (objectID == null) + { + throw new ArgumentNullException("objectID is a required property for GetObjectsRequest and cannot be null"); + } + this.ObjectID = objectID; + // to ensure "indexName" is required (not null) + if (indexName == null) + { + throw new ArgumentNullException("indexName is a required property for GetObjectsRequest and cannot be null"); + } + this.IndexName = indexName; + this.AttributesToRetrieve = attributesToRetrieve; + } + + /// + /// Attributes to retrieve. If not specified, all retrievable attributes are returned. + /// + /// Attributes to retrieve. If not specified, all retrievable attributes are returned. + [DataMember(Name = "attributesToRetrieve", EmitDefaultValue = false)] + public List AttributesToRetrieve { get; set; } + + /// + /// Record's objectID. + /// + /// Record's objectID. + [DataMember(Name = "objectID", IsRequired = true, EmitDefaultValue = true)] + public string ObjectID { get; set; } + + /// + /// Name of the index containing the required records. + /// + /// Name of the index containing the required records. + [DataMember(Name = "indexName", IsRequired = true, EmitDefaultValue = true)] + public string IndexName { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetObjectsRequest {\n"); + sb.Append(" AttributesToRetrieve: ").Append(AttributesToRetrieve).Append("\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetObjectsRequest); + } + + /// + /// Returns true if GetObjectsRequest instances are equal + /// + /// Instance of GetObjectsRequest to be compared + /// Boolean + public bool Equals(GetObjectsRequest input) + { + if (input == null) + { + return false; + } + return + ( + this.AttributesToRetrieve == input.AttributesToRetrieve || + this.AttributesToRetrieve != null && + input.AttributesToRetrieve != null && + this.AttributesToRetrieve.SequenceEqual(input.AttributesToRetrieve) + ) && + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ) && + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AttributesToRetrieve != null) + { + hashCode = (hashCode * 59) + this.AttributesToRetrieve.GetHashCode(); + } + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/GetObjectsResponse.cs b/algoliasearch/Search/Models/GetObjectsResponse.cs new file mode 100644 index 000000000..791dcc2e7 --- /dev/null +++ b/algoliasearch/Search/Models/GetObjectsResponse.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// GetObjectsResponse + /// + [DataContract(Name = "getObjectsResponse")] + public partial class GetObjectsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetObjectsResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Retrieved results. (required). + public GetObjectsResponse(List results = default(List)) + { + // to ensure "results" is required (not null) + if (results == null) + { + throw new ArgumentNullException("results is a required property for GetObjectsResponse and cannot be null"); + } + this.Results = results; + } + + /// + /// Retrieved results. + /// + /// Retrieved results. + [DataMember(Name = "results", IsRequired = true, EmitDefaultValue = true)] + public List Results { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetObjectsResponse {\n"); + sb.Append(" Results: ").Append(Results).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetObjectsResponse); + } + + /// + /// Returns true if GetObjectsResponse instances are equal + /// + /// Instance of GetObjectsResponse to be compared + /// Boolean + public bool Equals(GetObjectsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Results == input.Results || + this.Results != null && + input.Results != null && + this.Results.SequenceEqual(input.Results) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Results != null) + { + hashCode = (hashCode * 59) + this.Results.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/GetTaskResponse.cs b/algoliasearch/Search/Models/GetTaskResponse.cs new file mode 100644 index 000000000..afb71f94e --- /dev/null +++ b/algoliasearch/Search/Models/GetTaskResponse.cs @@ -0,0 +1,124 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// GetTaskResponse + /// + [DataContract(Name = "getTaskResponse")] + public partial class GetTaskResponse : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Status + /// + [DataMember(Name = "status", IsRequired = true, EmitDefaultValue = true)] + public TaskStatus Status { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetTaskResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// status (required). + public GetTaskResponse(TaskStatus status = default(TaskStatus)) + { + this.Status = status; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetTaskResponse {\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetTaskResponse); + } + + /// + /// Returns true if GetTaskResponse instances are equal + /// + /// Instance of GetTaskResponse to be compared + /// Boolean + public bool Equals(GetTaskResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Status == input.Status || + this.Status.Equals(input.Status) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Status.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/GetTopUserIdsResponse.cs b/algoliasearch/Search/Models/GetTopUserIdsResponse.cs new file mode 100644 index 000000000..27583d78e --- /dev/null +++ b/algoliasearch/Search/Models/GetTopUserIdsResponse.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// User IDs and clusters. + /// + [DataContract(Name = "getTopUserIdsResponse")] + public partial class GetTopUserIdsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected GetTopUserIdsResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Key-value pairs with cluster names as keys and lists of users with the highest number of records per cluster as values. (required). + public GetTopUserIdsResponse(List>> topUsers = default(List>>)) + { + // to ensure "topUsers" is required (not null) + if (topUsers == null) + { + throw new ArgumentNullException("topUsers is a required property for GetTopUserIdsResponse and cannot be null"); + } + this.TopUsers = topUsers; + } + + /// + /// Key-value pairs with cluster names as keys and lists of users with the highest number of records per cluster as values. + /// + /// Key-value pairs with cluster names as keys and lists of users with the highest number of records per cluster as values. + [DataMember(Name = "topUsers", IsRequired = true, EmitDefaultValue = true)] + public List>> TopUsers { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GetTopUserIdsResponse {\n"); + sb.Append(" TopUsers: ").Append(TopUsers).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as GetTopUserIdsResponse); + } + + /// + /// Returns true if GetTopUserIdsResponse instances are equal + /// + /// Instance of GetTopUserIdsResponse to be compared + /// Boolean + public bool Equals(GetTopUserIdsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.TopUsers == input.TopUsers || + this.TopUsers != null && + input.TopUsers != null && + this.TopUsers.SequenceEqual(input.TopUsers) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.TopUsers != null) + { + hashCode = (hashCode * 59) + this.TopUsers.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/HasPendingMappingsResponse.cs b/algoliasearch/Search/Models/HasPendingMappingsResponse.cs new file mode 100644 index 000000000..de30fed83 --- /dev/null +++ b/algoliasearch/Search/Models/HasPendingMappingsResponse.cs @@ -0,0 +1,145 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// HasPendingMappingsResponse + /// + [DataContract(Name = "hasPendingMappingsResponse")] + public partial class HasPendingMappingsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected HasPendingMappingsResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Indicates whether there are clusters undergoing migration, creation, or deletion. (required). + /// Cluster pending mapping state: migrating, creating, deleting. . + public HasPendingMappingsResponse(bool pending = default(bool), Dictionary> clusters = default(Dictionary>)) + { + this.Pending = pending; + this.Clusters = clusters; + } + + /// + /// Indicates whether there are clusters undergoing migration, creation, or deletion. + /// + /// Indicates whether there are clusters undergoing migration, creation, or deletion. + [DataMember(Name = "pending", IsRequired = true, EmitDefaultValue = true)] + public bool Pending { get; set; } + + /// + /// Cluster pending mapping state: migrating, creating, deleting. + /// + /// Cluster pending mapping state: migrating, creating, deleting. + [DataMember(Name = "clusters", EmitDefaultValue = false)] + public Dictionary> Clusters { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class HasPendingMappingsResponse {\n"); + sb.Append(" Pending: ").Append(Pending).Append("\n"); + sb.Append(" Clusters: ").Append(Clusters).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as HasPendingMappingsResponse); + } + + /// + /// Returns true if HasPendingMappingsResponse instances are equal + /// + /// Instance of HasPendingMappingsResponse to be compared + /// Boolean + public bool Equals(HasPendingMappingsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Pending == input.Pending || + this.Pending.Equals(input.Pending) + ) && + ( + this.Clusters == input.Clusters || + this.Clusters != null && + input.Clusters != null && + this.Clusters.SequenceEqual(input.Clusters) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Pending.GetHashCode(); + if (this.Clusters != null) + { + hashCode = (hashCode * 59) + this.Clusters.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/HighlightResult.cs b/algoliasearch/Search/Models/HighlightResult.cs new file mode 100644 index 000000000..73dc3bea8 --- /dev/null +++ b/algoliasearch/Search/Models/HighlightResult.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// HighlightResult + /// + [JsonConverter(typeof(HighlightResultJsonConverter))] + [DataContract(Name = "highlightResult")] + public partial class HighlightResult : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of HighlightResultOption. + public HighlightResult(HighlightResultOption actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of Dictionary<string, HighlightResultOption>. + public HighlightResult(Dictionary actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(Dictionary)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(HighlightResultOption)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: Dictionary, HighlightResultOption"); + } + } + } + + /// + /// Get the actual instance of `HighlightResultOption`. If the actual instance is not `HighlightResultOption`, + /// the InvalidClassException will be thrown + /// + /// An instance of HighlightResultOption + public HighlightResultOption GetterHighlightResultOption() + { + return (HighlightResultOption)this.ActualInstance; + } + + /// + /// Get the actual instance of `Dictionary<string, HighlightResultOption>`. If the actual instance is not `Dictionary<string, HighlightResultOption>`, + /// the InvalidClassException will be thrown + /// + /// An instance of Dictionary<string, HighlightResultOption> + public Dictionary GetterDictionary() + { + return (Dictionary)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class HighlightResult {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, HighlightResult.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of HighlightResult + /// + /// JSON string + /// An instance of HighlightResult + public static HighlightResult FromJson(string jsonString) + { + HighlightResult newHighlightResult = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newHighlightResult; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(Dictionary).GetProperty("AdditionalProperties") == null) + { + newHighlightResult = new HighlightResult(JsonConvert.DeserializeObject>(jsonString, HighlightResult.SerializerSettings)); + } + else + { + newHighlightResult = new HighlightResult(JsonConvert.DeserializeObject>(jsonString, HighlightResult.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("Dictionary"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into Dictionary: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(HighlightResultOption).GetProperty("AdditionalProperties") == null) + { + newHighlightResult = new HighlightResult(JsonConvert.DeserializeObject(jsonString, HighlightResult.SerializerSettings)); + } + else + { + newHighlightResult = new HighlightResult(JsonConvert.DeserializeObject(jsonString, HighlightResult.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("HighlightResultOption"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into HighlightResultOption: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newHighlightResult; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as HighlightResult); + } + + /// + /// Returns true if HighlightResult instances are equal + /// + /// Instance of HighlightResult to be compared + /// Boolean + public bool Equals(HighlightResult input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for HighlightResult + /// + public class HighlightResultJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(HighlightResult).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return HighlightResult.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/HighlightResultOption.cs b/algoliasearch/Search/Models/HighlightResultOption.cs new file mode 100644 index 000000000..b281c22c5 --- /dev/null +++ b/algoliasearch/Search/Models/HighlightResultOption.cs @@ -0,0 +1,188 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Show highlighted section and words matched on a query. + /// + [DataContract(Name = "highlightResultOption")] + public partial class HighlightResultOption : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets MatchLevel + /// + [DataMember(Name = "matchLevel", IsRequired = true, EmitDefaultValue = true)] + public MatchLevel MatchLevel { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected HighlightResultOption() { } + /// + /// Initializes a new instance of the class. + /// + /// Markup text with `facetQuery` matches highlighted. (required). + /// matchLevel (required). + /// List of words from the query that matched the object. (required). + /// Whether the entire attribute value is highlighted.. + public HighlightResultOption(string value = default(string), MatchLevel matchLevel = default(MatchLevel), List matchedWords = default(List), bool fullyHighlighted = default(bool)) + { + // to ensure "value" is required (not null) + if (value == null) + { + throw new ArgumentNullException("value is a required property for HighlightResultOption and cannot be null"); + } + this.Value = value; + this.MatchLevel = matchLevel; + // to ensure "matchedWords" is required (not null) + if (matchedWords == null) + { + throw new ArgumentNullException("matchedWords is a required property for HighlightResultOption and cannot be null"); + } + this.MatchedWords = matchedWords; + this.FullyHighlighted = fullyHighlighted; + } + + /// + /// Markup text with `facetQuery` matches highlighted. + /// + /// Markup text with `facetQuery` matches highlighted. + [DataMember(Name = "value", IsRequired = true, EmitDefaultValue = true)] + public string Value { get; set; } + + /// + /// List of words from the query that matched the object. + /// + /// List of words from the query that matched the object. + [DataMember(Name = "matchedWords", IsRequired = true, EmitDefaultValue = true)] + public List MatchedWords { get; set; } + + /// + /// Whether the entire attribute value is highlighted. + /// + /// Whether the entire attribute value is highlighted. + [DataMember(Name = "fullyHighlighted", EmitDefaultValue = true)] + public bool FullyHighlighted { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class HighlightResultOption {\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append(" MatchLevel: ").Append(MatchLevel).Append("\n"); + sb.Append(" MatchedWords: ").Append(MatchedWords).Append("\n"); + sb.Append(" FullyHighlighted: ").Append(FullyHighlighted).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as HighlightResultOption); + } + + /// + /// Returns true if HighlightResultOption instances are equal + /// + /// Instance of HighlightResultOption to be compared + /// Boolean + public bool Equals(HighlightResultOption input) + { + if (input == null) + { + return false; + } + return + ( + this.Value == input.Value || + (this.Value != null && + this.Value.Equals(input.Value)) + ) && + ( + this.MatchLevel == input.MatchLevel || + this.MatchLevel.Equals(input.MatchLevel) + ) && + ( + this.MatchedWords == input.MatchedWords || + this.MatchedWords != null && + input.MatchedWords != null && + this.MatchedWords.SequenceEqual(input.MatchedWords) + ) && + ( + this.FullyHighlighted == input.FullyHighlighted || + this.FullyHighlighted.Equals(input.FullyHighlighted) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Value != null) + { + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MatchLevel.GetHashCode(); + if (this.MatchedWords != null) + { + hashCode = (hashCode * 59) + this.MatchedWords.GetHashCode(); + } + hashCode = (hashCode * 59) + this.FullyHighlighted.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/Hit.cs b/algoliasearch/Search/Models/Hit.cs new file mode 100644 index 000000000..6957cc393 --- /dev/null +++ b/algoliasearch/Search/Models/Hit.cs @@ -0,0 +1,233 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// A single hit. + /// + [DataContract(Name = "hit")] + public partial class Hit : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Hit() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// Unique object identifier. (required). + /// Show highlighted section and words matched on a query.. + /// Snippeted attributes show parts of the matched attributes. Only returned when attributesToSnippet is non-empty.. + /// rankingInfo. + /// distinctSeqID. + public Hit(string objectID = default(string), Dictionary highlightResult = default(Dictionary), Dictionary snippetResult = default(Dictionary), RankingInfo rankingInfo = default(RankingInfo), int distinctSeqID = default(int)) : base() + { + // to ensure "objectID" is required (not null) + if (objectID == null) + { + throw new ArgumentNullException("objectID is a required property for Hit and cannot be null"); + } + this.ObjectID = objectID; + this.HighlightResult = highlightResult; + this.SnippetResult = snippetResult; + this.RankingInfo = rankingInfo; + this.DistinctSeqID = distinctSeqID; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Unique object identifier. + /// + /// Unique object identifier. + [DataMember(Name = "objectID", IsRequired = true, EmitDefaultValue = true)] + public string ObjectID { get; set; } + + /// + /// Show highlighted section and words matched on a query. + /// + /// Show highlighted section and words matched on a query. + [DataMember(Name = "_highlightResult", EmitDefaultValue = false)] + public Dictionary HighlightResult { get; set; } + + /// + /// Snippeted attributes show parts of the matched attributes. Only returned when attributesToSnippet is non-empty. + /// + /// Snippeted attributes show parts of the matched attributes. Only returned when attributesToSnippet is non-empty. + [DataMember(Name = "_snippetResult", EmitDefaultValue = false)] + public Dictionary SnippetResult { get; set; } + + /// + /// Gets or Sets RankingInfo + /// + [DataMember(Name = "_rankingInfo", EmitDefaultValue = false)] + public RankingInfo RankingInfo { get; set; } + + /// + /// Gets or Sets DistinctSeqID + /// + [DataMember(Name = "_distinctSeqID", EmitDefaultValue = false)] + public int DistinctSeqID { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Hit {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append(" HighlightResult: ").Append(HighlightResult).Append("\n"); + sb.Append(" SnippetResult: ").Append(SnippetResult).Append("\n"); + sb.Append(" RankingInfo: ").Append(RankingInfo).Append("\n"); + sb.Append(" DistinctSeqID: ").Append(DistinctSeqID).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Hit); + } + + /// + /// Returns true if Hit instances are equal + /// + /// Instance of Hit to be compared + /// Boolean + public bool Equals(Hit input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ) && base.Equals(input) && + ( + this.HighlightResult == input.HighlightResult || + this.HighlightResult != null && + input.HighlightResult != null && + this.HighlightResult.SequenceEqual(input.HighlightResult) + ) && base.Equals(input) && + ( + this.SnippetResult == input.SnippetResult || + this.SnippetResult != null && + input.SnippetResult != null && + this.SnippetResult.SequenceEqual(input.SnippetResult) + ) && base.Equals(input) && + ( + this.RankingInfo == input.RankingInfo || + (this.RankingInfo != null && + this.RankingInfo.Equals(input.RankingInfo)) + ) && base.Equals(input) && + ( + this.DistinctSeqID == input.DistinctSeqID || + this.DistinctSeqID.Equals(input.DistinctSeqID) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + if (this.HighlightResult != null) + { + hashCode = (hashCode * 59) + this.HighlightResult.GetHashCode(); + } + if (this.SnippetResult != null) + { + hashCode = (hashCode * 59) + this.SnippetResult.GetHashCode(); + } + if (this.RankingInfo != null) + { + hashCode = (hashCode * 59) + this.RankingInfo.GetHashCode(); + } + hashCode = (hashCode * 59) + this.DistinctSeqID.GetHashCode(); + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/IgnorePlurals.cs b/algoliasearch/Search/Models/IgnorePlurals.cs new file mode 100644 index 000000000..c95ee492a --- /dev/null +++ b/algoliasearch/Search/Models/IgnorePlurals.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// Treats singular, plurals, and other forms of declensions as matching terms. `ignorePlurals` is used in conjunction with the `queryLanguages` setting. _list_: language ISO codes for which ignoring plurals should be enabled. This list will override any values that you may have set in `queryLanguages`. _true_: enables the ignore plurals feature, where singulars and plurals are considered equivalent (\"foot\" = \"feet\"). The languages supported here are either [every language](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/) (this is the default) or those set by `queryLanguages`. _false_: turns off the ignore plurals feature, so that singulars and plurals aren't considered to be the same (\"foot\" will not find \"feet\"). + /// + [JsonConverter(typeof(IgnorePluralsJsonConverter))] + [DataContract(Name = "ignorePlurals")] + public partial class IgnorePlurals : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<string>. + public IgnorePlurals(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of bool. + public IgnorePlurals(bool actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(bool)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, bool"); + } + } + } + + /// + /// Get the actual instance of `List<string>`. If the actual instance is not `List<string>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<string> + public List GetterListString() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `bool`. If the actual instance is not `bool`, + /// the InvalidClassException will be thrown + /// + /// An instance of bool + public bool GetterBool() + { + return (bool)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class IgnorePlurals {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, IgnorePlurals.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of IgnorePlurals + /// + /// JSON string + /// An instance of IgnorePlurals + public static IgnorePlurals FromJson(string jsonString) + { + IgnorePlurals newIgnorePlurals = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newIgnorePlurals; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newIgnorePlurals = new IgnorePlurals(JsonConvert.DeserializeObject>(jsonString, IgnorePlurals.SerializerSettings)); + } + else + { + newIgnorePlurals = new IgnorePlurals(JsonConvert.DeserializeObject>(jsonString, IgnorePlurals.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(bool).GetProperty("AdditionalProperties") == null) + { + newIgnorePlurals = new IgnorePlurals(JsonConvert.DeserializeObject(jsonString, IgnorePlurals.SerializerSettings)); + } + else + { + newIgnorePlurals = new IgnorePlurals(JsonConvert.DeserializeObject(jsonString, IgnorePlurals.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("bool"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into bool: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newIgnorePlurals; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as IgnorePlurals); + } + + /// + /// Returns true if IgnorePlurals instances are equal + /// + /// Instance of IgnorePlurals to be compared + /// Boolean + public bool Equals(IgnorePlurals input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for IgnorePlurals + /// + public class IgnorePluralsJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(IgnorePlurals).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return IgnorePlurals.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/IndexSettings.cs b/algoliasearch/Search/Models/IndexSettings.cs new file mode 100644 index 000000000..685a94f66 --- /dev/null +++ b/algoliasearch/Search/Models/IndexSettings.cs @@ -0,0 +1,1224 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Algolia index settings. + /// + [DataContract(Name = "indexSettings")] + public partial class IndexSettings : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets QueryType + /// + [DataMember(Name = "queryType", EmitDefaultValue = false)] + public QueryType? QueryType { get; set; } + + /// + /// Gets or Sets RemoveWordsIfNoResults + /// + [DataMember(Name = "removeWordsIfNoResults", EmitDefaultValue = false)] + public RemoveWordsIfNoResults? RemoveWordsIfNoResults { get; set; } + + /// + /// Gets or Sets Mode + /// + [DataMember(Name = "mode", EmitDefaultValue = false)] + public Mode? Mode { get; set; } + + /// + /// Gets or Sets ExactOnSingleWordQuery + /// + [DataMember(Name = "exactOnSingleWordQuery", EmitDefaultValue = false)] + public ExactOnSingleWordQuery? ExactOnSingleWordQuery { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Creates [replicas](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/), which are copies of a primary index with the same records but different settings.. + /// Maximum number of hits accessible through pagination. (default to 1000). + /// Attributes that can't be retrieved at query time.. + /// Words for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/).. + /// Attributes in your index to which [Japanese transliteration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#japanese-transliteration-and-type-ahead) applies. This will ensure that words indexed in Katakana or Kanji can also be searched in Hiragana.. + /// Attributes on which to split [camel case](https://wikipedia.org/wiki/Camel_case) words.. + /// Attributes in your index to which [word segmentation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) (decompounding) applies.. + /// Set the languages of your index, for language-specific processing steps such as [tokenization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/tokenization/) and [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/).. + /// Attributes for which you want to turn off [prefix matching](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#adjusting-prefix-search).. + /// Incidates whether the engine compresses arrays with exclusively non-negative integers. When enabled, the compressed arrays may be reordered. (default to false). + /// Numeric attributes that can be used as [numerical filters](https://www.algolia.com/doc/guides/managing-results/rules/detecting-intent/how-to/applying-a-custom-filter-for-a-specific-query/#numerical-filters).. + /// Controls which separators are added to an Algolia index as part of [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean). Separators are all non-letter characters except spaces and currency characters, such as $€£¥. (default to ""). + /// [Attributes used for searching](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/), including determining [if matches at the beginning of a word are important (ordered) or not (unordered)](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/how-to/configuring-searchable-attributes-the-right-way/#understanding-word-position). . + /// Lets you store custom data in your indices.. + /// A list of characters and their normalized replacements to override Algolia's default [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/).. + /// Name of the deduplication attribute to be used with Algolia's [_distinct_ feature](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/#introducing-algolias-distinct-feature).. + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. . + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes.. + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/).. + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. . + /// Relevancy threshold below which less relevant results aren't included in the results. (default to 100). + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`).. + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. . + /// HTML string to insert before the highlighted parts in all highlight and snippet results. (default to "<em>"). + /// HTML string to insert after the highlighted parts in all highlight and snippet results. (default to "</em>"). + /// String used as an ellipsis indicator when a snippet is truncated. (default to "…"). + /// Restrict highlighting and snippeting to items that matched the query. (default to false). + /// Number of hits per page. (default to 20). + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 4). + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 8). + /// typoTolerance. + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. (default to true). + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/).. + /// ignorePlurals. + /// removeStopWords. + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). (default to ""). + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection.. + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. (default to true). + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. (default to true). + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. (default to false). + /// queryType. + /// removeWordsIfNoResults. + /// mode. + /// semanticSearch. + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). (default to false). + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query.. + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// exactOnSingleWordQuery. + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled.. + /// distinct. + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. (default to false). + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). (default to 1). + /// Attributes to include in the API response for search and browse queries.. + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). (default to 10). + /// Maximum number of facet values to return for each facet. (default to 100). + /// Controls how facet values are fetched. (default to "count"). + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. (default to false). + /// renderingContent. + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). (default to true). + /// reRankingApplyFilter. + public IndexSettings(List replicas = default(List), int paginationLimitedTo = 1000, List unretrievableAttributes = default(List), List disableTypoToleranceOnWords = default(List), List attributesToTransliterate = default(List), List camelCaseAttributes = default(List), Object decompoundedAttributes = default(Object), List indexLanguages = default(List), List disablePrefixOnAttributes = default(List), bool allowCompressionOfIntegerArray = false, List numericAttributesForFiltering = default(List), string separatorsToIndex = @"", List searchableAttributes = default(List), Object userData = default(Object), Dictionary> customNormalization = default(Dictionary>), string attributeForDistinct = default(string), List attributesForFaceting = default(List), List attributesToRetrieve = default(List), List ranking = default(List), List customRanking = default(List), int relevancyStrictness = 100, List attributesToHighlight = default(List), List attributesToSnippet = default(List), string highlightPreTag = @"", string highlightPostTag = @"", string snippetEllipsisText = @"…", bool restrictHighlightAndSnippetArrays = false, int hitsPerPage = 20, int minWordSizefor1Typo = 4, int minWordSizefor2Typos = 8, TypoTolerance typoTolerance = default(TypoTolerance), bool allowTyposOnNumericTokens = true, List disableTypoToleranceOnAttributes = default(List), IgnorePlurals ignorePlurals = default(IgnorePlurals), RemoveStopWords removeStopWords = default(RemoveStopWords), string keepDiacriticsOnCharacters = @"", List queryLanguages = default(List), bool decompoundQuery = true, bool enableRules = true, bool enablePersonalization = false, QueryType? queryType = default(QueryType?), RemoveWordsIfNoResults? removeWordsIfNoResults = default(RemoveWordsIfNoResults?), Mode? mode = default(Mode?), SemanticSearch semanticSearch = default(SemanticSearch), bool advancedSyntax = false, List optionalWords = default(List), List disableExactOnAttributes = default(List), ExactOnSingleWordQuery? exactOnSingleWordQuery = default(ExactOnSingleWordQuery?), List alternativesAsExact = default(List), List advancedSyntaxFeatures = default(List), Distinct distinct = default(Distinct), bool replaceSynonymsInHighlight = false, int minProximity = 1, List responseFields = default(List), int maxFacetHits = 10, int maxValuesPerFacet = 100, string sortFacetValuesBy = @"count", bool attributeCriteriaComputedByMinProximity = false, RenderingContent renderingContent = default(RenderingContent), bool enableReRanking = true, ReRankingApplyFilter reRankingApplyFilter = default(ReRankingApplyFilter)) + { + this.Replicas = replicas; + this.PaginationLimitedTo = paginationLimitedTo; + this.UnretrievableAttributes = unretrievableAttributes; + this.DisableTypoToleranceOnWords = disableTypoToleranceOnWords; + this.AttributesToTransliterate = attributesToTransliterate; + this.CamelCaseAttributes = camelCaseAttributes; + this.DecompoundedAttributes = decompoundedAttributes; + this.IndexLanguages = indexLanguages; + this.DisablePrefixOnAttributes = disablePrefixOnAttributes; + this.AllowCompressionOfIntegerArray = allowCompressionOfIntegerArray; + this.NumericAttributesForFiltering = numericAttributesForFiltering; + // use default value if no "separatorsToIndex" provided + this.SeparatorsToIndex = separatorsToIndex ?? @""; + this.SearchableAttributes = searchableAttributes; + this.UserData = userData; + this.CustomNormalization = customNormalization; + this.AttributeForDistinct = attributeForDistinct; + this.AttributesForFaceting = attributesForFaceting; + this.AttributesToRetrieve = attributesToRetrieve; + this.Ranking = ranking; + this.CustomRanking = customRanking; + this.RelevancyStrictness = relevancyStrictness; + this.AttributesToHighlight = attributesToHighlight; + this.AttributesToSnippet = attributesToSnippet; + // use default value if no "highlightPreTag" provided + this.HighlightPreTag = highlightPreTag ?? @""; + // use default value if no "highlightPostTag" provided + this.HighlightPostTag = highlightPostTag ?? @""; + // use default value if no "snippetEllipsisText" provided + this.SnippetEllipsisText = snippetEllipsisText ?? @"…"; + this.RestrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + this.HitsPerPage = hitsPerPage; + this.MinWordSizefor1Typo = minWordSizefor1Typo; + this.MinWordSizefor2Typos = minWordSizefor2Typos; + this.TypoTolerance = typoTolerance; + this.AllowTyposOnNumericTokens = allowTyposOnNumericTokens; + this.DisableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + this.IgnorePlurals = ignorePlurals; + this.RemoveStopWords = removeStopWords; + // use default value if no "keepDiacriticsOnCharacters" provided + this.KeepDiacriticsOnCharacters = keepDiacriticsOnCharacters ?? @""; + this.QueryLanguages = queryLanguages; + this.DecompoundQuery = decompoundQuery; + this.EnableRules = enableRules; + this.EnablePersonalization = enablePersonalization; + this.QueryType = queryType; + this.RemoveWordsIfNoResults = removeWordsIfNoResults; + this.Mode = mode; + this.SemanticSearch = semanticSearch; + this.AdvancedSyntax = advancedSyntax; + this.OptionalWords = optionalWords; + this.DisableExactOnAttributes = disableExactOnAttributes; + this.ExactOnSingleWordQuery = exactOnSingleWordQuery; + this.AlternativesAsExact = alternativesAsExact; + this.AdvancedSyntaxFeatures = advancedSyntaxFeatures; + this.Distinct = distinct; + this.ReplaceSynonymsInHighlight = replaceSynonymsInHighlight; + this.MinProximity = minProximity; + this.ResponseFields = responseFields; + this.MaxFacetHits = maxFacetHits; + this.MaxValuesPerFacet = maxValuesPerFacet; + // use default value if no "sortFacetValuesBy" provided + this.SortFacetValuesBy = sortFacetValuesBy ?? @"count"; + this.AttributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + this.RenderingContent = renderingContent; + this.EnableReRanking = enableReRanking; + this.ReRankingApplyFilter = reRankingApplyFilter; + } + + /// + /// Creates [replicas](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/), which are copies of a primary index with the same records but different settings. + /// + /// Creates [replicas](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/in-depth/replicas/), which are copies of a primary index with the same records but different settings. + [DataMember(Name = "replicas", EmitDefaultValue = false)] + public List Replicas { get; set; } + + /// + /// Maximum number of hits accessible through pagination. + /// + /// Maximum number of hits accessible through pagination. + [DataMember(Name = "paginationLimitedTo", EmitDefaultValue = false)] + public int PaginationLimitedTo { get; set; } + + /// + /// Attributes that can't be retrieved at query time. + /// + /// Attributes that can't be retrieved at query time. + [DataMember(Name = "unretrievableAttributes", EmitDefaultValue = false)] + public List UnretrievableAttributes { get; set; } + + /// + /// Words for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + /// + /// Words for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + [DataMember(Name = "disableTypoToleranceOnWords", EmitDefaultValue = false)] + public List DisableTypoToleranceOnWords { get; set; } + + /// + /// Attributes in your index to which [Japanese transliteration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#japanese-transliteration-and-type-ahead) applies. This will ensure that words indexed in Katakana or Kanji can also be searched in Hiragana. + /// + /// Attributes in your index to which [Japanese transliteration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#japanese-transliteration-and-type-ahead) applies. This will ensure that words indexed in Katakana or Kanji can also be searched in Hiragana. + [DataMember(Name = "attributesToTransliterate", EmitDefaultValue = false)] + public List AttributesToTransliterate { get; set; } + + /// + /// Attributes on which to split [camel case](https://wikipedia.org/wiki/Camel_case) words. + /// + /// Attributes on which to split [camel case](https://wikipedia.org/wiki/Camel_case) words. + [DataMember(Name = "camelCaseAttributes", EmitDefaultValue = false)] + public List CamelCaseAttributes { get; set; } + + /// + /// Attributes in your index to which [word segmentation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) (decompounding) applies. + /// + /// Attributes in your index to which [word segmentation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/how-to/customize-segmentation/) (decompounding) applies. + [DataMember(Name = "decompoundedAttributes", EmitDefaultValue = false)] + public Object DecompoundedAttributes { get; set; } + + /// + /// Set the languages of your index, for language-specific processing steps such as [tokenization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/tokenization/) and [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + /// + /// Set the languages of your index, for language-specific processing steps such as [tokenization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/tokenization/) and [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + [DataMember(Name = "indexLanguages", EmitDefaultValue = false)] + public List IndexLanguages { get; set; } + + /// + /// Attributes for which you want to turn off [prefix matching](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#adjusting-prefix-search). + /// + /// Attributes for which you want to turn off [prefix matching](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#adjusting-prefix-search). + [DataMember(Name = "disablePrefixOnAttributes", EmitDefaultValue = false)] + public List DisablePrefixOnAttributes { get; set; } + + /// + /// Incidates whether the engine compresses arrays with exclusively non-negative integers. When enabled, the compressed arrays may be reordered. + /// + /// Incidates whether the engine compresses arrays with exclusively non-negative integers. When enabled, the compressed arrays may be reordered. + [DataMember(Name = "allowCompressionOfIntegerArray", EmitDefaultValue = true)] + public bool AllowCompressionOfIntegerArray { get; set; } + + /// + /// Numeric attributes that can be used as [numerical filters](https://www.algolia.com/doc/guides/managing-results/rules/detecting-intent/how-to/applying-a-custom-filter-for-a-specific-query/#numerical-filters). + /// + /// Numeric attributes that can be used as [numerical filters](https://www.algolia.com/doc/guides/managing-results/rules/detecting-intent/how-to/applying-a-custom-filter-for-a-specific-query/#numerical-filters). + [DataMember(Name = "numericAttributesForFiltering", EmitDefaultValue = false)] + public List NumericAttributesForFiltering { get; set; } + + /// + /// Controls which separators are added to an Algolia index as part of [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean). Separators are all non-letter characters except spaces and currency characters, such as $€£¥. + /// + /// Controls which separators are added to an Algolia index as part of [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean). Separators are all non-letter characters except spaces and currency characters, such as $€£¥. + [DataMember(Name = "separatorsToIndex", EmitDefaultValue = false)] + public string SeparatorsToIndex { get; set; } + + /// + /// [Attributes used for searching](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/), including determining [if matches at the beginning of a word are important (ordered) or not (unordered)](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/how-to/configuring-searchable-attributes-the-right-way/#understanding-word-position). + /// + /// [Attributes used for searching](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/), including determining [if matches at the beginning of a word are important (ordered) or not (unordered)](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/how-to/configuring-searchable-attributes-the-right-way/#understanding-word-position). + [DataMember(Name = "searchableAttributes", EmitDefaultValue = false)] + public List SearchableAttributes { get; set; } + + /// + /// Lets you store custom data in your indices. + /// + /// Lets you store custom data in your indices. + [DataMember(Name = "userData", EmitDefaultValue = false)] + public Object UserData { get; set; } + + /// + /// A list of characters and their normalized replacements to override Algolia's default [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + /// + /// A list of characters and their normalized replacements to override Algolia's default [normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + [DataMember(Name = "customNormalization", EmitDefaultValue = false)] + public Dictionary> CustomNormalization { get; set; } + + /// + /// Name of the deduplication attribute to be used with Algolia's [_distinct_ feature](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/#introducing-algolias-distinct-feature). + /// + /// Name of the deduplication attribute to be used with Algolia's [_distinct_ feature](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/#introducing-algolias-distinct-feature). + [DataMember(Name = "attributeForDistinct", EmitDefaultValue = false)] + public string AttributeForDistinct { get; set; } + + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + [DataMember(Name = "attributesForFaceting", EmitDefaultValue = false)] + public List AttributesForFaceting { get; set; } + + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + [DataMember(Name = "attributesToRetrieve", EmitDefaultValue = false)] + public List AttributesToRetrieve { get; set; } + + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + [DataMember(Name = "ranking", EmitDefaultValue = false)] + public List Ranking { get; set; } + + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + [DataMember(Name = "customRanking", EmitDefaultValue = false)] + public List CustomRanking { get; set; } + + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + [DataMember(Name = "relevancyStrictness", EmitDefaultValue = false)] + public int RelevancyStrictness { get; set; } + + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + [DataMember(Name = "attributesToHighlight", EmitDefaultValue = false)] + public List AttributesToHighlight { get; set; } + + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + [DataMember(Name = "attributesToSnippet", EmitDefaultValue = false)] + public List AttributesToSnippet { get; set; } + + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPreTag", EmitDefaultValue = false)] + public string HighlightPreTag { get; set; } + + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPostTag", EmitDefaultValue = false)] + public string HighlightPostTag { get; set; } + + /// + /// String used as an ellipsis indicator when a snippet is truncated. + /// + /// String used as an ellipsis indicator when a snippet is truncated. + [DataMember(Name = "snippetEllipsisText", EmitDefaultValue = false)] + public string SnippetEllipsisText { get; set; } + + /// + /// Restrict highlighting and snippeting to items that matched the query. + /// + /// Restrict highlighting and snippeting to items that matched the query. + [DataMember(Name = "restrictHighlightAndSnippetArrays", EmitDefaultValue = true)] + public bool RestrictHighlightAndSnippetArrays { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", EmitDefaultValue = false)] + public int HitsPerPage { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor1Typo", EmitDefaultValue = false)] + public int MinWordSizefor1Typo { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor2Typos", EmitDefaultValue = false)] + public int MinWordSizefor2Typos { get; set; } + + /// + /// Gets or Sets TypoTolerance + /// + [DataMember(Name = "typoTolerance", EmitDefaultValue = false)] + public TypoTolerance TypoTolerance { get; set; } + + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + [DataMember(Name = "allowTyposOnNumericTokens", EmitDefaultValue = true)] + public bool AllowTyposOnNumericTokens { get; set; } + + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + [DataMember(Name = "disableTypoToleranceOnAttributes", EmitDefaultValue = false)] + public List DisableTypoToleranceOnAttributes { get; set; } + + /// + /// Gets or Sets IgnorePlurals + /// + [DataMember(Name = "ignorePlurals", EmitDefaultValue = false)] + public IgnorePlurals IgnorePlurals { get; set; } + + /// + /// Gets or Sets RemoveStopWords + /// + [DataMember(Name = "removeStopWords", EmitDefaultValue = false)] + public RemoveStopWords RemoveStopWords { get; set; } + + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + [DataMember(Name = "keepDiacriticsOnCharacters", EmitDefaultValue = false)] + public string KeepDiacriticsOnCharacters { get; set; } + + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + [DataMember(Name = "queryLanguages", EmitDefaultValue = false)] + public List QueryLanguages { get; set; } + + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + [DataMember(Name = "decompoundQuery", EmitDefaultValue = true)] + public bool DecompoundQuery { get; set; } + + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + [DataMember(Name = "enableRules", EmitDefaultValue = true)] + public bool EnableRules { get; set; } + + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + [DataMember(Name = "enablePersonalization", EmitDefaultValue = true)] + public bool EnablePersonalization { get; set; } + + /// + /// Gets or Sets SemanticSearch + /// + [DataMember(Name = "semanticSearch", EmitDefaultValue = false)] + public SemanticSearch SemanticSearch { get; set; } + + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + [DataMember(Name = "advancedSyntax", EmitDefaultValue = true)] + public bool AdvancedSyntax { get; set; } + + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + [DataMember(Name = "optionalWords", EmitDefaultValue = false)] + public List OptionalWords { get; set; } + + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "disableExactOnAttributes", EmitDefaultValue = false)] + public List DisableExactOnAttributes { get; set; } + + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "alternativesAsExact", EmitDefaultValue = false)] + public List AlternativesAsExact { get; set; } + + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + [DataMember(Name = "advancedSyntaxFeatures", EmitDefaultValue = false)] + public List AdvancedSyntaxFeatures { get; set; } + + /// + /// Gets or Sets Distinct + /// + [DataMember(Name = "distinct", EmitDefaultValue = false)] + public Distinct Distinct { get; set; } + + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + [DataMember(Name = "replaceSynonymsInHighlight", EmitDefaultValue = true)] + public bool ReplaceSynonymsInHighlight { get; set; } + + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + [DataMember(Name = "minProximity", EmitDefaultValue = false)] + public int MinProximity { get; set; } + + /// + /// Attributes to include in the API response for search and browse queries. + /// + /// Attributes to include in the API response for search and browse queries. + [DataMember(Name = "responseFields", EmitDefaultValue = false)] + public List ResponseFields { get; set; } + + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + [DataMember(Name = "maxFacetHits", EmitDefaultValue = false)] + public int MaxFacetHits { get; set; } + + /// + /// Maximum number of facet values to return for each facet. + /// + /// Maximum number of facet values to return for each facet. + [DataMember(Name = "maxValuesPerFacet", EmitDefaultValue = false)] + public int MaxValuesPerFacet { get; set; } + + /// + /// Controls how facet values are fetched. + /// + /// Controls how facet values are fetched. + [DataMember(Name = "sortFacetValuesBy", EmitDefaultValue = false)] + public string SortFacetValuesBy { get; set; } + + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + [DataMember(Name = "attributeCriteriaComputedByMinProximity", EmitDefaultValue = true)] + public bool AttributeCriteriaComputedByMinProximity { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + [DataMember(Name = "enableReRanking", EmitDefaultValue = true)] + public bool EnableReRanking { get; set; } + + /// + /// Gets or Sets ReRankingApplyFilter + /// + [DataMember(Name = "reRankingApplyFilter", EmitDefaultValue = true)] + public ReRankingApplyFilter ReRankingApplyFilter { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class IndexSettings {\n"); + sb.Append(" Replicas: ").Append(Replicas).Append("\n"); + sb.Append(" PaginationLimitedTo: ").Append(PaginationLimitedTo).Append("\n"); + sb.Append(" UnretrievableAttributes: ").Append(UnretrievableAttributes).Append("\n"); + sb.Append(" DisableTypoToleranceOnWords: ").Append(DisableTypoToleranceOnWords).Append("\n"); + sb.Append(" AttributesToTransliterate: ").Append(AttributesToTransliterate).Append("\n"); + sb.Append(" CamelCaseAttributes: ").Append(CamelCaseAttributes).Append("\n"); + sb.Append(" DecompoundedAttributes: ").Append(DecompoundedAttributes).Append("\n"); + sb.Append(" IndexLanguages: ").Append(IndexLanguages).Append("\n"); + sb.Append(" DisablePrefixOnAttributes: ").Append(DisablePrefixOnAttributes).Append("\n"); + sb.Append(" AllowCompressionOfIntegerArray: ").Append(AllowCompressionOfIntegerArray).Append("\n"); + sb.Append(" NumericAttributesForFiltering: ").Append(NumericAttributesForFiltering).Append("\n"); + sb.Append(" SeparatorsToIndex: ").Append(SeparatorsToIndex).Append("\n"); + sb.Append(" SearchableAttributes: ").Append(SearchableAttributes).Append("\n"); + sb.Append(" UserData: ").Append(UserData).Append("\n"); + sb.Append(" CustomNormalization: ").Append(CustomNormalization).Append("\n"); + sb.Append(" AttributeForDistinct: ").Append(AttributeForDistinct).Append("\n"); + sb.Append(" AttributesForFaceting: ").Append(AttributesForFaceting).Append("\n"); + sb.Append(" AttributesToRetrieve: ").Append(AttributesToRetrieve).Append("\n"); + sb.Append(" Ranking: ").Append(Ranking).Append("\n"); + sb.Append(" CustomRanking: ").Append(CustomRanking).Append("\n"); + sb.Append(" RelevancyStrictness: ").Append(RelevancyStrictness).Append("\n"); + sb.Append(" AttributesToHighlight: ").Append(AttributesToHighlight).Append("\n"); + sb.Append(" AttributesToSnippet: ").Append(AttributesToSnippet).Append("\n"); + sb.Append(" HighlightPreTag: ").Append(HighlightPreTag).Append("\n"); + sb.Append(" HighlightPostTag: ").Append(HighlightPostTag).Append("\n"); + sb.Append(" SnippetEllipsisText: ").Append(SnippetEllipsisText).Append("\n"); + sb.Append(" RestrictHighlightAndSnippetArrays: ").Append(RestrictHighlightAndSnippetArrays).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" MinWordSizefor1Typo: ").Append(MinWordSizefor1Typo).Append("\n"); + sb.Append(" MinWordSizefor2Typos: ").Append(MinWordSizefor2Typos).Append("\n"); + sb.Append(" TypoTolerance: ").Append(TypoTolerance).Append("\n"); + sb.Append(" AllowTyposOnNumericTokens: ").Append(AllowTyposOnNumericTokens).Append("\n"); + sb.Append(" DisableTypoToleranceOnAttributes: ").Append(DisableTypoToleranceOnAttributes).Append("\n"); + sb.Append(" IgnorePlurals: ").Append(IgnorePlurals).Append("\n"); + sb.Append(" RemoveStopWords: ").Append(RemoveStopWords).Append("\n"); + sb.Append(" KeepDiacriticsOnCharacters: ").Append(KeepDiacriticsOnCharacters).Append("\n"); + sb.Append(" QueryLanguages: ").Append(QueryLanguages).Append("\n"); + sb.Append(" DecompoundQuery: ").Append(DecompoundQuery).Append("\n"); + sb.Append(" EnableRules: ").Append(EnableRules).Append("\n"); + sb.Append(" EnablePersonalization: ").Append(EnablePersonalization).Append("\n"); + sb.Append(" QueryType: ").Append(QueryType).Append("\n"); + sb.Append(" RemoveWordsIfNoResults: ").Append(RemoveWordsIfNoResults).Append("\n"); + sb.Append(" Mode: ").Append(Mode).Append("\n"); + sb.Append(" SemanticSearch: ").Append(SemanticSearch).Append("\n"); + sb.Append(" AdvancedSyntax: ").Append(AdvancedSyntax).Append("\n"); + sb.Append(" OptionalWords: ").Append(OptionalWords).Append("\n"); + sb.Append(" DisableExactOnAttributes: ").Append(DisableExactOnAttributes).Append("\n"); + sb.Append(" ExactOnSingleWordQuery: ").Append(ExactOnSingleWordQuery).Append("\n"); + sb.Append(" AlternativesAsExact: ").Append(AlternativesAsExact).Append("\n"); + sb.Append(" AdvancedSyntaxFeatures: ").Append(AdvancedSyntaxFeatures).Append("\n"); + sb.Append(" Distinct: ").Append(Distinct).Append("\n"); + sb.Append(" ReplaceSynonymsInHighlight: ").Append(ReplaceSynonymsInHighlight).Append("\n"); + sb.Append(" MinProximity: ").Append(MinProximity).Append("\n"); + sb.Append(" ResponseFields: ").Append(ResponseFields).Append("\n"); + sb.Append(" MaxFacetHits: ").Append(MaxFacetHits).Append("\n"); + sb.Append(" MaxValuesPerFacet: ").Append(MaxValuesPerFacet).Append("\n"); + sb.Append(" SortFacetValuesBy: ").Append(SortFacetValuesBy).Append("\n"); + sb.Append(" AttributeCriteriaComputedByMinProximity: ").Append(AttributeCriteriaComputedByMinProximity).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append(" EnableReRanking: ").Append(EnableReRanking).Append("\n"); + sb.Append(" ReRankingApplyFilter: ").Append(ReRankingApplyFilter).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as IndexSettings); + } + + /// + /// Returns true if IndexSettings instances are equal + /// + /// Instance of IndexSettings to be compared + /// Boolean + public bool Equals(IndexSettings input) + { + if (input == null) + { + return false; + } + return + ( + this.Replicas == input.Replicas || + this.Replicas != null && + input.Replicas != null && + this.Replicas.SequenceEqual(input.Replicas) + ) && + ( + this.PaginationLimitedTo == input.PaginationLimitedTo || + this.PaginationLimitedTo.Equals(input.PaginationLimitedTo) + ) && + ( + this.UnretrievableAttributes == input.UnretrievableAttributes || + this.UnretrievableAttributes != null && + input.UnretrievableAttributes != null && + this.UnretrievableAttributes.SequenceEqual(input.UnretrievableAttributes) + ) && + ( + this.DisableTypoToleranceOnWords == input.DisableTypoToleranceOnWords || + this.DisableTypoToleranceOnWords != null && + input.DisableTypoToleranceOnWords != null && + this.DisableTypoToleranceOnWords.SequenceEqual(input.DisableTypoToleranceOnWords) + ) && + ( + this.AttributesToTransliterate == input.AttributesToTransliterate || + this.AttributesToTransliterate != null && + input.AttributesToTransliterate != null && + this.AttributesToTransliterate.SequenceEqual(input.AttributesToTransliterate) + ) && + ( + this.CamelCaseAttributes == input.CamelCaseAttributes || + this.CamelCaseAttributes != null && + input.CamelCaseAttributes != null && + this.CamelCaseAttributes.SequenceEqual(input.CamelCaseAttributes) + ) && + ( + this.DecompoundedAttributes == input.DecompoundedAttributes || + (this.DecompoundedAttributes != null && + this.DecompoundedAttributes.Equals(input.DecompoundedAttributes)) + ) && + ( + this.IndexLanguages == input.IndexLanguages || + this.IndexLanguages != null && + input.IndexLanguages != null && + this.IndexLanguages.SequenceEqual(input.IndexLanguages) + ) && + ( + this.DisablePrefixOnAttributes == input.DisablePrefixOnAttributes || + this.DisablePrefixOnAttributes != null && + input.DisablePrefixOnAttributes != null && + this.DisablePrefixOnAttributes.SequenceEqual(input.DisablePrefixOnAttributes) + ) && + ( + this.AllowCompressionOfIntegerArray == input.AllowCompressionOfIntegerArray || + this.AllowCompressionOfIntegerArray.Equals(input.AllowCompressionOfIntegerArray) + ) && + ( + this.NumericAttributesForFiltering == input.NumericAttributesForFiltering || + this.NumericAttributesForFiltering != null && + input.NumericAttributesForFiltering != null && + this.NumericAttributesForFiltering.SequenceEqual(input.NumericAttributesForFiltering) + ) && + ( + this.SeparatorsToIndex == input.SeparatorsToIndex || + (this.SeparatorsToIndex != null && + this.SeparatorsToIndex.Equals(input.SeparatorsToIndex)) + ) && + ( + this.SearchableAttributes == input.SearchableAttributes || + this.SearchableAttributes != null && + input.SearchableAttributes != null && + this.SearchableAttributes.SequenceEqual(input.SearchableAttributes) + ) && + ( + this.UserData == input.UserData || + (this.UserData != null && + this.UserData.Equals(input.UserData)) + ) && + ( + this.CustomNormalization == input.CustomNormalization || + this.CustomNormalization != null && + input.CustomNormalization != null && + this.CustomNormalization.SequenceEqual(input.CustomNormalization) + ) && + ( + this.AttributeForDistinct == input.AttributeForDistinct || + (this.AttributeForDistinct != null && + this.AttributeForDistinct.Equals(input.AttributeForDistinct)) + ) && + ( + this.AttributesForFaceting == input.AttributesForFaceting || + this.AttributesForFaceting != null && + input.AttributesForFaceting != null && + this.AttributesForFaceting.SequenceEqual(input.AttributesForFaceting) + ) && + ( + this.AttributesToRetrieve == input.AttributesToRetrieve || + this.AttributesToRetrieve != null && + input.AttributesToRetrieve != null && + this.AttributesToRetrieve.SequenceEqual(input.AttributesToRetrieve) + ) && + ( + this.Ranking == input.Ranking || + this.Ranking != null && + input.Ranking != null && + this.Ranking.SequenceEqual(input.Ranking) + ) && + ( + this.CustomRanking == input.CustomRanking || + this.CustomRanking != null && + input.CustomRanking != null && + this.CustomRanking.SequenceEqual(input.CustomRanking) + ) && + ( + this.RelevancyStrictness == input.RelevancyStrictness || + this.RelevancyStrictness.Equals(input.RelevancyStrictness) + ) && + ( + this.AttributesToHighlight == input.AttributesToHighlight || + this.AttributesToHighlight != null && + input.AttributesToHighlight != null && + this.AttributesToHighlight.SequenceEqual(input.AttributesToHighlight) + ) && + ( + this.AttributesToSnippet == input.AttributesToSnippet || + this.AttributesToSnippet != null && + input.AttributesToSnippet != null && + this.AttributesToSnippet.SequenceEqual(input.AttributesToSnippet) + ) && + ( + this.HighlightPreTag == input.HighlightPreTag || + (this.HighlightPreTag != null && + this.HighlightPreTag.Equals(input.HighlightPreTag)) + ) && + ( + this.HighlightPostTag == input.HighlightPostTag || + (this.HighlightPostTag != null && + this.HighlightPostTag.Equals(input.HighlightPostTag)) + ) && + ( + this.SnippetEllipsisText == input.SnippetEllipsisText || + (this.SnippetEllipsisText != null && + this.SnippetEllipsisText.Equals(input.SnippetEllipsisText)) + ) && + ( + this.RestrictHighlightAndSnippetArrays == input.RestrictHighlightAndSnippetArrays || + this.RestrictHighlightAndSnippetArrays.Equals(input.RestrictHighlightAndSnippetArrays) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && + ( + this.MinWordSizefor1Typo == input.MinWordSizefor1Typo || + this.MinWordSizefor1Typo.Equals(input.MinWordSizefor1Typo) + ) && + ( + this.MinWordSizefor2Typos == input.MinWordSizefor2Typos || + this.MinWordSizefor2Typos.Equals(input.MinWordSizefor2Typos) + ) && + ( + this.TypoTolerance == input.TypoTolerance || + (this.TypoTolerance != null && + this.TypoTolerance.Equals(input.TypoTolerance)) + ) && + ( + this.AllowTyposOnNumericTokens == input.AllowTyposOnNumericTokens || + this.AllowTyposOnNumericTokens.Equals(input.AllowTyposOnNumericTokens) + ) && + ( + this.DisableTypoToleranceOnAttributes == input.DisableTypoToleranceOnAttributes || + this.DisableTypoToleranceOnAttributes != null && + input.DisableTypoToleranceOnAttributes != null && + this.DisableTypoToleranceOnAttributes.SequenceEqual(input.DisableTypoToleranceOnAttributes) + ) && + ( + this.IgnorePlurals == input.IgnorePlurals || + (this.IgnorePlurals != null && + this.IgnorePlurals.Equals(input.IgnorePlurals)) + ) && + ( + this.RemoveStopWords == input.RemoveStopWords || + (this.RemoveStopWords != null && + this.RemoveStopWords.Equals(input.RemoveStopWords)) + ) && + ( + this.KeepDiacriticsOnCharacters == input.KeepDiacriticsOnCharacters || + (this.KeepDiacriticsOnCharacters != null && + this.KeepDiacriticsOnCharacters.Equals(input.KeepDiacriticsOnCharacters)) + ) && + ( + this.QueryLanguages == input.QueryLanguages || + this.QueryLanguages != null && + input.QueryLanguages != null && + this.QueryLanguages.SequenceEqual(input.QueryLanguages) + ) && + ( + this.DecompoundQuery == input.DecompoundQuery || + this.DecompoundQuery.Equals(input.DecompoundQuery) + ) && + ( + this.EnableRules == input.EnableRules || + this.EnableRules.Equals(input.EnableRules) + ) && + ( + this.EnablePersonalization == input.EnablePersonalization || + this.EnablePersonalization.Equals(input.EnablePersonalization) + ) && + ( + this.QueryType == input.QueryType || + this.QueryType.Equals(input.QueryType) + ) && + ( + this.RemoveWordsIfNoResults == input.RemoveWordsIfNoResults || + this.RemoveWordsIfNoResults.Equals(input.RemoveWordsIfNoResults) + ) && + ( + this.Mode == input.Mode || + this.Mode.Equals(input.Mode) + ) && + ( + this.SemanticSearch == input.SemanticSearch || + (this.SemanticSearch != null && + this.SemanticSearch.Equals(input.SemanticSearch)) + ) && + ( + this.AdvancedSyntax == input.AdvancedSyntax || + this.AdvancedSyntax.Equals(input.AdvancedSyntax) + ) && + ( + this.OptionalWords == input.OptionalWords || + this.OptionalWords != null && + input.OptionalWords != null && + this.OptionalWords.SequenceEqual(input.OptionalWords) + ) && + ( + this.DisableExactOnAttributes == input.DisableExactOnAttributes || + this.DisableExactOnAttributes != null && + input.DisableExactOnAttributes != null && + this.DisableExactOnAttributes.SequenceEqual(input.DisableExactOnAttributes) + ) && + ( + this.ExactOnSingleWordQuery == input.ExactOnSingleWordQuery || + this.ExactOnSingleWordQuery.Equals(input.ExactOnSingleWordQuery) + ) && + ( + this.AlternativesAsExact == input.AlternativesAsExact || + this.AlternativesAsExact != null && + input.AlternativesAsExact != null && + this.AlternativesAsExact.SequenceEqual(input.AlternativesAsExact) + ) && + ( + this.AdvancedSyntaxFeatures == input.AdvancedSyntaxFeatures || + this.AdvancedSyntaxFeatures != null && + input.AdvancedSyntaxFeatures != null && + this.AdvancedSyntaxFeatures.SequenceEqual(input.AdvancedSyntaxFeatures) + ) && + ( + this.Distinct == input.Distinct || + (this.Distinct != null && + this.Distinct.Equals(input.Distinct)) + ) && + ( + this.ReplaceSynonymsInHighlight == input.ReplaceSynonymsInHighlight || + this.ReplaceSynonymsInHighlight.Equals(input.ReplaceSynonymsInHighlight) + ) && + ( + this.MinProximity == input.MinProximity || + this.MinProximity.Equals(input.MinProximity) + ) && + ( + this.ResponseFields == input.ResponseFields || + this.ResponseFields != null && + input.ResponseFields != null && + this.ResponseFields.SequenceEqual(input.ResponseFields) + ) && + ( + this.MaxFacetHits == input.MaxFacetHits || + this.MaxFacetHits.Equals(input.MaxFacetHits) + ) && + ( + this.MaxValuesPerFacet == input.MaxValuesPerFacet || + this.MaxValuesPerFacet.Equals(input.MaxValuesPerFacet) + ) && + ( + this.SortFacetValuesBy == input.SortFacetValuesBy || + (this.SortFacetValuesBy != null && + this.SortFacetValuesBy.Equals(input.SortFacetValuesBy)) + ) && + ( + this.AttributeCriteriaComputedByMinProximity == input.AttributeCriteriaComputedByMinProximity || + this.AttributeCriteriaComputedByMinProximity.Equals(input.AttributeCriteriaComputedByMinProximity) + ) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ) && + ( + this.EnableReRanking == input.EnableReRanking || + this.EnableReRanking.Equals(input.EnableReRanking) + ) && + ( + this.ReRankingApplyFilter == input.ReRankingApplyFilter || + (this.ReRankingApplyFilter != null && + this.ReRankingApplyFilter.Equals(input.ReRankingApplyFilter)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Replicas != null) + { + hashCode = (hashCode * 59) + this.Replicas.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PaginationLimitedTo.GetHashCode(); + if (this.UnretrievableAttributes != null) + { + hashCode = (hashCode * 59) + this.UnretrievableAttributes.GetHashCode(); + } + if (this.DisableTypoToleranceOnWords != null) + { + hashCode = (hashCode * 59) + this.DisableTypoToleranceOnWords.GetHashCode(); + } + if (this.AttributesToTransliterate != null) + { + hashCode = (hashCode * 59) + this.AttributesToTransliterate.GetHashCode(); + } + if (this.CamelCaseAttributes != null) + { + hashCode = (hashCode * 59) + this.CamelCaseAttributes.GetHashCode(); + } + if (this.DecompoundedAttributes != null) + { + hashCode = (hashCode * 59) + this.DecompoundedAttributes.GetHashCode(); + } + if (this.IndexLanguages != null) + { + hashCode = (hashCode * 59) + this.IndexLanguages.GetHashCode(); + } + if (this.DisablePrefixOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisablePrefixOnAttributes.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AllowCompressionOfIntegerArray.GetHashCode(); + if (this.NumericAttributesForFiltering != null) + { + hashCode = (hashCode * 59) + this.NumericAttributesForFiltering.GetHashCode(); + } + if (this.SeparatorsToIndex != null) + { + hashCode = (hashCode * 59) + this.SeparatorsToIndex.GetHashCode(); + } + if (this.SearchableAttributes != null) + { + hashCode = (hashCode * 59) + this.SearchableAttributes.GetHashCode(); + } + if (this.UserData != null) + { + hashCode = (hashCode * 59) + this.UserData.GetHashCode(); + } + if (this.CustomNormalization != null) + { + hashCode = (hashCode * 59) + this.CustomNormalization.GetHashCode(); + } + if (this.AttributeForDistinct != null) + { + hashCode = (hashCode * 59) + this.AttributeForDistinct.GetHashCode(); + } + if (this.AttributesForFaceting != null) + { + hashCode = (hashCode * 59) + this.AttributesForFaceting.GetHashCode(); + } + if (this.AttributesToRetrieve != null) + { + hashCode = (hashCode * 59) + this.AttributesToRetrieve.GetHashCode(); + } + if (this.Ranking != null) + { + hashCode = (hashCode * 59) + this.Ranking.GetHashCode(); + } + if (this.CustomRanking != null) + { + hashCode = (hashCode * 59) + this.CustomRanking.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RelevancyStrictness.GetHashCode(); + if (this.AttributesToHighlight != null) + { + hashCode = (hashCode * 59) + this.AttributesToHighlight.GetHashCode(); + } + if (this.AttributesToSnippet != null) + { + hashCode = (hashCode * 59) + this.AttributesToSnippet.GetHashCode(); + } + if (this.HighlightPreTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPreTag.GetHashCode(); + } + if (this.HighlightPostTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPostTag.GetHashCode(); + } + if (this.SnippetEllipsisText != null) + { + hashCode = (hashCode * 59) + this.SnippetEllipsisText.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RestrictHighlightAndSnippetArrays.GetHashCode(); + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor1Typo.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor2Typos.GetHashCode(); + if (this.TypoTolerance != null) + { + hashCode = (hashCode * 59) + this.TypoTolerance.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AllowTyposOnNumericTokens.GetHashCode(); + if (this.DisableTypoToleranceOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableTypoToleranceOnAttributes.GetHashCode(); + } + if (this.IgnorePlurals != null) + { + hashCode = (hashCode * 59) + this.IgnorePlurals.GetHashCode(); + } + if (this.RemoveStopWords != null) + { + hashCode = (hashCode * 59) + this.RemoveStopWords.GetHashCode(); + } + if (this.KeepDiacriticsOnCharacters != null) + { + hashCode = (hashCode * 59) + this.KeepDiacriticsOnCharacters.GetHashCode(); + } + if (this.QueryLanguages != null) + { + hashCode = (hashCode * 59) + this.QueryLanguages.GetHashCode(); + } + hashCode = (hashCode * 59) + this.DecompoundQuery.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableRules.GetHashCode(); + hashCode = (hashCode * 59) + this.EnablePersonalization.GetHashCode(); + hashCode = (hashCode * 59) + this.QueryType.GetHashCode(); + hashCode = (hashCode * 59) + this.RemoveWordsIfNoResults.GetHashCode(); + hashCode = (hashCode * 59) + this.Mode.GetHashCode(); + if (this.SemanticSearch != null) + { + hashCode = (hashCode * 59) + this.SemanticSearch.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AdvancedSyntax.GetHashCode(); + if (this.OptionalWords != null) + { + hashCode = (hashCode * 59) + this.OptionalWords.GetHashCode(); + } + if (this.DisableExactOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableExactOnAttributes.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ExactOnSingleWordQuery.GetHashCode(); + if (this.AlternativesAsExact != null) + { + hashCode = (hashCode * 59) + this.AlternativesAsExact.GetHashCode(); + } + if (this.AdvancedSyntaxFeatures != null) + { + hashCode = (hashCode * 59) + this.AdvancedSyntaxFeatures.GetHashCode(); + } + if (this.Distinct != null) + { + hashCode = (hashCode * 59) + this.Distinct.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ReplaceSynonymsInHighlight.GetHashCode(); + hashCode = (hashCode * 59) + this.MinProximity.GetHashCode(); + if (this.ResponseFields != null) + { + hashCode = (hashCode * 59) + this.ResponseFields.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MaxFacetHits.GetHashCode(); + hashCode = (hashCode * 59) + this.MaxValuesPerFacet.GetHashCode(); + if (this.SortFacetValuesBy != null) + { + hashCode = (hashCode * 59) + this.SortFacetValuesBy.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AttributeCriteriaComputedByMinProximity.GetHashCode(); + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EnableReRanking.GetHashCode(); + if (this.ReRankingApplyFilter != null) + { + hashCode = (hashCode * 59) + this.ReRankingApplyFilter.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + // MinProximity (int) maximum + if (this.MinProximity > (int)7) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value less than or equal to 7.", new[] { "MinProximity" }); + } + + // MinProximity (int) minimum + if (this.MinProximity < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value greater than or equal to 1.", new[] { "MinProximity" }); + } + + // MaxFacetHits (int) maximum + if (this.MaxFacetHits > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MaxFacetHits, must be a value less than or equal to 100.", new[] { "MaxFacetHits" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/IndexSettingsAsSearchParams.cs b/algoliasearch/Search/Models/IndexSettingsAsSearchParams.cs new file mode 100644 index 000000000..5507c3a80 --- /dev/null +++ b/algoliasearch/Search/Models/IndexSettingsAsSearchParams.cs @@ -0,0 +1,917 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// IndexSettingsAsSearchParams + /// + [DataContract(Name = "indexSettingsAsSearchParams")] + public partial class IndexSettingsAsSearchParams : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets QueryType + /// + [DataMember(Name = "queryType", EmitDefaultValue = false)] + public QueryType? QueryType { get; set; } + + /// + /// Gets or Sets RemoveWordsIfNoResults + /// + [DataMember(Name = "removeWordsIfNoResults", EmitDefaultValue = false)] + public RemoveWordsIfNoResults? RemoveWordsIfNoResults { get; set; } + + /// + /// Gets or Sets Mode + /// + [DataMember(Name = "mode", EmitDefaultValue = false)] + public Mode? Mode { get; set; } + + /// + /// Gets or Sets ExactOnSingleWordQuery + /// + [DataMember(Name = "exactOnSingleWordQuery", EmitDefaultValue = false)] + public ExactOnSingleWordQuery? ExactOnSingleWordQuery { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. . + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes.. + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/).. + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. . + /// Relevancy threshold below which less relevant results aren't included in the results. (default to 100). + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`).. + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. . + /// HTML string to insert before the highlighted parts in all highlight and snippet results. (default to "<em>"). + /// HTML string to insert after the highlighted parts in all highlight and snippet results. (default to "</em>"). + /// String used as an ellipsis indicator when a snippet is truncated. (default to "…"). + /// Restrict highlighting and snippeting to items that matched the query. (default to false). + /// Number of hits per page. (default to 20). + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 4). + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 8). + /// typoTolerance. + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. (default to true). + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/).. + /// ignorePlurals. + /// removeStopWords. + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). (default to ""). + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection.. + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. (default to true). + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. (default to true). + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. (default to false). + /// queryType. + /// removeWordsIfNoResults. + /// mode. + /// semanticSearch. + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). (default to false). + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query.. + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// exactOnSingleWordQuery. + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled.. + /// distinct. + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. (default to false). + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). (default to 1). + /// Attributes to include in the API response for search and browse queries.. + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). (default to 10). + /// Maximum number of facet values to return for each facet. (default to 100). + /// Controls how facet values are fetched. (default to "count"). + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. (default to false). + /// renderingContent. + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). (default to true). + /// reRankingApplyFilter. + public IndexSettingsAsSearchParams(List attributesForFaceting = default(List), List attributesToRetrieve = default(List), List ranking = default(List), List customRanking = default(List), int relevancyStrictness = 100, List attributesToHighlight = default(List), List attributesToSnippet = default(List), string highlightPreTag = @"", string highlightPostTag = @"", string snippetEllipsisText = @"…", bool restrictHighlightAndSnippetArrays = false, int hitsPerPage = 20, int minWordSizefor1Typo = 4, int minWordSizefor2Typos = 8, TypoTolerance typoTolerance = default(TypoTolerance), bool allowTyposOnNumericTokens = true, List disableTypoToleranceOnAttributes = default(List), IgnorePlurals ignorePlurals = default(IgnorePlurals), RemoveStopWords removeStopWords = default(RemoveStopWords), string keepDiacriticsOnCharacters = @"", List queryLanguages = default(List), bool decompoundQuery = true, bool enableRules = true, bool enablePersonalization = false, QueryType? queryType = default(QueryType?), RemoveWordsIfNoResults? removeWordsIfNoResults = default(RemoveWordsIfNoResults?), Mode? mode = default(Mode?), SemanticSearch semanticSearch = default(SemanticSearch), bool advancedSyntax = false, List optionalWords = default(List), List disableExactOnAttributes = default(List), ExactOnSingleWordQuery? exactOnSingleWordQuery = default(ExactOnSingleWordQuery?), List alternativesAsExact = default(List), List advancedSyntaxFeatures = default(List), Distinct distinct = default(Distinct), bool replaceSynonymsInHighlight = false, int minProximity = 1, List responseFields = default(List), int maxFacetHits = 10, int maxValuesPerFacet = 100, string sortFacetValuesBy = @"count", bool attributeCriteriaComputedByMinProximity = false, RenderingContent renderingContent = default(RenderingContent), bool enableReRanking = true, ReRankingApplyFilter reRankingApplyFilter = default(ReRankingApplyFilter)) + { + this.AttributesForFaceting = attributesForFaceting; + this.AttributesToRetrieve = attributesToRetrieve; + this.Ranking = ranking; + this.CustomRanking = customRanking; + this.RelevancyStrictness = relevancyStrictness; + this.AttributesToHighlight = attributesToHighlight; + this.AttributesToSnippet = attributesToSnippet; + // use default value if no "highlightPreTag" provided + this.HighlightPreTag = highlightPreTag ?? @""; + // use default value if no "highlightPostTag" provided + this.HighlightPostTag = highlightPostTag ?? @""; + // use default value if no "snippetEllipsisText" provided + this.SnippetEllipsisText = snippetEllipsisText ?? @"…"; + this.RestrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + this.HitsPerPage = hitsPerPage; + this.MinWordSizefor1Typo = minWordSizefor1Typo; + this.MinWordSizefor2Typos = minWordSizefor2Typos; + this.TypoTolerance = typoTolerance; + this.AllowTyposOnNumericTokens = allowTyposOnNumericTokens; + this.DisableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + this.IgnorePlurals = ignorePlurals; + this.RemoveStopWords = removeStopWords; + // use default value if no "keepDiacriticsOnCharacters" provided + this.KeepDiacriticsOnCharacters = keepDiacriticsOnCharacters ?? @""; + this.QueryLanguages = queryLanguages; + this.DecompoundQuery = decompoundQuery; + this.EnableRules = enableRules; + this.EnablePersonalization = enablePersonalization; + this.QueryType = queryType; + this.RemoveWordsIfNoResults = removeWordsIfNoResults; + this.Mode = mode; + this.SemanticSearch = semanticSearch; + this.AdvancedSyntax = advancedSyntax; + this.OptionalWords = optionalWords; + this.DisableExactOnAttributes = disableExactOnAttributes; + this.ExactOnSingleWordQuery = exactOnSingleWordQuery; + this.AlternativesAsExact = alternativesAsExact; + this.AdvancedSyntaxFeatures = advancedSyntaxFeatures; + this.Distinct = distinct; + this.ReplaceSynonymsInHighlight = replaceSynonymsInHighlight; + this.MinProximity = minProximity; + this.ResponseFields = responseFields; + this.MaxFacetHits = maxFacetHits; + this.MaxValuesPerFacet = maxValuesPerFacet; + // use default value if no "sortFacetValuesBy" provided + this.SortFacetValuesBy = sortFacetValuesBy ?? @"count"; + this.AttributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + this.RenderingContent = renderingContent; + this.EnableReRanking = enableReRanking; + this.ReRankingApplyFilter = reRankingApplyFilter; + } + + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + [DataMember(Name = "attributesForFaceting", EmitDefaultValue = false)] + public List AttributesForFaceting { get; set; } + + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + [DataMember(Name = "attributesToRetrieve", EmitDefaultValue = false)] + public List AttributesToRetrieve { get; set; } + + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + [DataMember(Name = "ranking", EmitDefaultValue = false)] + public List Ranking { get; set; } + + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + [DataMember(Name = "customRanking", EmitDefaultValue = false)] + public List CustomRanking { get; set; } + + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + [DataMember(Name = "relevancyStrictness", EmitDefaultValue = false)] + public int RelevancyStrictness { get; set; } + + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + [DataMember(Name = "attributesToHighlight", EmitDefaultValue = false)] + public List AttributesToHighlight { get; set; } + + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + [DataMember(Name = "attributesToSnippet", EmitDefaultValue = false)] + public List AttributesToSnippet { get; set; } + + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPreTag", EmitDefaultValue = false)] + public string HighlightPreTag { get; set; } + + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPostTag", EmitDefaultValue = false)] + public string HighlightPostTag { get; set; } + + /// + /// String used as an ellipsis indicator when a snippet is truncated. + /// + /// String used as an ellipsis indicator when a snippet is truncated. + [DataMember(Name = "snippetEllipsisText", EmitDefaultValue = false)] + public string SnippetEllipsisText { get; set; } + + /// + /// Restrict highlighting and snippeting to items that matched the query. + /// + /// Restrict highlighting and snippeting to items that matched the query. + [DataMember(Name = "restrictHighlightAndSnippetArrays", EmitDefaultValue = true)] + public bool RestrictHighlightAndSnippetArrays { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", EmitDefaultValue = false)] + public int HitsPerPage { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor1Typo", EmitDefaultValue = false)] + public int MinWordSizefor1Typo { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor2Typos", EmitDefaultValue = false)] + public int MinWordSizefor2Typos { get; set; } + + /// + /// Gets or Sets TypoTolerance + /// + [DataMember(Name = "typoTolerance", EmitDefaultValue = false)] + public TypoTolerance TypoTolerance { get; set; } + + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + [DataMember(Name = "allowTyposOnNumericTokens", EmitDefaultValue = true)] + public bool AllowTyposOnNumericTokens { get; set; } + + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + [DataMember(Name = "disableTypoToleranceOnAttributes", EmitDefaultValue = false)] + public List DisableTypoToleranceOnAttributes { get; set; } + + /// + /// Gets or Sets IgnorePlurals + /// + [DataMember(Name = "ignorePlurals", EmitDefaultValue = false)] + public IgnorePlurals IgnorePlurals { get; set; } + + /// + /// Gets or Sets RemoveStopWords + /// + [DataMember(Name = "removeStopWords", EmitDefaultValue = false)] + public RemoveStopWords RemoveStopWords { get; set; } + + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + [DataMember(Name = "keepDiacriticsOnCharacters", EmitDefaultValue = false)] + public string KeepDiacriticsOnCharacters { get; set; } + + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + [DataMember(Name = "queryLanguages", EmitDefaultValue = false)] + public List QueryLanguages { get; set; } + + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + [DataMember(Name = "decompoundQuery", EmitDefaultValue = true)] + public bool DecompoundQuery { get; set; } + + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + [DataMember(Name = "enableRules", EmitDefaultValue = true)] + public bool EnableRules { get; set; } + + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + [DataMember(Name = "enablePersonalization", EmitDefaultValue = true)] + public bool EnablePersonalization { get; set; } + + /// + /// Gets or Sets SemanticSearch + /// + [DataMember(Name = "semanticSearch", EmitDefaultValue = false)] + public SemanticSearch SemanticSearch { get; set; } + + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + [DataMember(Name = "advancedSyntax", EmitDefaultValue = true)] + public bool AdvancedSyntax { get; set; } + + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + [DataMember(Name = "optionalWords", EmitDefaultValue = false)] + public List OptionalWords { get; set; } + + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "disableExactOnAttributes", EmitDefaultValue = false)] + public List DisableExactOnAttributes { get; set; } + + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "alternativesAsExact", EmitDefaultValue = false)] + public List AlternativesAsExact { get; set; } + + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + [DataMember(Name = "advancedSyntaxFeatures", EmitDefaultValue = false)] + public List AdvancedSyntaxFeatures { get; set; } + + /// + /// Gets or Sets Distinct + /// + [DataMember(Name = "distinct", EmitDefaultValue = false)] + public Distinct Distinct { get; set; } + + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + [DataMember(Name = "replaceSynonymsInHighlight", EmitDefaultValue = true)] + public bool ReplaceSynonymsInHighlight { get; set; } + + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + [DataMember(Name = "minProximity", EmitDefaultValue = false)] + public int MinProximity { get; set; } + + /// + /// Attributes to include in the API response for search and browse queries. + /// + /// Attributes to include in the API response for search and browse queries. + [DataMember(Name = "responseFields", EmitDefaultValue = false)] + public List ResponseFields { get; set; } + + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + [DataMember(Name = "maxFacetHits", EmitDefaultValue = false)] + public int MaxFacetHits { get; set; } + + /// + /// Maximum number of facet values to return for each facet. + /// + /// Maximum number of facet values to return for each facet. + [DataMember(Name = "maxValuesPerFacet", EmitDefaultValue = false)] + public int MaxValuesPerFacet { get; set; } + + /// + /// Controls how facet values are fetched. + /// + /// Controls how facet values are fetched. + [DataMember(Name = "sortFacetValuesBy", EmitDefaultValue = false)] + public string SortFacetValuesBy { get; set; } + + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + [DataMember(Name = "attributeCriteriaComputedByMinProximity", EmitDefaultValue = true)] + public bool AttributeCriteriaComputedByMinProximity { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + [DataMember(Name = "enableReRanking", EmitDefaultValue = true)] + public bool EnableReRanking { get; set; } + + /// + /// Gets or Sets ReRankingApplyFilter + /// + [DataMember(Name = "reRankingApplyFilter", EmitDefaultValue = true)] + public ReRankingApplyFilter ReRankingApplyFilter { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class IndexSettingsAsSearchParams {\n"); + sb.Append(" AttributesForFaceting: ").Append(AttributesForFaceting).Append("\n"); + sb.Append(" AttributesToRetrieve: ").Append(AttributesToRetrieve).Append("\n"); + sb.Append(" Ranking: ").Append(Ranking).Append("\n"); + sb.Append(" CustomRanking: ").Append(CustomRanking).Append("\n"); + sb.Append(" RelevancyStrictness: ").Append(RelevancyStrictness).Append("\n"); + sb.Append(" AttributesToHighlight: ").Append(AttributesToHighlight).Append("\n"); + sb.Append(" AttributesToSnippet: ").Append(AttributesToSnippet).Append("\n"); + sb.Append(" HighlightPreTag: ").Append(HighlightPreTag).Append("\n"); + sb.Append(" HighlightPostTag: ").Append(HighlightPostTag).Append("\n"); + sb.Append(" SnippetEllipsisText: ").Append(SnippetEllipsisText).Append("\n"); + sb.Append(" RestrictHighlightAndSnippetArrays: ").Append(RestrictHighlightAndSnippetArrays).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" MinWordSizefor1Typo: ").Append(MinWordSizefor1Typo).Append("\n"); + sb.Append(" MinWordSizefor2Typos: ").Append(MinWordSizefor2Typos).Append("\n"); + sb.Append(" TypoTolerance: ").Append(TypoTolerance).Append("\n"); + sb.Append(" AllowTyposOnNumericTokens: ").Append(AllowTyposOnNumericTokens).Append("\n"); + sb.Append(" DisableTypoToleranceOnAttributes: ").Append(DisableTypoToleranceOnAttributes).Append("\n"); + sb.Append(" IgnorePlurals: ").Append(IgnorePlurals).Append("\n"); + sb.Append(" RemoveStopWords: ").Append(RemoveStopWords).Append("\n"); + sb.Append(" KeepDiacriticsOnCharacters: ").Append(KeepDiacriticsOnCharacters).Append("\n"); + sb.Append(" QueryLanguages: ").Append(QueryLanguages).Append("\n"); + sb.Append(" DecompoundQuery: ").Append(DecompoundQuery).Append("\n"); + sb.Append(" EnableRules: ").Append(EnableRules).Append("\n"); + sb.Append(" EnablePersonalization: ").Append(EnablePersonalization).Append("\n"); + sb.Append(" QueryType: ").Append(QueryType).Append("\n"); + sb.Append(" RemoveWordsIfNoResults: ").Append(RemoveWordsIfNoResults).Append("\n"); + sb.Append(" Mode: ").Append(Mode).Append("\n"); + sb.Append(" SemanticSearch: ").Append(SemanticSearch).Append("\n"); + sb.Append(" AdvancedSyntax: ").Append(AdvancedSyntax).Append("\n"); + sb.Append(" OptionalWords: ").Append(OptionalWords).Append("\n"); + sb.Append(" DisableExactOnAttributes: ").Append(DisableExactOnAttributes).Append("\n"); + sb.Append(" ExactOnSingleWordQuery: ").Append(ExactOnSingleWordQuery).Append("\n"); + sb.Append(" AlternativesAsExact: ").Append(AlternativesAsExact).Append("\n"); + sb.Append(" AdvancedSyntaxFeatures: ").Append(AdvancedSyntaxFeatures).Append("\n"); + sb.Append(" Distinct: ").Append(Distinct).Append("\n"); + sb.Append(" ReplaceSynonymsInHighlight: ").Append(ReplaceSynonymsInHighlight).Append("\n"); + sb.Append(" MinProximity: ").Append(MinProximity).Append("\n"); + sb.Append(" ResponseFields: ").Append(ResponseFields).Append("\n"); + sb.Append(" MaxFacetHits: ").Append(MaxFacetHits).Append("\n"); + sb.Append(" MaxValuesPerFacet: ").Append(MaxValuesPerFacet).Append("\n"); + sb.Append(" SortFacetValuesBy: ").Append(SortFacetValuesBy).Append("\n"); + sb.Append(" AttributeCriteriaComputedByMinProximity: ").Append(AttributeCriteriaComputedByMinProximity).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append(" EnableReRanking: ").Append(EnableReRanking).Append("\n"); + sb.Append(" ReRankingApplyFilter: ").Append(ReRankingApplyFilter).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as IndexSettingsAsSearchParams); + } + + /// + /// Returns true if IndexSettingsAsSearchParams instances are equal + /// + /// Instance of IndexSettingsAsSearchParams to be compared + /// Boolean + public bool Equals(IndexSettingsAsSearchParams input) + { + if (input == null) + { + return false; + } + return + ( + this.AttributesForFaceting == input.AttributesForFaceting || + this.AttributesForFaceting != null && + input.AttributesForFaceting != null && + this.AttributesForFaceting.SequenceEqual(input.AttributesForFaceting) + ) && + ( + this.AttributesToRetrieve == input.AttributesToRetrieve || + this.AttributesToRetrieve != null && + input.AttributesToRetrieve != null && + this.AttributesToRetrieve.SequenceEqual(input.AttributesToRetrieve) + ) && + ( + this.Ranking == input.Ranking || + this.Ranking != null && + input.Ranking != null && + this.Ranking.SequenceEqual(input.Ranking) + ) && + ( + this.CustomRanking == input.CustomRanking || + this.CustomRanking != null && + input.CustomRanking != null && + this.CustomRanking.SequenceEqual(input.CustomRanking) + ) && + ( + this.RelevancyStrictness == input.RelevancyStrictness || + this.RelevancyStrictness.Equals(input.RelevancyStrictness) + ) && + ( + this.AttributesToHighlight == input.AttributesToHighlight || + this.AttributesToHighlight != null && + input.AttributesToHighlight != null && + this.AttributesToHighlight.SequenceEqual(input.AttributesToHighlight) + ) && + ( + this.AttributesToSnippet == input.AttributesToSnippet || + this.AttributesToSnippet != null && + input.AttributesToSnippet != null && + this.AttributesToSnippet.SequenceEqual(input.AttributesToSnippet) + ) && + ( + this.HighlightPreTag == input.HighlightPreTag || + (this.HighlightPreTag != null && + this.HighlightPreTag.Equals(input.HighlightPreTag)) + ) && + ( + this.HighlightPostTag == input.HighlightPostTag || + (this.HighlightPostTag != null && + this.HighlightPostTag.Equals(input.HighlightPostTag)) + ) && + ( + this.SnippetEllipsisText == input.SnippetEllipsisText || + (this.SnippetEllipsisText != null && + this.SnippetEllipsisText.Equals(input.SnippetEllipsisText)) + ) && + ( + this.RestrictHighlightAndSnippetArrays == input.RestrictHighlightAndSnippetArrays || + this.RestrictHighlightAndSnippetArrays.Equals(input.RestrictHighlightAndSnippetArrays) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && + ( + this.MinWordSizefor1Typo == input.MinWordSizefor1Typo || + this.MinWordSizefor1Typo.Equals(input.MinWordSizefor1Typo) + ) && + ( + this.MinWordSizefor2Typos == input.MinWordSizefor2Typos || + this.MinWordSizefor2Typos.Equals(input.MinWordSizefor2Typos) + ) && + ( + this.TypoTolerance == input.TypoTolerance || + (this.TypoTolerance != null && + this.TypoTolerance.Equals(input.TypoTolerance)) + ) && + ( + this.AllowTyposOnNumericTokens == input.AllowTyposOnNumericTokens || + this.AllowTyposOnNumericTokens.Equals(input.AllowTyposOnNumericTokens) + ) && + ( + this.DisableTypoToleranceOnAttributes == input.DisableTypoToleranceOnAttributes || + this.DisableTypoToleranceOnAttributes != null && + input.DisableTypoToleranceOnAttributes != null && + this.DisableTypoToleranceOnAttributes.SequenceEqual(input.DisableTypoToleranceOnAttributes) + ) && + ( + this.IgnorePlurals == input.IgnorePlurals || + (this.IgnorePlurals != null && + this.IgnorePlurals.Equals(input.IgnorePlurals)) + ) && + ( + this.RemoveStopWords == input.RemoveStopWords || + (this.RemoveStopWords != null && + this.RemoveStopWords.Equals(input.RemoveStopWords)) + ) && + ( + this.KeepDiacriticsOnCharacters == input.KeepDiacriticsOnCharacters || + (this.KeepDiacriticsOnCharacters != null && + this.KeepDiacriticsOnCharacters.Equals(input.KeepDiacriticsOnCharacters)) + ) && + ( + this.QueryLanguages == input.QueryLanguages || + this.QueryLanguages != null && + input.QueryLanguages != null && + this.QueryLanguages.SequenceEqual(input.QueryLanguages) + ) && + ( + this.DecompoundQuery == input.DecompoundQuery || + this.DecompoundQuery.Equals(input.DecompoundQuery) + ) && + ( + this.EnableRules == input.EnableRules || + this.EnableRules.Equals(input.EnableRules) + ) && + ( + this.EnablePersonalization == input.EnablePersonalization || + this.EnablePersonalization.Equals(input.EnablePersonalization) + ) && + ( + this.QueryType == input.QueryType || + this.QueryType.Equals(input.QueryType) + ) && + ( + this.RemoveWordsIfNoResults == input.RemoveWordsIfNoResults || + this.RemoveWordsIfNoResults.Equals(input.RemoveWordsIfNoResults) + ) && + ( + this.Mode == input.Mode || + this.Mode.Equals(input.Mode) + ) && + ( + this.SemanticSearch == input.SemanticSearch || + (this.SemanticSearch != null && + this.SemanticSearch.Equals(input.SemanticSearch)) + ) && + ( + this.AdvancedSyntax == input.AdvancedSyntax || + this.AdvancedSyntax.Equals(input.AdvancedSyntax) + ) && + ( + this.OptionalWords == input.OptionalWords || + this.OptionalWords != null && + input.OptionalWords != null && + this.OptionalWords.SequenceEqual(input.OptionalWords) + ) && + ( + this.DisableExactOnAttributes == input.DisableExactOnAttributes || + this.DisableExactOnAttributes != null && + input.DisableExactOnAttributes != null && + this.DisableExactOnAttributes.SequenceEqual(input.DisableExactOnAttributes) + ) && + ( + this.ExactOnSingleWordQuery == input.ExactOnSingleWordQuery || + this.ExactOnSingleWordQuery.Equals(input.ExactOnSingleWordQuery) + ) && + ( + this.AlternativesAsExact == input.AlternativesAsExact || + this.AlternativesAsExact != null && + input.AlternativesAsExact != null && + this.AlternativesAsExact.SequenceEqual(input.AlternativesAsExact) + ) && + ( + this.AdvancedSyntaxFeatures == input.AdvancedSyntaxFeatures || + this.AdvancedSyntaxFeatures != null && + input.AdvancedSyntaxFeatures != null && + this.AdvancedSyntaxFeatures.SequenceEqual(input.AdvancedSyntaxFeatures) + ) && + ( + this.Distinct == input.Distinct || + (this.Distinct != null && + this.Distinct.Equals(input.Distinct)) + ) && + ( + this.ReplaceSynonymsInHighlight == input.ReplaceSynonymsInHighlight || + this.ReplaceSynonymsInHighlight.Equals(input.ReplaceSynonymsInHighlight) + ) && + ( + this.MinProximity == input.MinProximity || + this.MinProximity.Equals(input.MinProximity) + ) && + ( + this.ResponseFields == input.ResponseFields || + this.ResponseFields != null && + input.ResponseFields != null && + this.ResponseFields.SequenceEqual(input.ResponseFields) + ) && + ( + this.MaxFacetHits == input.MaxFacetHits || + this.MaxFacetHits.Equals(input.MaxFacetHits) + ) && + ( + this.MaxValuesPerFacet == input.MaxValuesPerFacet || + this.MaxValuesPerFacet.Equals(input.MaxValuesPerFacet) + ) && + ( + this.SortFacetValuesBy == input.SortFacetValuesBy || + (this.SortFacetValuesBy != null && + this.SortFacetValuesBy.Equals(input.SortFacetValuesBy)) + ) && + ( + this.AttributeCriteriaComputedByMinProximity == input.AttributeCriteriaComputedByMinProximity || + this.AttributeCriteriaComputedByMinProximity.Equals(input.AttributeCriteriaComputedByMinProximity) + ) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ) && + ( + this.EnableReRanking == input.EnableReRanking || + this.EnableReRanking.Equals(input.EnableReRanking) + ) && + ( + this.ReRankingApplyFilter == input.ReRankingApplyFilter || + (this.ReRankingApplyFilter != null && + this.ReRankingApplyFilter.Equals(input.ReRankingApplyFilter)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AttributesForFaceting != null) + { + hashCode = (hashCode * 59) + this.AttributesForFaceting.GetHashCode(); + } + if (this.AttributesToRetrieve != null) + { + hashCode = (hashCode * 59) + this.AttributesToRetrieve.GetHashCode(); + } + if (this.Ranking != null) + { + hashCode = (hashCode * 59) + this.Ranking.GetHashCode(); + } + if (this.CustomRanking != null) + { + hashCode = (hashCode * 59) + this.CustomRanking.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RelevancyStrictness.GetHashCode(); + if (this.AttributesToHighlight != null) + { + hashCode = (hashCode * 59) + this.AttributesToHighlight.GetHashCode(); + } + if (this.AttributesToSnippet != null) + { + hashCode = (hashCode * 59) + this.AttributesToSnippet.GetHashCode(); + } + if (this.HighlightPreTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPreTag.GetHashCode(); + } + if (this.HighlightPostTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPostTag.GetHashCode(); + } + if (this.SnippetEllipsisText != null) + { + hashCode = (hashCode * 59) + this.SnippetEllipsisText.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RestrictHighlightAndSnippetArrays.GetHashCode(); + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor1Typo.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor2Typos.GetHashCode(); + if (this.TypoTolerance != null) + { + hashCode = (hashCode * 59) + this.TypoTolerance.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AllowTyposOnNumericTokens.GetHashCode(); + if (this.DisableTypoToleranceOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableTypoToleranceOnAttributes.GetHashCode(); + } + if (this.IgnorePlurals != null) + { + hashCode = (hashCode * 59) + this.IgnorePlurals.GetHashCode(); + } + if (this.RemoveStopWords != null) + { + hashCode = (hashCode * 59) + this.RemoveStopWords.GetHashCode(); + } + if (this.KeepDiacriticsOnCharacters != null) + { + hashCode = (hashCode * 59) + this.KeepDiacriticsOnCharacters.GetHashCode(); + } + if (this.QueryLanguages != null) + { + hashCode = (hashCode * 59) + this.QueryLanguages.GetHashCode(); + } + hashCode = (hashCode * 59) + this.DecompoundQuery.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableRules.GetHashCode(); + hashCode = (hashCode * 59) + this.EnablePersonalization.GetHashCode(); + hashCode = (hashCode * 59) + this.QueryType.GetHashCode(); + hashCode = (hashCode * 59) + this.RemoveWordsIfNoResults.GetHashCode(); + hashCode = (hashCode * 59) + this.Mode.GetHashCode(); + if (this.SemanticSearch != null) + { + hashCode = (hashCode * 59) + this.SemanticSearch.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AdvancedSyntax.GetHashCode(); + if (this.OptionalWords != null) + { + hashCode = (hashCode * 59) + this.OptionalWords.GetHashCode(); + } + if (this.DisableExactOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableExactOnAttributes.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ExactOnSingleWordQuery.GetHashCode(); + if (this.AlternativesAsExact != null) + { + hashCode = (hashCode * 59) + this.AlternativesAsExact.GetHashCode(); + } + if (this.AdvancedSyntaxFeatures != null) + { + hashCode = (hashCode * 59) + this.AdvancedSyntaxFeatures.GetHashCode(); + } + if (this.Distinct != null) + { + hashCode = (hashCode * 59) + this.Distinct.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ReplaceSynonymsInHighlight.GetHashCode(); + hashCode = (hashCode * 59) + this.MinProximity.GetHashCode(); + if (this.ResponseFields != null) + { + hashCode = (hashCode * 59) + this.ResponseFields.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MaxFacetHits.GetHashCode(); + hashCode = (hashCode * 59) + this.MaxValuesPerFacet.GetHashCode(); + if (this.SortFacetValuesBy != null) + { + hashCode = (hashCode * 59) + this.SortFacetValuesBy.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AttributeCriteriaComputedByMinProximity.GetHashCode(); + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EnableReRanking.GetHashCode(); + if (this.ReRankingApplyFilter != null) + { + hashCode = (hashCode * 59) + this.ReRankingApplyFilter.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + // MinProximity (int) maximum + if (this.MinProximity > (int)7) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value less than or equal to 7.", new[] { "MinProximity" }); + } + + // MinProximity (int) minimum + if (this.MinProximity < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value greater than or equal to 1.", new[] { "MinProximity" }); + } + + // MaxFacetHits (int) maximum + if (this.MaxFacetHits > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MaxFacetHits, must be a value less than or equal to 100.", new[] { "MaxFacetHits" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/Languages.cs b/algoliasearch/Search/Models/Languages.cs new file mode 100644 index 000000000..c199928bc --- /dev/null +++ b/algoliasearch/Search/Models/Languages.cs @@ -0,0 +1,179 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Dictionary language. + /// + [DataContract(Name = "languages")] + public partial class Languages : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Languages() { } + /// + /// Initializes a new instance of the class. + /// + /// plurals (required). + /// stopwords (required). + /// compounds (required). + public Languages(DictionaryLanguage plurals = default(DictionaryLanguage), DictionaryLanguage stopwords = default(DictionaryLanguage), DictionaryLanguage compounds = default(DictionaryLanguage)) + { + // to ensure "plurals" is required (not null) + if (plurals == null) + { + throw new ArgumentNullException("plurals is a required property for Languages and cannot be null"); + } + this.Plurals = plurals; + // to ensure "stopwords" is required (not null) + if (stopwords == null) + { + throw new ArgumentNullException("stopwords is a required property for Languages and cannot be null"); + } + this.Stopwords = stopwords; + // to ensure "compounds" is required (not null) + if (compounds == null) + { + throw new ArgumentNullException("compounds is a required property for Languages and cannot be null"); + } + this.Compounds = compounds; + } + + /// + /// Gets or Sets Plurals + /// + [DataMember(Name = "plurals", IsRequired = true, EmitDefaultValue = true)] + public DictionaryLanguage Plurals { get; set; } + + /// + /// Gets or Sets Stopwords + /// + [DataMember(Name = "stopwords", IsRequired = true, EmitDefaultValue = true)] + public DictionaryLanguage Stopwords { get; set; } + + /// + /// Gets or Sets Compounds + /// + [DataMember(Name = "compounds", IsRequired = true, EmitDefaultValue = true)] + public DictionaryLanguage Compounds { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Languages {\n"); + sb.Append(" Plurals: ").Append(Plurals).Append("\n"); + sb.Append(" Stopwords: ").Append(Stopwords).Append("\n"); + sb.Append(" Compounds: ").Append(Compounds).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Languages); + } + + /// + /// Returns true if Languages instances are equal + /// + /// Instance of Languages to be compared + /// Boolean + public bool Equals(Languages input) + { + if (input == null) + { + return false; + } + return + ( + this.Plurals == input.Plurals || + (this.Plurals != null && + this.Plurals.Equals(input.Plurals)) + ) && + ( + this.Stopwords == input.Stopwords || + (this.Stopwords != null && + this.Stopwords.Equals(input.Stopwords)) + ) && + ( + this.Compounds == input.Compounds || + (this.Compounds != null && + this.Compounds.Equals(input.Compounds)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Plurals != null) + { + hashCode = (hashCode * 59) + this.Plurals.GetHashCode(); + } + if (this.Stopwords != null) + { + hashCode = (hashCode * 59) + this.Stopwords.GetHashCode(); + } + if (this.Compounds != null) + { + hashCode = (hashCode * 59) + this.Compounds.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/ListApiKeysResponse.cs b/algoliasearch/Search/Models/ListApiKeysResponse.cs new file mode 100644 index 000000000..fcc8cc6ae --- /dev/null +++ b/algoliasearch/Search/Models/ListApiKeysResponse.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// ListApiKeysResponse + /// + [DataContract(Name = "listApiKeysResponse")] + public partial class ListApiKeysResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ListApiKeysResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// API keys. (required). + public ListApiKeysResponse(List keys = default(List)) + { + // to ensure "keys" is required (not null) + if (keys == null) + { + throw new ArgumentNullException("keys is a required property for ListApiKeysResponse and cannot be null"); + } + this.Keys = keys; + } + + /// + /// API keys. + /// + /// API keys. + [DataMember(Name = "keys", IsRequired = true, EmitDefaultValue = true)] + public List Keys { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ListApiKeysResponse {\n"); + sb.Append(" Keys: ").Append(Keys).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ListApiKeysResponse); + } + + /// + /// Returns true if ListApiKeysResponse instances are equal + /// + /// Instance of ListApiKeysResponse to be compared + /// Boolean + public bool Equals(ListApiKeysResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Keys == input.Keys || + this.Keys != null && + input.Keys != null && + this.Keys.SequenceEqual(input.Keys) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Keys != null) + { + hashCode = (hashCode * 59) + this.Keys.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/ListClustersResponse.cs b/algoliasearch/Search/Models/ListClustersResponse.cs new file mode 100644 index 000000000..c62f1edff --- /dev/null +++ b/algoliasearch/Search/Models/ListClustersResponse.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Clusters. + /// + [DataContract(Name = "listClustersResponse")] + public partial class ListClustersResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ListClustersResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Key-value pairs with cluster names as keys and lists of users with the highest number of records per cluster as values. (required). + public ListClustersResponse(List topUsers = default(List)) + { + // to ensure "topUsers" is required (not null) + if (topUsers == null) + { + throw new ArgumentNullException("topUsers is a required property for ListClustersResponse and cannot be null"); + } + this.TopUsers = topUsers; + } + + /// + /// Key-value pairs with cluster names as keys and lists of users with the highest number of records per cluster as values. + /// + /// Key-value pairs with cluster names as keys and lists of users with the highest number of records per cluster as values. + [DataMember(Name = "topUsers", IsRequired = true, EmitDefaultValue = true)] + public List TopUsers { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ListClustersResponse {\n"); + sb.Append(" TopUsers: ").Append(TopUsers).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ListClustersResponse); + } + + /// + /// Returns true if ListClustersResponse instances are equal + /// + /// Instance of ListClustersResponse to be compared + /// Boolean + public bool Equals(ListClustersResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.TopUsers == input.TopUsers || + this.TopUsers != null && + input.TopUsers != null && + this.TopUsers.SequenceEqual(input.TopUsers) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.TopUsers != null) + { + hashCode = (hashCode * 59) + this.TopUsers.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/ListIndicesResponse.cs b/algoliasearch/Search/Models/ListIndicesResponse.cs new file mode 100644 index 000000000..ebd9ca31a --- /dev/null +++ b/algoliasearch/Search/Models/ListIndicesResponse.cs @@ -0,0 +1,150 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// ListIndicesResponse + /// + [DataContract(Name = "listIndicesResponse")] + public partial class ListIndicesResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ListIndicesResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// All indices in your Algolia application. (required). + /// Number of pages.. + public ListIndicesResponse(List items = default(List), int nbPages = default(int)) + { + // to ensure "items" is required (not null) + if (items == null) + { + throw new ArgumentNullException("items is a required property for ListIndicesResponse and cannot be null"); + } + this.Items = items; + this.NbPages = nbPages; + } + + /// + /// All indices in your Algolia application. + /// + /// All indices in your Algolia application. + [DataMember(Name = "items", IsRequired = true, EmitDefaultValue = true)] + public List Items { get; set; } + + /// + /// Number of pages. + /// + /// Number of pages. + [DataMember(Name = "nbPages", EmitDefaultValue = false)] + public int NbPages { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ListIndicesResponse {\n"); + sb.Append(" Items: ").Append(Items).Append("\n"); + sb.Append(" NbPages: ").Append(NbPages).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ListIndicesResponse); + } + + /// + /// Returns true if ListIndicesResponse instances are equal + /// + /// Instance of ListIndicesResponse to be compared + /// Boolean + public bool Equals(ListIndicesResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Items == input.Items || + this.Items != null && + input.Items != null && + this.Items.SequenceEqual(input.Items) + ) && + ( + this.NbPages == input.NbPages || + this.NbPages.Equals(input.NbPages) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Items != null) + { + hashCode = (hashCode * 59) + this.Items.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NbPages.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/ListUserIdsResponse.cs b/algoliasearch/Search/Models/ListUserIdsResponse.cs new file mode 100644 index 000000000..5f7c31d93 --- /dev/null +++ b/algoliasearch/Search/Models/ListUserIdsResponse.cs @@ -0,0 +1,135 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// User ID data. + /// + [DataContract(Name = "listUserIdsResponse")] + public partial class ListUserIdsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ListUserIdsResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// User IDs. (required). + public ListUserIdsResponse(List userIDs = default(List)) + { + // to ensure "userIDs" is required (not null) + if (userIDs == null) + { + throw new ArgumentNullException("userIDs is a required property for ListUserIdsResponse and cannot be null"); + } + this.UserIDs = userIDs; + } + + /// + /// User IDs. + /// + /// User IDs. + [DataMember(Name = "userIDs", IsRequired = true, EmitDefaultValue = true)] + public List UserIDs { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ListUserIdsResponse {\n"); + sb.Append(" UserIDs: ").Append(UserIDs).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ListUserIdsResponse); + } + + /// + /// Returns true if ListUserIdsResponse instances are equal + /// + /// Instance of ListUserIdsResponse to be compared + /// Boolean + public bool Equals(ListUserIdsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.UserIDs == input.UserIDs || + this.UserIDs != null && + input.UserIDs != null && + this.UserIDs.SequenceEqual(input.UserIDs) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.UserIDs != null) + { + hashCode = (hashCode * 59) + this.UserIDs.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/Log.cs b/algoliasearch/Search/Models/Log.cs new file mode 100644 index 000000000..e4a6c6e35 --- /dev/null +++ b/algoliasearch/Search/Models/Log.cs @@ -0,0 +1,451 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Log + /// + [DataContract(Name = "log")] + public partial class Log : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Log() { } + /// + /// Initializes a new instance of the class. + /// + /// Timestamp in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + /// HTTP method of the performed request. (required). + /// HTTP response code. (required). + /// Request body. Truncated after 1,000 characters. (required). + /// Answer body. Truncated after 1,000 characters. (required). + /// Request URL. (required). + /// IP address of the client that performed the request. (required). + /// Request headers (API key is obfuscated). (required). + /// SHA1 signature of the log entry. (required). + /// Number of API calls. (required). + /// Processing time for the query. Doesn't include network time. (required). + /// Index targeted by the query.. + /// Query parameters sent with the request.. + /// Number of hits returned for the query.. + /// Performed queries for the given request.. + public Log(string timestamp = default(string), string method = default(string), string answerCode = default(string), string queryBody = default(string), string answer = default(string), string url = default(string), string ip = default(string), string queryHeaders = default(string), string sha1 = default(string), string nbApiCalls = default(string), string processingTimeMs = default(string), string index = default(string), string queryParams = default(string), string queryNbHits = default(string), List innerQueries = default(List)) + { + // to ensure "timestamp" is required (not null) + if (timestamp == null) + { + throw new ArgumentNullException("timestamp is a required property for Log and cannot be null"); + } + this.Timestamp = timestamp; + // to ensure "method" is required (not null) + if (method == null) + { + throw new ArgumentNullException("method is a required property for Log and cannot be null"); + } + this.Method = method; + // to ensure "answerCode" is required (not null) + if (answerCode == null) + { + throw new ArgumentNullException("answerCode is a required property for Log and cannot be null"); + } + this.AnswerCode = answerCode; + // to ensure "queryBody" is required (not null) + if (queryBody == null) + { + throw new ArgumentNullException("queryBody is a required property for Log and cannot be null"); + } + this.QueryBody = queryBody; + // to ensure "answer" is required (not null) + if (answer == null) + { + throw new ArgumentNullException("answer is a required property for Log and cannot be null"); + } + this.Answer = answer; + // to ensure "url" is required (not null) + if (url == null) + { + throw new ArgumentNullException("url is a required property for Log and cannot be null"); + } + this.Url = url; + // to ensure "ip" is required (not null) + if (ip == null) + { + throw new ArgumentNullException("ip is a required property for Log and cannot be null"); + } + this.Ip = ip; + // to ensure "queryHeaders" is required (not null) + if (queryHeaders == null) + { + throw new ArgumentNullException("queryHeaders is a required property for Log and cannot be null"); + } + this.QueryHeaders = queryHeaders; + // to ensure "sha1" is required (not null) + if (sha1 == null) + { + throw new ArgumentNullException("sha1 is a required property for Log and cannot be null"); + } + this.Sha1 = sha1; + // to ensure "nbApiCalls" is required (not null) + if (nbApiCalls == null) + { + throw new ArgumentNullException("nbApiCalls is a required property for Log and cannot be null"); + } + this.NbApiCalls = nbApiCalls; + // to ensure "processingTimeMs" is required (not null) + if (processingTimeMs == null) + { + throw new ArgumentNullException("processingTimeMs is a required property for Log and cannot be null"); + } + this.ProcessingTimeMs = processingTimeMs; + this.Index = index; + this.QueryParams = queryParams; + this.QueryNbHits = queryNbHits; + this.InnerQueries = innerQueries; + } + + /// + /// Timestamp in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "timestamp", IsRequired = true, EmitDefaultValue = true)] + public string Timestamp { get; set; } + + /// + /// HTTP method of the performed request. + /// + /// HTTP method of the performed request. + [DataMember(Name = "method", IsRequired = true, EmitDefaultValue = true)] + public string Method { get; set; } + + /// + /// HTTP response code. + /// + /// HTTP response code. + [DataMember(Name = "answer_code", IsRequired = true, EmitDefaultValue = true)] + public string AnswerCode { get; set; } + + /// + /// Request body. Truncated after 1,000 characters. + /// + /// Request body. Truncated after 1,000 characters. + [DataMember(Name = "query_body", IsRequired = true, EmitDefaultValue = true)] + public string QueryBody { get; set; } + + /// + /// Answer body. Truncated after 1,000 characters. + /// + /// Answer body. Truncated after 1,000 characters. + [DataMember(Name = "answer", IsRequired = true, EmitDefaultValue = true)] + public string Answer { get; set; } + + /// + /// Request URL. + /// + /// Request URL. + [DataMember(Name = "url", IsRequired = true, EmitDefaultValue = true)] + public string Url { get; set; } + + /// + /// IP address of the client that performed the request. + /// + /// IP address of the client that performed the request. + [DataMember(Name = "ip", IsRequired = true, EmitDefaultValue = true)] + public string Ip { get; set; } + + /// + /// Request headers (API key is obfuscated). + /// + /// Request headers (API key is obfuscated). + [DataMember(Name = "query_headers", IsRequired = true, EmitDefaultValue = true)] + public string QueryHeaders { get; set; } + + /// + /// SHA1 signature of the log entry. + /// + /// SHA1 signature of the log entry. + [DataMember(Name = "sha1", IsRequired = true, EmitDefaultValue = true)] + public string Sha1 { get; set; } + + /// + /// Number of API calls. + /// + /// Number of API calls. + [DataMember(Name = "nb_api_calls", IsRequired = true, EmitDefaultValue = true)] + public string NbApiCalls { get; set; } + + /// + /// Processing time for the query. Doesn't include network time. + /// + /// Processing time for the query. Doesn't include network time. + [DataMember(Name = "processing_time_ms", IsRequired = true, EmitDefaultValue = true)] + public string ProcessingTimeMs { get; set; } + + /// + /// Index targeted by the query. + /// + /// Index targeted by the query. + [DataMember(Name = "index", EmitDefaultValue = false)] + public string Index { get; set; } + + /// + /// Query parameters sent with the request. + /// + /// Query parameters sent with the request. + [DataMember(Name = "query_params", EmitDefaultValue = false)] + public string QueryParams { get; set; } + + /// + /// Number of hits returned for the query. + /// + /// Number of hits returned for the query. + [DataMember(Name = "query_nb_hits", EmitDefaultValue = false)] + public string QueryNbHits { get; set; } + + /// + /// Performed queries for the given request. + /// + /// Performed queries for the given request. + [DataMember(Name = "inner_queries", EmitDefaultValue = false)] + public List InnerQueries { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Log {\n"); + sb.Append(" Timestamp: ").Append(Timestamp).Append("\n"); + sb.Append(" Method: ").Append(Method).Append("\n"); + sb.Append(" AnswerCode: ").Append(AnswerCode).Append("\n"); + sb.Append(" QueryBody: ").Append(QueryBody).Append("\n"); + sb.Append(" Answer: ").Append(Answer).Append("\n"); + sb.Append(" Url: ").Append(Url).Append("\n"); + sb.Append(" Ip: ").Append(Ip).Append("\n"); + sb.Append(" QueryHeaders: ").Append(QueryHeaders).Append("\n"); + sb.Append(" Sha1: ").Append(Sha1).Append("\n"); + sb.Append(" NbApiCalls: ").Append(NbApiCalls).Append("\n"); + sb.Append(" ProcessingTimeMs: ").Append(ProcessingTimeMs).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" QueryParams: ").Append(QueryParams).Append("\n"); + sb.Append(" QueryNbHits: ").Append(QueryNbHits).Append("\n"); + sb.Append(" InnerQueries: ").Append(InnerQueries).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Log); + } + + /// + /// Returns true if Log instances are equal + /// + /// Instance of Log to be compared + /// Boolean + public bool Equals(Log input) + { + if (input == null) + { + return false; + } + return + ( + this.Timestamp == input.Timestamp || + (this.Timestamp != null && + this.Timestamp.Equals(input.Timestamp)) + ) && + ( + this.Method == input.Method || + (this.Method != null && + this.Method.Equals(input.Method)) + ) && + ( + this.AnswerCode == input.AnswerCode || + (this.AnswerCode != null && + this.AnswerCode.Equals(input.AnswerCode)) + ) && + ( + this.QueryBody == input.QueryBody || + (this.QueryBody != null && + this.QueryBody.Equals(input.QueryBody)) + ) && + ( + this.Answer == input.Answer || + (this.Answer != null && + this.Answer.Equals(input.Answer)) + ) && + ( + this.Url == input.Url || + (this.Url != null && + this.Url.Equals(input.Url)) + ) && + ( + this.Ip == input.Ip || + (this.Ip != null && + this.Ip.Equals(input.Ip)) + ) && + ( + this.QueryHeaders == input.QueryHeaders || + (this.QueryHeaders != null && + this.QueryHeaders.Equals(input.QueryHeaders)) + ) && + ( + this.Sha1 == input.Sha1 || + (this.Sha1 != null && + this.Sha1.Equals(input.Sha1)) + ) && + ( + this.NbApiCalls == input.NbApiCalls || + (this.NbApiCalls != null && + this.NbApiCalls.Equals(input.NbApiCalls)) + ) && + ( + this.ProcessingTimeMs == input.ProcessingTimeMs || + (this.ProcessingTimeMs != null && + this.ProcessingTimeMs.Equals(input.ProcessingTimeMs)) + ) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && + ( + this.QueryParams == input.QueryParams || + (this.QueryParams != null && + this.QueryParams.Equals(input.QueryParams)) + ) && + ( + this.QueryNbHits == input.QueryNbHits || + (this.QueryNbHits != null && + this.QueryNbHits.Equals(input.QueryNbHits)) + ) && + ( + this.InnerQueries == input.InnerQueries || + this.InnerQueries != null && + input.InnerQueries != null && + this.InnerQueries.SequenceEqual(input.InnerQueries) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Timestamp != null) + { + hashCode = (hashCode * 59) + this.Timestamp.GetHashCode(); + } + if (this.Method != null) + { + hashCode = (hashCode * 59) + this.Method.GetHashCode(); + } + if (this.AnswerCode != null) + { + hashCode = (hashCode * 59) + this.AnswerCode.GetHashCode(); + } + if (this.QueryBody != null) + { + hashCode = (hashCode * 59) + this.QueryBody.GetHashCode(); + } + if (this.Answer != null) + { + hashCode = (hashCode * 59) + this.Answer.GetHashCode(); + } + if (this.Url != null) + { + hashCode = (hashCode * 59) + this.Url.GetHashCode(); + } + if (this.Ip != null) + { + hashCode = (hashCode * 59) + this.Ip.GetHashCode(); + } + if (this.QueryHeaders != null) + { + hashCode = (hashCode * 59) + this.QueryHeaders.GetHashCode(); + } + if (this.Sha1 != null) + { + hashCode = (hashCode * 59) + this.Sha1.GetHashCode(); + } + if (this.NbApiCalls != null) + { + hashCode = (hashCode * 59) + this.NbApiCalls.GetHashCode(); + } + if (this.ProcessingTimeMs != null) + { + hashCode = (hashCode * 59) + this.ProcessingTimeMs.GetHashCode(); + } + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.QueryParams != null) + { + hashCode = (hashCode * 59) + this.QueryParams.GetHashCode(); + } + if (this.QueryNbHits != null) + { + hashCode = (hashCode * 59) + this.QueryNbHits.GetHashCode(); + } + if (this.InnerQueries != null) + { + hashCode = (hashCode * 59) + this.InnerQueries.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/LogQuery.cs b/algoliasearch/Search/Models/LogQuery.cs new file mode 100644 index 000000000..a453fed8a --- /dev/null +++ b/algoliasearch/Search/Models/LogQuery.cs @@ -0,0 +1,162 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// LogQuery + /// + [DataContract(Name = "logQuery")] + public partial class LogQuery : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Index targeted by the query.. + /// User identifier.. + /// Unique query identifier.. + public LogQuery(string indexName = default(string), string userToken = default(string), string queryId = default(string)) + { + this.IndexName = indexName; + this.UserToken = userToken; + this.QueryId = queryId; + } + + /// + /// Index targeted by the query. + /// + /// Index targeted by the query. + [DataMember(Name = "index_name", EmitDefaultValue = false)] + public string IndexName { get; set; } + + /// + /// User identifier. + /// + /// User identifier. + [DataMember(Name = "user_token", EmitDefaultValue = false)] + public string UserToken { get; set; } + + /// + /// Unique query identifier. + /// + /// Unique query identifier. + [DataMember(Name = "query_id", EmitDefaultValue = false)] + public string QueryId { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LogQuery {\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" QueryId: ").Append(QueryId).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as LogQuery); + } + + /// + /// Returns true if LogQuery instances are equal + /// + /// Instance of LogQuery to be compared + /// Boolean + public bool Equals(LogQuery input) + { + if (input == null) + { + return false; + } + return + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.QueryId == input.QueryId || + (this.QueryId != null && + this.QueryId.Equals(input.QueryId)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + if (this.QueryId != null) + { + hashCode = (hashCode * 59) + this.QueryId.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/LogType.cs b/algoliasearch/Search/Models/LogType.cs new file mode 100644 index 000000000..aa1539f3d --- /dev/null +++ b/algoliasearch/Search/Models/LogType.cs @@ -0,0 +1,54 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Defines logType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum LogType + { + /// + /// Enum All for value: all + /// + [EnumMember(Value = "all")] + All = 1, + + /// + /// Enum Query for value: query + /// + [EnumMember(Value = "query")] + Query = 2, + + /// + /// Enum Build for value: build + /// + [EnumMember(Value = "build")] + Build = 3, + + /// + /// Enum Error for value: error + /// + [EnumMember(Value = "error")] + Error = 4 + } + +} diff --git a/algoliasearch/Search/Models/MatchLevel.cs b/algoliasearch/Search/Models/MatchLevel.cs new file mode 100644 index 000000000..6fb045222 --- /dev/null +++ b/algoliasearch/Search/Models/MatchLevel.cs @@ -0,0 +1,49 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Indicates how well the attribute matched the search query. + /// + /// Indicates how well the attribute matched the search query. + [JsonConverter(typeof(StringEnumConverter))] + public enum MatchLevel + { + /// + /// Enum None for value: none + /// + [EnumMember(Value = "none")] + None = 1, + + /// + /// Enum Partial for value: partial + /// + [EnumMember(Value = "partial")] + Partial = 2, + + /// + /// Enum Full for value: full + /// + [EnumMember(Value = "full")] + Full = 3 + } + +} diff --git a/algoliasearch/Search/Models/MatchedGeoLocation.cs b/algoliasearch/Search/Models/MatchedGeoLocation.cs new file mode 100644 index 000000000..9120cfeee --- /dev/null +++ b/algoliasearch/Search/Models/MatchedGeoLocation.cs @@ -0,0 +1,150 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// MatchedGeoLocation + /// + [DataContract(Name = "matchedGeoLocation")] + public partial class MatchedGeoLocation : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Latitude of the matched location.. + /// Longitude of the matched location.. + /// Distance between the matched location and the search location (in meters).. + public MatchedGeoLocation(double lat = default(double), double lng = default(double), int distance = default(int)) + { + this.Lat = lat; + this.Lng = lng; + this.Distance = distance; + } + + /// + /// Latitude of the matched location. + /// + /// Latitude of the matched location. + [DataMember(Name = "lat", EmitDefaultValue = false)] + public double Lat { get; set; } + + /// + /// Longitude of the matched location. + /// + /// Longitude of the matched location. + [DataMember(Name = "lng", EmitDefaultValue = false)] + public double Lng { get; set; } + + /// + /// Distance between the matched location and the search location (in meters). + /// + /// Distance between the matched location and the search location (in meters). + [DataMember(Name = "distance", EmitDefaultValue = false)] + public int Distance { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MatchedGeoLocation {\n"); + sb.Append(" Lat: ").Append(Lat).Append("\n"); + sb.Append(" Lng: ").Append(Lng).Append("\n"); + sb.Append(" Distance: ").Append(Distance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as MatchedGeoLocation); + } + + /// + /// Returns true if MatchedGeoLocation instances are equal + /// + /// Instance of MatchedGeoLocation to be compared + /// Boolean + public bool Equals(MatchedGeoLocation input) + { + if (input == null) + { + return false; + } + return + ( + this.Lat == input.Lat || + this.Lat.Equals(input.Lat) + ) && + ( + this.Lng == input.Lng || + this.Lng.Equals(input.Lng) + ) && + ( + this.Distance == input.Distance || + this.Distance.Equals(input.Distance) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Lat.GetHashCode(); + hashCode = (hashCode * 59) + this.Lng.GetHashCode(); + hashCode = (hashCode * 59) + this.Distance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/MixedSearchFilters.cs b/algoliasearch/Search/Models/MixedSearchFilters.cs new file mode 100644 index 000000000..b4dafe1ac --- /dev/null +++ b/algoliasearch/Search/Models/MixedSearchFilters.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// MixedSearchFilters + /// + [JsonConverter(typeof(MixedSearchFiltersJsonConverter))] + [DataContract(Name = "mixedSearchFilters")] + public partial class MixedSearchFilters : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<string>. + public MixedSearchFilters(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public MixedSearchFilters(string actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, string"); + } + } + } + + /// + /// Get the actual instance of `List<string>`. If the actual instance is not `List<string>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<string> + public List GetterListString() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class MixedSearchFilters {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, MixedSearchFilters.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of MixedSearchFilters + /// + /// JSON string + /// An instance of MixedSearchFilters + public static MixedSearchFilters FromJson(string jsonString) + { + MixedSearchFilters newMixedSearchFilters = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newMixedSearchFilters; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newMixedSearchFilters = new MixedSearchFilters(JsonConvert.DeserializeObject>(jsonString, MixedSearchFilters.SerializerSettings)); + } + else + { + newMixedSearchFilters = new MixedSearchFilters(JsonConvert.DeserializeObject>(jsonString, MixedSearchFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newMixedSearchFilters = new MixedSearchFilters(JsonConvert.DeserializeObject(jsonString, MixedSearchFilters.SerializerSettings)); + } + else + { + newMixedSearchFilters = new MixedSearchFilters(JsonConvert.DeserializeObject(jsonString, MixedSearchFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newMixedSearchFilters; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as MixedSearchFilters); + } + + /// + /// Returns true if MixedSearchFilters instances are equal + /// + /// Instance of MixedSearchFilters to be compared + /// Boolean + public bool Equals(MixedSearchFilters input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for MixedSearchFilters + /// + public class MixedSearchFiltersJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(MixedSearchFilters).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return MixedSearchFilters.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/Mode.cs b/algoliasearch/Search/Models/Mode.cs new file mode 100644 index 000000000..9fd349b70 --- /dev/null +++ b/algoliasearch/Search/Models/Mode.cs @@ -0,0 +1,43 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Search mode the index will use to query for results. + /// + /// Search mode the index will use to query for results. + [JsonConverter(typeof(StringEnumConverter))] + public enum Mode + { + /// + /// Enum NeuralSearch for value: neuralSearch + /// + [EnumMember(Value = "neuralSearch")] + NeuralSearch = 1, + + /// + /// Enum KeywordSearch for value: keywordSearch + /// + [EnumMember(Value = "keywordSearch")] + KeywordSearch = 2 + } + +} diff --git a/algoliasearch/Search/Models/MultipleBatchRequest.cs b/algoliasearch/Search/Models/MultipleBatchRequest.cs new file mode 100644 index 000000000..9b08994db --- /dev/null +++ b/algoliasearch/Search/Models/MultipleBatchRequest.cs @@ -0,0 +1,172 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// MultipleBatchRequest + /// + [DataContract(Name = "multipleBatchRequest")] + public partial class MultipleBatchRequest : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Action + /// + [DataMember(Name = "action", IsRequired = true, EmitDefaultValue = true)] + public Action Action { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected MultipleBatchRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// action (required). + /// Operation arguments (varies with specified `action`). (required). + /// Index to target for this operation. (required). + public MultipleBatchRequest(Action action = default(Action), Object body = default(Object), string indexName = default(string)) + { + this.Action = action; + // to ensure "body" is required (not null) + if (body == null) + { + throw new ArgumentNullException("body is a required property for MultipleBatchRequest and cannot be null"); + } + this.Body = body; + // to ensure "indexName" is required (not null) + if (indexName == null) + { + throw new ArgumentNullException("indexName is a required property for MultipleBatchRequest and cannot be null"); + } + this.IndexName = indexName; + } + + /// + /// Operation arguments (varies with specified `action`). + /// + /// Operation arguments (varies with specified `action`). + [DataMember(Name = "body", IsRequired = true, EmitDefaultValue = true)] + public Object Body { get; set; } + + /// + /// Index to target for this operation. + /// + /// Index to target for this operation. + [DataMember(Name = "indexName", IsRequired = true, EmitDefaultValue = true)] + public string IndexName { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MultipleBatchRequest {\n"); + sb.Append(" Action: ").Append(Action).Append("\n"); + sb.Append(" Body: ").Append(Body).Append("\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as MultipleBatchRequest); + } + + /// + /// Returns true if MultipleBatchRequest instances are equal + /// + /// Instance of MultipleBatchRequest to be compared + /// Boolean + public bool Equals(MultipleBatchRequest input) + { + if (input == null) + { + return false; + } + return + ( + this.Action == input.Action || + this.Action.Equals(input.Action) + ) && + ( + this.Body == input.Body || + (this.Body != null && + this.Body.Equals(input.Body)) + ) && + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Action.GetHashCode(); + if (this.Body != null) + { + hashCode = (hashCode * 59) + this.Body.GetHashCode(); + } + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/MultipleBatchResponse.cs b/algoliasearch/Search/Models/MultipleBatchResponse.cs new file mode 100644 index 000000000..eb47760ee --- /dev/null +++ b/algoliasearch/Search/Models/MultipleBatchResponse.cs @@ -0,0 +1,160 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// MultipleBatchResponse + /// + [DataContract(Name = "multipleBatchResponse")] + public partial class MultipleBatchResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected MultipleBatchResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// TaskIDs per index. (required). + /// Unique object (record) identifiers. (required). + public MultipleBatchResponse(Dictionary taskID = default(Dictionary), List objectIDs = default(List)) + { + // to ensure "taskID" is required (not null) + if (taskID == null) + { + throw new ArgumentNullException("taskID is a required property for MultipleBatchResponse and cannot be null"); + } + this.TaskID = taskID; + // to ensure "objectIDs" is required (not null) + if (objectIDs == null) + { + throw new ArgumentNullException("objectIDs is a required property for MultipleBatchResponse and cannot be null"); + } + this.ObjectIDs = objectIDs; + } + + /// + /// TaskIDs per index. + /// + /// TaskIDs per index. + [DataMember(Name = "taskID", IsRequired = true, EmitDefaultValue = true)] + public Dictionary TaskID { get; set; } + + /// + /// Unique object (record) identifiers. + /// + /// Unique object (record) identifiers. + [DataMember(Name = "objectIDs", IsRequired = true, EmitDefaultValue = true)] + public List ObjectIDs { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MultipleBatchResponse {\n"); + sb.Append(" TaskID: ").Append(TaskID).Append("\n"); + sb.Append(" ObjectIDs: ").Append(ObjectIDs).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as MultipleBatchResponse); + } + + /// + /// Returns true if MultipleBatchResponse instances are equal + /// + /// Instance of MultipleBatchResponse to be compared + /// Boolean + public bool Equals(MultipleBatchResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.TaskID == input.TaskID || + this.TaskID != null && + input.TaskID != null && + this.TaskID.SequenceEqual(input.TaskID) + ) && + ( + this.ObjectIDs == input.ObjectIDs || + this.ObjectIDs != null && + input.ObjectIDs != null && + this.ObjectIDs.SequenceEqual(input.ObjectIDs) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.TaskID != null) + { + hashCode = (hashCode * 59) + this.TaskID.GetHashCode(); + } + if (this.ObjectIDs != null) + { + hashCode = (hashCode * 59) + this.ObjectIDs.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/NumericFilters.cs b/algoliasearch/Search/Models/NumericFilters.cs new file mode 100644 index 000000000..0061f032b --- /dev/null +++ b/algoliasearch/Search/Models/NumericFilters.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// [Filter on numeric attributes](https://www.algolia.com/doc/api-reference/api-parameters/numericFilters/). + /// + [JsonConverter(typeof(NumericFiltersJsonConverter))] + [DataContract(Name = "numericFilters")] + public partial class NumericFilters : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<MixedSearchFilters>. + public NumericFilters(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public NumericFilters(string actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, string"); + } + } + } + + /// + /// Get the actual instance of `List<MixedSearchFilters>`. If the actual instance is not `List<MixedSearchFilters>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<MixedSearchFilters> + public List GetterList() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class NumericFilters {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, NumericFilters.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of NumericFilters + /// + /// JSON string + /// An instance of NumericFilters + public static NumericFilters FromJson(string jsonString) + { + NumericFilters newNumericFilters = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newNumericFilters; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newNumericFilters = new NumericFilters(JsonConvert.DeserializeObject>(jsonString, NumericFilters.SerializerSettings)); + } + else + { + newNumericFilters = new NumericFilters(JsonConvert.DeserializeObject>(jsonString, NumericFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newNumericFilters = new NumericFilters(JsonConvert.DeserializeObject(jsonString, NumericFilters.SerializerSettings)); + } + else + { + newNumericFilters = new NumericFilters(JsonConvert.DeserializeObject(jsonString, NumericFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newNumericFilters; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as NumericFilters); + } + + /// + /// Returns true if NumericFilters instances are equal + /// + /// Instance of NumericFilters to be compared + /// Boolean + public bool Equals(NumericFilters input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for NumericFilters + /// + public class NumericFiltersJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(NumericFilters).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return NumericFilters.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/OperationIndexParams.cs b/algoliasearch/Search/Models/OperationIndexParams.cs new file mode 100644 index 000000000..7d0c2c9a8 --- /dev/null +++ b/algoliasearch/Search/Models/OperationIndexParams.cs @@ -0,0 +1,168 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// OperationIndexParams + /// + [DataContract(Name = "operationIndexParams")] + public partial class OperationIndexParams : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Operation + /// + [DataMember(Name = "operation", IsRequired = true, EmitDefaultValue = true)] + public OperationType Operation { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected OperationIndexParams() { } + /// + /// Initializes a new instance of the class. + /// + /// operation (required). + /// Algolia index name. (required). + /// **This only applies to the _copy_ operation.** If you omit `scope`, the copy command copies all records, settings, synonyms, and rules. If you specify `scope`, only the specified scopes are copied.. + public OperationIndexParams(OperationType operation = default(OperationType), string destination = default(string), List scope = default(List)) + { + this.Operation = operation; + // to ensure "destination" is required (not null) + if (destination == null) + { + throw new ArgumentNullException("destination is a required property for OperationIndexParams and cannot be null"); + } + this.Destination = destination; + this.Scope = scope; + } + + /// + /// Algolia index name. + /// + /// Algolia index name. + [DataMember(Name = "destination", IsRequired = true, EmitDefaultValue = true)] + public string Destination { get; set; } + + /// + /// **This only applies to the _copy_ operation.** If you omit `scope`, the copy command copies all records, settings, synonyms, and rules. If you specify `scope`, only the specified scopes are copied. + /// + /// **This only applies to the _copy_ operation.** If you omit `scope`, the copy command copies all records, settings, synonyms, and rules. If you specify `scope`, only the specified scopes are copied. + [DataMember(Name = "scope", EmitDefaultValue = false)] + public List Scope { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OperationIndexParams {\n"); + sb.Append(" Operation: ").Append(Operation).Append("\n"); + sb.Append(" Destination: ").Append(Destination).Append("\n"); + sb.Append(" Scope: ").Append(Scope).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as OperationIndexParams); + } + + /// + /// Returns true if OperationIndexParams instances are equal + /// + /// Instance of OperationIndexParams to be compared + /// Boolean + public bool Equals(OperationIndexParams input) + { + if (input == null) + { + return false; + } + return + ( + this.Operation == input.Operation || + this.Operation.Equals(input.Operation) + ) && + ( + this.Destination == input.Destination || + (this.Destination != null && + this.Destination.Equals(input.Destination)) + ) && + ( + this.Scope == input.Scope || + this.Scope != null && + input.Scope != null && + this.Scope.SequenceEqual(input.Scope) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Operation.GetHashCode(); + if (this.Destination != null) + { + hashCode = (hashCode * 59) + this.Destination.GetHashCode(); + } + if (this.Scope != null) + { + hashCode = (hashCode * 59) + this.Scope.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/OperationType.cs b/algoliasearch/Search/Models/OperationType.cs new file mode 100644 index 000000000..4b12f40f6 --- /dev/null +++ b/algoliasearch/Search/Models/OperationType.cs @@ -0,0 +1,43 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Operation to perform (_move_ or _copy_). + /// + /// Operation to perform (_move_ or _copy_). + [JsonConverter(typeof(StringEnumConverter))] + public enum OperationType + { + /// + /// Enum Move for value: move + /// + [EnumMember(Value = "move")] + Move = 1, + + /// + /// Enum Copy for value: copy + /// + [EnumMember(Value = "copy")] + Copy = 2 + } + +} diff --git a/algoliasearch/Search/Models/OptionalFilters.cs b/algoliasearch/Search/Models/OptionalFilters.cs new file mode 100644 index 000000000..a10c61a86 --- /dev/null +++ b/algoliasearch/Search/Models/OptionalFilters.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// Create filters to boost or demote records. Records that match the filter are ranked higher for positive and lower for negative optional filters. In contrast to regular filters, records that don't match the optional filter are still included in the results, only their ranking is affected. + /// + [JsonConverter(typeof(OptionalFiltersJsonConverter))] + [DataContract(Name = "optionalFilters")] + public partial class OptionalFilters : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<MixedSearchFilters>. + public OptionalFilters(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public OptionalFilters(string actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, string"); + } + } + } + + /// + /// Get the actual instance of `List<MixedSearchFilters>`. If the actual instance is not `List<MixedSearchFilters>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<MixedSearchFilters> + public List GetterList() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class OptionalFilters {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, OptionalFilters.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of OptionalFilters + /// + /// JSON string + /// An instance of OptionalFilters + public static OptionalFilters FromJson(string jsonString) + { + OptionalFilters newOptionalFilters = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newOptionalFilters; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newOptionalFilters = new OptionalFilters(JsonConvert.DeserializeObject>(jsonString, OptionalFilters.SerializerSettings)); + } + else + { + newOptionalFilters = new OptionalFilters(JsonConvert.DeserializeObject>(jsonString, OptionalFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newOptionalFilters = new OptionalFilters(JsonConvert.DeserializeObject(jsonString, OptionalFilters.SerializerSettings)); + } + else + { + newOptionalFilters = new OptionalFilters(JsonConvert.DeserializeObject(jsonString, OptionalFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newOptionalFilters; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as OptionalFilters); + } + + /// + /// Returns true if OptionalFilters instances are equal + /// + /// Instance of OptionalFilters to be compared + /// Boolean + public bool Equals(OptionalFilters input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for OptionalFilters + /// + public class OptionalFiltersJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(OptionalFilters).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return OptionalFilters.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/Params.cs b/algoliasearch/Search/Models/Params.cs new file mode 100644 index 000000000..7c23e9af3 --- /dev/null +++ b/algoliasearch/Search/Models/Params.cs @@ -0,0 +1,177 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Additional search parameters. + /// + [DataContract(Name = "varParams")] + public partial class Params : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// query. + /// automaticFacetFilters. + /// automaticOptionalFacetFilters. + /// renderingContent. + public Params(ConsequenceQuery query = default(ConsequenceQuery), AutomaticFacetFilters automaticFacetFilters = default(AutomaticFacetFilters), AutomaticFacetFilters automaticOptionalFacetFilters = default(AutomaticFacetFilters), RenderingContent renderingContent = default(RenderingContent)) + { + this.Query = query; + this.AutomaticFacetFilters = automaticFacetFilters; + this.AutomaticOptionalFacetFilters = automaticOptionalFacetFilters; + this.RenderingContent = renderingContent; + } + + /// + /// Gets or Sets Query + /// + [DataMember(Name = "query", EmitDefaultValue = false)] + public ConsequenceQuery Query { get; set; } + + /// + /// Gets or Sets AutomaticFacetFilters + /// + [DataMember(Name = "automaticFacetFilters", EmitDefaultValue = false)] + public AutomaticFacetFilters AutomaticFacetFilters { get; set; } + + /// + /// Gets or Sets AutomaticOptionalFacetFilters + /// + [DataMember(Name = "automaticOptionalFacetFilters", EmitDefaultValue = false)] + public AutomaticFacetFilters AutomaticOptionalFacetFilters { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Params {\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" AutomaticFacetFilters: ").Append(AutomaticFacetFilters).Append("\n"); + sb.Append(" AutomaticOptionalFacetFilters: ").Append(AutomaticOptionalFacetFilters).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Params); + } + + /// + /// Returns true if Params instances are equal + /// + /// Instance of Params to be compared + /// Boolean + public bool Equals(Params input) + { + if (input == null) + { + return false; + } + return + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.AutomaticFacetFilters == input.AutomaticFacetFilters || + (this.AutomaticFacetFilters != null && + this.AutomaticFacetFilters.Equals(input.AutomaticFacetFilters)) + ) && + ( + this.AutomaticOptionalFacetFilters == input.AutomaticOptionalFacetFilters || + (this.AutomaticOptionalFacetFilters != null && + this.AutomaticOptionalFacetFilters.Equals(input.AutomaticOptionalFacetFilters)) + ) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.AutomaticFacetFilters != null) + { + hashCode = (hashCode * 59) + this.AutomaticFacetFilters.GetHashCode(); + } + if (this.AutomaticOptionalFacetFilters != null) + { + hashCode = (hashCode * 59) + this.AutomaticOptionalFacetFilters.GetHashCode(); + } + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/Personalization.cs b/algoliasearch/Search/Models/Personalization.cs new file mode 100644 index 000000000..e2341e6c5 --- /dev/null +++ b/algoliasearch/Search/Models/Personalization.cs @@ -0,0 +1,150 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Personalization + /// + [DataContract(Name = "personalization")] + public partial class Personalization : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// The score of the filters.. + /// The score of the ranking.. + /// The score of the event.. + public Personalization(int filtersScore = default(int), int rankingScore = default(int), int score = default(int)) + { + this.FiltersScore = filtersScore; + this.RankingScore = rankingScore; + this.Score = score; + } + + /// + /// The score of the filters. + /// + /// The score of the filters. + [DataMember(Name = "filtersScore", EmitDefaultValue = false)] + public int FiltersScore { get; set; } + + /// + /// The score of the ranking. + /// + /// The score of the ranking. + [DataMember(Name = "rankingScore", EmitDefaultValue = false)] + public int RankingScore { get; set; } + + /// + /// The score of the event. + /// + /// The score of the event. + [DataMember(Name = "score", EmitDefaultValue = false)] + public int Score { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Personalization {\n"); + sb.Append(" FiltersScore: ").Append(FiltersScore).Append("\n"); + sb.Append(" RankingScore: ").Append(RankingScore).Append("\n"); + sb.Append(" Score: ").Append(Score).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Personalization); + } + + /// + /// Returns true if Personalization instances are equal + /// + /// Instance of Personalization to be compared + /// Boolean + public bool Equals(Personalization input) + { + if (input == null) + { + return false; + } + return + ( + this.FiltersScore == input.FiltersScore || + this.FiltersScore.Equals(input.FiltersScore) + ) && + ( + this.RankingScore == input.RankingScore || + this.RankingScore.Equals(input.RankingScore) + ) && + ( + this.Score == input.Score || + this.Score.Equals(input.Score) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.FiltersScore.GetHashCode(); + hashCode = (hashCode * 59) + this.RankingScore.GetHashCode(); + hashCode = (hashCode * 59) + this.Score.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/Promote.cs b/algoliasearch/Search/Models/Promote.cs new file mode 100644 index 000000000..8789e9318 --- /dev/null +++ b/algoliasearch/Search/Models/Promote.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// Promote + /// + [JsonConverter(typeof(PromoteJsonConverter))] + [DataContract(Name = "promote")] + public partial class Promote : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of PromoteObjectIDs. + public Promote(PromoteObjectIDs actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of PromoteObjectID. + public Promote(PromoteObjectID actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(PromoteObjectID)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(PromoteObjectIDs)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: PromoteObjectID, PromoteObjectIDs"); + } + } + } + + /// + /// Get the actual instance of `PromoteObjectIDs`. If the actual instance is not `PromoteObjectIDs`, + /// the InvalidClassException will be thrown + /// + /// An instance of PromoteObjectIDs + public PromoteObjectIDs GetterPromoteObjectIDs() + { + return (PromoteObjectIDs)this.ActualInstance; + } + + /// + /// Get the actual instance of `PromoteObjectID`. If the actual instance is not `PromoteObjectID`, + /// the InvalidClassException will be thrown + /// + /// An instance of PromoteObjectID + public PromoteObjectID GetterPromoteObjectID() + { + return (PromoteObjectID)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Promote {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, Promote.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of Promote + /// + /// JSON string + /// An instance of Promote + public static Promote FromJson(string jsonString) + { + Promote newPromote = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newPromote; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(PromoteObjectID).GetProperty("AdditionalProperties") == null) + { + newPromote = new Promote(JsonConvert.DeserializeObject(jsonString, Promote.SerializerSettings)); + } + else + { + newPromote = new Promote(JsonConvert.DeserializeObject(jsonString, Promote.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("PromoteObjectID"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PromoteObjectID: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(PromoteObjectIDs).GetProperty("AdditionalProperties") == null) + { + newPromote = new Promote(JsonConvert.DeserializeObject(jsonString, Promote.SerializerSettings)); + } + else + { + newPromote = new Promote(JsonConvert.DeserializeObject(jsonString, Promote.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("PromoteObjectIDs"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into PromoteObjectIDs: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newPromote; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Promote); + } + + /// + /// Returns true if Promote instances are equal + /// + /// Instance of Promote to be compared + /// Boolean + public bool Equals(Promote input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for Promote + /// + public class PromoteJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(Promote).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return Promote.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/PromoteObjectID.cs b/algoliasearch/Search/Models/PromoteObjectID.cs new file mode 100644 index 000000000..4afa27888 --- /dev/null +++ b/algoliasearch/Search/Models/PromoteObjectID.cs @@ -0,0 +1,149 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Record to promote. + /// + [DataContract(Name = "promoteObjectID")] + public partial class PromoteObjectID : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PromoteObjectID() { } + /// + /// Initializes a new instance of the class. + /// + /// Unique identifier of the record to promote. (required). + /// The position to promote the records to. If you pass objectIDs, the records are placed at this position as a group. For example, if you pronmote four objectIDs to position 0, the records take the first four positions. (required). + public PromoteObjectID(string objectID = default(string), int position = default(int)) + { + // to ensure "objectID" is required (not null) + if (objectID == null) + { + throw new ArgumentNullException("objectID is a required property for PromoteObjectID and cannot be null"); + } + this.ObjectID = objectID; + this.Position = position; + } + + /// + /// Unique identifier of the record to promote. + /// + /// Unique identifier of the record to promote. + [DataMember(Name = "objectID", IsRequired = true, EmitDefaultValue = true)] + public string ObjectID { get; set; } + + /// + /// The position to promote the records to. If you pass objectIDs, the records are placed at this position as a group. For example, if you pronmote four objectIDs to position 0, the records take the first four positions. + /// + /// The position to promote the records to. If you pass objectIDs, the records are placed at this position as a group. For example, if you pronmote four objectIDs to position 0, the records take the first four positions. + [DataMember(Name = "position", IsRequired = true, EmitDefaultValue = true)] + public int Position { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PromoteObjectID {\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append(" Position: ").Append(Position).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as PromoteObjectID); + } + + /// + /// Returns true if PromoteObjectID instances are equal + /// + /// Instance of PromoteObjectID to be compared + /// Boolean + public bool Equals(PromoteObjectID input) + { + if (input == null) + { + return false; + } + return + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ) && + ( + this.Position == input.Position || + this.Position.Equals(input.Position) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Position.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/PromoteObjectIDs.cs b/algoliasearch/Search/Models/PromoteObjectIDs.cs new file mode 100644 index 000000000..378c41e83 --- /dev/null +++ b/algoliasearch/Search/Models/PromoteObjectIDs.cs @@ -0,0 +1,150 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Records to promote. + /// + [DataContract(Name = "promoteObjectIDs")] + public partial class PromoteObjectIDs : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected PromoteObjectIDs() { } + /// + /// Initializes a new instance of the class. + /// + /// Unique identifiers of the records to promote. (required). + /// The position to promote the records to. If you pass objectIDs, the records are placed at this position as a group. For example, if you pronmote four objectIDs to position 0, the records take the first four positions. (required). + public PromoteObjectIDs(List objectIDs = default(List), int position = default(int)) + { + // to ensure "objectIDs" is required (not null) + if (objectIDs == null) + { + throw new ArgumentNullException("objectIDs is a required property for PromoteObjectIDs and cannot be null"); + } + this.ObjectIDs = objectIDs; + this.Position = position; + } + + /// + /// Unique identifiers of the records to promote. + /// + /// Unique identifiers of the records to promote. + [DataMember(Name = "objectIDs", IsRequired = true, EmitDefaultValue = true)] + public List ObjectIDs { get; set; } + + /// + /// The position to promote the records to. If you pass objectIDs, the records are placed at this position as a group. For example, if you pronmote four objectIDs to position 0, the records take the first four positions. + /// + /// The position to promote the records to. If you pass objectIDs, the records are placed at this position as a group. For example, if you pronmote four objectIDs to position 0, the records take the first four positions. + [DataMember(Name = "position", IsRequired = true, EmitDefaultValue = true)] + public int Position { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PromoteObjectIDs {\n"); + sb.Append(" ObjectIDs: ").Append(ObjectIDs).Append("\n"); + sb.Append(" Position: ").Append(Position).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as PromoteObjectIDs); + } + + /// + /// Returns true if PromoteObjectIDs instances are equal + /// + /// Instance of PromoteObjectIDs to be compared + /// Boolean + public bool Equals(PromoteObjectIDs input) + { + if (input == null) + { + return false; + } + return + ( + this.ObjectIDs == input.ObjectIDs || + this.ObjectIDs != null && + input.ObjectIDs != null && + this.ObjectIDs.SequenceEqual(input.ObjectIDs) + ) && + ( + this.Position == input.Position || + this.Position.Equals(input.Position) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ObjectIDs != null) + { + hashCode = (hashCode * 59) + this.ObjectIDs.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Position.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/QueryType.cs b/algoliasearch/Search/Models/QueryType.cs new file mode 100644 index 000000000..2d5100a04 --- /dev/null +++ b/algoliasearch/Search/Models/QueryType.cs @@ -0,0 +1,49 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Determines how query words are [interpreted as prefixes](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/prefix-searching/). + /// + /// Determines how query words are [interpreted as prefixes](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/prefix-searching/). + [JsonConverter(typeof(StringEnumConverter))] + public enum QueryType + { + /// + /// Enum PrefixLast for value: prefixLast + /// + [EnumMember(Value = "prefixLast")] + PrefixLast = 1, + + /// + /// Enum PrefixAll for value: prefixAll + /// + [EnumMember(Value = "prefixAll")] + PrefixAll = 2, + + /// + /// Enum PrefixNone for value: prefixNone + /// + [EnumMember(Value = "prefixNone")] + PrefixNone = 3 + } + +} diff --git a/algoliasearch/Search/Models/RankingInfo.cs b/algoliasearch/Search/Models/RankingInfo.cs new file mode 100644 index 000000000..896157870 --- /dev/null +++ b/algoliasearch/Search/Models/RankingInfo.cs @@ -0,0 +1,311 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// RankingInfo + /// + [DataContract(Name = "rankingInfo")] + public partial class RankingInfo : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RankingInfo() { } + /// + /// Initializes a new instance of the class. + /// + /// This field is reserved for advanced usage. (required). + /// Position of the most important matched attribute in the attributes to index list. (required). + /// Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). (required). + /// Precision used when computing the geo distance, in meters.. + /// matchedGeoLocation. + /// personalization. + /// Number of exactly matched words. (required). + /// Number of typos encountered when matching the record. (required). + /// Present and set to true if a Rule promoted the hit. (required). + /// When the query contains more than one word, the sum of the distances between matched words (in meters).. + /// Custom ranking for the object, expressed as a single integer value. (required). + /// Number of matched words, including prefixes and typos. (required). + /// Wether the record are promoted by the re-ranking strategy.. + public RankingInfo(int filters = default(int), int firstMatchedWord = default(int), int geoDistance = default(int), int geoPrecision = default(int), MatchedGeoLocation matchedGeoLocation = default(MatchedGeoLocation), Personalization personalization = default(Personalization), int nbExactWords = default(int), int nbTypos = default(int), bool promoted = default(bool), int proximityDistance = default(int), int userScore = default(int), int words = default(int), bool promotedByReRanking = default(bool)) + { + this.Filters = filters; + this.FirstMatchedWord = firstMatchedWord; + this.GeoDistance = geoDistance; + this.NbExactWords = nbExactWords; + this.NbTypos = nbTypos; + this.Promoted = promoted; + this.UserScore = userScore; + this.Words = words; + this.GeoPrecision = geoPrecision; + this.MatchedGeoLocation = matchedGeoLocation; + this.Personalization = personalization; + this.ProximityDistance = proximityDistance; + this.PromotedByReRanking = promotedByReRanking; + } + + /// + /// This field is reserved for advanced usage. + /// + /// This field is reserved for advanced usage. + [DataMember(Name = "filters", IsRequired = true, EmitDefaultValue = true)] + public int Filters { get; set; } + + /// + /// Position of the most important matched attribute in the attributes to index list. + /// + /// Position of the most important matched attribute in the attributes to index list. + [DataMember(Name = "firstMatchedWord", IsRequired = true, EmitDefaultValue = true)] + public int FirstMatchedWord { get; set; } + + /// + /// Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). + /// + /// Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters). + [DataMember(Name = "geoDistance", IsRequired = true, EmitDefaultValue = true)] + public int GeoDistance { get; set; } + + /// + /// Precision used when computing the geo distance, in meters. + /// + /// Precision used when computing the geo distance, in meters. + [DataMember(Name = "geoPrecision", EmitDefaultValue = false)] + public int GeoPrecision { get; set; } + + /// + /// Gets or Sets MatchedGeoLocation + /// + [DataMember(Name = "matchedGeoLocation", EmitDefaultValue = false)] + public MatchedGeoLocation MatchedGeoLocation { get; set; } + + /// + /// Gets or Sets Personalization + /// + [DataMember(Name = "personalization", EmitDefaultValue = false)] + public Personalization Personalization { get; set; } + + /// + /// Number of exactly matched words. + /// + /// Number of exactly matched words. + [DataMember(Name = "nbExactWords", IsRequired = true, EmitDefaultValue = true)] + public int NbExactWords { get; set; } + + /// + /// Number of typos encountered when matching the record. + /// + /// Number of typos encountered when matching the record. + [DataMember(Name = "nbTypos", IsRequired = true, EmitDefaultValue = true)] + public int NbTypos { get; set; } + + /// + /// Present and set to true if a Rule promoted the hit. + /// + /// Present and set to true if a Rule promoted the hit. + [DataMember(Name = "promoted", IsRequired = true, EmitDefaultValue = true)] + public bool Promoted { get; set; } + + /// + /// When the query contains more than one word, the sum of the distances between matched words (in meters). + /// + /// When the query contains more than one word, the sum of the distances between matched words (in meters). + [DataMember(Name = "proximityDistance", EmitDefaultValue = false)] + public int ProximityDistance { get; set; } + + /// + /// Custom ranking for the object, expressed as a single integer value. + /// + /// Custom ranking for the object, expressed as a single integer value. + [DataMember(Name = "userScore", IsRequired = true, EmitDefaultValue = true)] + public int UserScore { get; set; } + + /// + /// Number of matched words, including prefixes and typos. + /// + /// Number of matched words, including prefixes and typos. + [DataMember(Name = "words", IsRequired = true, EmitDefaultValue = true)] + public int Words { get; set; } + + /// + /// Wether the record are promoted by the re-ranking strategy. + /// + /// Wether the record are promoted by the re-ranking strategy. + [DataMember(Name = "promotedByReRanking", EmitDefaultValue = true)] + public bool PromotedByReRanking { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RankingInfo {\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" FirstMatchedWord: ").Append(FirstMatchedWord).Append("\n"); + sb.Append(" GeoDistance: ").Append(GeoDistance).Append("\n"); + sb.Append(" GeoPrecision: ").Append(GeoPrecision).Append("\n"); + sb.Append(" MatchedGeoLocation: ").Append(MatchedGeoLocation).Append("\n"); + sb.Append(" Personalization: ").Append(Personalization).Append("\n"); + sb.Append(" NbExactWords: ").Append(NbExactWords).Append("\n"); + sb.Append(" NbTypos: ").Append(NbTypos).Append("\n"); + sb.Append(" Promoted: ").Append(Promoted).Append("\n"); + sb.Append(" ProximityDistance: ").Append(ProximityDistance).Append("\n"); + sb.Append(" UserScore: ").Append(UserScore).Append("\n"); + sb.Append(" Words: ").Append(Words).Append("\n"); + sb.Append(" PromotedByReRanking: ").Append(PromotedByReRanking).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RankingInfo); + } + + /// + /// Returns true if RankingInfo instances are equal + /// + /// Instance of RankingInfo to be compared + /// Boolean + public bool Equals(RankingInfo input) + { + if (input == null) + { + return false; + } + return + ( + this.Filters == input.Filters || + this.Filters.Equals(input.Filters) + ) && + ( + this.FirstMatchedWord == input.FirstMatchedWord || + this.FirstMatchedWord.Equals(input.FirstMatchedWord) + ) && + ( + this.GeoDistance == input.GeoDistance || + this.GeoDistance.Equals(input.GeoDistance) + ) && + ( + this.GeoPrecision == input.GeoPrecision || + this.GeoPrecision.Equals(input.GeoPrecision) + ) && + ( + this.MatchedGeoLocation == input.MatchedGeoLocation || + (this.MatchedGeoLocation != null && + this.MatchedGeoLocation.Equals(input.MatchedGeoLocation)) + ) && + ( + this.Personalization == input.Personalization || + (this.Personalization != null && + this.Personalization.Equals(input.Personalization)) + ) && + ( + this.NbExactWords == input.NbExactWords || + this.NbExactWords.Equals(input.NbExactWords) + ) && + ( + this.NbTypos == input.NbTypos || + this.NbTypos.Equals(input.NbTypos) + ) && + ( + this.Promoted == input.Promoted || + this.Promoted.Equals(input.Promoted) + ) && + ( + this.ProximityDistance == input.ProximityDistance || + this.ProximityDistance.Equals(input.ProximityDistance) + ) && + ( + this.UserScore == input.UserScore || + this.UserScore.Equals(input.UserScore) + ) && + ( + this.Words == input.Words || + this.Words.Equals(input.Words) + ) && + ( + this.PromotedByReRanking == input.PromotedByReRanking || + this.PromotedByReRanking.Equals(input.PromotedByReRanking) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + hashCode = (hashCode * 59) + this.FirstMatchedWord.GetHashCode(); + hashCode = (hashCode * 59) + this.GeoDistance.GetHashCode(); + hashCode = (hashCode * 59) + this.GeoPrecision.GetHashCode(); + if (this.MatchedGeoLocation != null) + { + hashCode = (hashCode * 59) + this.MatchedGeoLocation.GetHashCode(); + } + if (this.Personalization != null) + { + hashCode = (hashCode * 59) + this.Personalization.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NbExactWords.GetHashCode(); + hashCode = (hashCode * 59) + this.NbTypos.GetHashCode(); + hashCode = (hashCode * 59) + this.Promoted.GetHashCode(); + hashCode = (hashCode * 59) + this.ProximityDistance.GetHashCode(); + hashCode = (hashCode * 59) + this.UserScore.GetHashCode(); + hashCode = (hashCode * 59) + this.Words.GetHashCode(); + hashCode = (hashCode * 59) + this.PromotedByReRanking.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/ReRankingApplyFilter.cs b/algoliasearch/Search/Models/ReRankingApplyFilter.cs new file mode 100644 index 000000000..8b8c52280 --- /dev/null +++ b/algoliasearch/Search/Models/ReRankingApplyFilter.cs @@ -0,0 +1,297 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// When [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/) is enabled, only records that match these filters will be affected by Dynamic Re-Ranking. + /// + [JsonConverter(typeof(ReRankingApplyFilterJsonConverter))] + [DataContract(Name = "reRankingApplyFilter")] + public partial class ReRankingApplyFilter : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + public ReRankingApplyFilter() + { + this.IsNullable = true; + this.SchemaType = "oneOf"; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<MixedSearchFilters>. + public ReRankingApplyFilter(List actualInstance) + { + this.IsNullable = true; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public ReRankingApplyFilter(string actualInstance) + { + this.IsNullable = true; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, string"); + } + } + } + + /// + /// Get the actual instance of `List<MixedSearchFilters>`. If the actual instance is not `List<MixedSearchFilters>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<MixedSearchFilters> + public List GetterList() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class ReRankingApplyFilter {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, ReRankingApplyFilter.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of ReRankingApplyFilter + /// + /// JSON string + /// An instance of ReRankingApplyFilter + public static ReRankingApplyFilter FromJson(string jsonString) + { + ReRankingApplyFilter newReRankingApplyFilter = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newReRankingApplyFilter; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newReRankingApplyFilter = new ReRankingApplyFilter(JsonConvert.DeserializeObject>(jsonString, ReRankingApplyFilter.SerializerSettings)); + } + else + { + newReRankingApplyFilter = new ReRankingApplyFilter(JsonConvert.DeserializeObject>(jsonString, ReRankingApplyFilter.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newReRankingApplyFilter = new ReRankingApplyFilter(JsonConvert.DeserializeObject(jsonString, ReRankingApplyFilter.SerializerSettings)); + } + else + { + newReRankingApplyFilter = new ReRankingApplyFilter(JsonConvert.DeserializeObject(jsonString, ReRankingApplyFilter.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newReRankingApplyFilter; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ReRankingApplyFilter); + } + + /// + /// Returns true if ReRankingApplyFilter instances are equal + /// + /// Instance of ReRankingApplyFilter to be compared + /// Boolean + public bool Equals(ReRankingApplyFilter input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for ReRankingApplyFilter + /// + public class ReRankingApplyFilterJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(ReRankingApplyFilter).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return ReRankingApplyFilter.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/Redirect.cs b/algoliasearch/Search/Models/Redirect.cs new file mode 100644 index 000000000..94ccd18c1 --- /dev/null +++ b/algoliasearch/Search/Models/Redirect.cs @@ -0,0 +1,124 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// [Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/). + /// + [DataContract(Name = "redirect")] + public partial class Redirect : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// index. + public Redirect(List index = default(List)) + { + this.Index = index; + } + + /// + /// Gets or Sets Index + /// + [DataMember(Name = "index", EmitDefaultValue = false)] + public List Index { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Redirect {\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Redirect); + } + + /// + /// Returns true if Redirect instances are equal + /// + /// Instance of Redirect to be compared + /// Boolean + public bool Equals(Redirect input) + { + if (input == null) + { + return false; + } + return + ( + this.Index == input.Index || + this.Index != null && + input.Index != null && + this.Index.SequenceEqual(input.Index) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/RedirectRuleIndexMetadata.cs b/algoliasearch/Search/Models/RedirectRuleIndexMetadata.cs new file mode 100644 index 000000000..ccea0be57 --- /dev/null +++ b/algoliasearch/Search/Models/RedirectRuleIndexMetadata.cs @@ -0,0 +1,220 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// RedirectRuleIndexMetadata + /// + [DataContract(Name = "RedirectRuleIndexMetadata")] + public partial class RedirectRuleIndexMetadata : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RedirectRuleIndexMetadata() { } + /// + /// Initializes a new instance of the class. + /// + /// Source index for the redirect rule. (required). + /// Destination index for the redirect rule. (required). + /// Reason for the redirect rule. (required). + /// Redirect rule status. (required). + /// data (required). + public RedirectRuleIndexMetadata(string source = default(string), string dest = default(string), string reason = default(string), bool succeed = default(bool), RedirectRuleIndexMetadataData data = default(RedirectRuleIndexMetadataData)) + { + // to ensure "source" is required (not null) + if (source == null) + { + throw new ArgumentNullException("source is a required property for RedirectRuleIndexMetadata and cannot be null"); + } + this.Source = source; + // to ensure "dest" is required (not null) + if (dest == null) + { + throw new ArgumentNullException("dest is a required property for RedirectRuleIndexMetadata and cannot be null"); + } + this.Dest = dest; + // to ensure "reason" is required (not null) + if (reason == null) + { + throw new ArgumentNullException("reason is a required property for RedirectRuleIndexMetadata and cannot be null"); + } + this.Reason = reason; + this.Succeed = succeed; + // to ensure "data" is required (not null) + if (data == null) + { + throw new ArgumentNullException("data is a required property for RedirectRuleIndexMetadata and cannot be null"); + } + this.Data = data; + } + + /// + /// Source index for the redirect rule. + /// + /// Source index for the redirect rule. + [DataMember(Name = "source", IsRequired = true, EmitDefaultValue = true)] + public string Source { get; set; } + + /// + /// Destination index for the redirect rule. + /// + /// Destination index for the redirect rule. + [DataMember(Name = "dest", IsRequired = true, EmitDefaultValue = true)] + public string Dest { get; set; } + + /// + /// Reason for the redirect rule. + /// + /// Reason for the redirect rule. + [DataMember(Name = "reason", IsRequired = true, EmitDefaultValue = true)] + public string Reason { get; set; } + + /// + /// Redirect rule status. + /// + /// Redirect rule status. + [DataMember(Name = "succeed", IsRequired = true, EmitDefaultValue = true)] + public bool Succeed { get; set; } + + /// + /// Gets or Sets Data + /// + [DataMember(Name = "data", IsRequired = true, EmitDefaultValue = true)] + public RedirectRuleIndexMetadataData Data { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RedirectRuleIndexMetadata {\n"); + sb.Append(" Source: ").Append(Source).Append("\n"); + sb.Append(" Dest: ").Append(Dest).Append("\n"); + sb.Append(" Reason: ").Append(Reason).Append("\n"); + sb.Append(" Succeed: ").Append(Succeed).Append("\n"); + sb.Append(" Data: ").Append(Data).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RedirectRuleIndexMetadata); + } + + /// + /// Returns true if RedirectRuleIndexMetadata instances are equal + /// + /// Instance of RedirectRuleIndexMetadata to be compared + /// Boolean + public bool Equals(RedirectRuleIndexMetadata input) + { + if (input == null) + { + return false; + } + return + ( + this.Source == input.Source || + (this.Source != null && + this.Source.Equals(input.Source)) + ) && + ( + this.Dest == input.Dest || + (this.Dest != null && + this.Dest.Equals(input.Dest)) + ) && + ( + this.Reason == input.Reason || + (this.Reason != null && + this.Reason.Equals(input.Reason)) + ) && + ( + this.Succeed == input.Succeed || + this.Succeed.Equals(input.Succeed) + ) && + ( + this.Data == input.Data || + (this.Data != null && + this.Data.Equals(input.Data)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Source != null) + { + hashCode = (hashCode * 59) + this.Source.GetHashCode(); + } + if (this.Dest != null) + { + hashCode = (hashCode * 59) + this.Dest.GetHashCode(); + } + if (this.Reason != null) + { + hashCode = (hashCode * 59) + this.Reason.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Succeed.GetHashCode(); + if (this.Data != null) + { + hashCode = (hashCode * 59) + this.Data.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/RedirectRuleIndexMetadataData.cs b/algoliasearch/Search/Models/RedirectRuleIndexMetadataData.cs new file mode 100644 index 000000000..6aa8ac661 --- /dev/null +++ b/algoliasearch/Search/Models/RedirectRuleIndexMetadataData.cs @@ -0,0 +1,133 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Redirect rule data. + /// + [DataContract(Name = "RedirectRuleIndexMetadata_data")] + public partial class RedirectRuleIndexMetadataData : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RedirectRuleIndexMetadataData() { } + /// + /// Initializes a new instance of the class. + /// + /// ruleObjectID (required). + public RedirectRuleIndexMetadataData(string ruleObjectID = default(string)) + { + // to ensure "ruleObjectID" is required (not null) + if (ruleObjectID == null) + { + throw new ArgumentNullException("ruleObjectID is a required property for RedirectRuleIndexMetadataData and cannot be null"); + } + this.RuleObjectID = ruleObjectID; + } + + /// + /// Gets or Sets RuleObjectID + /// + [DataMember(Name = "ruleObjectID", IsRequired = true, EmitDefaultValue = true)] + public string RuleObjectID { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RedirectRuleIndexMetadataData {\n"); + sb.Append(" RuleObjectID: ").Append(RuleObjectID).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RedirectRuleIndexMetadataData); + } + + /// + /// Returns true if RedirectRuleIndexMetadataData instances are equal + /// + /// Instance of RedirectRuleIndexMetadataData to be compared + /// Boolean + public bool Equals(RedirectRuleIndexMetadataData input) + { + if (input == null) + { + return false; + } + return + ( + this.RuleObjectID == input.RuleObjectID || + (this.RuleObjectID != null && + this.RuleObjectID.Equals(input.RuleObjectID)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RuleObjectID != null) + { + hashCode = (hashCode * 59) + this.RuleObjectID.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/RemoveStopWords.cs b/algoliasearch/Search/Models/RemoveStopWords.cs new file mode 100644 index 000000000..fc6650ac3 --- /dev/null +++ b/algoliasearch/Search/Models/RemoveStopWords.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// Removes stop (common) words from the query before executing it. `removeStopWords` is used in conjunction with the `queryLanguages` setting. _list_: language ISO codes for which stop words should be enabled. This list will override any values that you may have set in `queryLanguages`. _true_: enables the stop words feature, ensuring that stop words are removed from consideration in a search. The languages supported here are either [every language](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/) (this is the default) or those set by `queryLanguages`. _false_: turns off the stop words feature, allowing stop words to be taken into account in a search. + /// + [JsonConverter(typeof(RemoveStopWordsJsonConverter))] + [DataContract(Name = "removeStopWords")] + public partial class RemoveStopWords : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<string>. + public RemoveStopWords(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of bool. + public RemoveStopWords(bool actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(bool)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, bool"); + } + } + } + + /// + /// Get the actual instance of `List<string>`. If the actual instance is not `List<string>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<string> + public List GetterListString() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `bool`. If the actual instance is not `bool`, + /// the InvalidClassException will be thrown + /// + /// An instance of bool + public bool GetterBool() + { + return (bool)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class RemoveStopWords {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, RemoveStopWords.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of RemoveStopWords + /// + /// JSON string + /// An instance of RemoveStopWords + public static RemoveStopWords FromJson(string jsonString) + { + RemoveStopWords newRemoveStopWords = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newRemoveStopWords; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newRemoveStopWords = new RemoveStopWords(JsonConvert.DeserializeObject>(jsonString, RemoveStopWords.SerializerSettings)); + } + else + { + newRemoveStopWords = new RemoveStopWords(JsonConvert.DeserializeObject>(jsonString, RemoveStopWords.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(bool).GetProperty("AdditionalProperties") == null) + { + newRemoveStopWords = new RemoveStopWords(JsonConvert.DeserializeObject(jsonString, RemoveStopWords.SerializerSettings)); + } + else + { + newRemoveStopWords = new RemoveStopWords(JsonConvert.DeserializeObject(jsonString, RemoveStopWords.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("bool"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into bool: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newRemoveStopWords; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RemoveStopWords); + } + + /// + /// Returns true if RemoveStopWords instances are equal + /// + /// Instance of RemoveStopWords to be compared + /// Boolean + public bool Equals(RemoveStopWords input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for RemoveStopWords + /// + public class RemoveStopWordsJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(RemoveStopWords).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return RemoveStopWords.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/RemoveUserIdResponse.cs b/algoliasearch/Search/Models/RemoveUserIdResponse.cs new file mode 100644 index 000000000..633973e8d --- /dev/null +++ b/algoliasearch/Search/Models/RemoveUserIdResponse.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// RemoveUserIdResponse + /// + [DataContract(Name = "removeUserIdResponse")] + public partial class RemoveUserIdResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RemoveUserIdResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + public RemoveUserIdResponse(string deletedAt = default(string)) + { + // to ensure "deletedAt" is required (not null) + if (deletedAt == null) + { + throw new ArgumentNullException("deletedAt is a required property for RemoveUserIdResponse and cannot be null"); + } + this.DeletedAt = deletedAt; + } + + /// + /// Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of deletion in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "deletedAt", IsRequired = true, EmitDefaultValue = true)] + public string DeletedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RemoveUserIdResponse {\n"); + sb.Append(" DeletedAt: ").Append(DeletedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RemoveUserIdResponse); + } + + /// + /// Returns true if RemoveUserIdResponse instances are equal + /// + /// Instance of RemoveUserIdResponse to be compared + /// Boolean + public bool Equals(RemoveUserIdResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.DeletedAt == input.DeletedAt || + (this.DeletedAt != null && + this.DeletedAt.Equals(input.DeletedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.DeletedAt != null) + { + hashCode = (hashCode * 59) + this.DeletedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/RemoveWordsIfNoResults.cs b/algoliasearch/Search/Models/RemoveWordsIfNoResults.cs new file mode 100644 index 000000000..b5110e4c4 --- /dev/null +++ b/algoliasearch/Search/Models/RemoveWordsIfNoResults.cs @@ -0,0 +1,55 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Strategy to [remove words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/in-depth/why-use-remove-words-if-no-results/) from the query when it doesn't match any hits. + /// + /// Strategy to [remove words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/in-depth/why-use-remove-words-if-no-results/) from the query when it doesn't match any hits. + [JsonConverter(typeof(StringEnumConverter))] + public enum RemoveWordsIfNoResults + { + /// + /// Enum None for value: none + /// + [EnumMember(Value = "none")] + None = 1, + + /// + /// Enum LastWords for value: lastWords + /// + [EnumMember(Value = "lastWords")] + LastWords = 2, + + /// + /// Enum FirstWords for value: firstWords + /// + [EnumMember(Value = "firstWords")] + FirstWords = 3, + + /// + /// Enum AllOptional for value: allOptional + /// + [EnumMember(Value = "allOptional")] + AllOptional = 4 + } + +} diff --git a/algoliasearch/Search/Models/RenderingContent.cs b/algoliasearch/Search/Models/RenderingContent.cs new file mode 100644 index 000000000..c78c096a3 --- /dev/null +++ b/algoliasearch/Search/Models/RenderingContent.cs @@ -0,0 +1,123 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Extra content for the search UI, for example, to control the [ordering and display of facets](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/merchandising-facets/#merchandise-facets-and-their-values-in-the-manual-editor). You can set a default value and dynamically override it with [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/). + /// + [DataContract(Name = "renderingContent")] + public partial class RenderingContent : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// facetOrdering. + public RenderingContent(FacetOrdering facetOrdering = default(FacetOrdering)) + { + this.FacetOrdering = facetOrdering; + } + + /// + /// Gets or Sets FacetOrdering + /// + [DataMember(Name = "facetOrdering", EmitDefaultValue = false)] + public FacetOrdering FacetOrdering { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RenderingContent {\n"); + sb.Append(" FacetOrdering: ").Append(FacetOrdering).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RenderingContent); + } + + /// + /// Returns true if RenderingContent instances are equal + /// + /// Instance of RenderingContent to be compared + /// Boolean + public bool Equals(RenderingContent input) + { + if (input == null) + { + return false; + } + return + ( + this.FacetOrdering == input.FacetOrdering || + (this.FacetOrdering != null && + this.FacetOrdering.Equals(input.FacetOrdering)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.FacetOrdering != null) + { + hashCode = (hashCode * 59) + this.FacetOrdering.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/ReplaceSourceResponse.cs b/algoliasearch/Search/Models/ReplaceSourceResponse.cs new file mode 100644 index 000000000..de1d29ffd --- /dev/null +++ b/algoliasearch/Search/Models/ReplaceSourceResponse.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// ReplaceSourceResponse + /// + [DataContract(Name = "replaceSourceResponse")] + public partial class ReplaceSourceResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ReplaceSourceResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + public ReplaceSourceResponse(string updatedAt = default(string)) + { + // to ensure "updatedAt" is required (not null) + if (updatedAt == null) + { + throw new ArgumentNullException("updatedAt is a required property for ReplaceSourceResponse and cannot be null"); + } + this.UpdatedAt = updatedAt; + } + + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "updatedAt", IsRequired = true, EmitDefaultValue = true)] + public string UpdatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ReplaceSourceResponse {\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ReplaceSourceResponse); + } + + /// + /// Returns true if ReplaceSourceResponse instances are equal + /// + /// Instance of ReplaceSourceResponse to be compared + /// Boolean + public bool Equals(ReplaceSourceResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/Rule.cs b/algoliasearch/Search/Models/Rule.cs new file mode 100644 index 000000000..af82428ae --- /dev/null +++ b/algoliasearch/Search/Models/Rule.cs @@ -0,0 +1,226 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Rule object. + /// + [DataContract(Name = "rule")] + public partial class Rule : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Rule() { } + /// + /// Initializes a new instance of the class. + /// + /// Unique identifier for a rule object. (required). + /// [Conditions](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/#conditions) required to activate a rule. You can use up to 25 conditions per rule. . + /// consequence. + /// Description of the rule's purpose. This can be helpful for display in the Algolia dashboard.. + /// Indicates whether to enable the rule. If it isn't enabled, it isn't applied at query time. (default to true). + /// If you specify a validity period, the rule _only_ applies only during that period. If specified, the array must not be empty.. + public Rule(string objectID = default(string), List conditions = default(List), Consequence consequence = default(Consequence), string description = default(string), bool enabled = true, List validity = default(List)) + { + // to ensure "objectID" is required (not null) + if (objectID == null) + { + throw new ArgumentNullException("objectID is a required property for Rule and cannot be null"); + } + this.ObjectID = objectID; + this.Conditions = conditions; + this.Consequence = consequence; + this.Description = description; + this.Enabled = enabled; + this.Validity = validity; + } + + /// + /// Unique identifier for a rule object. + /// + /// Unique identifier for a rule object. + [DataMember(Name = "objectID", IsRequired = true, EmitDefaultValue = true)] + public string ObjectID { get; set; } + + /// + /// [Conditions](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/#conditions) required to activate a rule. You can use up to 25 conditions per rule. + /// + /// [Conditions](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/#conditions) required to activate a rule. You can use up to 25 conditions per rule. + [DataMember(Name = "conditions", EmitDefaultValue = false)] + public List Conditions { get; set; } + + /// + /// Gets or Sets Consequence + /// + [DataMember(Name = "consequence", EmitDefaultValue = false)] + public Consequence Consequence { get; set; } + + /// + /// Description of the rule's purpose. This can be helpful for display in the Algolia dashboard. + /// + /// Description of the rule's purpose. This can be helpful for display in the Algolia dashboard. + [DataMember(Name = "description", EmitDefaultValue = false)] + public string Description { get; set; } + + /// + /// Indicates whether to enable the rule. If it isn't enabled, it isn't applied at query time. + /// + /// Indicates whether to enable the rule. If it isn't enabled, it isn't applied at query time. + [DataMember(Name = "enabled", EmitDefaultValue = true)] + public bool Enabled { get; set; } + + /// + /// If you specify a validity period, the rule _only_ applies only during that period. If specified, the array must not be empty. + /// + /// If you specify a validity period, the rule _only_ applies only during that period. If specified, the array must not be empty. + [DataMember(Name = "validity", EmitDefaultValue = false)] + public List Validity { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Rule {\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append(" Conditions: ").Append(Conditions).Append("\n"); + sb.Append(" Consequence: ").Append(Consequence).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append(" Enabled: ").Append(Enabled).Append("\n"); + sb.Append(" Validity: ").Append(Validity).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Rule); + } + + /// + /// Returns true if Rule instances are equal + /// + /// Instance of Rule to be compared + /// Boolean + public bool Equals(Rule input) + { + if (input == null) + { + return false; + } + return + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ) && + ( + this.Conditions == input.Conditions || + this.Conditions != null && + input.Conditions != null && + this.Conditions.SequenceEqual(input.Conditions) + ) && + ( + this.Consequence == input.Consequence || + (this.Consequence != null && + this.Consequence.Equals(input.Consequence)) + ) && + ( + this.Description == input.Description || + (this.Description != null && + this.Description.Equals(input.Description)) + ) && + ( + this.Enabled == input.Enabled || + this.Enabled.Equals(input.Enabled) + ) && + ( + this.Validity == input.Validity || + this.Validity != null && + input.Validity != null && + this.Validity.SequenceEqual(input.Validity) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + if (this.Conditions != null) + { + hashCode = (hashCode * 59) + this.Conditions.GetHashCode(); + } + if (this.Consequence != null) + { + hashCode = (hashCode * 59) + this.Consequence.GetHashCode(); + } + if (this.Description != null) + { + hashCode = (hashCode * 59) + this.Description.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Enabled.GetHashCode(); + if (this.Validity != null) + { + hashCode = (hashCode * 59) + this.Validity.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SaveObjectResponse.cs b/algoliasearch/Search/Models/SaveObjectResponse.cs new file mode 100644 index 000000000..8b0c21089 --- /dev/null +++ b/algoliasearch/Search/Models/SaveObjectResponse.cs @@ -0,0 +1,168 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SaveObjectResponse + /// + [DataContract(Name = "saveObjectResponse")] + public partial class SaveObjectResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SaveObjectResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Date of creation (ISO-8601 format). (required). + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. (required). + /// Unique object identifier.. + public SaveObjectResponse(string createdAt = default(string), long taskID = default(long), string objectID = default(string)) + { + // to ensure "createdAt" is required (not null) + if (createdAt == null) + { + throw new ArgumentNullException("createdAt is a required property for SaveObjectResponse and cannot be null"); + } + this.CreatedAt = createdAt; + this.TaskID = taskID; + this.ObjectID = objectID; + } + + /// + /// Date of creation (ISO-8601 format). + /// + /// Date of creation (ISO-8601 format). + [DataMember(Name = "createdAt", IsRequired = true, EmitDefaultValue = true)] + public string CreatedAt { get; set; } + + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + [DataMember(Name = "taskID", IsRequired = true, EmitDefaultValue = true)] + public long TaskID { get; set; } + + /// + /// Unique object identifier. + /// + /// Unique object identifier. + [DataMember(Name = "objectID", EmitDefaultValue = false)] + public string ObjectID { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SaveObjectResponse {\n"); + sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n"); + sb.Append(" TaskID: ").Append(TaskID).Append("\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SaveObjectResponse); + } + + /// + /// Returns true if SaveObjectResponse instances are equal + /// + /// Instance of SaveObjectResponse to be compared + /// Boolean + public bool Equals(SaveObjectResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.CreatedAt == input.CreatedAt || + (this.CreatedAt != null && + this.CreatedAt.Equals(input.CreatedAt)) + ) && + ( + this.TaskID == input.TaskID || + this.TaskID.Equals(input.TaskID) + ) && + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.CreatedAt != null) + { + hashCode = (hashCode * 59) + this.CreatedAt.GetHashCode(); + } + hashCode = (hashCode * 59) + this.TaskID.GetHashCode(); + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SaveSynonymResponse.cs b/algoliasearch/Search/Models/SaveSynonymResponse.cs new file mode 100644 index 000000000..a9e77bf62 --- /dev/null +++ b/algoliasearch/Search/Models/SaveSynonymResponse.cs @@ -0,0 +1,173 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SaveSynonymResponse + /// + [DataContract(Name = "saveSynonymResponse")] + public partial class SaveSynonymResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SaveSynonymResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. (required). + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + /// Unique identifier of a synonym object. (required). + public SaveSynonymResponse(long taskID = default(long), string updatedAt = default(string), string id = default(string)) + { + this.TaskID = taskID; + // to ensure "updatedAt" is required (not null) + if (updatedAt == null) + { + throw new ArgumentNullException("updatedAt is a required property for SaveSynonymResponse and cannot be null"); + } + this.UpdatedAt = updatedAt; + // to ensure "id" is required (not null) + if (id == null) + { + throw new ArgumentNullException("id is a required property for SaveSynonymResponse and cannot be null"); + } + this.Id = id; + } + + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + [DataMember(Name = "taskID", IsRequired = true, EmitDefaultValue = true)] + public long TaskID { get; set; } + + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "updatedAt", IsRequired = true, EmitDefaultValue = true)] + public string UpdatedAt { get; set; } + + /// + /// Unique identifier of a synonym object. + /// + /// Unique identifier of a synonym object. + [DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)] + public string Id { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SaveSynonymResponse {\n"); + sb.Append(" TaskID: ").Append(TaskID).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SaveSynonymResponse); + } + + /// + /// Returns true if SaveSynonymResponse instances are equal + /// + /// Instance of SaveSynonymResponse to be compared + /// Boolean + public bool Equals(SaveSynonymResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.TaskID == input.TaskID || + this.TaskID.Equals(input.TaskID) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ) && + ( + this.Id == input.Id || + (this.Id != null && + this.Id.Equals(input.Id)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.TaskID.GetHashCode(); + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + if (this.Id != null) + { + hashCode = (hashCode * 59) + this.Id.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/ScopeType.cs b/algoliasearch/Search/Models/ScopeType.cs new file mode 100644 index 000000000..c59bc6999 --- /dev/null +++ b/algoliasearch/Search/Models/ScopeType.cs @@ -0,0 +1,48 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Defines scopeType + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ScopeType + { + /// + /// Enum Settings for value: settings + /// + [EnumMember(Value = "settings")] + Settings = 1, + + /// + /// Enum Synonyms for value: synonyms + /// + [EnumMember(Value = "synonyms")] + Synonyms = 2, + + /// + /// Enum Rules for value: rules + /// + [EnumMember(Value = "rules")] + Rules = 3 + } + +} diff --git a/algoliasearch/Search/Models/SearchDictionaryEntriesParams.cs b/algoliasearch/Search/Models/SearchDictionaryEntriesParams.cs new file mode 100644 index 000000000..8f6059400 --- /dev/null +++ b/algoliasearch/Search/Models/SearchDictionaryEntriesParams.cs @@ -0,0 +1,195 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// `searchDictionaryEntries` parameters. + /// + [DataContract(Name = "searchDictionaryEntriesParams")] + public partial class SearchDictionaryEntriesParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchDictionaryEntriesParams() { } + /// + /// Initializes a new instance of the class. + /// + /// Text to search for in an index. (required) (default to ""). + /// Page to retrieve (the first page is `0`, not `1`). (default to 0). + /// Number of hits per page. (default to 20). + /// [Supported language ISO code](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/). . + public SearchDictionaryEntriesParams(string query = @"", int page = 0, int hitsPerPage = 20, string language = default(string)) + { + // to ensure "query" is required (not null) + if (query == null) + { + throw new ArgumentNullException("query is a required property for SearchDictionaryEntriesParams and cannot be null"); + } + this.Query = query; + this.Page = page; + this.HitsPerPage = hitsPerPage; + this.Language = language; + } + + /// + /// Text to search for in an index. + /// + /// Text to search for in an index. + [DataMember(Name = "query", IsRequired = true, EmitDefaultValue = true)] + public string Query { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", EmitDefaultValue = false)] + public int Page { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", EmitDefaultValue = false)] + public int HitsPerPage { get; set; } + + /// + /// [Supported language ISO code](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/). + /// + /// [Supported language ISO code](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/). + [DataMember(Name = "language", EmitDefaultValue = false)] + public string Language { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchDictionaryEntriesParams {\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" Language: ").Append(Language).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchDictionaryEntriesParams); + } + + /// + /// Returns true if SearchDictionaryEntriesParams instances are equal + /// + /// Instance of SearchDictionaryEntriesParams to be compared + /// Boolean + public bool Equals(SearchDictionaryEntriesParams input) + { + if (input == null) + { + return false; + } + return + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && + ( + this.Language == input.Language || + (this.Language != null && + this.Language.Equals(input.Language)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + if (this.Language != null) + { + hashCode = (hashCode * 59) + this.Language.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchForFacetValuesRequest.cs b/algoliasearch/Search/Models/SearchForFacetValuesRequest.cs new file mode 100644 index 000000000..2307757d8 --- /dev/null +++ b/algoliasearch/Search/Models/SearchForFacetValuesRequest.cs @@ -0,0 +1,166 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchForFacetValuesRequest + /// + [DataContract(Name = "searchForFacetValuesRequest")] + public partial class SearchForFacetValuesRequest : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Search parameters as a URL-encoded query string. (default to ""). + /// Text to search inside the facet's values. (default to ""). + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). (default to 10). + public SearchForFacetValuesRequest(string varParams = @"", string facetQuery = @"", int maxFacetHits = 10) + { + // use default value if no "varParams" provided + this.VarParams = varParams ?? @""; + // use default value if no "facetQuery" provided + this.FacetQuery = facetQuery ?? @""; + this.MaxFacetHits = maxFacetHits; + } + + /// + /// Search parameters as a URL-encoded query string. + /// + /// Search parameters as a URL-encoded query string. + [DataMember(Name = "params", EmitDefaultValue = false)] + public string VarParams { get; set; } + + /// + /// Text to search inside the facet's values. + /// + /// Text to search inside the facet's values. + [DataMember(Name = "facetQuery", EmitDefaultValue = false)] + public string FacetQuery { get; set; } + + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + [DataMember(Name = "maxFacetHits", EmitDefaultValue = false)] + public int MaxFacetHits { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchForFacetValuesRequest {\n"); + sb.Append(" VarParams: ").Append(VarParams).Append("\n"); + sb.Append(" FacetQuery: ").Append(FacetQuery).Append("\n"); + sb.Append(" MaxFacetHits: ").Append(MaxFacetHits).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchForFacetValuesRequest); + } + + /// + /// Returns true if SearchForFacetValuesRequest instances are equal + /// + /// Instance of SearchForFacetValuesRequest to be compared + /// Boolean + public bool Equals(SearchForFacetValuesRequest input) + { + if (input == null) + { + return false; + } + return + ( + this.VarParams == input.VarParams || + (this.VarParams != null && + this.VarParams.Equals(input.VarParams)) + ) && + ( + this.FacetQuery == input.FacetQuery || + (this.FacetQuery != null && + this.FacetQuery.Equals(input.FacetQuery)) + ) && + ( + this.MaxFacetHits == input.MaxFacetHits || + this.MaxFacetHits.Equals(input.MaxFacetHits) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.VarParams != null) + { + hashCode = (hashCode * 59) + this.VarParams.GetHashCode(); + } + if (this.FacetQuery != null) + { + hashCode = (hashCode * 59) + this.FacetQuery.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MaxFacetHits.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // MaxFacetHits (int) maximum + if (this.MaxFacetHits > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MaxFacetHits, must be a value less than or equal to 100.", new[] { "MaxFacetHits" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchForFacetValuesResponse.cs b/algoliasearch/Search/Models/SearchForFacetValuesResponse.cs new file mode 100644 index 000000000..2e590baa4 --- /dev/null +++ b/algoliasearch/Search/Models/SearchForFacetValuesResponse.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchForFacetValuesResponse + /// + [DataContract(Name = "searchForFacetValuesResponse")] + public partial class SearchForFacetValuesResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchForFacetValuesResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// facetHits (required). + public SearchForFacetValuesResponse(List facetHits = default(List)) + { + // to ensure "facetHits" is required (not null) + if (facetHits == null) + { + throw new ArgumentNullException("facetHits is a required property for SearchForFacetValuesResponse and cannot be null"); + } + this.FacetHits = facetHits; + } + + /// + /// Gets or Sets FacetHits + /// + [DataMember(Name = "facetHits", IsRequired = true, EmitDefaultValue = true)] + public List FacetHits { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchForFacetValuesResponse {\n"); + sb.Append(" FacetHits: ").Append(FacetHits).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchForFacetValuesResponse); + } + + /// + /// Returns true if SearchForFacetValuesResponse instances are equal + /// + /// Instance of SearchForFacetValuesResponse to be compared + /// Boolean + public bool Equals(SearchForFacetValuesResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.FacetHits == input.FacetHits || + this.FacetHits != null && + input.FacetHits != null && + this.FacetHits.SequenceEqual(input.FacetHits) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.FacetHits != null) + { + hashCode = (hashCode * 59) + this.FacetHits.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchForFacets.cs b/algoliasearch/Search/Models/SearchForFacets.cs new file mode 100644 index 000000000..1b48e7104 --- /dev/null +++ b/algoliasearch/Search/Models/SearchForFacets.cs @@ -0,0 +1,1619 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchForFacets + /// + [DataContract(Name = "SearchForFacets")] + public partial class SearchForFacets : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets QueryType + /// + [DataMember(Name = "queryType", EmitDefaultValue = false)] + public QueryType? QueryType { get; set; } + + /// + /// Gets or Sets RemoveWordsIfNoResults + /// + [DataMember(Name = "removeWordsIfNoResults", EmitDefaultValue = false)] + public RemoveWordsIfNoResults? RemoveWordsIfNoResults { get; set; } + + /// + /// Gets or Sets Mode + /// + [DataMember(Name = "mode", EmitDefaultValue = false)] + public Mode? Mode { get; set; } + + /// + /// Gets or Sets ExactOnSingleWordQuery + /// + [DataMember(Name = "exactOnSingleWordQuery", EmitDefaultValue = false)] + public ExactOnSingleWordQuery? ExactOnSingleWordQuery { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public SearchTypeFacet Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchForFacets() { } + /// + /// Initializes a new instance of the class. + /// + /// Search parameters as a URL-encoded query string. (default to ""). + /// Text to search for in an index. (default to ""). + /// Overrides the query parameter and performs a more generic search. (default to ""). + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. (default to ""). + /// facetFilters. + /// optionalFilters. + /// numericFilters. + /// tagFilters. + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. (default to false). + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/).. + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values.. + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. (default to false). + /// Page to retrieve (the first page is `0`, not `1`). (default to 0). + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. (default to ""). + /// Search for entries around a location. The location is automatically computed from the requester's IP address. (default to false). + /// aroundRadius. + /// aroundPrecision. + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set.. + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries.. + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries.. + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). (default to 100). + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search.. + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). (default to false). + /// Enriches the API's response with information about how the query was processed.. + /// Whether to take into account an index's synonyms for a particular search. (default to true). + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). (default to false). + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). (default to true). + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).. + /// Whether to include or exclude a query from the processing-time percentile computation. (default to true). + /// Incidates whether this search will be considered in A/B testing. (default to true). + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. . + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes.. + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/).. + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. . + /// Relevancy threshold below which less relevant results aren't included in the results. (default to 100). + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`).. + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. . + /// HTML string to insert before the highlighted parts in all highlight and snippet results. (default to "<em>"). + /// HTML string to insert after the highlighted parts in all highlight and snippet results. (default to "</em>"). + /// String used as an ellipsis indicator when a snippet is truncated. (default to "…"). + /// Restrict highlighting and snippeting to items that matched the query. (default to false). + /// Number of hits per page. (default to 20). + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 4). + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 8). + /// typoTolerance. + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. (default to true). + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/).. + /// ignorePlurals. + /// removeStopWords. + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). (default to ""). + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection.. + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. (default to true). + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. (default to true). + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. (default to false). + /// queryType. + /// removeWordsIfNoResults. + /// mode. + /// semanticSearch. + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). (default to false). + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query.. + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// exactOnSingleWordQuery. + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled.. + /// distinct. + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. (default to false). + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). (default to 1). + /// Attributes to include in the API response for search and browse queries.. + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). (default to 10). + /// Maximum number of facet values to return for each facet. (default to 100). + /// Controls how facet values are fetched. (default to "count"). + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. (default to false). + /// renderingContent. + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). (default to true). + /// reRankingApplyFilter. + /// Facet name. (required). + /// Algolia index name. (required). + /// Text to search inside the facet's values. (default to ""). + /// type (required). + public SearchForFacets(string varParams = @"", string query = @"", string similarQuery = @"", string filters = @"", FacetFilters facetFilters = default(FacetFilters), OptionalFilters optionalFilters = default(OptionalFilters), NumericFilters numericFilters = default(NumericFilters), TagFilters tagFilters = default(TagFilters), bool sumOrFiltersScores = false, List restrictSearchableAttributes = default(List), List facets = default(List), bool facetingAfterDistinct = false, int page = 0, int offset = default(int), int length = default(int), string aroundLatLng = @"", bool aroundLatLngViaIP = false, AroundRadius aroundRadius = default(AroundRadius), AroundPrecision aroundPrecision = default(AroundPrecision), int minimumAroundRadius = default(int), List> insideBoundingBox = default(List>), List> insidePolygon = default(List>), List naturalLanguages = default(List), List ruleContexts = default(List), int personalizationImpact = 100, string userToken = default(string), bool getRankingInfo = false, List explain = default(List), bool synonyms = true, bool clickAnalytics = false, bool analytics = true, List analyticsTags = default(List), bool percentileComputation = true, bool enableABTest = true, List attributesForFaceting = default(List), List attributesToRetrieve = default(List), List ranking = default(List), List customRanking = default(List), int relevancyStrictness = 100, List attributesToHighlight = default(List), List attributesToSnippet = default(List), string highlightPreTag = @"", string highlightPostTag = @"", string snippetEllipsisText = @"…", bool restrictHighlightAndSnippetArrays = false, int hitsPerPage = 20, int minWordSizefor1Typo = 4, int minWordSizefor2Typos = 8, TypoTolerance typoTolerance = default(TypoTolerance), bool allowTyposOnNumericTokens = true, List disableTypoToleranceOnAttributes = default(List), IgnorePlurals ignorePlurals = default(IgnorePlurals), RemoveStopWords removeStopWords = default(RemoveStopWords), string keepDiacriticsOnCharacters = @"", List queryLanguages = default(List), bool decompoundQuery = true, bool enableRules = true, bool enablePersonalization = false, QueryType? queryType = default(QueryType?), RemoveWordsIfNoResults? removeWordsIfNoResults = default(RemoveWordsIfNoResults?), Mode? mode = default(Mode?), SemanticSearch semanticSearch = default(SemanticSearch), bool advancedSyntax = false, List optionalWords = default(List), List disableExactOnAttributes = default(List), ExactOnSingleWordQuery? exactOnSingleWordQuery = default(ExactOnSingleWordQuery?), List alternativesAsExact = default(List), List advancedSyntaxFeatures = default(List), Distinct distinct = default(Distinct), bool replaceSynonymsInHighlight = false, int minProximity = 1, List responseFields = default(List), int maxFacetHits = 10, int maxValuesPerFacet = 100, string sortFacetValuesBy = @"count", bool attributeCriteriaComputedByMinProximity = false, RenderingContent renderingContent = default(RenderingContent), bool enableReRanking = true, ReRankingApplyFilter reRankingApplyFilter = default(ReRankingApplyFilter), string facet = default(string), string indexName = default(string), string facetQuery = @"", SearchTypeFacet type = default(SearchTypeFacet)) + { + // to ensure "facet" is required (not null) + if (facet == null) + { + throw new ArgumentNullException("facet is a required property for SearchForFacets and cannot be null"); + } + this.Facet = facet; + // to ensure "indexName" is required (not null) + if (indexName == null) + { + throw new ArgumentNullException("indexName is a required property for SearchForFacets and cannot be null"); + } + this.IndexName = indexName; + this.Type = type; + // use default value if no "varParams" provided + this.VarParams = varParams ?? @""; + // use default value if no "query" provided + this.Query = query ?? @""; + // use default value if no "similarQuery" provided + this.SimilarQuery = similarQuery ?? @""; + // use default value if no "filters" provided + this.Filters = filters ?? @""; + this.FacetFilters = facetFilters; + this.OptionalFilters = optionalFilters; + this.NumericFilters = numericFilters; + this.TagFilters = tagFilters; + this.SumOrFiltersScores = sumOrFiltersScores; + this.RestrictSearchableAttributes = restrictSearchableAttributes; + this.Facets = facets; + this.FacetingAfterDistinct = facetingAfterDistinct; + this.Page = page; + this.Offset = offset; + this.Length = length; + // use default value if no "aroundLatLng" provided + this.AroundLatLng = aroundLatLng ?? @""; + this.AroundLatLngViaIP = aroundLatLngViaIP; + this.AroundRadius = aroundRadius; + this.AroundPrecision = aroundPrecision; + this.MinimumAroundRadius = minimumAroundRadius; + this.InsideBoundingBox = insideBoundingBox; + this.InsidePolygon = insidePolygon; + this.NaturalLanguages = naturalLanguages; + this.RuleContexts = ruleContexts; + this.PersonalizationImpact = personalizationImpact; + this.UserToken = userToken; + this.GetRankingInfo = getRankingInfo; + this.Explain = explain; + this.Synonyms = synonyms; + this.ClickAnalytics = clickAnalytics; + this.Analytics = analytics; + this.AnalyticsTags = analyticsTags; + this.PercentileComputation = percentileComputation; + this.EnableABTest = enableABTest; + this.AttributesForFaceting = attributesForFaceting; + this.AttributesToRetrieve = attributesToRetrieve; + this.Ranking = ranking; + this.CustomRanking = customRanking; + this.RelevancyStrictness = relevancyStrictness; + this.AttributesToHighlight = attributesToHighlight; + this.AttributesToSnippet = attributesToSnippet; + // use default value if no "highlightPreTag" provided + this.HighlightPreTag = highlightPreTag ?? @""; + // use default value if no "highlightPostTag" provided + this.HighlightPostTag = highlightPostTag ?? @""; + // use default value if no "snippetEllipsisText" provided + this.SnippetEllipsisText = snippetEllipsisText ?? @"…"; + this.RestrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + this.HitsPerPage = hitsPerPage; + this.MinWordSizefor1Typo = minWordSizefor1Typo; + this.MinWordSizefor2Typos = minWordSizefor2Typos; + this.TypoTolerance = typoTolerance; + this.AllowTyposOnNumericTokens = allowTyposOnNumericTokens; + this.DisableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + this.IgnorePlurals = ignorePlurals; + this.RemoveStopWords = removeStopWords; + // use default value if no "keepDiacriticsOnCharacters" provided + this.KeepDiacriticsOnCharacters = keepDiacriticsOnCharacters ?? @""; + this.QueryLanguages = queryLanguages; + this.DecompoundQuery = decompoundQuery; + this.EnableRules = enableRules; + this.EnablePersonalization = enablePersonalization; + this.QueryType = queryType; + this.RemoveWordsIfNoResults = removeWordsIfNoResults; + this.Mode = mode; + this.SemanticSearch = semanticSearch; + this.AdvancedSyntax = advancedSyntax; + this.OptionalWords = optionalWords; + this.DisableExactOnAttributes = disableExactOnAttributes; + this.ExactOnSingleWordQuery = exactOnSingleWordQuery; + this.AlternativesAsExact = alternativesAsExact; + this.AdvancedSyntaxFeatures = advancedSyntaxFeatures; + this.Distinct = distinct; + this.ReplaceSynonymsInHighlight = replaceSynonymsInHighlight; + this.MinProximity = minProximity; + this.ResponseFields = responseFields; + this.MaxFacetHits = maxFacetHits; + this.MaxValuesPerFacet = maxValuesPerFacet; + // use default value if no "sortFacetValuesBy" provided + this.SortFacetValuesBy = sortFacetValuesBy ?? @"count"; + this.AttributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + this.RenderingContent = renderingContent; + this.EnableReRanking = enableReRanking; + this.ReRankingApplyFilter = reRankingApplyFilter; + // use default value if no "facetQuery" provided + this.FacetQuery = facetQuery ?? @""; + } + + /// + /// Search parameters as a URL-encoded query string. + /// + /// Search parameters as a URL-encoded query string. + [DataMember(Name = "params", EmitDefaultValue = false)] + public string VarParams { get; set; } + + /// + /// Text to search for in an index. + /// + /// Text to search for in an index. + [DataMember(Name = "query", EmitDefaultValue = false)] + public string Query { get; set; } + + /// + /// Overrides the query parameter and performs a more generic search. + /// + /// Overrides the query parameter and performs a more generic search. + [DataMember(Name = "similarQuery", EmitDefaultValue = false)] + public string SimilarQuery { get; set; } + + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + [DataMember(Name = "filters", EmitDefaultValue = false)] + public string Filters { get; set; } + + /// + /// Gets or Sets FacetFilters + /// + [DataMember(Name = "facetFilters", EmitDefaultValue = false)] + public FacetFilters FacetFilters { get; set; } + + /// + /// Gets or Sets OptionalFilters + /// + [DataMember(Name = "optionalFilters", EmitDefaultValue = false)] + public OptionalFilters OptionalFilters { get; set; } + + /// + /// Gets or Sets NumericFilters + /// + [DataMember(Name = "numericFilters", EmitDefaultValue = false)] + public NumericFilters NumericFilters { get; set; } + + /// + /// Gets or Sets TagFilters + /// + [DataMember(Name = "tagFilters", EmitDefaultValue = false)] + public TagFilters TagFilters { get; set; } + + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + [DataMember(Name = "sumOrFiltersScores", EmitDefaultValue = true)] + public bool SumOrFiltersScores { get; set; } + + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + [DataMember(Name = "restrictSearchableAttributes", EmitDefaultValue = false)] + public List RestrictSearchableAttributes { get; set; } + + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + [DataMember(Name = "facets", EmitDefaultValue = false)] + public List Facets { get; set; } + + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + [DataMember(Name = "facetingAfterDistinct", EmitDefaultValue = true)] + public bool FacetingAfterDistinct { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", EmitDefaultValue = false)] + public int Page { get; set; } + + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "offset", EmitDefaultValue = false)] + public int Offset { get; set; } + + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "length", EmitDefaultValue = false)] + public int Length { get; set; } + + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + [DataMember(Name = "aroundLatLngViaIP", EmitDefaultValue = true)] + public bool AroundLatLngViaIP { get; set; } + + /// + /// Gets or Sets AroundRadius + /// + [DataMember(Name = "aroundRadius", EmitDefaultValue = false)] + public AroundRadius AroundRadius { get; set; } + + /// + /// Gets or Sets AroundPrecision + /// + [DataMember(Name = "aroundPrecision", EmitDefaultValue = false)] + public AroundPrecision AroundPrecision { get; set; } + + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + [DataMember(Name = "minimumAroundRadius", EmitDefaultValue = false)] + public int MinimumAroundRadius { get; set; } + + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insideBoundingBox", EmitDefaultValue = false)] + public List> InsideBoundingBox { get; set; } + + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insidePolygon", EmitDefaultValue = false)] + public List> InsidePolygon { get; set; } + + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + [DataMember(Name = "naturalLanguages", EmitDefaultValue = false)] + public List NaturalLanguages { get; set; } + + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + [DataMember(Name = "ruleContexts", EmitDefaultValue = false)] + public List RuleContexts { get; set; } + + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + [DataMember(Name = "personalizationImpact", EmitDefaultValue = false)] + public int PersonalizationImpact { get; set; } + + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + [DataMember(Name = "userToken", EmitDefaultValue = false)] + public string UserToken { get; set; } + + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + [DataMember(Name = "getRankingInfo", EmitDefaultValue = true)] + public bool GetRankingInfo { get; set; } + + /// + /// Enriches the API's response with information about how the query was processed. + /// + /// Enriches the API's response with information about how the query was processed. + [DataMember(Name = "explain", EmitDefaultValue = false)] + public List Explain { get; set; } + + /// + /// Whether to take into account an index's synonyms for a particular search. + /// + /// Whether to take into account an index's synonyms for a particular search. + [DataMember(Name = "synonyms", EmitDefaultValue = true)] + public bool Synonyms { get; set; } + + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + [DataMember(Name = "clickAnalytics", EmitDefaultValue = true)] + public bool ClickAnalytics { get; set; } + + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + [DataMember(Name = "analytics", EmitDefaultValue = true)] + public bool Analytics { get; set; } + + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + [DataMember(Name = "analyticsTags", EmitDefaultValue = false)] + public List AnalyticsTags { get; set; } + + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + [DataMember(Name = "percentileComputation", EmitDefaultValue = true)] + public bool PercentileComputation { get; set; } + + /// + /// Incidates whether this search will be considered in A/B testing. + /// + /// Incidates whether this search will be considered in A/B testing. + [DataMember(Name = "enableABTest", EmitDefaultValue = true)] + public bool EnableABTest { get; set; } + + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + [DataMember(Name = "attributesForFaceting", EmitDefaultValue = false)] + public List AttributesForFaceting { get; set; } + + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + [DataMember(Name = "attributesToRetrieve", EmitDefaultValue = false)] + public List AttributesToRetrieve { get; set; } + + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + [DataMember(Name = "ranking", EmitDefaultValue = false)] + public List Ranking { get; set; } + + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + [DataMember(Name = "customRanking", EmitDefaultValue = false)] + public List CustomRanking { get; set; } + + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + [DataMember(Name = "relevancyStrictness", EmitDefaultValue = false)] + public int RelevancyStrictness { get; set; } + + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + [DataMember(Name = "attributesToHighlight", EmitDefaultValue = false)] + public List AttributesToHighlight { get; set; } + + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + [DataMember(Name = "attributesToSnippet", EmitDefaultValue = false)] + public List AttributesToSnippet { get; set; } + + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPreTag", EmitDefaultValue = false)] + public string HighlightPreTag { get; set; } + + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPostTag", EmitDefaultValue = false)] + public string HighlightPostTag { get; set; } + + /// + /// String used as an ellipsis indicator when a snippet is truncated. + /// + /// String used as an ellipsis indicator when a snippet is truncated. + [DataMember(Name = "snippetEllipsisText", EmitDefaultValue = false)] + public string SnippetEllipsisText { get; set; } + + /// + /// Restrict highlighting and snippeting to items that matched the query. + /// + /// Restrict highlighting and snippeting to items that matched the query. + [DataMember(Name = "restrictHighlightAndSnippetArrays", EmitDefaultValue = true)] + public bool RestrictHighlightAndSnippetArrays { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", EmitDefaultValue = false)] + public int HitsPerPage { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor1Typo", EmitDefaultValue = false)] + public int MinWordSizefor1Typo { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor2Typos", EmitDefaultValue = false)] + public int MinWordSizefor2Typos { get; set; } + + /// + /// Gets or Sets TypoTolerance + /// + [DataMember(Name = "typoTolerance", EmitDefaultValue = false)] + public TypoTolerance TypoTolerance { get; set; } + + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + [DataMember(Name = "allowTyposOnNumericTokens", EmitDefaultValue = true)] + public bool AllowTyposOnNumericTokens { get; set; } + + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + [DataMember(Name = "disableTypoToleranceOnAttributes", EmitDefaultValue = false)] + public List DisableTypoToleranceOnAttributes { get; set; } + + /// + /// Gets or Sets IgnorePlurals + /// + [DataMember(Name = "ignorePlurals", EmitDefaultValue = false)] + public IgnorePlurals IgnorePlurals { get; set; } + + /// + /// Gets or Sets RemoveStopWords + /// + [DataMember(Name = "removeStopWords", EmitDefaultValue = false)] + public RemoveStopWords RemoveStopWords { get; set; } + + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + [DataMember(Name = "keepDiacriticsOnCharacters", EmitDefaultValue = false)] + public string KeepDiacriticsOnCharacters { get; set; } + + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + [DataMember(Name = "queryLanguages", EmitDefaultValue = false)] + public List QueryLanguages { get; set; } + + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + [DataMember(Name = "decompoundQuery", EmitDefaultValue = true)] + public bool DecompoundQuery { get; set; } + + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + [DataMember(Name = "enableRules", EmitDefaultValue = true)] + public bool EnableRules { get; set; } + + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + [DataMember(Name = "enablePersonalization", EmitDefaultValue = true)] + public bool EnablePersonalization { get; set; } + + /// + /// Gets or Sets SemanticSearch + /// + [DataMember(Name = "semanticSearch", EmitDefaultValue = false)] + public SemanticSearch SemanticSearch { get; set; } + + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + [DataMember(Name = "advancedSyntax", EmitDefaultValue = true)] + public bool AdvancedSyntax { get; set; } + + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + [DataMember(Name = "optionalWords", EmitDefaultValue = false)] + public List OptionalWords { get; set; } + + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "disableExactOnAttributes", EmitDefaultValue = false)] + public List DisableExactOnAttributes { get; set; } + + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "alternativesAsExact", EmitDefaultValue = false)] + public List AlternativesAsExact { get; set; } + + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + [DataMember(Name = "advancedSyntaxFeatures", EmitDefaultValue = false)] + public List AdvancedSyntaxFeatures { get; set; } + + /// + /// Gets or Sets Distinct + /// + [DataMember(Name = "distinct", EmitDefaultValue = false)] + public Distinct Distinct { get; set; } + + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + [DataMember(Name = "replaceSynonymsInHighlight", EmitDefaultValue = true)] + public bool ReplaceSynonymsInHighlight { get; set; } + + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + [DataMember(Name = "minProximity", EmitDefaultValue = false)] + public int MinProximity { get; set; } + + /// + /// Attributes to include in the API response for search and browse queries. + /// + /// Attributes to include in the API response for search and browse queries. + [DataMember(Name = "responseFields", EmitDefaultValue = false)] + public List ResponseFields { get; set; } + + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + [DataMember(Name = "maxFacetHits", EmitDefaultValue = false)] + public int MaxFacetHits { get; set; } + + /// + /// Maximum number of facet values to return for each facet. + /// + /// Maximum number of facet values to return for each facet. + [DataMember(Name = "maxValuesPerFacet", EmitDefaultValue = false)] + public int MaxValuesPerFacet { get; set; } + + /// + /// Controls how facet values are fetched. + /// + /// Controls how facet values are fetched. + [DataMember(Name = "sortFacetValuesBy", EmitDefaultValue = false)] + public string SortFacetValuesBy { get; set; } + + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + [DataMember(Name = "attributeCriteriaComputedByMinProximity", EmitDefaultValue = true)] + public bool AttributeCriteriaComputedByMinProximity { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + [DataMember(Name = "enableReRanking", EmitDefaultValue = true)] + public bool EnableReRanking { get; set; } + + /// + /// Gets or Sets ReRankingApplyFilter + /// + [DataMember(Name = "reRankingApplyFilter", EmitDefaultValue = true)] + public ReRankingApplyFilter ReRankingApplyFilter { get; set; } + + /// + /// Facet name. + /// + /// Facet name. + [DataMember(Name = "facet", IsRequired = true, EmitDefaultValue = true)] + public string Facet { get; set; } + + /// + /// Algolia index name. + /// + /// Algolia index name. + [DataMember(Name = "indexName", IsRequired = true, EmitDefaultValue = true)] + public string IndexName { get; set; } + + /// + /// Text to search inside the facet's values. + /// + /// Text to search inside the facet's values. + [DataMember(Name = "facetQuery", EmitDefaultValue = false)] + public string FacetQuery { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchForFacets {\n"); + sb.Append(" VarParams: ").Append(VarParams).Append("\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" SimilarQuery: ").Append(SimilarQuery).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" FacetFilters: ").Append(FacetFilters).Append("\n"); + sb.Append(" OptionalFilters: ").Append(OptionalFilters).Append("\n"); + sb.Append(" NumericFilters: ").Append(NumericFilters).Append("\n"); + sb.Append(" TagFilters: ").Append(TagFilters).Append("\n"); + sb.Append(" SumOrFiltersScores: ").Append(SumOrFiltersScores).Append("\n"); + sb.Append(" RestrictSearchableAttributes: ").Append(RestrictSearchableAttributes).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" FacetingAfterDistinct: ").Append(FacetingAfterDistinct).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" Offset: ").Append(Offset).Append("\n"); + sb.Append(" Length: ").Append(Length).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AroundLatLngViaIP: ").Append(AroundLatLngViaIP).Append("\n"); + sb.Append(" AroundRadius: ").Append(AroundRadius).Append("\n"); + sb.Append(" AroundPrecision: ").Append(AroundPrecision).Append("\n"); + sb.Append(" MinimumAroundRadius: ").Append(MinimumAroundRadius).Append("\n"); + sb.Append(" InsideBoundingBox: ").Append(InsideBoundingBox).Append("\n"); + sb.Append(" InsidePolygon: ").Append(InsidePolygon).Append("\n"); + sb.Append(" NaturalLanguages: ").Append(NaturalLanguages).Append("\n"); + sb.Append(" RuleContexts: ").Append(RuleContexts).Append("\n"); + sb.Append(" PersonalizationImpact: ").Append(PersonalizationImpact).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" GetRankingInfo: ").Append(GetRankingInfo).Append("\n"); + sb.Append(" Explain: ").Append(Explain).Append("\n"); + sb.Append(" Synonyms: ").Append(Synonyms).Append("\n"); + sb.Append(" ClickAnalytics: ").Append(ClickAnalytics).Append("\n"); + sb.Append(" Analytics: ").Append(Analytics).Append("\n"); + sb.Append(" AnalyticsTags: ").Append(AnalyticsTags).Append("\n"); + sb.Append(" PercentileComputation: ").Append(PercentileComputation).Append("\n"); + sb.Append(" EnableABTest: ").Append(EnableABTest).Append("\n"); + sb.Append(" AttributesForFaceting: ").Append(AttributesForFaceting).Append("\n"); + sb.Append(" AttributesToRetrieve: ").Append(AttributesToRetrieve).Append("\n"); + sb.Append(" Ranking: ").Append(Ranking).Append("\n"); + sb.Append(" CustomRanking: ").Append(CustomRanking).Append("\n"); + sb.Append(" RelevancyStrictness: ").Append(RelevancyStrictness).Append("\n"); + sb.Append(" AttributesToHighlight: ").Append(AttributesToHighlight).Append("\n"); + sb.Append(" AttributesToSnippet: ").Append(AttributesToSnippet).Append("\n"); + sb.Append(" HighlightPreTag: ").Append(HighlightPreTag).Append("\n"); + sb.Append(" HighlightPostTag: ").Append(HighlightPostTag).Append("\n"); + sb.Append(" SnippetEllipsisText: ").Append(SnippetEllipsisText).Append("\n"); + sb.Append(" RestrictHighlightAndSnippetArrays: ").Append(RestrictHighlightAndSnippetArrays).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" MinWordSizefor1Typo: ").Append(MinWordSizefor1Typo).Append("\n"); + sb.Append(" MinWordSizefor2Typos: ").Append(MinWordSizefor2Typos).Append("\n"); + sb.Append(" TypoTolerance: ").Append(TypoTolerance).Append("\n"); + sb.Append(" AllowTyposOnNumericTokens: ").Append(AllowTyposOnNumericTokens).Append("\n"); + sb.Append(" DisableTypoToleranceOnAttributes: ").Append(DisableTypoToleranceOnAttributes).Append("\n"); + sb.Append(" IgnorePlurals: ").Append(IgnorePlurals).Append("\n"); + sb.Append(" RemoveStopWords: ").Append(RemoveStopWords).Append("\n"); + sb.Append(" KeepDiacriticsOnCharacters: ").Append(KeepDiacriticsOnCharacters).Append("\n"); + sb.Append(" QueryLanguages: ").Append(QueryLanguages).Append("\n"); + sb.Append(" DecompoundQuery: ").Append(DecompoundQuery).Append("\n"); + sb.Append(" EnableRules: ").Append(EnableRules).Append("\n"); + sb.Append(" EnablePersonalization: ").Append(EnablePersonalization).Append("\n"); + sb.Append(" QueryType: ").Append(QueryType).Append("\n"); + sb.Append(" RemoveWordsIfNoResults: ").Append(RemoveWordsIfNoResults).Append("\n"); + sb.Append(" Mode: ").Append(Mode).Append("\n"); + sb.Append(" SemanticSearch: ").Append(SemanticSearch).Append("\n"); + sb.Append(" AdvancedSyntax: ").Append(AdvancedSyntax).Append("\n"); + sb.Append(" OptionalWords: ").Append(OptionalWords).Append("\n"); + sb.Append(" DisableExactOnAttributes: ").Append(DisableExactOnAttributes).Append("\n"); + sb.Append(" ExactOnSingleWordQuery: ").Append(ExactOnSingleWordQuery).Append("\n"); + sb.Append(" AlternativesAsExact: ").Append(AlternativesAsExact).Append("\n"); + sb.Append(" AdvancedSyntaxFeatures: ").Append(AdvancedSyntaxFeatures).Append("\n"); + sb.Append(" Distinct: ").Append(Distinct).Append("\n"); + sb.Append(" ReplaceSynonymsInHighlight: ").Append(ReplaceSynonymsInHighlight).Append("\n"); + sb.Append(" MinProximity: ").Append(MinProximity).Append("\n"); + sb.Append(" ResponseFields: ").Append(ResponseFields).Append("\n"); + sb.Append(" MaxFacetHits: ").Append(MaxFacetHits).Append("\n"); + sb.Append(" MaxValuesPerFacet: ").Append(MaxValuesPerFacet).Append("\n"); + sb.Append(" SortFacetValuesBy: ").Append(SortFacetValuesBy).Append("\n"); + sb.Append(" AttributeCriteriaComputedByMinProximity: ").Append(AttributeCriteriaComputedByMinProximity).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append(" EnableReRanking: ").Append(EnableReRanking).Append("\n"); + sb.Append(" ReRankingApplyFilter: ").Append(ReRankingApplyFilter).Append("\n"); + sb.Append(" Facet: ").Append(Facet).Append("\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append(" FacetQuery: ").Append(FacetQuery).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchForFacets); + } + + /// + /// Returns true if SearchForFacets instances are equal + /// + /// Instance of SearchForFacets to be compared + /// Boolean + public bool Equals(SearchForFacets input) + { + if (input == null) + { + return false; + } + return + ( + this.VarParams == input.VarParams || + (this.VarParams != null && + this.VarParams.Equals(input.VarParams)) + ) && + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.SimilarQuery == input.SimilarQuery || + (this.SimilarQuery != null && + this.SimilarQuery.Equals(input.SimilarQuery)) + ) && + ( + this.Filters == input.Filters || + (this.Filters != null && + this.Filters.Equals(input.Filters)) + ) && + ( + this.FacetFilters == input.FacetFilters || + (this.FacetFilters != null && + this.FacetFilters.Equals(input.FacetFilters)) + ) && + ( + this.OptionalFilters == input.OptionalFilters || + (this.OptionalFilters != null && + this.OptionalFilters.Equals(input.OptionalFilters)) + ) && + ( + this.NumericFilters == input.NumericFilters || + (this.NumericFilters != null && + this.NumericFilters.Equals(input.NumericFilters)) + ) && + ( + this.TagFilters == input.TagFilters || + (this.TagFilters != null && + this.TagFilters.Equals(input.TagFilters)) + ) && + ( + this.SumOrFiltersScores == input.SumOrFiltersScores || + this.SumOrFiltersScores.Equals(input.SumOrFiltersScores) + ) && + ( + this.RestrictSearchableAttributes == input.RestrictSearchableAttributes || + this.RestrictSearchableAttributes != null && + input.RestrictSearchableAttributes != null && + this.RestrictSearchableAttributes.SequenceEqual(input.RestrictSearchableAttributes) + ) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && + ( + this.FacetingAfterDistinct == input.FacetingAfterDistinct || + this.FacetingAfterDistinct.Equals(input.FacetingAfterDistinct) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.Offset == input.Offset || + this.Offset.Equals(input.Offset) + ) && + ( + this.Length == input.Length || + this.Length.Equals(input.Length) + ) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && + ( + this.AroundLatLngViaIP == input.AroundLatLngViaIP || + this.AroundLatLngViaIP.Equals(input.AroundLatLngViaIP) + ) && + ( + this.AroundRadius == input.AroundRadius || + (this.AroundRadius != null && + this.AroundRadius.Equals(input.AroundRadius)) + ) && + ( + this.AroundPrecision == input.AroundPrecision || + (this.AroundPrecision != null && + this.AroundPrecision.Equals(input.AroundPrecision)) + ) && + ( + this.MinimumAroundRadius == input.MinimumAroundRadius || + this.MinimumAroundRadius.Equals(input.MinimumAroundRadius) + ) && + ( + this.InsideBoundingBox == input.InsideBoundingBox || + this.InsideBoundingBox != null && + input.InsideBoundingBox != null && + this.InsideBoundingBox.SequenceEqual(input.InsideBoundingBox) + ) && + ( + this.InsidePolygon == input.InsidePolygon || + this.InsidePolygon != null && + input.InsidePolygon != null && + this.InsidePolygon.SequenceEqual(input.InsidePolygon) + ) && + ( + this.NaturalLanguages == input.NaturalLanguages || + this.NaturalLanguages != null && + input.NaturalLanguages != null && + this.NaturalLanguages.SequenceEqual(input.NaturalLanguages) + ) && + ( + this.RuleContexts == input.RuleContexts || + this.RuleContexts != null && + input.RuleContexts != null && + this.RuleContexts.SequenceEqual(input.RuleContexts) + ) && + ( + this.PersonalizationImpact == input.PersonalizationImpact || + this.PersonalizationImpact.Equals(input.PersonalizationImpact) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.GetRankingInfo == input.GetRankingInfo || + this.GetRankingInfo.Equals(input.GetRankingInfo) + ) && + ( + this.Explain == input.Explain || + this.Explain != null && + input.Explain != null && + this.Explain.SequenceEqual(input.Explain) + ) && + ( + this.Synonyms == input.Synonyms || + this.Synonyms.Equals(input.Synonyms) + ) && + ( + this.ClickAnalytics == input.ClickAnalytics || + this.ClickAnalytics.Equals(input.ClickAnalytics) + ) && + ( + this.Analytics == input.Analytics || + this.Analytics.Equals(input.Analytics) + ) && + ( + this.AnalyticsTags == input.AnalyticsTags || + this.AnalyticsTags != null && + input.AnalyticsTags != null && + this.AnalyticsTags.SequenceEqual(input.AnalyticsTags) + ) && + ( + this.PercentileComputation == input.PercentileComputation || + this.PercentileComputation.Equals(input.PercentileComputation) + ) && + ( + this.EnableABTest == input.EnableABTest || + this.EnableABTest.Equals(input.EnableABTest) + ) && + ( + this.AttributesForFaceting == input.AttributesForFaceting || + this.AttributesForFaceting != null && + input.AttributesForFaceting != null && + this.AttributesForFaceting.SequenceEqual(input.AttributesForFaceting) + ) && + ( + this.AttributesToRetrieve == input.AttributesToRetrieve || + this.AttributesToRetrieve != null && + input.AttributesToRetrieve != null && + this.AttributesToRetrieve.SequenceEqual(input.AttributesToRetrieve) + ) && + ( + this.Ranking == input.Ranking || + this.Ranking != null && + input.Ranking != null && + this.Ranking.SequenceEqual(input.Ranking) + ) && + ( + this.CustomRanking == input.CustomRanking || + this.CustomRanking != null && + input.CustomRanking != null && + this.CustomRanking.SequenceEqual(input.CustomRanking) + ) && + ( + this.RelevancyStrictness == input.RelevancyStrictness || + this.RelevancyStrictness.Equals(input.RelevancyStrictness) + ) && + ( + this.AttributesToHighlight == input.AttributesToHighlight || + this.AttributesToHighlight != null && + input.AttributesToHighlight != null && + this.AttributesToHighlight.SequenceEqual(input.AttributesToHighlight) + ) && + ( + this.AttributesToSnippet == input.AttributesToSnippet || + this.AttributesToSnippet != null && + input.AttributesToSnippet != null && + this.AttributesToSnippet.SequenceEqual(input.AttributesToSnippet) + ) && + ( + this.HighlightPreTag == input.HighlightPreTag || + (this.HighlightPreTag != null && + this.HighlightPreTag.Equals(input.HighlightPreTag)) + ) && + ( + this.HighlightPostTag == input.HighlightPostTag || + (this.HighlightPostTag != null && + this.HighlightPostTag.Equals(input.HighlightPostTag)) + ) && + ( + this.SnippetEllipsisText == input.SnippetEllipsisText || + (this.SnippetEllipsisText != null && + this.SnippetEllipsisText.Equals(input.SnippetEllipsisText)) + ) && + ( + this.RestrictHighlightAndSnippetArrays == input.RestrictHighlightAndSnippetArrays || + this.RestrictHighlightAndSnippetArrays.Equals(input.RestrictHighlightAndSnippetArrays) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && + ( + this.MinWordSizefor1Typo == input.MinWordSizefor1Typo || + this.MinWordSizefor1Typo.Equals(input.MinWordSizefor1Typo) + ) && + ( + this.MinWordSizefor2Typos == input.MinWordSizefor2Typos || + this.MinWordSizefor2Typos.Equals(input.MinWordSizefor2Typos) + ) && + ( + this.TypoTolerance == input.TypoTolerance || + (this.TypoTolerance != null && + this.TypoTolerance.Equals(input.TypoTolerance)) + ) && + ( + this.AllowTyposOnNumericTokens == input.AllowTyposOnNumericTokens || + this.AllowTyposOnNumericTokens.Equals(input.AllowTyposOnNumericTokens) + ) && + ( + this.DisableTypoToleranceOnAttributes == input.DisableTypoToleranceOnAttributes || + this.DisableTypoToleranceOnAttributes != null && + input.DisableTypoToleranceOnAttributes != null && + this.DisableTypoToleranceOnAttributes.SequenceEqual(input.DisableTypoToleranceOnAttributes) + ) && + ( + this.IgnorePlurals == input.IgnorePlurals || + (this.IgnorePlurals != null && + this.IgnorePlurals.Equals(input.IgnorePlurals)) + ) && + ( + this.RemoveStopWords == input.RemoveStopWords || + (this.RemoveStopWords != null && + this.RemoveStopWords.Equals(input.RemoveStopWords)) + ) && + ( + this.KeepDiacriticsOnCharacters == input.KeepDiacriticsOnCharacters || + (this.KeepDiacriticsOnCharacters != null && + this.KeepDiacriticsOnCharacters.Equals(input.KeepDiacriticsOnCharacters)) + ) && + ( + this.QueryLanguages == input.QueryLanguages || + this.QueryLanguages != null && + input.QueryLanguages != null && + this.QueryLanguages.SequenceEqual(input.QueryLanguages) + ) && + ( + this.DecompoundQuery == input.DecompoundQuery || + this.DecompoundQuery.Equals(input.DecompoundQuery) + ) && + ( + this.EnableRules == input.EnableRules || + this.EnableRules.Equals(input.EnableRules) + ) && + ( + this.EnablePersonalization == input.EnablePersonalization || + this.EnablePersonalization.Equals(input.EnablePersonalization) + ) && + ( + this.QueryType == input.QueryType || + this.QueryType.Equals(input.QueryType) + ) && + ( + this.RemoveWordsIfNoResults == input.RemoveWordsIfNoResults || + this.RemoveWordsIfNoResults.Equals(input.RemoveWordsIfNoResults) + ) && + ( + this.Mode == input.Mode || + this.Mode.Equals(input.Mode) + ) && + ( + this.SemanticSearch == input.SemanticSearch || + (this.SemanticSearch != null && + this.SemanticSearch.Equals(input.SemanticSearch)) + ) && + ( + this.AdvancedSyntax == input.AdvancedSyntax || + this.AdvancedSyntax.Equals(input.AdvancedSyntax) + ) && + ( + this.OptionalWords == input.OptionalWords || + this.OptionalWords != null && + input.OptionalWords != null && + this.OptionalWords.SequenceEqual(input.OptionalWords) + ) && + ( + this.DisableExactOnAttributes == input.DisableExactOnAttributes || + this.DisableExactOnAttributes != null && + input.DisableExactOnAttributes != null && + this.DisableExactOnAttributes.SequenceEqual(input.DisableExactOnAttributes) + ) && + ( + this.ExactOnSingleWordQuery == input.ExactOnSingleWordQuery || + this.ExactOnSingleWordQuery.Equals(input.ExactOnSingleWordQuery) + ) && + ( + this.AlternativesAsExact == input.AlternativesAsExact || + this.AlternativesAsExact != null && + input.AlternativesAsExact != null && + this.AlternativesAsExact.SequenceEqual(input.AlternativesAsExact) + ) && + ( + this.AdvancedSyntaxFeatures == input.AdvancedSyntaxFeatures || + this.AdvancedSyntaxFeatures != null && + input.AdvancedSyntaxFeatures != null && + this.AdvancedSyntaxFeatures.SequenceEqual(input.AdvancedSyntaxFeatures) + ) && + ( + this.Distinct == input.Distinct || + (this.Distinct != null && + this.Distinct.Equals(input.Distinct)) + ) && + ( + this.ReplaceSynonymsInHighlight == input.ReplaceSynonymsInHighlight || + this.ReplaceSynonymsInHighlight.Equals(input.ReplaceSynonymsInHighlight) + ) && + ( + this.MinProximity == input.MinProximity || + this.MinProximity.Equals(input.MinProximity) + ) && + ( + this.ResponseFields == input.ResponseFields || + this.ResponseFields != null && + input.ResponseFields != null && + this.ResponseFields.SequenceEqual(input.ResponseFields) + ) && + ( + this.MaxFacetHits == input.MaxFacetHits || + this.MaxFacetHits.Equals(input.MaxFacetHits) + ) && + ( + this.MaxValuesPerFacet == input.MaxValuesPerFacet || + this.MaxValuesPerFacet.Equals(input.MaxValuesPerFacet) + ) && + ( + this.SortFacetValuesBy == input.SortFacetValuesBy || + (this.SortFacetValuesBy != null && + this.SortFacetValuesBy.Equals(input.SortFacetValuesBy)) + ) && + ( + this.AttributeCriteriaComputedByMinProximity == input.AttributeCriteriaComputedByMinProximity || + this.AttributeCriteriaComputedByMinProximity.Equals(input.AttributeCriteriaComputedByMinProximity) + ) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ) && + ( + this.EnableReRanking == input.EnableReRanking || + this.EnableReRanking.Equals(input.EnableReRanking) + ) && + ( + this.ReRankingApplyFilter == input.ReRankingApplyFilter || + (this.ReRankingApplyFilter != null && + this.ReRankingApplyFilter.Equals(input.ReRankingApplyFilter)) + ) && + ( + this.Facet == input.Facet || + (this.Facet != null && + this.Facet.Equals(input.Facet)) + ) && + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ) && + ( + this.FacetQuery == input.FacetQuery || + (this.FacetQuery != null && + this.FacetQuery.Equals(input.FacetQuery)) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.VarParams != null) + { + hashCode = (hashCode * 59) + this.VarParams.GetHashCode(); + } + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.SimilarQuery != null) + { + hashCode = (hashCode * 59) + this.SimilarQuery.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.FacetFilters != null) + { + hashCode = (hashCode * 59) + this.FacetFilters.GetHashCode(); + } + if (this.OptionalFilters != null) + { + hashCode = (hashCode * 59) + this.OptionalFilters.GetHashCode(); + } + if (this.NumericFilters != null) + { + hashCode = (hashCode * 59) + this.NumericFilters.GetHashCode(); + } + if (this.TagFilters != null) + { + hashCode = (hashCode * 59) + this.TagFilters.GetHashCode(); + } + hashCode = (hashCode * 59) + this.SumOrFiltersScores.GetHashCode(); + if (this.RestrictSearchableAttributes != null) + { + hashCode = (hashCode * 59) + this.RestrictSearchableAttributes.GetHashCode(); + } + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + hashCode = (hashCode * 59) + this.FacetingAfterDistinct.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.Offset.GetHashCode(); + hashCode = (hashCode * 59) + this.Length.GetHashCode(); + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AroundLatLngViaIP.GetHashCode(); + if (this.AroundRadius != null) + { + hashCode = (hashCode * 59) + this.AroundRadius.GetHashCode(); + } + if (this.AroundPrecision != null) + { + hashCode = (hashCode * 59) + this.AroundPrecision.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MinimumAroundRadius.GetHashCode(); + if (this.InsideBoundingBox != null) + { + hashCode = (hashCode * 59) + this.InsideBoundingBox.GetHashCode(); + } + if (this.InsidePolygon != null) + { + hashCode = (hashCode * 59) + this.InsidePolygon.GetHashCode(); + } + if (this.NaturalLanguages != null) + { + hashCode = (hashCode * 59) + this.NaturalLanguages.GetHashCode(); + } + if (this.RuleContexts != null) + { + hashCode = (hashCode * 59) + this.RuleContexts.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PersonalizationImpact.GetHashCode(); + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.GetRankingInfo.GetHashCode(); + if (this.Explain != null) + { + hashCode = (hashCode * 59) + this.Explain.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Synonyms.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickAnalytics.GetHashCode(); + hashCode = (hashCode * 59) + this.Analytics.GetHashCode(); + if (this.AnalyticsTags != null) + { + hashCode = (hashCode * 59) + this.AnalyticsTags.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PercentileComputation.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableABTest.GetHashCode(); + if (this.AttributesForFaceting != null) + { + hashCode = (hashCode * 59) + this.AttributesForFaceting.GetHashCode(); + } + if (this.AttributesToRetrieve != null) + { + hashCode = (hashCode * 59) + this.AttributesToRetrieve.GetHashCode(); + } + if (this.Ranking != null) + { + hashCode = (hashCode * 59) + this.Ranking.GetHashCode(); + } + if (this.CustomRanking != null) + { + hashCode = (hashCode * 59) + this.CustomRanking.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RelevancyStrictness.GetHashCode(); + if (this.AttributesToHighlight != null) + { + hashCode = (hashCode * 59) + this.AttributesToHighlight.GetHashCode(); + } + if (this.AttributesToSnippet != null) + { + hashCode = (hashCode * 59) + this.AttributesToSnippet.GetHashCode(); + } + if (this.HighlightPreTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPreTag.GetHashCode(); + } + if (this.HighlightPostTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPostTag.GetHashCode(); + } + if (this.SnippetEllipsisText != null) + { + hashCode = (hashCode * 59) + this.SnippetEllipsisText.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RestrictHighlightAndSnippetArrays.GetHashCode(); + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor1Typo.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor2Typos.GetHashCode(); + if (this.TypoTolerance != null) + { + hashCode = (hashCode * 59) + this.TypoTolerance.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AllowTyposOnNumericTokens.GetHashCode(); + if (this.DisableTypoToleranceOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableTypoToleranceOnAttributes.GetHashCode(); + } + if (this.IgnorePlurals != null) + { + hashCode = (hashCode * 59) + this.IgnorePlurals.GetHashCode(); + } + if (this.RemoveStopWords != null) + { + hashCode = (hashCode * 59) + this.RemoveStopWords.GetHashCode(); + } + if (this.KeepDiacriticsOnCharacters != null) + { + hashCode = (hashCode * 59) + this.KeepDiacriticsOnCharacters.GetHashCode(); + } + if (this.QueryLanguages != null) + { + hashCode = (hashCode * 59) + this.QueryLanguages.GetHashCode(); + } + hashCode = (hashCode * 59) + this.DecompoundQuery.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableRules.GetHashCode(); + hashCode = (hashCode * 59) + this.EnablePersonalization.GetHashCode(); + hashCode = (hashCode * 59) + this.QueryType.GetHashCode(); + hashCode = (hashCode * 59) + this.RemoveWordsIfNoResults.GetHashCode(); + hashCode = (hashCode * 59) + this.Mode.GetHashCode(); + if (this.SemanticSearch != null) + { + hashCode = (hashCode * 59) + this.SemanticSearch.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AdvancedSyntax.GetHashCode(); + if (this.OptionalWords != null) + { + hashCode = (hashCode * 59) + this.OptionalWords.GetHashCode(); + } + if (this.DisableExactOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableExactOnAttributes.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ExactOnSingleWordQuery.GetHashCode(); + if (this.AlternativesAsExact != null) + { + hashCode = (hashCode * 59) + this.AlternativesAsExact.GetHashCode(); + } + if (this.AdvancedSyntaxFeatures != null) + { + hashCode = (hashCode * 59) + this.AdvancedSyntaxFeatures.GetHashCode(); + } + if (this.Distinct != null) + { + hashCode = (hashCode * 59) + this.Distinct.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ReplaceSynonymsInHighlight.GetHashCode(); + hashCode = (hashCode * 59) + this.MinProximity.GetHashCode(); + if (this.ResponseFields != null) + { + hashCode = (hashCode * 59) + this.ResponseFields.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MaxFacetHits.GetHashCode(); + hashCode = (hashCode * 59) + this.MaxValuesPerFacet.GetHashCode(); + if (this.SortFacetValuesBy != null) + { + hashCode = (hashCode * 59) + this.SortFacetValuesBy.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AttributeCriteriaComputedByMinProximity.GetHashCode(); + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EnableReRanking.GetHashCode(); + if (this.ReRankingApplyFilter != null) + { + hashCode = (hashCode * 59) + this.ReRankingApplyFilter.GetHashCode(); + } + if (this.Facet != null) + { + hashCode = (hashCode * 59) + this.Facet.GetHashCode(); + } + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + if (this.FacetQuery != null) + { + hashCode = (hashCode * 59) + this.FacetQuery.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Length (int) maximum + if (this.Length > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value less than or equal to 1000.", new[] { "Length" }); + } + + // Length (int) minimum + if (this.Length < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value greater than or equal to 1.", new[] { "Length" }); + } + + // MinimumAroundRadius (int) minimum + if (this.MinimumAroundRadius < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinimumAroundRadius, must be a value greater than or equal to 1.", new[] { "MinimumAroundRadius" }); + } + + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + // MinProximity (int) maximum + if (this.MinProximity > (int)7) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value less than or equal to 7.", new[] { "MinProximity" }); + } + + // MinProximity (int) minimum + if (this.MinProximity < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value greater than or equal to 1.", new[] { "MinProximity" }); + } + + // MaxFacetHits (int) maximum + if (this.MaxFacetHits > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MaxFacetHits, must be a value less than or equal to 100.", new[] { "MaxFacetHits" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchForFacetsOptions.cs b/algoliasearch/Search/Models/SearchForFacetsOptions.cs new file mode 100644 index 000000000..ec80bc5c1 --- /dev/null +++ b/algoliasearch/Search/Models/SearchForFacetsOptions.cs @@ -0,0 +1,213 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchForFacetsOptions + /// + [DataContract(Name = "searchForFacetsOptions")] + public partial class SearchForFacetsOptions : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public SearchTypeFacet Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchForFacetsOptions() { } + /// + /// Initializes a new instance of the class. + /// + /// Facet name. (required). + /// Algolia index name. (required). + /// Text to search inside the facet's values. (default to ""). + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). (default to 10). + /// type (required). + public SearchForFacetsOptions(string facet = default(string), string indexName = default(string), string facetQuery = @"", int maxFacetHits = 10, SearchTypeFacet type = default(SearchTypeFacet)) + { + // to ensure "facet" is required (not null) + if (facet == null) + { + throw new ArgumentNullException("facet is a required property for SearchForFacetsOptions and cannot be null"); + } + this.Facet = facet; + // to ensure "indexName" is required (not null) + if (indexName == null) + { + throw new ArgumentNullException("indexName is a required property for SearchForFacetsOptions and cannot be null"); + } + this.IndexName = indexName; + this.Type = type; + // use default value if no "facetQuery" provided + this.FacetQuery = facetQuery ?? @""; + this.MaxFacetHits = maxFacetHits; + } + + /// + /// Facet name. + /// + /// Facet name. + [DataMember(Name = "facet", IsRequired = true, EmitDefaultValue = true)] + public string Facet { get; set; } + + /// + /// Algolia index name. + /// + /// Algolia index name. + [DataMember(Name = "indexName", IsRequired = true, EmitDefaultValue = true)] + public string IndexName { get; set; } + + /// + /// Text to search inside the facet's values. + /// + /// Text to search inside the facet's values. + [DataMember(Name = "facetQuery", EmitDefaultValue = false)] + public string FacetQuery { get; set; } + + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + [DataMember(Name = "maxFacetHits", EmitDefaultValue = false)] + public int MaxFacetHits { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchForFacetsOptions {\n"); + sb.Append(" Facet: ").Append(Facet).Append("\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append(" FacetQuery: ").Append(FacetQuery).Append("\n"); + sb.Append(" MaxFacetHits: ").Append(MaxFacetHits).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchForFacetsOptions); + } + + /// + /// Returns true if SearchForFacetsOptions instances are equal + /// + /// Instance of SearchForFacetsOptions to be compared + /// Boolean + public bool Equals(SearchForFacetsOptions input) + { + if (input == null) + { + return false; + } + return + ( + this.Facet == input.Facet || + (this.Facet != null && + this.Facet.Equals(input.Facet)) + ) && + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ) && + ( + this.FacetQuery == input.FacetQuery || + (this.FacetQuery != null && + this.FacetQuery.Equals(input.FacetQuery)) + ) && + ( + this.MaxFacetHits == input.MaxFacetHits || + this.MaxFacetHits.Equals(input.MaxFacetHits) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Facet != null) + { + hashCode = (hashCode * 59) + this.Facet.GetHashCode(); + } + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + if (this.FacetQuery != null) + { + hashCode = (hashCode * 59) + this.FacetQuery.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MaxFacetHits.GetHashCode(); + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // MaxFacetHits (int) maximum + if (this.MaxFacetHits > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MaxFacetHits, must be a value less than or equal to 100.", new[] { "MaxFacetHits" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchForHits.cs b/algoliasearch/Search/Models/SearchForHits.cs new file mode 100644 index 000000000..447c4dbc1 --- /dev/null +++ b/algoliasearch/Search/Models/SearchForHits.cs @@ -0,0 +1,1575 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchForHits + /// + [DataContract(Name = "SearchForHits")] + public partial class SearchForHits : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets QueryType + /// + [DataMember(Name = "queryType", EmitDefaultValue = false)] + public QueryType? QueryType { get; set; } + + /// + /// Gets or Sets RemoveWordsIfNoResults + /// + [DataMember(Name = "removeWordsIfNoResults", EmitDefaultValue = false)] + public RemoveWordsIfNoResults? RemoveWordsIfNoResults { get; set; } + + /// + /// Gets or Sets Mode + /// + [DataMember(Name = "mode", EmitDefaultValue = false)] + public Mode? Mode { get; set; } + + /// + /// Gets or Sets ExactOnSingleWordQuery + /// + [DataMember(Name = "exactOnSingleWordQuery", EmitDefaultValue = false)] + public ExactOnSingleWordQuery? ExactOnSingleWordQuery { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", EmitDefaultValue = false)] + public SearchTypeDefault? Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchForHits() { } + /// + /// Initializes a new instance of the class. + /// + /// Search parameters as a URL-encoded query string. (default to ""). + /// Text to search for in an index. (default to ""). + /// Overrides the query parameter and performs a more generic search. (default to ""). + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. (default to ""). + /// facetFilters. + /// optionalFilters. + /// numericFilters. + /// tagFilters. + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. (default to false). + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/).. + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values.. + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. (default to false). + /// Page to retrieve (the first page is `0`, not `1`). (default to 0). + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. (default to ""). + /// Search for entries around a location. The location is automatically computed from the requester's IP address. (default to false). + /// aroundRadius. + /// aroundPrecision. + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set.. + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries.. + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries.. + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). (default to 100). + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search.. + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). (default to false). + /// Enriches the API's response with information about how the query was processed.. + /// Whether to take into account an index's synonyms for a particular search. (default to true). + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). (default to false). + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). (default to true). + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).. + /// Whether to include or exclude a query from the processing-time percentile computation. (default to true). + /// Incidates whether this search will be considered in A/B testing. (default to true). + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. . + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes.. + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/).. + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. . + /// Relevancy threshold below which less relevant results aren't included in the results. (default to 100). + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`).. + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. . + /// HTML string to insert before the highlighted parts in all highlight and snippet results. (default to "<em>"). + /// HTML string to insert after the highlighted parts in all highlight and snippet results. (default to "</em>"). + /// String used as an ellipsis indicator when a snippet is truncated. (default to "…"). + /// Restrict highlighting and snippeting to items that matched the query. (default to false). + /// Number of hits per page. (default to 20). + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 4). + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 8). + /// typoTolerance. + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. (default to true). + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/).. + /// ignorePlurals. + /// removeStopWords. + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). (default to ""). + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection.. + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. (default to true). + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. (default to true). + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. (default to false). + /// queryType. + /// removeWordsIfNoResults. + /// mode. + /// semanticSearch. + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). (default to false). + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query.. + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// exactOnSingleWordQuery. + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled.. + /// distinct. + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. (default to false). + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). (default to 1). + /// Attributes to include in the API response for search and browse queries.. + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). (default to 10). + /// Maximum number of facet values to return for each facet. (default to 100). + /// Controls how facet values are fetched. (default to "count"). + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. (default to false). + /// renderingContent. + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). (default to true). + /// reRankingApplyFilter. + /// Algolia index name. (required). + /// type. + public SearchForHits(string varParams = @"", string query = @"", string similarQuery = @"", string filters = @"", FacetFilters facetFilters = default(FacetFilters), OptionalFilters optionalFilters = default(OptionalFilters), NumericFilters numericFilters = default(NumericFilters), TagFilters tagFilters = default(TagFilters), bool sumOrFiltersScores = false, List restrictSearchableAttributes = default(List), List facets = default(List), bool facetingAfterDistinct = false, int page = 0, int offset = default(int), int length = default(int), string aroundLatLng = @"", bool aroundLatLngViaIP = false, AroundRadius aroundRadius = default(AroundRadius), AroundPrecision aroundPrecision = default(AroundPrecision), int minimumAroundRadius = default(int), List> insideBoundingBox = default(List>), List> insidePolygon = default(List>), List naturalLanguages = default(List), List ruleContexts = default(List), int personalizationImpact = 100, string userToken = default(string), bool getRankingInfo = false, List explain = default(List), bool synonyms = true, bool clickAnalytics = false, bool analytics = true, List analyticsTags = default(List), bool percentileComputation = true, bool enableABTest = true, List attributesForFaceting = default(List), List attributesToRetrieve = default(List), List ranking = default(List), List customRanking = default(List), int relevancyStrictness = 100, List attributesToHighlight = default(List), List attributesToSnippet = default(List), string highlightPreTag = @"", string highlightPostTag = @"", string snippetEllipsisText = @"…", bool restrictHighlightAndSnippetArrays = false, int hitsPerPage = 20, int minWordSizefor1Typo = 4, int minWordSizefor2Typos = 8, TypoTolerance typoTolerance = default(TypoTolerance), bool allowTyposOnNumericTokens = true, List disableTypoToleranceOnAttributes = default(List), IgnorePlurals ignorePlurals = default(IgnorePlurals), RemoveStopWords removeStopWords = default(RemoveStopWords), string keepDiacriticsOnCharacters = @"", List queryLanguages = default(List), bool decompoundQuery = true, bool enableRules = true, bool enablePersonalization = false, QueryType? queryType = default(QueryType?), RemoveWordsIfNoResults? removeWordsIfNoResults = default(RemoveWordsIfNoResults?), Mode? mode = default(Mode?), SemanticSearch semanticSearch = default(SemanticSearch), bool advancedSyntax = false, List optionalWords = default(List), List disableExactOnAttributes = default(List), ExactOnSingleWordQuery? exactOnSingleWordQuery = default(ExactOnSingleWordQuery?), List alternativesAsExact = default(List), List advancedSyntaxFeatures = default(List), Distinct distinct = default(Distinct), bool replaceSynonymsInHighlight = false, int minProximity = 1, List responseFields = default(List), int maxFacetHits = 10, int maxValuesPerFacet = 100, string sortFacetValuesBy = @"count", bool attributeCriteriaComputedByMinProximity = false, RenderingContent renderingContent = default(RenderingContent), bool enableReRanking = true, ReRankingApplyFilter reRankingApplyFilter = default(ReRankingApplyFilter), string indexName = default(string), SearchTypeDefault? type = default(SearchTypeDefault?)) + { + // to ensure "indexName" is required (not null) + if (indexName == null) + { + throw new ArgumentNullException("indexName is a required property for SearchForHits and cannot be null"); + } + this.IndexName = indexName; + // use default value if no "varParams" provided + this.VarParams = varParams ?? @""; + // use default value if no "query" provided + this.Query = query ?? @""; + // use default value if no "similarQuery" provided + this.SimilarQuery = similarQuery ?? @""; + // use default value if no "filters" provided + this.Filters = filters ?? @""; + this.FacetFilters = facetFilters; + this.OptionalFilters = optionalFilters; + this.NumericFilters = numericFilters; + this.TagFilters = tagFilters; + this.SumOrFiltersScores = sumOrFiltersScores; + this.RestrictSearchableAttributes = restrictSearchableAttributes; + this.Facets = facets; + this.FacetingAfterDistinct = facetingAfterDistinct; + this.Page = page; + this.Offset = offset; + this.Length = length; + // use default value if no "aroundLatLng" provided + this.AroundLatLng = aroundLatLng ?? @""; + this.AroundLatLngViaIP = aroundLatLngViaIP; + this.AroundRadius = aroundRadius; + this.AroundPrecision = aroundPrecision; + this.MinimumAroundRadius = minimumAroundRadius; + this.InsideBoundingBox = insideBoundingBox; + this.InsidePolygon = insidePolygon; + this.NaturalLanguages = naturalLanguages; + this.RuleContexts = ruleContexts; + this.PersonalizationImpact = personalizationImpact; + this.UserToken = userToken; + this.GetRankingInfo = getRankingInfo; + this.Explain = explain; + this.Synonyms = synonyms; + this.ClickAnalytics = clickAnalytics; + this.Analytics = analytics; + this.AnalyticsTags = analyticsTags; + this.PercentileComputation = percentileComputation; + this.EnableABTest = enableABTest; + this.AttributesForFaceting = attributesForFaceting; + this.AttributesToRetrieve = attributesToRetrieve; + this.Ranking = ranking; + this.CustomRanking = customRanking; + this.RelevancyStrictness = relevancyStrictness; + this.AttributesToHighlight = attributesToHighlight; + this.AttributesToSnippet = attributesToSnippet; + // use default value if no "highlightPreTag" provided + this.HighlightPreTag = highlightPreTag ?? @""; + // use default value if no "highlightPostTag" provided + this.HighlightPostTag = highlightPostTag ?? @""; + // use default value if no "snippetEllipsisText" provided + this.SnippetEllipsisText = snippetEllipsisText ?? @"…"; + this.RestrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + this.HitsPerPage = hitsPerPage; + this.MinWordSizefor1Typo = minWordSizefor1Typo; + this.MinWordSizefor2Typos = minWordSizefor2Typos; + this.TypoTolerance = typoTolerance; + this.AllowTyposOnNumericTokens = allowTyposOnNumericTokens; + this.DisableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + this.IgnorePlurals = ignorePlurals; + this.RemoveStopWords = removeStopWords; + // use default value if no "keepDiacriticsOnCharacters" provided + this.KeepDiacriticsOnCharacters = keepDiacriticsOnCharacters ?? @""; + this.QueryLanguages = queryLanguages; + this.DecompoundQuery = decompoundQuery; + this.EnableRules = enableRules; + this.EnablePersonalization = enablePersonalization; + this.QueryType = queryType; + this.RemoveWordsIfNoResults = removeWordsIfNoResults; + this.Mode = mode; + this.SemanticSearch = semanticSearch; + this.AdvancedSyntax = advancedSyntax; + this.OptionalWords = optionalWords; + this.DisableExactOnAttributes = disableExactOnAttributes; + this.ExactOnSingleWordQuery = exactOnSingleWordQuery; + this.AlternativesAsExact = alternativesAsExact; + this.AdvancedSyntaxFeatures = advancedSyntaxFeatures; + this.Distinct = distinct; + this.ReplaceSynonymsInHighlight = replaceSynonymsInHighlight; + this.MinProximity = minProximity; + this.ResponseFields = responseFields; + this.MaxFacetHits = maxFacetHits; + this.MaxValuesPerFacet = maxValuesPerFacet; + // use default value if no "sortFacetValuesBy" provided + this.SortFacetValuesBy = sortFacetValuesBy ?? @"count"; + this.AttributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + this.RenderingContent = renderingContent; + this.EnableReRanking = enableReRanking; + this.ReRankingApplyFilter = reRankingApplyFilter; + this.Type = type; + } + + /// + /// Search parameters as a URL-encoded query string. + /// + /// Search parameters as a URL-encoded query string. + [DataMember(Name = "params", EmitDefaultValue = false)] + public string VarParams { get; set; } + + /// + /// Text to search for in an index. + /// + /// Text to search for in an index. + [DataMember(Name = "query", EmitDefaultValue = false)] + public string Query { get; set; } + + /// + /// Overrides the query parameter and performs a more generic search. + /// + /// Overrides the query parameter and performs a more generic search. + [DataMember(Name = "similarQuery", EmitDefaultValue = false)] + public string SimilarQuery { get; set; } + + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + [DataMember(Name = "filters", EmitDefaultValue = false)] + public string Filters { get; set; } + + /// + /// Gets or Sets FacetFilters + /// + [DataMember(Name = "facetFilters", EmitDefaultValue = false)] + public FacetFilters FacetFilters { get; set; } + + /// + /// Gets or Sets OptionalFilters + /// + [DataMember(Name = "optionalFilters", EmitDefaultValue = false)] + public OptionalFilters OptionalFilters { get; set; } + + /// + /// Gets or Sets NumericFilters + /// + [DataMember(Name = "numericFilters", EmitDefaultValue = false)] + public NumericFilters NumericFilters { get; set; } + + /// + /// Gets or Sets TagFilters + /// + [DataMember(Name = "tagFilters", EmitDefaultValue = false)] + public TagFilters TagFilters { get; set; } + + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + [DataMember(Name = "sumOrFiltersScores", EmitDefaultValue = true)] + public bool SumOrFiltersScores { get; set; } + + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + [DataMember(Name = "restrictSearchableAttributes", EmitDefaultValue = false)] + public List RestrictSearchableAttributes { get; set; } + + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + [DataMember(Name = "facets", EmitDefaultValue = false)] + public List Facets { get; set; } + + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + [DataMember(Name = "facetingAfterDistinct", EmitDefaultValue = true)] + public bool FacetingAfterDistinct { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", EmitDefaultValue = false)] + public int Page { get; set; } + + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "offset", EmitDefaultValue = false)] + public int Offset { get; set; } + + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "length", EmitDefaultValue = false)] + public int Length { get; set; } + + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + [DataMember(Name = "aroundLatLngViaIP", EmitDefaultValue = true)] + public bool AroundLatLngViaIP { get; set; } + + /// + /// Gets or Sets AroundRadius + /// + [DataMember(Name = "aroundRadius", EmitDefaultValue = false)] + public AroundRadius AroundRadius { get; set; } + + /// + /// Gets or Sets AroundPrecision + /// + [DataMember(Name = "aroundPrecision", EmitDefaultValue = false)] + public AroundPrecision AroundPrecision { get; set; } + + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + [DataMember(Name = "minimumAroundRadius", EmitDefaultValue = false)] + public int MinimumAroundRadius { get; set; } + + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insideBoundingBox", EmitDefaultValue = false)] + public List> InsideBoundingBox { get; set; } + + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insidePolygon", EmitDefaultValue = false)] + public List> InsidePolygon { get; set; } + + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + [DataMember(Name = "naturalLanguages", EmitDefaultValue = false)] + public List NaturalLanguages { get; set; } + + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + [DataMember(Name = "ruleContexts", EmitDefaultValue = false)] + public List RuleContexts { get; set; } + + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + [DataMember(Name = "personalizationImpact", EmitDefaultValue = false)] + public int PersonalizationImpact { get; set; } + + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + [DataMember(Name = "userToken", EmitDefaultValue = false)] + public string UserToken { get; set; } + + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + [DataMember(Name = "getRankingInfo", EmitDefaultValue = true)] + public bool GetRankingInfo { get; set; } + + /// + /// Enriches the API's response with information about how the query was processed. + /// + /// Enriches the API's response with information about how the query was processed. + [DataMember(Name = "explain", EmitDefaultValue = false)] + public List Explain { get; set; } + + /// + /// Whether to take into account an index's synonyms for a particular search. + /// + /// Whether to take into account an index's synonyms for a particular search. + [DataMember(Name = "synonyms", EmitDefaultValue = true)] + public bool Synonyms { get; set; } + + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + [DataMember(Name = "clickAnalytics", EmitDefaultValue = true)] + public bool ClickAnalytics { get; set; } + + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + [DataMember(Name = "analytics", EmitDefaultValue = true)] + public bool Analytics { get; set; } + + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + [DataMember(Name = "analyticsTags", EmitDefaultValue = false)] + public List AnalyticsTags { get; set; } + + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + [DataMember(Name = "percentileComputation", EmitDefaultValue = true)] + public bool PercentileComputation { get; set; } + + /// + /// Incidates whether this search will be considered in A/B testing. + /// + /// Incidates whether this search will be considered in A/B testing. + [DataMember(Name = "enableABTest", EmitDefaultValue = true)] + public bool EnableABTest { get; set; } + + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + [DataMember(Name = "attributesForFaceting", EmitDefaultValue = false)] + public List AttributesForFaceting { get; set; } + + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + [DataMember(Name = "attributesToRetrieve", EmitDefaultValue = false)] + public List AttributesToRetrieve { get; set; } + + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + [DataMember(Name = "ranking", EmitDefaultValue = false)] + public List Ranking { get; set; } + + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + [DataMember(Name = "customRanking", EmitDefaultValue = false)] + public List CustomRanking { get; set; } + + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + [DataMember(Name = "relevancyStrictness", EmitDefaultValue = false)] + public int RelevancyStrictness { get; set; } + + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + [DataMember(Name = "attributesToHighlight", EmitDefaultValue = false)] + public List AttributesToHighlight { get; set; } + + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + [DataMember(Name = "attributesToSnippet", EmitDefaultValue = false)] + public List AttributesToSnippet { get; set; } + + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPreTag", EmitDefaultValue = false)] + public string HighlightPreTag { get; set; } + + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPostTag", EmitDefaultValue = false)] + public string HighlightPostTag { get; set; } + + /// + /// String used as an ellipsis indicator when a snippet is truncated. + /// + /// String used as an ellipsis indicator when a snippet is truncated. + [DataMember(Name = "snippetEllipsisText", EmitDefaultValue = false)] + public string SnippetEllipsisText { get; set; } + + /// + /// Restrict highlighting and snippeting to items that matched the query. + /// + /// Restrict highlighting and snippeting to items that matched the query. + [DataMember(Name = "restrictHighlightAndSnippetArrays", EmitDefaultValue = true)] + public bool RestrictHighlightAndSnippetArrays { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", EmitDefaultValue = false)] + public int HitsPerPage { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor1Typo", EmitDefaultValue = false)] + public int MinWordSizefor1Typo { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor2Typos", EmitDefaultValue = false)] + public int MinWordSizefor2Typos { get; set; } + + /// + /// Gets or Sets TypoTolerance + /// + [DataMember(Name = "typoTolerance", EmitDefaultValue = false)] + public TypoTolerance TypoTolerance { get; set; } + + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + [DataMember(Name = "allowTyposOnNumericTokens", EmitDefaultValue = true)] + public bool AllowTyposOnNumericTokens { get; set; } + + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + [DataMember(Name = "disableTypoToleranceOnAttributes", EmitDefaultValue = false)] + public List DisableTypoToleranceOnAttributes { get; set; } + + /// + /// Gets or Sets IgnorePlurals + /// + [DataMember(Name = "ignorePlurals", EmitDefaultValue = false)] + public IgnorePlurals IgnorePlurals { get; set; } + + /// + /// Gets or Sets RemoveStopWords + /// + [DataMember(Name = "removeStopWords", EmitDefaultValue = false)] + public RemoveStopWords RemoveStopWords { get; set; } + + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + [DataMember(Name = "keepDiacriticsOnCharacters", EmitDefaultValue = false)] + public string KeepDiacriticsOnCharacters { get; set; } + + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + [DataMember(Name = "queryLanguages", EmitDefaultValue = false)] + public List QueryLanguages { get; set; } + + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + [DataMember(Name = "decompoundQuery", EmitDefaultValue = true)] + public bool DecompoundQuery { get; set; } + + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + [DataMember(Name = "enableRules", EmitDefaultValue = true)] + public bool EnableRules { get; set; } + + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + [DataMember(Name = "enablePersonalization", EmitDefaultValue = true)] + public bool EnablePersonalization { get; set; } + + /// + /// Gets or Sets SemanticSearch + /// + [DataMember(Name = "semanticSearch", EmitDefaultValue = false)] + public SemanticSearch SemanticSearch { get; set; } + + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + [DataMember(Name = "advancedSyntax", EmitDefaultValue = true)] + public bool AdvancedSyntax { get; set; } + + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + [DataMember(Name = "optionalWords", EmitDefaultValue = false)] + public List OptionalWords { get; set; } + + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "disableExactOnAttributes", EmitDefaultValue = false)] + public List DisableExactOnAttributes { get; set; } + + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "alternativesAsExact", EmitDefaultValue = false)] + public List AlternativesAsExact { get; set; } + + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + [DataMember(Name = "advancedSyntaxFeatures", EmitDefaultValue = false)] + public List AdvancedSyntaxFeatures { get; set; } + + /// + /// Gets or Sets Distinct + /// + [DataMember(Name = "distinct", EmitDefaultValue = false)] + public Distinct Distinct { get; set; } + + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + [DataMember(Name = "replaceSynonymsInHighlight", EmitDefaultValue = true)] + public bool ReplaceSynonymsInHighlight { get; set; } + + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + [DataMember(Name = "minProximity", EmitDefaultValue = false)] + public int MinProximity { get; set; } + + /// + /// Attributes to include in the API response for search and browse queries. + /// + /// Attributes to include in the API response for search and browse queries. + [DataMember(Name = "responseFields", EmitDefaultValue = false)] + public List ResponseFields { get; set; } + + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + [DataMember(Name = "maxFacetHits", EmitDefaultValue = false)] + public int MaxFacetHits { get; set; } + + /// + /// Maximum number of facet values to return for each facet. + /// + /// Maximum number of facet values to return for each facet. + [DataMember(Name = "maxValuesPerFacet", EmitDefaultValue = false)] + public int MaxValuesPerFacet { get; set; } + + /// + /// Controls how facet values are fetched. + /// + /// Controls how facet values are fetched. + [DataMember(Name = "sortFacetValuesBy", EmitDefaultValue = false)] + public string SortFacetValuesBy { get; set; } + + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + [DataMember(Name = "attributeCriteriaComputedByMinProximity", EmitDefaultValue = true)] + public bool AttributeCriteriaComputedByMinProximity { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + [DataMember(Name = "enableReRanking", EmitDefaultValue = true)] + public bool EnableReRanking { get; set; } + + /// + /// Gets or Sets ReRankingApplyFilter + /// + [DataMember(Name = "reRankingApplyFilter", EmitDefaultValue = true)] + public ReRankingApplyFilter ReRankingApplyFilter { get; set; } + + /// + /// Algolia index name. + /// + /// Algolia index name. + [DataMember(Name = "indexName", IsRequired = true, EmitDefaultValue = true)] + public string IndexName { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchForHits {\n"); + sb.Append(" VarParams: ").Append(VarParams).Append("\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" SimilarQuery: ").Append(SimilarQuery).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" FacetFilters: ").Append(FacetFilters).Append("\n"); + sb.Append(" OptionalFilters: ").Append(OptionalFilters).Append("\n"); + sb.Append(" NumericFilters: ").Append(NumericFilters).Append("\n"); + sb.Append(" TagFilters: ").Append(TagFilters).Append("\n"); + sb.Append(" SumOrFiltersScores: ").Append(SumOrFiltersScores).Append("\n"); + sb.Append(" RestrictSearchableAttributes: ").Append(RestrictSearchableAttributes).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" FacetingAfterDistinct: ").Append(FacetingAfterDistinct).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" Offset: ").Append(Offset).Append("\n"); + sb.Append(" Length: ").Append(Length).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AroundLatLngViaIP: ").Append(AroundLatLngViaIP).Append("\n"); + sb.Append(" AroundRadius: ").Append(AroundRadius).Append("\n"); + sb.Append(" AroundPrecision: ").Append(AroundPrecision).Append("\n"); + sb.Append(" MinimumAroundRadius: ").Append(MinimumAroundRadius).Append("\n"); + sb.Append(" InsideBoundingBox: ").Append(InsideBoundingBox).Append("\n"); + sb.Append(" InsidePolygon: ").Append(InsidePolygon).Append("\n"); + sb.Append(" NaturalLanguages: ").Append(NaturalLanguages).Append("\n"); + sb.Append(" RuleContexts: ").Append(RuleContexts).Append("\n"); + sb.Append(" PersonalizationImpact: ").Append(PersonalizationImpact).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" GetRankingInfo: ").Append(GetRankingInfo).Append("\n"); + sb.Append(" Explain: ").Append(Explain).Append("\n"); + sb.Append(" Synonyms: ").Append(Synonyms).Append("\n"); + sb.Append(" ClickAnalytics: ").Append(ClickAnalytics).Append("\n"); + sb.Append(" Analytics: ").Append(Analytics).Append("\n"); + sb.Append(" AnalyticsTags: ").Append(AnalyticsTags).Append("\n"); + sb.Append(" PercentileComputation: ").Append(PercentileComputation).Append("\n"); + sb.Append(" EnableABTest: ").Append(EnableABTest).Append("\n"); + sb.Append(" AttributesForFaceting: ").Append(AttributesForFaceting).Append("\n"); + sb.Append(" AttributesToRetrieve: ").Append(AttributesToRetrieve).Append("\n"); + sb.Append(" Ranking: ").Append(Ranking).Append("\n"); + sb.Append(" CustomRanking: ").Append(CustomRanking).Append("\n"); + sb.Append(" RelevancyStrictness: ").Append(RelevancyStrictness).Append("\n"); + sb.Append(" AttributesToHighlight: ").Append(AttributesToHighlight).Append("\n"); + sb.Append(" AttributesToSnippet: ").Append(AttributesToSnippet).Append("\n"); + sb.Append(" HighlightPreTag: ").Append(HighlightPreTag).Append("\n"); + sb.Append(" HighlightPostTag: ").Append(HighlightPostTag).Append("\n"); + sb.Append(" SnippetEllipsisText: ").Append(SnippetEllipsisText).Append("\n"); + sb.Append(" RestrictHighlightAndSnippetArrays: ").Append(RestrictHighlightAndSnippetArrays).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" MinWordSizefor1Typo: ").Append(MinWordSizefor1Typo).Append("\n"); + sb.Append(" MinWordSizefor2Typos: ").Append(MinWordSizefor2Typos).Append("\n"); + sb.Append(" TypoTolerance: ").Append(TypoTolerance).Append("\n"); + sb.Append(" AllowTyposOnNumericTokens: ").Append(AllowTyposOnNumericTokens).Append("\n"); + sb.Append(" DisableTypoToleranceOnAttributes: ").Append(DisableTypoToleranceOnAttributes).Append("\n"); + sb.Append(" IgnorePlurals: ").Append(IgnorePlurals).Append("\n"); + sb.Append(" RemoveStopWords: ").Append(RemoveStopWords).Append("\n"); + sb.Append(" KeepDiacriticsOnCharacters: ").Append(KeepDiacriticsOnCharacters).Append("\n"); + sb.Append(" QueryLanguages: ").Append(QueryLanguages).Append("\n"); + sb.Append(" DecompoundQuery: ").Append(DecompoundQuery).Append("\n"); + sb.Append(" EnableRules: ").Append(EnableRules).Append("\n"); + sb.Append(" EnablePersonalization: ").Append(EnablePersonalization).Append("\n"); + sb.Append(" QueryType: ").Append(QueryType).Append("\n"); + sb.Append(" RemoveWordsIfNoResults: ").Append(RemoveWordsIfNoResults).Append("\n"); + sb.Append(" Mode: ").Append(Mode).Append("\n"); + sb.Append(" SemanticSearch: ").Append(SemanticSearch).Append("\n"); + sb.Append(" AdvancedSyntax: ").Append(AdvancedSyntax).Append("\n"); + sb.Append(" OptionalWords: ").Append(OptionalWords).Append("\n"); + sb.Append(" DisableExactOnAttributes: ").Append(DisableExactOnAttributes).Append("\n"); + sb.Append(" ExactOnSingleWordQuery: ").Append(ExactOnSingleWordQuery).Append("\n"); + sb.Append(" AlternativesAsExact: ").Append(AlternativesAsExact).Append("\n"); + sb.Append(" AdvancedSyntaxFeatures: ").Append(AdvancedSyntaxFeatures).Append("\n"); + sb.Append(" Distinct: ").Append(Distinct).Append("\n"); + sb.Append(" ReplaceSynonymsInHighlight: ").Append(ReplaceSynonymsInHighlight).Append("\n"); + sb.Append(" MinProximity: ").Append(MinProximity).Append("\n"); + sb.Append(" ResponseFields: ").Append(ResponseFields).Append("\n"); + sb.Append(" MaxFacetHits: ").Append(MaxFacetHits).Append("\n"); + sb.Append(" MaxValuesPerFacet: ").Append(MaxValuesPerFacet).Append("\n"); + sb.Append(" SortFacetValuesBy: ").Append(SortFacetValuesBy).Append("\n"); + sb.Append(" AttributeCriteriaComputedByMinProximity: ").Append(AttributeCriteriaComputedByMinProximity).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append(" EnableReRanking: ").Append(EnableReRanking).Append("\n"); + sb.Append(" ReRankingApplyFilter: ").Append(ReRankingApplyFilter).Append("\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchForHits); + } + + /// + /// Returns true if SearchForHits instances are equal + /// + /// Instance of SearchForHits to be compared + /// Boolean + public bool Equals(SearchForHits input) + { + if (input == null) + { + return false; + } + return + ( + this.VarParams == input.VarParams || + (this.VarParams != null && + this.VarParams.Equals(input.VarParams)) + ) && + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.SimilarQuery == input.SimilarQuery || + (this.SimilarQuery != null && + this.SimilarQuery.Equals(input.SimilarQuery)) + ) && + ( + this.Filters == input.Filters || + (this.Filters != null && + this.Filters.Equals(input.Filters)) + ) && + ( + this.FacetFilters == input.FacetFilters || + (this.FacetFilters != null && + this.FacetFilters.Equals(input.FacetFilters)) + ) && + ( + this.OptionalFilters == input.OptionalFilters || + (this.OptionalFilters != null && + this.OptionalFilters.Equals(input.OptionalFilters)) + ) && + ( + this.NumericFilters == input.NumericFilters || + (this.NumericFilters != null && + this.NumericFilters.Equals(input.NumericFilters)) + ) && + ( + this.TagFilters == input.TagFilters || + (this.TagFilters != null && + this.TagFilters.Equals(input.TagFilters)) + ) && + ( + this.SumOrFiltersScores == input.SumOrFiltersScores || + this.SumOrFiltersScores.Equals(input.SumOrFiltersScores) + ) && + ( + this.RestrictSearchableAttributes == input.RestrictSearchableAttributes || + this.RestrictSearchableAttributes != null && + input.RestrictSearchableAttributes != null && + this.RestrictSearchableAttributes.SequenceEqual(input.RestrictSearchableAttributes) + ) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && + ( + this.FacetingAfterDistinct == input.FacetingAfterDistinct || + this.FacetingAfterDistinct.Equals(input.FacetingAfterDistinct) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.Offset == input.Offset || + this.Offset.Equals(input.Offset) + ) && + ( + this.Length == input.Length || + this.Length.Equals(input.Length) + ) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && + ( + this.AroundLatLngViaIP == input.AroundLatLngViaIP || + this.AroundLatLngViaIP.Equals(input.AroundLatLngViaIP) + ) && + ( + this.AroundRadius == input.AroundRadius || + (this.AroundRadius != null && + this.AroundRadius.Equals(input.AroundRadius)) + ) && + ( + this.AroundPrecision == input.AroundPrecision || + (this.AroundPrecision != null && + this.AroundPrecision.Equals(input.AroundPrecision)) + ) && + ( + this.MinimumAroundRadius == input.MinimumAroundRadius || + this.MinimumAroundRadius.Equals(input.MinimumAroundRadius) + ) && + ( + this.InsideBoundingBox == input.InsideBoundingBox || + this.InsideBoundingBox != null && + input.InsideBoundingBox != null && + this.InsideBoundingBox.SequenceEqual(input.InsideBoundingBox) + ) && + ( + this.InsidePolygon == input.InsidePolygon || + this.InsidePolygon != null && + input.InsidePolygon != null && + this.InsidePolygon.SequenceEqual(input.InsidePolygon) + ) && + ( + this.NaturalLanguages == input.NaturalLanguages || + this.NaturalLanguages != null && + input.NaturalLanguages != null && + this.NaturalLanguages.SequenceEqual(input.NaturalLanguages) + ) && + ( + this.RuleContexts == input.RuleContexts || + this.RuleContexts != null && + input.RuleContexts != null && + this.RuleContexts.SequenceEqual(input.RuleContexts) + ) && + ( + this.PersonalizationImpact == input.PersonalizationImpact || + this.PersonalizationImpact.Equals(input.PersonalizationImpact) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.GetRankingInfo == input.GetRankingInfo || + this.GetRankingInfo.Equals(input.GetRankingInfo) + ) && + ( + this.Explain == input.Explain || + this.Explain != null && + input.Explain != null && + this.Explain.SequenceEqual(input.Explain) + ) && + ( + this.Synonyms == input.Synonyms || + this.Synonyms.Equals(input.Synonyms) + ) && + ( + this.ClickAnalytics == input.ClickAnalytics || + this.ClickAnalytics.Equals(input.ClickAnalytics) + ) && + ( + this.Analytics == input.Analytics || + this.Analytics.Equals(input.Analytics) + ) && + ( + this.AnalyticsTags == input.AnalyticsTags || + this.AnalyticsTags != null && + input.AnalyticsTags != null && + this.AnalyticsTags.SequenceEqual(input.AnalyticsTags) + ) && + ( + this.PercentileComputation == input.PercentileComputation || + this.PercentileComputation.Equals(input.PercentileComputation) + ) && + ( + this.EnableABTest == input.EnableABTest || + this.EnableABTest.Equals(input.EnableABTest) + ) && + ( + this.AttributesForFaceting == input.AttributesForFaceting || + this.AttributesForFaceting != null && + input.AttributesForFaceting != null && + this.AttributesForFaceting.SequenceEqual(input.AttributesForFaceting) + ) && + ( + this.AttributesToRetrieve == input.AttributesToRetrieve || + this.AttributesToRetrieve != null && + input.AttributesToRetrieve != null && + this.AttributesToRetrieve.SequenceEqual(input.AttributesToRetrieve) + ) && + ( + this.Ranking == input.Ranking || + this.Ranking != null && + input.Ranking != null && + this.Ranking.SequenceEqual(input.Ranking) + ) && + ( + this.CustomRanking == input.CustomRanking || + this.CustomRanking != null && + input.CustomRanking != null && + this.CustomRanking.SequenceEqual(input.CustomRanking) + ) && + ( + this.RelevancyStrictness == input.RelevancyStrictness || + this.RelevancyStrictness.Equals(input.RelevancyStrictness) + ) && + ( + this.AttributesToHighlight == input.AttributesToHighlight || + this.AttributesToHighlight != null && + input.AttributesToHighlight != null && + this.AttributesToHighlight.SequenceEqual(input.AttributesToHighlight) + ) && + ( + this.AttributesToSnippet == input.AttributesToSnippet || + this.AttributesToSnippet != null && + input.AttributesToSnippet != null && + this.AttributesToSnippet.SequenceEqual(input.AttributesToSnippet) + ) && + ( + this.HighlightPreTag == input.HighlightPreTag || + (this.HighlightPreTag != null && + this.HighlightPreTag.Equals(input.HighlightPreTag)) + ) && + ( + this.HighlightPostTag == input.HighlightPostTag || + (this.HighlightPostTag != null && + this.HighlightPostTag.Equals(input.HighlightPostTag)) + ) && + ( + this.SnippetEllipsisText == input.SnippetEllipsisText || + (this.SnippetEllipsisText != null && + this.SnippetEllipsisText.Equals(input.SnippetEllipsisText)) + ) && + ( + this.RestrictHighlightAndSnippetArrays == input.RestrictHighlightAndSnippetArrays || + this.RestrictHighlightAndSnippetArrays.Equals(input.RestrictHighlightAndSnippetArrays) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && + ( + this.MinWordSizefor1Typo == input.MinWordSizefor1Typo || + this.MinWordSizefor1Typo.Equals(input.MinWordSizefor1Typo) + ) && + ( + this.MinWordSizefor2Typos == input.MinWordSizefor2Typos || + this.MinWordSizefor2Typos.Equals(input.MinWordSizefor2Typos) + ) && + ( + this.TypoTolerance == input.TypoTolerance || + (this.TypoTolerance != null && + this.TypoTolerance.Equals(input.TypoTolerance)) + ) && + ( + this.AllowTyposOnNumericTokens == input.AllowTyposOnNumericTokens || + this.AllowTyposOnNumericTokens.Equals(input.AllowTyposOnNumericTokens) + ) && + ( + this.DisableTypoToleranceOnAttributes == input.DisableTypoToleranceOnAttributes || + this.DisableTypoToleranceOnAttributes != null && + input.DisableTypoToleranceOnAttributes != null && + this.DisableTypoToleranceOnAttributes.SequenceEqual(input.DisableTypoToleranceOnAttributes) + ) && + ( + this.IgnorePlurals == input.IgnorePlurals || + (this.IgnorePlurals != null && + this.IgnorePlurals.Equals(input.IgnorePlurals)) + ) && + ( + this.RemoveStopWords == input.RemoveStopWords || + (this.RemoveStopWords != null && + this.RemoveStopWords.Equals(input.RemoveStopWords)) + ) && + ( + this.KeepDiacriticsOnCharacters == input.KeepDiacriticsOnCharacters || + (this.KeepDiacriticsOnCharacters != null && + this.KeepDiacriticsOnCharacters.Equals(input.KeepDiacriticsOnCharacters)) + ) && + ( + this.QueryLanguages == input.QueryLanguages || + this.QueryLanguages != null && + input.QueryLanguages != null && + this.QueryLanguages.SequenceEqual(input.QueryLanguages) + ) && + ( + this.DecompoundQuery == input.DecompoundQuery || + this.DecompoundQuery.Equals(input.DecompoundQuery) + ) && + ( + this.EnableRules == input.EnableRules || + this.EnableRules.Equals(input.EnableRules) + ) && + ( + this.EnablePersonalization == input.EnablePersonalization || + this.EnablePersonalization.Equals(input.EnablePersonalization) + ) && + ( + this.QueryType == input.QueryType || + this.QueryType.Equals(input.QueryType) + ) && + ( + this.RemoveWordsIfNoResults == input.RemoveWordsIfNoResults || + this.RemoveWordsIfNoResults.Equals(input.RemoveWordsIfNoResults) + ) && + ( + this.Mode == input.Mode || + this.Mode.Equals(input.Mode) + ) && + ( + this.SemanticSearch == input.SemanticSearch || + (this.SemanticSearch != null && + this.SemanticSearch.Equals(input.SemanticSearch)) + ) && + ( + this.AdvancedSyntax == input.AdvancedSyntax || + this.AdvancedSyntax.Equals(input.AdvancedSyntax) + ) && + ( + this.OptionalWords == input.OptionalWords || + this.OptionalWords != null && + input.OptionalWords != null && + this.OptionalWords.SequenceEqual(input.OptionalWords) + ) && + ( + this.DisableExactOnAttributes == input.DisableExactOnAttributes || + this.DisableExactOnAttributes != null && + input.DisableExactOnAttributes != null && + this.DisableExactOnAttributes.SequenceEqual(input.DisableExactOnAttributes) + ) && + ( + this.ExactOnSingleWordQuery == input.ExactOnSingleWordQuery || + this.ExactOnSingleWordQuery.Equals(input.ExactOnSingleWordQuery) + ) && + ( + this.AlternativesAsExact == input.AlternativesAsExact || + this.AlternativesAsExact != null && + input.AlternativesAsExact != null && + this.AlternativesAsExact.SequenceEqual(input.AlternativesAsExact) + ) && + ( + this.AdvancedSyntaxFeatures == input.AdvancedSyntaxFeatures || + this.AdvancedSyntaxFeatures != null && + input.AdvancedSyntaxFeatures != null && + this.AdvancedSyntaxFeatures.SequenceEqual(input.AdvancedSyntaxFeatures) + ) && + ( + this.Distinct == input.Distinct || + (this.Distinct != null && + this.Distinct.Equals(input.Distinct)) + ) && + ( + this.ReplaceSynonymsInHighlight == input.ReplaceSynonymsInHighlight || + this.ReplaceSynonymsInHighlight.Equals(input.ReplaceSynonymsInHighlight) + ) && + ( + this.MinProximity == input.MinProximity || + this.MinProximity.Equals(input.MinProximity) + ) && + ( + this.ResponseFields == input.ResponseFields || + this.ResponseFields != null && + input.ResponseFields != null && + this.ResponseFields.SequenceEqual(input.ResponseFields) + ) && + ( + this.MaxFacetHits == input.MaxFacetHits || + this.MaxFacetHits.Equals(input.MaxFacetHits) + ) && + ( + this.MaxValuesPerFacet == input.MaxValuesPerFacet || + this.MaxValuesPerFacet.Equals(input.MaxValuesPerFacet) + ) && + ( + this.SortFacetValuesBy == input.SortFacetValuesBy || + (this.SortFacetValuesBy != null && + this.SortFacetValuesBy.Equals(input.SortFacetValuesBy)) + ) && + ( + this.AttributeCriteriaComputedByMinProximity == input.AttributeCriteriaComputedByMinProximity || + this.AttributeCriteriaComputedByMinProximity.Equals(input.AttributeCriteriaComputedByMinProximity) + ) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ) && + ( + this.EnableReRanking == input.EnableReRanking || + this.EnableReRanking.Equals(input.EnableReRanking) + ) && + ( + this.ReRankingApplyFilter == input.ReRankingApplyFilter || + (this.ReRankingApplyFilter != null && + this.ReRankingApplyFilter.Equals(input.ReRankingApplyFilter)) + ) && + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.VarParams != null) + { + hashCode = (hashCode * 59) + this.VarParams.GetHashCode(); + } + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.SimilarQuery != null) + { + hashCode = (hashCode * 59) + this.SimilarQuery.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.FacetFilters != null) + { + hashCode = (hashCode * 59) + this.FacetFilters.GetHashCode(); + } + if (this.OptionalFilters != null) + { + hashCode = (hashCode * 59) + this.OptionalFilters.GetHashCode(); + } + if (this.NumericFilters != null) + { + hashCode = (hashCode * 59) + this.NumericFilters.GetHashCode(); + } + if (this.TagFilters != null) + { + hashCode = (hashCode * 59) + this.TagFilters.GetHashCode(); + } + hashCode = (hashCode * 59) + this.SumOrFiltersScores.GetHashCode(); + if (this.RestrictSearchableAttributes != null) + { + hashCode = (hashCode * 59) + this.RestrictSearchableAttributes.GetHashCode(); + } + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + hashCode = (hashCode * 59) + this.FacetingAfterDistinct.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.Offset.GetHashCode(); + hashCode = (hashCode * 59) + this.Length.GetHashCode(); + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AroundLatLngViaIP.GetHashCode(); + if (this.AroundRadius != null) + { + hashCode = (hashCode * 59) + this.AroundRadius.GetHashCode(); + } + if (this.AroundPrecision != null) + { + hashCode = (hashCode * 59) + this.AroundPrecision.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MinimumAroundRadius.GetHashCode(); + if (this.InsideBoundingBox != null) + { + hashCode = (hashCode * 59) + this.InsideBoundingBox.GetHashCode(); + } + if (this.InsidePolygon != null) + { + hashCode = (hashCode * 59) + this.InsidePolygon.GetHashCode(); + } + if (this.NaturalLanguages != null) + { + hashCode = (hashCode * 59) + this.NaturalLanguages.GetHashCode(); + } + if (this.RuleContexts != null) + { + hashCode = (hashCode * 59) + this.RuleContexts.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PersonalizationImpact.GetHashCode(); + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.GetRankingInfo.GetHashCode(); + if (this.Explain != null) + { + hashCode = (hashCode * 59) + this.Explain.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Synonyms.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickAnalytics.GetHashCode(); + hashCode = (hashCode * 59) + this.Analytics.GetHashCode(); + if (this.AnalyticsTags != null) + { + hashCode = (hashCode * 59) + this.AnalyticsTags.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PercentileComputation.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableABTest.GetHashCode(); + if (this.AttributesForFaceting != null) + { + hashCode = (hashCode * 59) + this.AttributesForFaceting.GetHashCode(); + } + if (this.AttributesToRetrieve != null) + { + hashCode = (hashCode * 59) + this.AttributesToRetrieve.GetHashCode(); + } + if (this.Ranking != null) + { + hashCode = (hashCode * 59) + this.Ranking.GetHashCode(); + } + if (this.CustomRanking != null) + { + hashCode = (hashCode * 59) + this.CustomRanking.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RelevancyStrictness.GetHashCode(); + if (this.AttributesToHighlight != null) + { + hashCode = (hashCode * 59) + this.AttributesToHighlight.GetHashCode(); + } + if (this.AttributesToSnippet != null) + { + hashCode = (hashCode * 59) + this.AttributesToSnippet.GetHashCode(); + } + if (this.HighlightPreTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPreTag.GetHashCode(); + } + if (this.HighlightPostTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPostTag.GetHashCode(); + } + if (this.SnippetEllipsisText != null) + { + hashCode = (hashCode * 59) + this.SnippetEllipsisText.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RestrictHighlightAndSnippetArrays.GetHashCode(); + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor1Typo.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor2Typos.GetHashCode(); + if (this.TypoTolerance != null) + { + hashCode = (hashCode * 59) + this.TypoTolerance.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AllowTyposOnNumericTokens.GetHashCode(); + if (this.DisableTypoToleranceOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableTypoToleranceOnAttributes.GetHashCode(); + } + if (this.IgnorePlurals != null) + { + hashCode = (hashCode * 59) + this.IgnorePlurals.GetHashCode(); + } + if (this.RemoveStopWords != null) + { + hashCode = (hashCode * 59) + this.RemoveStopWords.GetHashCode(); + } + if (this.KeepDiacriticsOnCharacters != null) + { + hashCode = (hashCode * 59) + this.KeepDiacriticsOnCharacters.GetHashCode(); + } + if (this.QueryLanguages != null) + { + hashCode = (hashCode * 59) + this.QueryLanguages.GetHashCode(); + } + hashCode = (hashCode * 59) + this.DecompoundQuery.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableRules.GetHashCode(); + hashCode = (hashCode * 59) + this.EnablePersonalization.GetHashCode(); + hashCode = (hashCode * 59) + this.QueryType.GetHashCode(); + hashCode = (hashCode * 59) + this.RemoveWordsIfNoResults.GetHashCode(); + hashCode = (hashCode * 59) + this.Mode.GetHashCode(); + if (this.SemanticSearch != null) + { + hashCode = (hashCode * 59) + this.SemanticSearch.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AdvancedSyntax.GetHashCode(); + if (this.OptionalWords != null) + { + hashCode = (hashCode * 59) + this.OptionalWords.GetHashCode(); + } + if (this.DisableExactOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableExactOnAttributes.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ExactOnSingleWordQuery.GetHashCode(); + if (this.AlternativesAsExact != null) + { + hashCode = (hashCode * 59) + this.AlternativesAsExact.GetHashCode(); + } + if (this.AdvancedSyntaxFeatures != null) + { + hashCode = (hashCode * 59) + this.AdvancedSyntaxFeatures.GetHashCode(); + } + if (this.Distinct != null) + { + hashCode = (hashCode * 59) + this.Distinct.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ReplaceSynonymsInHighlight.GetHashCode(); + hashCode = (hashCode * 59) + this.MinProximity.GetHashCode(); + if (this.ResponseFields != null) + { + hashCode = (hashCode * 59) + this.ResponseFields.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MaxFacetHits.GetHashCode(); + hashCode = (hashCode * 59) + this.MaxValuesPerFacet.GetHashCode(); + if (this.SortFacetValuesBy != null) + { + hashCode = (hashCode * 59) + this.SortFacetValuesBy.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AttributeCriteriaComputedByMinProximity.GetHashCode(); + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EnableReRanking.GetHashCode(); + if (this.ReRankingApplyFilter != null) + { + hashCode = (hashCode * 59) + this.ReRankingApplyFilter.GetHashCode(); + } + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Length (int) maximum + if (this.Length > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value less than or equal to 1000.", new[] { "Length" }); + } + + // Length (int) minimum + if (this.Length < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value greater than or equal to 1.", new[] { "Length" }); + } + + // MinimumAroundRadius (int) minimum + if (this.MinimumAroundRadius < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinimumAroundRadius, must be a value greater than or equal to 1.", new[] { "MinimumAroundRadius" }); + } + + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + // MinProximity (int) maximum + if (this.MinProximity > (int)7) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value less than or equal to 7.", new[] { "MinProximity" }); + } + + // MinProximity (int) minimum + if (this.MinProximity < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value greater than or equal to 1.", new[] { "MinProximity" }); + } + + // MaxFacetHits (int) maximum + if (this.MaxFacetHits > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MaxFacetHits, must be a value less than or equal to 100.", new[] { "MaxFacetHits" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchForHitsOptions.cs b/algoliasearch/Search/Models/SearchForHitsOptions.cs new file mode 100644 index 000000000..148e9bfe8 --- /dev/null +++ b/algoliasearch/Search/Models/SearchForHitsOptions.cs @@ -0,0 +1,148 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchForHitsOptions + /// + [DataContract(Name = "searchForHitsOptions")] + public partial class SearchForHitsOptions : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", EmitDefaultValue = false)] + public SearchTypeDefault? Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchForHitsOptions() { } + /// + /// Initializes a new instance of the class. + /// + /// Algolia index name. (required). + /// type. + public SearchForHitsOptions(string indexName = default(string), SearchTypeDefault? type = default(SearchTypeDefault?)) + { + // to ensure "indexName" is required (not null) + if (indexName == null) + { + throw new ArgumentNullException("indexName is a required property for SearchForHitsOptions and cannot be null"); + } + this.IndexName = indexName; + this.Type = type; + } + + /// + /// Algolia index name. + /// + /// Algolia index name. + [DataMember(Name = "indexName", IsRequired = true, EmitDefaultValue = true)] + public string IndexName { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchForHitsOptions {\n"); + sb.Append(" IndexName: ").Append(IndexName).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchForHitsOptions); + } + + /// + /// Returns true if SearchForHitsOptions instances are equal + /// + /// Instance of SearchForHitsOptions to be compared + /// Boolean + public bool Equals(SearchForHitsOptions input) + { + if (input == null) + { + return false; + } + return + ( + this.IndexName == input.IndexName || + (this.IndexName != null && + this.IndexName.Equals(input.IndexName)) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.IndexName != null) + { + hashCode = (hashCode * 59) + this.IndexName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchHits.cs b/algoliasearch/Search/Models/SearchHits.cs new file mode 100644 index 000000000..ea89a996f --- /dev/null +++ b/algoliasearch/Search/Models/SearchHits.cs @@ -0,0 +1,209 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchHits + /// + [DataContract(Name = "searchHits")] + public partial class SearchHits : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchHits() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// hits (required). + /// Text to search for in an index. (required) (default to ""). + /// URL-encoded string of all search parameters. (required). + public SearchHits(List hits = default(List), string query = @"", string varParams = default(string)) : base() + { + // to ensure "hits" is required (not null) + if (hits == null) + { + throw new ArgumentNullException("hits is a required property for SearchHits and cannot be null"); + } + this.Hits = hits; + // to ensure "query" is required (not null) + if (query == null) + { + throw new ArgumentNullException("query is a required property for SearchHits and cannot be null"); + } + this.Query = query; + // to ensure "varParams" is required (not null) + if (varParams == null) + { + throw new ArgumentNullException("varParams is a required property for SearchHits and cannot be null"); + } + this.VarParams = varParams; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets Hits + /// + [DataMember(Name = "hits", IsRequired = true, EmitDefaultValue = true)] + public List Hits { get; set; } + + /// + /// Text to search for in an index. + /// + /// Text to search for in an index. + [DataMember(Name = "query", IsRequired = true, EmitDefaultValue = true)] + public string Query { get; set; } + + /// + /// URL-encoded string of all search parameters. + /// + /// URL-encoded string of all search parameters. + [DataMember(Name = "params", IsRequired = true, EmitDefaultValue = true)] + public string VarParams { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchHits {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" Hits: ").Append(Hits).Append("\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" VarParams: ").Append(VarParams).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchHits); + } + + /// + /// Returns true if SearchHits instances are equal + /// + /// Instance of SearchHits to be compared + /// Boolean + public bool Equals(SearchHits input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.Hits == input.Hits || + this.Hits != null && + input.Hits != null && + this.Hits.SequenceEqual(input.Hits) + ) && base.Equals(input) && + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && base.Equals(input) && + ( + this.VarParams == input.VarParams || + (this.VarParams != null && + this.VarParams.Equals(input.VarParams)) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.Hits != null) + { + hashCode = (hashCode * 59) + this.Hits.GetHashCode(); + } + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.VarParams != null) + { + hashCode = (hashCode * 59) + this.VarParams.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchMethodParams.cs b/algoliasearch/Search/Models/SearchMethodParams.cs new file mode 100644 index 000000000..cb135d132 --- /dev/null +++ b/algoliasearch/Search/Models/SearchMethodParams.cs @@ -0,0 +1,148 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchMethodParams + /// + [DataContract(Name = "searchMethodParams")] + public partial class SearchMethodParams : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Strategy + /// + [DataMember(Name = "strategy", EmitDefaultValue = false)] + public SearchStrategy? Strategy { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchMethodParams() { } + /// + /// Initializes a new instance of the class. + /// + /// requests (required). + /// strategy. + public SearchMethodParams(List requests = default(List), SearchStrategy? strategy = default(SearchStrategy?)) + { + // to ensure "requests" is required (not null) + if (requests == null) + { + throw new ArgumentNullException("requests is a required property for SearchMethodParams and cannot be null"); + } + this.Requests = requests; + this.Strategy = strategy; + } + + /// + /// Gets or Sets Requests + /// + [DataMember(Name = "requests", IsRequired = true, EmitDefaultValue = true)] + public List Requests { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchMethodParams {\n"); + sb.Append(" Requests: ").Append(Requests).Append("\n"); + sb.Append(" Strategy: ").Append(Strategy).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchMethodParams); + } + + /// + /// Returns true if SearchMethodParams instances are equal + /// + /// Instance of SearchMethodParams to be compared + /// Boolean + public bool Equals(SearchMethodParams input) + { + if (input == null) + { + return false; + } + return + ( + this.Requests == input.Requests || + this.Requests != null && + input.Requests != null && + this.Requests.SequenceEqual(input.Requests) + ) && + ( + this.Strategy == input.Strategy || + this.Strategy.Equals(input.Strategy) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Requests != null) + { + hashCode = (hashCode * 59) + this.Requests.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Strategy.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchParams.cs b/algoliasearch/Search/Models/SearchParams.cs new file mode 100644 index 000000000..6c378b1e2 --- /dev/null +++ b/algoliasearch/Search/Models/SearchParams.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchParams + /// + [JsonConverter(typeof(SearchParamsJsonConverter))] + [DataContract(Name = "searchParams")] + public partial class SearchParams : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SearchParamsString. + public SearchParams(SearchParamsString actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SearchParamsObject. + public SearchParams(SearchParamsObject actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(SearchParamsObject)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SearchParamsString)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: SearchParamsObject, SearchParamsString"); + } + } + } + + /// + /// Get the actual instance of `SearchParamsString`. If the actual instance is not `SearchParamsString`, + /// the InvalidClassException will be thrown + /// + /// An instance of SearchParamsString + public SearchParamsString GetterSearchParamsString() + { + return (SearchParamsString)this.ActualInstance; + } + + /// + /// Get the actual instance of `SearchParamsObject`. If the actual instance is not `SearchParamsObject`, + /// the InvalidClassException will be thrown + /// + /// An instance of SearchParamsObject + public SearchParamsObject GetterSearchParamsObject() + { + return (SearchParamsObject)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class SearchParams {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, SearchParams.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of SearchParams + /// + /// JSON string + /// An instance of SearchParams + public static SearchParams FromJson(string jsonString) + { + SearchParams newSearchParams = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newSearchParams; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SearchParamsObject).GetProperty("AdditionalProperties") == null) + { + newSearchParams = new SearchParams(JsonConvert.DeserializeObject(jsonString, SearchParams.SerializerSettings)); + } + else + { + newSearchParams = new SearchParams(JsonConvert.DeserializeObject(jsonString, SearchParams.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SearchParamsObject"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SearchParamsObject: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SearchParamsString).GetProperty("AdditionalProperties") == null) + { + newSearchParams = new SearchParams(JsonConvert.DeserializeObject(jsonString, SearchParams.SerializerSettings)); + } + else + { + newSearchParams = new SearchParams(JsonConvert.DeserializeObject(jsonString, SearchParams.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SearchParamsString"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SearchParamsString: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newSearchParams; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchParams); + } + + /// + /// Returns true if SearchParams instances are equal + /// + /// Instance of SearchParams to be compared + /// Boolean + public bool Equals(SearchParams input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for SearchParams + /// + public class SearchParamsJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(SearchParams).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return SearchParams.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchParamsObject.cs b/algoliasearch/Search/Models/SearchParamsObject.cs new file mode 100644 index 000000000..84254dec6 --- /dev/null +++ b/algoliasearch/Search/Models/SearchParamsObject.cs @@ -0,0 +1,1512 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchParamsObject + /// + [DataContract(Name = "searchParamsObject")] + public partial class SearchParamsObject : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets QueryType + /// + [DataMember(Name = "queryType", EmitDefaultValue = false)] + public QueryType? QueryType { get; set; } + + /// + /// Gets or Sets RemoveWordsIfNoResults + /// + [DataMember(Name = "removeWordsIfNoResults", EmitDefaultValue = false)] + public RemoveWordsIfNoResults? RemoveWordsIfNoResults { get; set; } + + /// + /// Gets or Sets Mode + /// + [DataMember(Name = "mode", EmitDefaultValue = false)] + public Mode? Mode { get; set; } + + /// + /// Gets or Sets ExactOnSingleWordQuery + /// + [DataMember(Name = "exactOnSingleWordQuery", EmitDefaultValue = false)] + public ExactOnSingleWordQuery? ExactOnSingleWordQuery { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Text to search for in an index. (default to ""). + /// Overrides the query parameter and performs a more generic search. (default to ""). + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. (default to ""). + /// facetFilters. + /// optionalFilters. + /// numericFilters. + /// tagFilters. + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. (default to false). + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/).. + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values.. + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. (default to false). + /// Page to retrieve (the first page is `0`, not `1`). (default to 0). + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). . + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. (default to ""). + /// Search for entries around a location. The location is automatically computed from the requester's IP address. (default to false). + /// aroundRadius. + /// aroundPrecision. + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set.. + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates).. + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries.. + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries.. + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). (default to 100). + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search.. + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). (default to false). + /// Enriches the API's response with information about how the query was processed.. + /// Whether to take into account an index's synonyms for a particular search. (default to true). + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). (default to false). + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). (default to true). + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).. + /// Whether to include or exclude a query from the processing-time percentile computation. (default to true). + /// Incidates whether this search will be considered in A/B testing. (default to true). + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. . + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes.. + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/).. + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. . + /// Relevancy threshold below which less relevant results aren't included in the results. (default to 100). + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`).. + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. . + /// HTML string to insert before the highlighted parts in all highlight and snippet results. (default to "<em>"). + /// HTML string to insert after the highlighted parts in all highlight and snippet results. (default to "</em>"). + /// String used as an ellipsis indicator when a snippet is truncated. (default to "…"). + /// Restrict highlighting and snippeting to items that matched the query. (default to false). + /// Number of hits per page. (default to 20). + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 4). + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). (default to 8). + /// typoTolerance. + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. (default to true). + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/).. + /// ignorePlurals. + /// removeStopWords. + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). (default to ""). + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection.. + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. (default to true). + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. (default to true). + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. (default to false). + /// queryType. + /// removeWordsIfNoResults. + /// mode. + /// semanticSearch. + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). (default to false). + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query.. + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// exactOnSingleWordQuery. + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes).. + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled.. + /// distinct. + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. (default to false). + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). (default to 1). + /// Attributes to include in the API response for search and browse queries.. + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). (default to 10). + /// Maximum number of facet values to return for each facet. (default to 100). + /// Controls how facet values are fetched. (default to "count"). + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. (default to false). + /// renderingContent. + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). (default to true). + /// reRankingApplyFilter. + public SearchParamsObject(string query = @"", string similarQuery = @"", string filters = @"", FacetFilters facetFilters = default(FacetFilters), OptionalFilters optionalFilters = default(OptionalFilters), NumericFilters numericFilters = default(NumericFilters), TagFilters tagFilters = default(TagFilters), bool sumOrFiltersScores = false, List restrictSearchableAttributes = default(List), List facets = default(List), bool facetingAfterDistinct = false, int page = 0, int offset = default(int), int length = default(int), string aroundLatLng = @"", bool aroundLatLngViaIP = false, AroundRadius aroundRadius = default(AroundRadius), AroundPrecision aroundPrecision = default(AroundPrecision), int minimumAroundRadius = default(int), List> insideBoundingBox = default(List>), List> insidePolygon = default(List>), List naturalLanguages = default(List), List ruleContexts = default(List), int personalizationImpact = 100, string userToken = default(string), bool getRankingInfo = false, List explain = default(List), bool synonyms = true, bool clickAnalytics = false, bool analytics = true, List analyticsTags = default(List), bool percentileComputation = true, bool enableABTest = true, List attributesForFaceting = default(List), List attributesToRetrieve = default(List), List ranking = default(List), List customRanking = default(List), int relevancyStrictness = 100, List attributesToHighlight = default(List), List attributesToSnippet = default(List), string highlightPreTag = @"", string highlightPostTag = @"", string snippetEllipsisText = @"…", bool restrictHighlightAndSnippetArrays = false, int hitsPerPage = 20, int minWordSizefor1Typo = 4, int minWordSizefor2Typos = 8, TypoTolerance typoTolerance = default(TypoTolerance), bool allowTyposOnNumericTokens = true, List disableTypoToleranceOnAttributes = default(List), IgnorePlurals ignorePlurals = default(IgnorePlurals), RemoveStopWords removeStopWords = default(RemoveStopWords), string keepDiacriticsOnCharacters = @"", List queryLanguages = default(List), bool decompoundQuery = true, bool enableRules = true, bool enablePersonalization = false, QueryType? queryType = default(QueryType?), RemoveWordsIfNoResults? removeWordsIfNoResults = default(RemoveWordsIfNoResults?), Mode? mode = default(Mode?), SemanticSearch semanticSearch = default(SemanticSearch), bool advancedSyntax = false, List optionalWords = default(List), List disableExactOnAttributes = default(List), ExactOnSingleWordQuery? exactOnSingleWordQuery = default(ExactOnSingleWordQuery?), List alternativesAsExact = default(List), List advancedSyntaxFeatures = default(List), Distinct distinct = default(Distinct), bool replaceSynonymsInHighlight = false, int minProximity = 1, List responseFields = default(List), int maxFacetHits = 10, int maxValuesPerFacet = 100, string sortFacetValuesBy = @"count", bool attributeCriteriaComputedByMinProximity = false, RenderingContent renderingContent = default(RenderingContent), bool enableReRanking = true, ReRankingApplyFilter reRankingApplyFilter = default(ReRankingApplyFilter)) + { + // use default value if no "query" provided + this.Query = query ?? @""; + // use default value if no "similarQuery" provided + this.SimilarQuery = similarQuery ?? @""; + // use default value if no "filters" provided + this.Filters = filters ?? @""; + this.FacetFilters = facetFilters; + this.OptionalFilters = optionalFilters; + this.NumericFilters = numericFilters; + this.TagFilters = tagFilters; + this.SumOrFiltersScores = sumOrFiltersScores; + this.RestrictSearchableAttributes = restrictSearchableAttributes; + this.Facets = facets; + this.FacetingAfterDistinct = facetingAfterDistinct; + this.Page = page; + this.Offset = offset; + this.Length = length; + // use default value if no "aroundLatLng" provided + this.AroundLatLng = aroundLatLng ?? @""; + this.AroundLatLngViaIP = aroundLatLngViaIP; + this.AroundRadius = aroundRadius; + this.AroundPrecision = aroundPrecision; + this.MinimumAroundRadius = minimumAroundRadius; + this.InsideBoundingBox = insideBoundingBox; + this.InsidePolygon = insidePolygon; + this.NaturalLanguages = naturalLanguages; + this.RuleContexts = ruleContexts; + this.PersonalizationImpact = personalizationImpact; + this.UserToken = userToken; + this.GetRankingInfo = getRankingInfo; + this.Explain = explain; + this.Synonyms = synonyms; + this.ClickAnalytics = clickAnalytics; + this.Analytics = analytics; + this.AnalyticsTags = analyticsTags; + this.PercentileComputation = percentileComputation; + this.EnableABTest = enableABTest; + this.AttributesForFaceting = attributesForFaceting; + this.AttributesToRetrieve = attributesToRetrieve; + this.Ranking = ranking; + this.CustomRanking = customRanking; + this.RelevancyStrictness = relevancyStrictness; + this.AttributesToHighlight = attributesToHighlight; + this.AttributesToSnippet = attributesToSnippet; + // use default value if no "highlightPreTag" provided + this.HighlightPreTag = highlightPreTag ?? @""; + // use default value if no "highlightPostTag" provided + this.HighlightPostTag = highlightPostTag ?? @""; + // use default value if no "snippetEllipsisText" provided + this.SnippetEllipsisText = snippetEllipsisText ?? @"…"; + this.RestrictHighlightAndSnippetArrays = restrictHighlightAndSnippetArrays; + this.HitsPerPage = hitsPerPage; + this.MinWordSizefor1Typo = minWordSizefor1Typo; + this.MinWordSizefor2Typos = minWordSizefor2Typos; + this.TypoTolerance = typoTolerance; + this.AllowTyposOnNumericTokens = allowTyposOnNumericTokens; + this.DisableTypoToleranceOnAttributes = disableTypoToleranceOnAttributes; + this.IgnorePlurals = ignorePlurals; + this.RemoveStopWords = removeStopWords; + // use default value if no "keepDiacriticsOnCharacters" provided + this.KeepDiacriticsOnCharacters = keepDiacriticsOnCharacters ?? @""; + this.QueryLanguages = queryLanguages; + this.DecompoundQuery = decompoundQuery; + this.EnableRules = enableRules; + this.EnablePersonalization = enablePersonalization; + this.QueryType = queryType; + this.RemoveWordsIfNoResults = removeWordsIfNoResults; + this.Mode = mode; + this.SemanticSearch = semanticSearch; + this.AdvancedSyntax = advancedSyntax; + this.OptionalWords = optionalWords; + this.DisableExactOnAttributes = disableExactOnAttributes; + this.ExactOnSingleWordQuery = exactOnSingleWordQuery; + this.AlternativesAsExact = alternativesAsExact; + this.AdvancedSyntaxFeatures = advancedSyntaxFeatures; + this.Distinct = distinct; + this.ReplaceSynonymsInHighlight = replaceSynonymsInHighlight; + this.MinProximity = minProximity; + this.ResponseFields = responseFields; + this.MaxFacetHits = maxFacetHits; + this.MaxValuesPerFacet = maxValuesPerFacet; + // use default value if no "sortFacetValuesBy" provided + this.SortFacetValuesBy = sortFacetValuesBy ?? @"count"; + this.AttributeCriteriaComputedByMinProximity = attributeCriteriaComputedByMinProximity; + this.RenderingContent = renderingContent; + this.EnableReRanking = enableReRanking; + this.ReRankingApplyFilter = reRankingApplyFilter; + } + + /// + /// Text to search for in an index. + /// + /// Text to search for in an index. + [DataMember(Name = "query", EmitDefaultValue = false)] + public string Query { get; set; } + + /// + /// Overrides the query parameter and performs a more generic search. + /// + /// Overrides the query parameter and performs a more generic search. + [DataMember(Name = "similarQuery", EmitDefaultValue = false)] + public string SimilarQuery { get; set; } + + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + /// + /// [Filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/) the query with numeric, facet, or tag filters. + [DataMember(Name = "filters", EmitDefaultValue = false)] + public string Filters { get; set; } + + /// + /// Gets or Sets FacetFilters + /// + [DataMember(Name = "facetFilters", EmitDefaultValue = false)] + public FacetFilters FacetFilters { get; set; } + + /// + /// Gets or Sets OptionalFilters + /// + [DataMember(Name = "optionalFilters", EmitDefaultValue = false)] + public OptionalFilters OptionalFilters { get; set; } + + /// + /// Gets or Sets NumericFilters + /// + [DataMember(Name = "numericFilters", EmitDefaultValue = false)] + public NumericFilters NumericFilters { get; set; } + + /// + /// Gets or Sets TagFilters + /// + [DataMember(Name = "tagFilters", EmitDefaultValue = false)] + public TagFilters TagFilters { get; set; } + + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + /// + /// Determines how to calculate [filter scores](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/in-depth/filter-scoring/#accumulating-scores-with-sumorfiltersscores). If `false`, maximum score is kept. If `true`, score is summed. + [DataMember(Name = "sumOrFiltersScores", EmitDefaultValue = true)] + public bool SumOrFiltersScores { get; set; } + + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + /// + /// Restricts a query to only look at a subset of your [searchable attributes](https://www.algolia.com/doc/guides/managing-results/must-do/searchable-attributes/). + [DataMember(Name = "restrictSearchableAttributes", EmitDefaultValue = false)] + public List RestrictSearchableAttributes { get; set; } + + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + /// + /// Returns [facets](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#contextual-facet-values-and-counts), their facet values, and the number of matching facet values. + [DataMember(Name = "facets", EmitDefaultValue = false)] + public List Facets { get; set; } + + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + /// + /// Forces faceting to be applied after [de-duplication](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/) (with the distinct feature). Alternatively, the `afterDistinct` [modifier](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) of `attributesForFaceting` allows for more granular control. + [DataMember(Name = "facetingAfterDistinct", EmitDefaultValue = true)] + public bool FacetingAfterDistinct { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", EmitDefaultValue = false)] + public int Page { get; set; } + + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Specifies the offset of the first hit to return. > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "offset", EmitDefaultValue = false)] + public int Offset { get; set; } + + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + /// + /// Sets the number of hits to retrieve (for use with `offset`). > **Note**: Using `page` and `hitsPerPage` is the recommended method for [paging results](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/). However, you can use `offset` and `length` to implement [an alternative approach to paging](https://www.algolia.com/doc/guides/building-search-ui/ui-and-ux-patterns/pagination/js/#retrieving-a-subset-of-records-with-offset-and-length). + [DataMember(Name = "length", EmitDefaultValue = false)] + public int Length { get; set; } + + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + /// + /// Search for entries [around a central location](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filter-around-a-central-point), enabling a geographical search within a circular area. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + /// + /// Search for entries around a location. The location is automatically computed from the requester's IP address. + [DataMember(Name = "aroundLatLngViaIP", EmitDefaultValue = true)] + public bool AroundLatLngViaIP { get; set; } + + /// + /// Gets or Sets AroundRadius + /// + [DataMember(Name = "aroundRadius", EmitDefaultValue = false)] + public AroundRadius AroundRadius { get; set; } + + /// + /// Gets or Sets AroundPrecision + /// + [DataMember(Name = "aroundPrecision", EmitDefaultValue = false)] + public AroundPrecision AroundPrecision { get; set; } + + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + /// + /// Minimum radius (in meters) used for a geographical search when `aroundRadius` isn't set. + [DataMember(Name = "minimumAroundRadius", EmitDefaultValue = false)] + public int MinimumAroundRadius { get; set; } + + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insideBoundingBox", EmitDefaultValue = false)] + public List> InsideBoundingBox { get; set; } + + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + /// + /// Search inside a [polygon](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas) (in geographical coordinates). + [DataMember(Name = "insidePolygon", EmitDefaultValue = false)] + public List> InsidePolygon { get; set; } + + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + /// + /// Changes the default values of parameters that work best for a natural language query, such as `ignorePlurals`, `removeStopWords`, `removeWordsIfNoResults`, `analyticsTags`, and `ruleContexts`. These parameters work well together when the query consists of fuller natural language strings instead of keywords, for example when processing voice search queries. + [DataMember(Name = "naturalLanguages", EmitDefaultValue = false)] + public List NaturalLanguages { get; set; } + + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + /// + /// Assigns [rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) to search queries. + [DataMember(Name = "ruleContexts", EmitDefaultValue = false)] + public List RuleContexts { get; set; } + + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + /// + /// Defines how much [Personalization affects results](https://www.algolia.com/doc/guides/personalization/personalizing-results/in-depth/configuring-personalization/#understanding-personalization-impact). + [DataMember(Name = "personalizationImpact", EmitDefaultValue = false)] + public int PersonalizationImpact { get; set; } + + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + /// + /// Associates a [user token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/) with the current search. + [DataMember(Name = "userToken", EmitDefaultValue = false)] + public string UserToken { get; set; } + + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + /// + /// Incidates whether the search response includes [detailed ranking information](https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/understanding-the-api-response/#ranking-information). + [DataMember(Name = "getRankingInfo", EmitDefaultValue = true)] + public bool GetRankingInfo { get; set; } + + /// + /// Enriches the API's response with information about how the query was processed. + /// + /// Enriches the API's response with information about how the query was processed. + [DataMember(Name = "explain", EmitDefaultValue = false)] + public List Explain { get; set; } + + /// + /// Whether to take into account an index's synonyms for a particular search. + /// + /// Whether to take into account an index's synonyms for a particular search. + [DataMember(Name = "synonyms", EmitDefaultValue = true)] + public bool Synonyms { get; set; } + + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + /// + /// Indicates whether a query ID parameter is included in the search response. This is required for [tracking click and conversion events](https://www.algolia.com/doc/guides/sending-events/concepts/event-types/#events-related-to-algolia-requests). + [DataMember(Name = "clickAnalytics", EmitDefaultValue = true)] + public bool ClickAnalytics { get; set; } + + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + /// + /// Indicates whether this query will be included in [analytics](https://www.algolia.com/doc/guides/search-analytics/guides/exclude-queries/). + [DataMember(Name = "analytics", EmitDefaultValue = true)] + public bool Analytics { get; set; } + + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + /// + /// Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + [DataMember(Name = "analyticsTags", EmitDefaultValue = false)] + public List AnalyticsTags { get; set; } + + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + /// + /// Whether to include or exclude a query from the processing-time percentile computation. + [DataMember(Name = "percentileComputation", EmitDefaultValue = true)] + public bool PercentileComputation { get; set; } + + /// + /// Incidates whether this search will be considered in A/B testing. + /// + /// Incidates whether this search will be considered in A/B testing. + [DataMember(Name = "enableABTest", EmitDefaultValue = true)] + public bool EnableABTest { get; set; } + + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + /// + /// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/) and the [modifiers](https://www.algolia.com/doc/api-reference/api-parameters/attributesForFaceting/#modifiers) that can be applied: `filterOnly`, `searchable`, and `afterDistinct`. + [DataMember(Name = "attributesForFaceting", EmitDefaultValue = false)] + public List AttributesForFaceting { get; set; } + + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + /// + /// Attributes to include in the API response. To reduce the size of your response, you can retrieve only some of the attributes. By default, the response includes all attributes. + [DataMember(Name = "attributesToRetrieve", EmitDefaultValue = false)] + public List AttributesToRetrieve { get; set; } + + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + /// + /// Determines the order in which Algolia [returns your results](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/). + [DataMember(Name = "ranking", EmitDefaultValue = false)] + public List Ranking { get; set; } + + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + /// + /// Specifies the [Custom ranking criterion](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/). Use the `asc` and `desc` modifiers to specify the ranking order: ascending or descending. + [DataMember(Name = "customRanking", EmitDefaultValue = false)] + public List CustomRanking { get; set; } + + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + /// + /// Relevancy threshold below which less relevant results aren't included in the results. + [DataMember(Name = "relevancyStrictness", EmitDefaultValue = false)] + public int RelevancyStrictness { get; set; } + + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + /// + /// Attributes to highlight. Strings that match the search query in the attributes are highlighted by surrounding them with HTML tags (`highlightPreTag` and `highlightPostTag`). + [DataMember(Name = "attributesToHighlight", EmitDefaultValue = false)] + public List AttributesToHighlight { get; set; } + + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + /// + /// Attributes to _snippet_. 'Snippeting' is shortening the attribute to a certain number of words. If not specified, the attribute is shortened to the 10 words around the matching string but you can specify the number. For example: `body:20`. + [DataMember(Name = "attributesToSnippet", EmitDefaultValue = false)] + public List AttributesToSnippet { get; set; } + + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert before the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPreTag", EmitDefaultValue = false)] + public string HighlightPreTag { get; set; } + + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + /// + /// HTML string to insert after the highlighted parts in all highlight and snippet results. + [DataMember(Name = "highlightPostTag", EmitDefaultValue = false)] + public string HighlightPostTag { get; set; } + + /// + /// String used as an ellipsis indicator when a snippet is truncated. + /// + /// String used as an ellipsis indicator when a snippet is truncated. + [DataMember(Name = "snippetEllipsisText", EmitDefaultValue = false)] + public string SnippetEllipsisText { get; set; } + + /// + /// Restrict highlighting and snippeting to items that matched the query. + /// + /// Restrict highlighting and snippeting to items that matched the query. + [DataMember(Name = "restrictHighlightAndSnippetArrays", EmitDefaultValue = true)] + public bool RestrictHighlightAndSnippetArrays { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", EmitDefaultValue = false)] + public int HitsPerPage { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [one typo](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor1Typo", EmitDefaultValue = false)] + public int MinWordSizefor1Typo { get; set; } + + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + /// + /// Minimum number of characters a word in the query string must contain to accept matches with [two typos](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance/#configuring-word-length-for-typos). + [DataMember(Name = "minWordSizefor2Typos", EmitDefaultValue = false)] + public int MinWordSizefor2Typos { get; set; } + + /// + /// Gets or Sets TypoTolerance + /// + [DataMember(Name = "typoTolerance", EmitDefaultValue = false)] + public TypoTolerance TypoTolerance { get; set; } + + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + /// + /// Whether to allow typos on numbers (\"numeric tokens\") in the query string. + [DataMember(Name = "allowTyposOnNumericTokens", EmitDefaultValue = true)] + public bool AllowTyposOnNumericTokens { get; set; } + + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + /// + /// Attributes for which you want to turn off [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/). + [DataMember(Name = "disableTypoToleranceOnAttributes", EmitDefaultValue = false)] + public List DisableTypoToleranceOnAttributes { get; set; } + + /// + /// Gets or Sets IgnorePlurals + /// + [DataMember(Name = "ignorePlurals", EmitDefaultValue = false)] + public IgnorePlurals IgnorePlurals { get; set; } + + /// + /// Gets or Sets RemoveStopWords + /// + [DataMember(Name = "removeStopWords", EmitDefaultValue = false)] + public RemoveStopWords RemoveStopWords { get; set; } + + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + /// + /// Characters that the engine shouldn't automatically [normalize](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/). + [DataMember(Name = "keepDiacriticsOnCharacters", EmitDefaultValue = false)] + public string KeepDiacriticsOnCharacters { get; set; } + + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + /// + /// Sets your user's search language. This adjusts language-specific settings and features such as `ignorePlurals`, `removeStopWords`, and [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) word detection. + [DataMember(Name = "queryLanguages", EmitDefaultValue = false)] + public List QueryLanguages { get; set; } + + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + /// + /// [Splits compound words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/#splitting-compound-words) into their component word parts in the query. + [DataMember(Name = "decompoundQuery", EmitDefaultValue = true)] + public bool DecompoundQuery { get; set; } + + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + /// + /// Incidates whether [Rules](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/) are enabled. + [DataMember(Name = "enableRules", EmitDefaultValue = true)] + public bool EnableRules { get; set; } + + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + /// + /// Incidates whether [Personalization](https://www.algolia.com/doc/guides/personalization/what-is-personalization/) is enabled. + [DataMember(Name = "enablePersonalization", EmitDefaultValue = true)] + public bool EnablePersonalization { get; set; } + + /// + /// Gets or Sets SemanticSearch + /// + [DataMember(Name = "semanticSearch", EmitDefaultValue = false)] + public SemanticSearch SemanticSearch { get; set; } + + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + /// + /// Enables the [advanced query syntax](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/#advanced-syntax). + [DataMember(Name = "advancedSyntax", EmitDefaultValue = true)] + public bool AdvancedSyntax { get; set; } + + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + /// + /// Words which should be considered [optional](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words) when found in a query. + [DataMember(Name = "optionalWords", EmitDefaultValue = false)] + public List OptionalWords { get; set; } + + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Attributes for which you want to [turn off the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "disableExactOnAttributes", EmitDefaultValue = false)] + public List DisableExactOnAttributes { get; set; } + + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + /// + /// Alternatives that should be considered an exact match by [the exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). + [DataMember(Name = "alternativesAsExact", EmitDefaultValue = false)] + public List AlternativesAsExact { get; set; } + + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + /// + /// Allows you to specify which advanced syntax features are active when `advancedSyntax` is enabled. + [DataMember(Name = "advancedSyntaxFeatures", EmitDefaultValue = false)] + public List AdvancedSyntaxFeatures { get; set; } + + /// + /// Gets or Sets Distinct + /// + [DataMember(Name = "distinct", EmitDefaultValue = false)] + public Distinct Distinct { get; set; } + + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + /// + /// Whether to highlight and snippet the original word that matches the synonym or the synonym itself. + [DataMember(Name = "replaceSynonymsInHighlight", EmitDefaultValue = true)] + public bool ReplaceSynonymsInHighlight { get; set; } + + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + /// + /// Precision of the [proximity ranking criterion](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#proximity). + [DataMember(Name = "minProximity", EmitDefaultValue = false)] + public int MinProximity { get; set; } + + /// + /// Attributes to include in the API response for search and browse queries. + /// + /// Attributes to include in the API response for search and browse queries. + [DataMember(Name = "responseFields", EmitDefaultValue = false)] + public List ResponseFields { get; set; } + + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + /// + /// Maximum number of facet hits to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + [DataMember(Name = "maxFacetHits", EmitDefaultValue = false)] + public int MaxFacetHits { get; set; } + + /// + /// Maximum number of facet values to return for each facet. + /// + /// Maximum number of facet values to return for each facet. + [DataMember(Name = "maxValuesPerFacet", EmitDefaultValue = false)] + public int MaxValuesPerFacet { get; set; } + + /// + /// Controls how facet values are fetched. + /// + /// Controls how facet values are fetched. + [DataMember(Name = "sortFacetValuesBy", EmitDefaultValue = false)] + public string SortFacetValuesBy { get; set; } + + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + /// + /// When the [Attribute criterion is ranked above Proximity](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/#attribute-and-proximity-combinations) in your ranking formula, Proximity is used to select which searchable attribute is matched in the Attribute ranking stage. + [DataMember(Name = "attributeCriteriaComputedByMinProximity", EmitDefaultValue = true)] + public bool AttributeCriteriaComputedByMinProximity { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + /// + /// Indicates whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). + [DataMember(Name = "enableReRanking", EmitDefaultValue = true)] + public bool EnableReRanking { get; set; } + + /// + /// Gets or Sets ReRankingApplyFilter + /// + [DataMember(Name = "reRankingApplyFilter", EmitDefaultValue = true)] + public ReRankingApplyFilter ReRankingApplyFilter { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchParamsObject {\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" SimilarQuery: ").Append(SimilarQuery).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" FacetFilters: ").Append(FacetFilters).Append("\n"); + sb.Append(" OptionalFilters: ").Append(OptionalFilters).Append("\n"); + sb.Append(" NumericFilters: ").Append(NumericFilters).Append("\n"); + sb.Append(" TagFilters: ").Append(TagFilters).Append("\n"); + sb.Append(" SumOrFiltersScores: ").Append(SumOrFiltersScores).Append("\n"); + sb.Append(" RestrictSearchableAttributes: ").Append(RestrictSearchableAttributes).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" FacetingAfterDistinct: ").Append(FacetingAfterDistinct).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" Offset: ").Append(Offset).Append("\n"); + sb.Append(" Length: ").Append(Length).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AroundLatLngViaIP: ").Append(AroundLatLngViaIP).Append("\n"); + sb.Append(" AroundRadius: ").Append(AroundRadius).Append("\n"); + sb.Append(" AroundPrecision: ").Append(AroundPrecision).Append("\n"); + sb.Append(" MinimumAroundRadius: ").Append(MinimumAroundRadius).Append("\n"); + sb.Append(" InsideBoundingBox: ").Append(InsideBoundingBox).Append("\n"); + sb.Append(" InsidePolygon: ").Append(InsidePolygon).Append("\n"); + sb.Append(" NaturalLanguages: ").Append(NaturalLanguages).Append("\n"); + sb.Append(" RuleContexts: ").Append(RuleContexts).Append("\n"); + sb.Append(" PersonalizationImpact: ").Append(PersonalizationImpact).Append("\n"); + sb.Append(" UserToken: ").Append(UserToken).Append("\n"); + sb.Append(" GetRankingInfo: ").Append(GetRankingInfo).Append("\n"); + sb.Append(" Explain: ").Append(Explain).Append("\n"); + sb.Append(" Synonyms: ").Append(Synonyms).Append("\n"); + sb.Append(" ClickAnalytics: ").Append(ClickAnalytics).Append("\n"); + sb.Append(" Analytics: ").Append(Analytics).Append("\n"); + sb.Append(" AnalyticsTags: ").Append(AnalyticsTags).Append("\n"); + sb.Append(" PercentileComputation: ").Append(PercentileComputation).Append("\n"); + sb.Append(" EnableABTest: ").Append(EnableABTest).Append("\n"); + sb.Append(" AttributesForFaceting: ").Append(AttributesForFaceting).Append("\n"); + sb.Append(" AttributesToRetrieve: ").Append(AttributesToRetrieve).Append("\n"); + sb.Append(" Ranking: ").Append(Ranking).Append("\n"); + sb.Append(" CustomRanking: ").Append(CustomRanking).Append("\n"); + sb.Append(" RelevancyStrictness: ").Append(RelevancyStrictness).Append("\n"); + sb.Append(" AttributesToHighlight: ").Append(AttributesToHighlight).Append("\n"); + sb.Append(" AttributesToSnippet: ").Append(AttributesToSnippet).Append("\n"); + sb.Append(" HighlightPreTag: ").Append(HighlightPreTag).Append("\n"); + sb.Append(" HighlightPostTag: ").Append(HighlightPostTag).Append("\n"); + sb.Append(" SnippetEllipsisText: ").Append(SnippetEllipsisText).Append("\n"); + sb.Append(" RestrictHighlightAndSnippetArrays: ").Append(RestrictHighlightAndSnippetArrays).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" MinWordSizefor1Typo: ").Append(MinWordSizefor1Typo).Append("\n"); + sb.Append(" MinWordSizefor2Typos: ").Append(MinWordSizefor2Typos).Append("\n"); + sb.Append(" TypoTolerance: ").Append(TypoTolerance).Append("\n"); + sb.Append(" AllowTyposOnNumericTokens: ").Append(AllowTyposOnNumericTokens).Append("\n"); + sb.Append(" DisableTypoToleranceOnAttributes: ").Append(DisableTypoToleranceOnAttributes).Append("\n"); + sb.Append(" IgnorePlurals: ").Append(IgnorePlurals).Append("\n"); + sb.Append(" RemoveStopWords: ").Append(RemoveStopWords).Append("\n"); + sb.Append(" KeepDiacriticsOnCharacters: ").Append(KeepDiacriticsOnCharacters).Append("\n"); + sb.Append(" QueryLanguages: ").Append(QueryLanguages).Append("\n"); + sb.Append(" DecompoundQuery: ").Append(DecompoundQuery).Append("\n"); + sb.Append(" EnableRules: ").Append(EnableRules).Append("\n"); + sb.Append(" EnablePersonalization: ").Append(EnablePersonalization).Append("\n"); + sb.Append(" QueryType: ").Append(QueryType).Append("\n"); + sb.Append(" RemoveWordsIfNoResults: ").Append(RemoveWordsIfNoResults).Append("\n"); + sb.Append(" Mode: ").Append(Mode).Append("\n"); + sb.Append(" SemanticSearch: ").Append(SemanticSearch).Append("\n"); + sb.Append(" AdvancedSyntax: ").Append(AdvancedSyntax).Append("\n"); + sb.Append(" OptionalWords: ").Append(OptionalWords).Append("\n"); + sb.Append(" DisableExactOnAttributes: ").Append(DisableExactOnAttributes).Append("\n"); + sb.Append(" ExactOnSingleWordQuery: ").Append(ExactOnSingleWordQuery).Append("\n"); + sb.Append(" AlternativesAsExact: ").Append(AlternativesAsExact).Append("\n"); + sb.Append(" AdvancedSyntaxFeatures: ").Append(AdvancedSyntaxFeatures).Append("\n"); + sb.Append(" Distinct: ").Append(Distinct).Append("\n"); + sb.Append(" ReplaceSynonymsInHighlight: ").Append(ReplaceSynonymsInHighlight).Append("\n"); + sb.Append(" MinProximity: ").Append(MinProximity).Append("\n"); + sb.Append(" ResponseFields: ").Append(ResponseFields).Append("\n"); + sb.Append(" MaxFacetHits: ").Append(MaxFacetHits).Append("\n"); + sb.Append(" MaxValuesPerFacet: ").Append(MaxValuesPerFacet).Append("\n"); + sb.Append(" SortFacetValuesBy: ").Append(SortFacetValuesBy).Append("\n"); + sb.Append(" AttributeCriteriaComputedByMinProximity: ").Append(AttributeCriteriaComputedByMinProximity).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append(" EnableReRanking: ").Append(EnableReRanking).Append("\n"); + sb.Append(" ReRankingApplyFilter: ").Append(ReRankingApplyFilter).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchParamsObject); + } + + /// + /// Returns true if SearchParamsObject instances are equal + /// + /// Instance of SearchParamsObject to be compared + /// Boolean + public bool Equals(SearchParamsObject input) + { + if (input == null) + { + return false; + } + return + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.SimilarQuery == input.SimilarQuery || + (this.SimilarQuery != null && + this.SimilarQuery.Equals(input.SimilarQuery)) + ) && + ( + this.Filters == input.Filters || + (this.Filters != null && + this.Filters.Equals(input.Filters)) + ) && + ( + this.FacetFilters == input.FacetFilters || + (this.FacetFilters != null && + this.FacetFilters.Equals(input.FacetFilters)) + ) && + ( + this.OptionalFilters == input.OptionalFilters || + (this.OptionalFilters != null && + this.OptionalFilters.Equals(input.OptionalFilters)) + ) && + ( + this.NumericFilters == input.NumericFilters || + (this.NumericFilters != null && + this.NumericFilters.Equals(input.NumericFilters)) + ) && + ( + this.TagFilters == input.TagFilters || + (this.TagFilters != null && + this.TagFilters.Equals(input.TagFilters)) + ) && + ( + this.SumOrFiltersScores == input.SumOrFiltersScores || + this.SumOrFiltersScores.Equals(input.SumOrFiltersScores) + ) && + ( + this.RestrictSearchableAttributes == input.RestrictSearchableAttributes || + this.RestrictSearchableAttributes != null && + input.RestrictSearchableAttributes != null && + this.RestrictSearchableAttributes.SequenceEqual(input.RestrictSearchableAttributes) + ) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && + ( + this.FacetingAfterDistinct == input.FacetingAfterDistinct || + this.FacetingAfterDistinct.Equals(input.FacetingAfterDistinct) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.Offset == input.Offset || + this.Offset.Equals(input.Offset) + ) && + ( + this.Length == input.Length || + this.Length.Equals(input.Length) + ) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && + ( + this.AroundLatLngViaIP == input.AroundLatLngViaIP || + this.AroundLatLngViaIP.Equals(input.AroundLatLngViaIP) + ) && + ( + this.AroundRadius == input.AroundRadius || + (this.AroundRadius != null && + this.AroundRadius.Equals(input.AroundRadius)) + ) && + ( + this.AroundPrecision == input.AroundPrecision || + (this.AroundPrecision != null && + this.AroundPrecision.Equals(input.AroundPrecision)) + ) && + ( + this.MinimumAroundRadius == input.MinimumAroundRadius || + this.MinimumAroundRadius.Equals(input.MinimumAroundRadius) + ) && + ( + this.InsideBoundingBox == input.InsideBoundingBox || + this.InsideBoundingBox != null && + input.InsideBoundingBox != null && + this.InsideBoundingBox.SequenceEqual(input.InsideBoundingBox) + ) && + ( + this.InsidePolygon == input.InsidePolygon || + this.InsidePolygon != null && + input.InsidePolygon != null && + this.InsidePolygon.SequenceEqual(input.InsidePolygon) + ) && + ( + this.NaturalLanguages == input.NaturalLanguages || + this.NaturalLanguages != null && + input.NaturalLanguages != null && + this.NaturalLanguages.SequenceEqual(input.NaturalLanguages) + ) && + ( + this.RuleContexts == input.RuleContexts || + this.RuleContexts != null && + input.RuleContexts != null && + this.RuleContexts.SequenceEqual(input.RuleContexts) + ) && + ( + this.PersonalizationImpact == input.PersonalizationImpact || + this.PersonalizationImpact.Equals(input.PersonalizationImpact) + ) && + ( + this.UserToken == input.UserToken || + (this.UserToken != null && + this.UserToken.Equals(input.UserToken)) + ) && + ( + this.GetRankingInfo == input.GetRankingInfo || + this.GetRankingInfo.Equals(input.GetRankingInfo) + ) && + ( + this.Explain == input.Explain || + this.Explain != null && + input.Explain != null && + this.Explain.SequenceEqual(input.Explain) + ) && + ( + this.Synonyms == input.Synonyms || + this.Synonyms.Equals(input.Synonyms) + ) && + ( + this.ClickAnalytics == input.ClickAnalytics || + this.ClickAnalytics.Equals(input.ClickAnalytics) + ) && + ( + this.Analytics == input.Analytics || + this.Analytics.Equals(input.Analytics) + ) && + ( + this.AnalyticsTags == input.AnalyticsTags || + this.AnalyticsTags != null && + input.AnalyticsTags != null && + this.AnalyticsTags.SequenceEqual(input.AnalyticsTags) + ) && + ( + this.PercentileComputation == input.PercentileComputation || + this.PercentileComputation.Equals(input.PercentileComputation) + ) && + ( + this.EnableABTest == input.EnableABTest || + this.EnableABTest.Equals(input.EnableABTest) + ) && + ( + this.AttributesForFaceting == input.AttributesForFaceting || + this.AttributesForFaceting != null && + input.AttributesForFaceting != null && + this.AttributesForFaceting.SequenceEqual(input.AttributesForFaceting) + ) && + ( + this.AttributesToRetrieve == input.AttributesToRetrieve || + this.AttributesToRetrieve != null && + input.AttributesToRetrieve != null && + this.AttributesToRetrieve.SequenceEqual(input.AttributesToRetrieve) + ) && + ( + this.Ranking == input.Ranking || + this.Ranking != null && + input.Ranking != null && + this.Ranking.SequenceEqual(input.Ranking) + ) && + ( + this.CustomRanking == input.CustomRanking || + this.CustomRanking != null && + input.CustomRanking != null && + this.CustomRanking.SequenceEqual(input.CustomRanking) + ) && + ( + this.RelevancyStrictness == input.RelevancyStrictness || + this.RelevancyStrictness.Equals(input.RelevancyStrictness) + ) && + ( + this.AttributesToHighlight == input.AttributesToHighlight || + this.AttributesToHighlight != null && + input.AttributesToHighlight != null && + this.AttributesToHighlight.SequenceEqual(input.AttributesToHighlight) + ) && + ( + this.AttributesToSnippet == input.AttributesToSnippet || + this.AttributesToSnippet != null && + input.AttributesToSnippet != null && + this.AttributesToSnippet.SequenceEqual(input.AttributesToSnippet) + ) && + ( + this.HighlightPreTag == input.HighlightPreTag || + (this.HighlightPreTag != null && + this.HighlightPreTag.Equals(input.HighlightPreTag)) + ) && + ( + this.HighlightPostTag == input.HighlightPostTag || + (this.HighlightPostTag != null && + this.HighlightPostTag.Equals(input.HighlightPostTag)) + ) && + ( + this.SnippetEllipsisText == input.SnippetEllipsisText || + (this.SnippetEllipsisText != null && + this.SnippetEllipsisText.Equals(input.SnippetEllipsisText)) + ) && + ( + this.RestrictHighlightAndSnippetArrays == input.RestrictHighlightAndSnippetArrays || + this.RestrictHighlightAndSnippetArrays.Equals(input.RestrictHighlightAndSnippetArrays) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && + ( + this.MinWordSizefor1Typo == input.MinWordSizefor1Typo || + this.MinWordSizefor1Typo.Equals(input.MinWordSizefor1Typo) + ) && + ( + this.MinWordSizefor2Typos == input.MinWordSizefor2Typos || + this.MinWordSizefor2Typos.Equals(input.MinWordSizefor2Typos) + ) && + ( + this.TypoTolerance == input.TypoTolerance || + (this.TypoTolerance != null && + this.TypoTolerance.Equals(input.TypoTolerance)) + ) && + ( + this.AllowTyposOnNumericTokens == input.AllowTyposOnNumericTokens || + this.AllowTyposOnNumericTokens.Equals(input.AllowTyposOnNumericTokens) + ) && + ( + this.DisableTypoToleranceOnAttributes == input.DisableTypoToleranceOnAttributes || + this.DisableTypoToleranceOnAttributes != null && + input.DisableTypoToleranceOnAttributes != null && + this.DisableTypoToleranceOnAttributes.SequenceEqual(input.DisableTypoToleranceOnAttributes) + ) && + ( + this.IgnorePlurals == input.IgnorePlurals || + (this.IgnorePlurals != null && + this.IgnorePlurals.Equals(input.IgnorePlurals)) + ) && + ( + this.RemoveStopWords == input.RemoveStopWords || + (this.RemoveStopWords != null && + this.RemoveStopWords.Equals(input.RemoveStopWords)) + ) && + ( + this.KeepDiacriticsOnCharacters == input.KeepDiacriticsOnCharacters || + (this.KeepDiacriticsOnCharacters != null && + this.KeepDiacriticsOnCharacters.Equals(input.KeepDiacriticsOnCharacters)) + ) && + ( + this.QueryLanguages == input.QueryLanguages || + this.QueryLanguages != null && + input.QueryLanguages != null && + this.QueryLanguages.SequenceEqual(input.QueryLanguages) + ) && + ( + this.DecompoundQuery == input.DecompoundQuery || + this.DecompoundQuery.Equals(input.DecompoundQuery) + ) && + ( + this.EnableRules == input.EnableRules || + this.EnableRules.Equals(input.EnableRules) + ) && + ( + this.EnablePersonalization == input.EnablePersonalization || + this.EnablePersonalization.Equals(input.EnablePersonalization) + ) && + ( + this.QueryType == input.QueryType || + this.QueryType.Equals(input.QueryType) + ) && + ( + this.RemoveWordsIfNoResults == input.RemoveWordsIfNoResults || + this.RemoveWordsIfNoResults.Equals(input.RemoveWordsIfNoResults) + ) && + ( + this.Mode == input.Mode || + this.Mode.Equals(input.Mode) + ) && + ( + this.SemanticSearch == input.SemanticSearch || + (this.SemanticSearch != null && + this.SemanticSearch.Equals(input.SemanticSearch)) + ) && + ( + this.AdvancedSyntax == input.AdvancedSyntax || + this.AdvancedSyntax.Equals(input.AdvancedSyntax) + ) && + ( + this.OptionalWords == input.OptionalWords || + this.OptionalWords != null && + input.OptionalWords != null && + this.OptionalWords.SequenceEqual(input.OptionalWords) + ) && + ( + this.DisableExactOnAttributes == input.DisableExactOnAttributes || + this.DisableExactOnAttributes != null && + input.DisableExactOnAttributes != null && + this.DisableExactOnAttributes.SequenceEqual(input.DisableExactOnAttributes) + ) && + ( + this.ExactOnSingleWordQuery == input.ExactOnSingleWordQuery || + this.ExactOnSingleWordQuery.Equals(input.ExactOnSingleWordQuery) + ) && + ( + this.AlternativesAsExact == input.AlternativesAsExact || + this.AlternativesAsExact != null && + input.AlternativesAsExact != null && + this.AlternativesAsExact.SequenceEqual(input.AlternativesAsExact) + ) && + ( + this.AdvancedSyntaxFeatures == input.AdvancedSyntaxFeatures || + this.AdvancedSyntaxFeatures != null && + input.AdvancedSyntaxFeatures != null && + this.AdvancedSyntaxFeatures.SequenceEqual(input.AdvancedSyntaxFeatures) + ) && + ( + this.Distinct == input.Distinct || + (this.Distinct != null && + this.Distinct.Equals(input.Distinct)) + ) && + ( + this.ReplaceSynonymsInHighlight == input.ReplaceSynonymsInHighlight || + this.ReplaceSynonymsInHighlight.Equals(input.ReplaceSynonymsInHighlight) + ) && + ( + this.MinProximity == input.MinProximity || + this.MinProximity.Equals(input.MinProximity) + ) && + ( + this.ResponseFields == input.ResponseFields || + this.ResponseFields != null && + input.ResponseFields != null && + this.ResponseFields.SequenceEqual(input.ResponseFields) + ) && + ( + this.MaxFacetHits == input.MaxFacetHits || + this.MaxFacetHits.Equals(input.MaxFacetHits) + ) && + ( + this.MaxValuesPerFacet == input.MaxValuesPerFacet || + this.MaxValuesPerFacet.Equals(input.MaxValuesPerFacet) + ) && + ( + this.SortFacetValuesBy == input.SortFacetValuesBy || + (this.SortFacetValuesBy != null && + this.SortFacetValuesBy.Equals(input.SortFacetValuesBy)) + ) && + ( + this.AttributeCriteriaComputedByMinProximity == input.AttributeCriteriaComputedByMinProximity || + this.AttributeCriteriaComputedByMinProximity.Equals(input.AttributeCriteriaComputedByMinProximity) + ) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ) && + ( + this.EnableReRanking == input.EnableReRanking || + this.EnableReRanking.Equals(input.EnableReRanking) + ) && + ( + this.ReRankingApplyFilter == input.ReRankingApplyFilter || + (this.ReRankingApplyFilter != null && + this.ReRankingApplyFilter.Equals(input.ReRankingApplyFilter)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.SimilarQuery != null) + { + hashCode = (hashCode * 59) + this.SimilarQuery.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.FacetFilters != null) + { + hashCode = (hashCode * 59) + this.FacetFilters.GetHashCode(); + } + if (this.OptionalFilters != null) + { + hashCode = (hashCode * 59) + this.OptionalFilters.GetHashCode(); + } + if (this.NumericFilters != null) + { + hashCode = (hashCode * 59) + this.NumericFilters.GetHashCode(); + } + if (this.TagFilters != null) + { + hashCode = (hashCode * 59) + this.TagFilters.GetHashCode(); + } + hashCode = (hashCode * 59) + this.SumOrFiltersScores.GetHashCode(); + if (this.RestrictSearchableAttributes != null) + { + hashCode = (hashCode * 59) + this.RestrictSearchableAttributes.GetHashCode(); + } + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + hashCode = (hashCode * 59) + this.FacetingAfterDistinct.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.Offset.GetHashCode(); + hashCode = (hashCode * 59) + this.Length.GetHashCode(); + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AroundLatLngViaIP.GetHashCode(); + if (this.AroundRadius != null) + { + hashCode = (hashCode * 59) + this.AroundRadius.GetHashCode(); + } + if (this.AroundPrecision != null) + { + hashCode = (hashCode * 59) + this.AroundPrecision.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MinimumAroundRadius.GetHashCode(); + if (this.InsideBoundingBox != null) + { + hashCode = (hashCode * 59) + this.InsideBoundingBox.GetHashCode(); + } + if (this.InsidePolygon != null) + { + hashCode = (hashCode * 59) + this.InsidePolygon.GetHashCode(); + } + if (this.NaturalLanguages != null) + { + hashCode = (hashCode * 59) + this.NaturalLanguages.GetHashCode(); + } + if (this.RuleContexts != null) + { + hashCode = (hashCode * 59) + this.RuleContexts.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PersonalizationImpact.GetHashCode(); + if (this.UserToken != null) + { + hashCode = (hashCode * 59) + this.UserToken.GetHashCode(); + } + hashCode = (hashCode * 59) + this.GetRankingInfo.GetHashCode(); + if (this.Explain != null) + { + hashCode = (hashCode * 59) + this.Explain.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Synonyms.GetHashCode(); + hashCode = (hashCode * 59) + this.ClickAnalytics.GetHashCode(); + hashCode = (hashCode * 59) + this.Analytics.GetHashCode(); + if (this.AnalyticsTags != null) + { + hashCode = (hashCode * 59) + this.AnalyticsTags.GetHashCode(); + } + hashCode = (hashCode * 59) + this.PercentileComputation.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableABTest.GetHashCode(); + if (this.AttributesForFaceting != null) + { + hashCode = (hashCode * 59) + this.AttributesForFaceting.GetHashCode(); + } + if (this.AttributesToRetrieve != null) + { + hashCode = (hashCode * 59) + this.AttributesToRetrieve.GetHashCode(); + } + if (this.Ranking != null) + { + hashCode = (hashCode * 59) + this.Ranking.GetHashCode(); + } + if (this.CustomRanking != null) + { + hashCode = (hashCode * 59) + this.CustomRanking.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RelevancyStrictness.GetHashCode(); + if (this.AttributesToHighlight != null) + { + hashCode = (hashCode * 59) + this.AttributesToHighlight.GetHashCode(); + } + if (this.AttributesToSnippet != null) + { + hashCode = (hashCode * 59) + this.AttributesToSnippet.GetHashCode(); + } + if (this.HighlightPreTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPreTag.GetHashCode(); + } + if (this.HighlightPostTag != null) + { + hashCode = (hashCode * 59) + this.HighlightPostTag.GetHashCode(); + } + if (this.SnippetEllipsisText != null) + { + hashCode = (hashCode * 59) + this.SnippetEllipsisText.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RestrictHighlightAndSnippetArrays.GetHashCode(); + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor1Typo.GetHashCode(); + hashCode = (hashCode * 59) + this.MinWordSizefor2Typos.GetHashCode(); + if (this.TypoTolerance != null) + { + hashCode = (hashCode * 59) + this.TypoTolerance.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AllowTyposOnNumericTokens.GetHashCode(); + if (this.DisableTypoToleranceOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableTypoToleranceOnAttributes.GetHashCode(); + } + if (this.IgnorePlurals != null) + { + hashCode = (hashCode * 59) + this.IgnorePlurals.GetHashCode(); + } + if (this.RemoveStopWords != null) + { + hashCode = (hashCode * 59) + this.RemoveStopWords.GetHashCode(); + } + if (this.KeepDiacriticsOnCharacters != null) + { + hashCode = (hashCode * 59) + this.KeepDiacriticsOnCharacters.GetHashCode(); + } + if (this.QueryLanguages != null) + { + hashCode = (hashCode * 59) + this.QueryLanguages.GetHashCode(); + } + hashCode = (hashCode * 59) + this.DecompoundQuery.GetHashCode(); + hashCode = (hashCode * 59) + this.EnableRules.GetHashCode(); + hashCode = (hashCode * 59) + this.EnablePersonalization.GetHashCode(); + hashCode = (hashCode * 59) + this.QueryType.GetHashCode(); + hashCode = (hashCode * 59) + this.RemoveWordsIfNoResults.GetHashCode(); + hashCode = (hashCode * 59) + this.Mode.GetHashCode(); + if (this.SemanticSearch != null) + { + hashCode = (hashCode * 59) + this.SemanticSearch.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AdvancedSyntax.GetHashCode(); + if (this.OptionalWords != null) + { + hashCode = (hashCode * 59) + this.OptionalWords.GetHashCode(); + } + if (this.DisableExactOnAttributes != null) + { + hashCode = (hashCode * 59) + this.DisableExactOnAttributes.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ExactOnSingleWordQuery.GetHashCode(); + if (this.AlternativesAsExact != null) + { + hashCode = (hashCode * 59) + this.AlternativesAsExact.GetHashCode(); + } + if (this.AdvancedSyntaxFeatures != null) + { + hashCode = (hashCode * 59) + this.AdvancedSyntaxFeatures.GetHashCode(); + } + if (this.Distinct != null) + { + hashCode = (hashCode * 59) + this.Distinct.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ReplaceSynonymsInHighlight.GetHashCode(); + hashCode = (hashCode * 59) + this.MinProximity.GetHashCode(); + if (this.ResponseFields != null) + { + hashCode = (hashCode * 59) + this.ResponseFields.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MaxFacetHits.GetHashCode(); + hashCode = (hashCode * 59) + this.MaxValuesPerFacet.GetHashCode(); + if (this.SortFacetValuesBy != null) + { + hashCode = (hashCode * 59) + this.SortFacetValuesBy.GetHashCode(); + } + hashCode = (hashCode * 59) + this.AttributeCriteriaComputedByMinProximity.GetHashCode(); + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + hashCode = (hashCode * 59) + this.EnableReRanking.GetHashCode(); + if (this.ReRankingApplyFilter != null) + { + hashCode = (hashCode * 59) + this.ReRankingApplyFilter.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Length (int) maximum + if (this.Length > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value less than or equal to 1000.", new[] { "Length" }); + } + + // Length (int) minimum + if (this.Length < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Length, must be a value greater than or equal to 1.", new[] { "Length" }); + } + + // MinimumAroundRadius (int) minimum + if (this.MinimumAroundRadius < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinimumAroundRadius, must be a value greater than or equal to 1.", new[] { "MinimumAroundRadius" }); + } + + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + // MinProximity (int) maximum + if (this.MinProximity > (int)7) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value less than or equal to 7.", new[] { "MinProximity" }); + } + + // MinProximity (int) minimum + if (this.MinProximity < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MinProximity, must be a value greater than or equal to 1.", new[] { "MinProximity" }); + } + + // MaxFacetHits (int) maximum + if (this.MaxFacetHits > (int)100) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for MaxFacetHits, must be a value less than or equal to 100.", new[] { "MaxFacetHits" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchParamsQuery.cs b/algoliasearch/Search/Models/SearchParamsQuery.cs new file mode 100644 index 000000000..d5f8032a7 --- /dev/null +++ b/algoliasearch/Search/Models/SearchParamsQuery.cs @@ -0,0 +1,125 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchParamsQuery + /// + [DataContract(Name = "searchParamsQuery")] + public partial class SearchParamsQuery : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Text to search for in an index. (default to ""). + public SearchParamsQuery(string query = @"") + { + // use default value if no "query" provided + this.Query = query ?? @""; + } + + /// + /// Text to search for in an index. + /// + /// Text to search for in an index. + [DataMember(Name = "query", EmitDefaultValue = false)] + public string Query { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchParamsQuery {\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchParamsQuery); + } + + /// + /// Returns true if SearchParamsQuery instances are equal + /// + /// Instance of SearchParamsQuery to be compared + /// Boolean + public bool Equals(SearchParamsQuery input) + { + if (input == null) + { + return false; + } + return + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchParamsString.cs b/algoliasearch/Search/Models/SearchParamsString.cs new file mode 100644 index 000000000..dd2bb48dc --- /dev/null +++ b/algoliasearch/Search/Models/SearchParamsString.cs @@ -0,0 +1,125 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchParamsString + /// + [DataContract(Name = "searchParamsString")] + public partial class SearchParamsString : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Search parameters as a URL-encoded query string. (default to ""). + public SearchParamsString(string varParams = @"") + { + // use default value if no "varParams" provided + this.VarParams = varParams ?? @""; + } + + /// + /// Search parameters as a URL-encoded query string. + /// + /// Search parameters as a URL-encoded query string. + [DataMember(Name = "params", EmitDefaultValue = false)] + public string VarParams { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchParamsString {\n"); + sb.Append(" VarParams: ").Append(VarParams).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchParamsString); + } + + /// + /// Returns true if SearchParamsString instances are equal + /// + /// Instance of SearchParamsString to be compared + /// Boolean + public bool Equals(SearchParamsString input) + { + if (input == null) + { + return false; + } + return + ( + this.VarParams == input.VarParams || + (this.VarParams != null && + this.VarParams.Equals(input.VarParams)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.VarParams != null) + { + hashCode = (hashCode * 59) + this.VarParams.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchQuery.cs b/algoliasearch/Search/Models/SearchQuery.cs new file mode 100644 index 000000000..a53926a41 --- /dev/null +++ b/algoliasearch/Search/Models/SearchQuery.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchQuery + /// + [JsonConverter(typeof(SearchQueryJsonConverter))] + [DataContract(Name = "SearchQuery")] + public partial class SearchQuery : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SearchForHits. + public SearchQuery(SearchForHits actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SearchForFacets. + public SearchQuery(SearchForFacets actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(SearchForFacets)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SearchForHits)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: SearchForFacets, SearchForHits"); + } + } + } + + /// + /// Get the actual instance of `SearchForHits`. If the actual instance is not `SearchForHits`, + /// the InvalidClassException will be thrown + /// + /// An instance of SearchForHits + public SearchForHits GetterSearchForHits() + { + return (SearchForHits)this.ActualInstance; + } + + /// + /// Get the actual instance of `SearchForFacets`. If the actual instance is not `SearchForFacets`, + /// the InvalidClassException will be thrown + /// + /// An instance of SearchForFacets + public SearchForFacets GetterSearchForFacets() + { + return (SearchForFacets)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class SearchQuery {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, SearchQuery.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of SearchQuery + /// + /// JSON string + /// An instance of SearchQuery + public static SearchQuery FromJson(string jsonString) + { + SearchQuery newSearchQuery = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newSearchQuery; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SearchForFacets).GetProperty("AdditionalProperties") == null) + { + newSearchQuery = new SearchQuery(JsonConvert.DeserializeObject(jsonString, SearchQuery.SerializerSettings)); + } + else + { + newSearchQuery = new SearchQuery(JsonConvert.DeserializeObject(jsonString, SearchQuery.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SearchForFacets"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SearchForFacets: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SearchForHits).GetProperty("AdditionalProperties") == null) + { + newSearchQuery = new SearchQuery(JsonConvert.DeserializeObject(jsonString, SearchQuery.SerializerSettings)); + } + else + { + newSearchQuery = new SearchQuery(JsonConvert.DeserializeObject(jsonString, SearchQuery.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SearchForHits"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SearchForHits: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newSearchQuery; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchQuery); + } + + /// + /// Returns true if SearchQuery instances are equal + /// + /// Instance of SearchQuery to be compared + /// Boolean + public bool Equals(SearchQuery input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for SearchQuery + /// + public class SearchQueryJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(SearchQuery).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return SearchQuery.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchResponse.cs b/algoliasearch/Search/Models/SearchResponse.cs new file mode 100644 index 000000000..42874ce57 --- /dev/null +++ b/algoliasearch/Search/Models/SearchResponse.cs @@ -0,0 +1,704 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchResponse + /// + [DataContract(Name = "searchResponse")] + public partial class SearchResponse : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchResponse() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// A/B test ID. This is only included in the response for indices that are part of an A/B test.. + /// Variant ID. This is only included in the response for indices that are part of an A/B test.. + /// Computed geographical location.. + /// Automatically-computed radius.. + /// exhaustive. + /// See the `facetsCount` field of the `exhaustive` object in the response.. + /// See the `nbHits` field of the `exhaustive` object in the response.. + /// See the `typo` field of the `exhaustive` object in the response.. + /// Mapping of each facet name to the corresponding facet counts.. + /// Statistics for numerical facets.. + /// Number of hits per page. (required) (default to 20). + /// Index name used for the query.. + /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query.. + /// Warnings about the query.. + /// Number of hits the search query matched. (required). + /// Number of pages of results for the current query. (required). + /// Number of hits selected and sorted by the relevant sort algorithm.. + /// Page to retrieve (the first page is `0`, not `1`). (required) (default to 0). + /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched.. + /// Time the server took to process the request, in milliseconds. (required). + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues.. + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set.. + /// redirect. + /// renderingContent. + /// Time the server took to process the request, in milliseconds.. + /// Host name of the server that processed the request.. + /// Lets you store custom data in your indices.. + /// hits (required). + /// Text to search for in an index. (required) (default to ""). + /// URL-encoded string of all search parameters. (required). + public SearchResponse(int abTestID = default(int), int abTestVariantID = default(int), string aroundLatLng = default(string), string automaticRadius = default(string), Exhaustive exhaustive = default(Exhaustive), bool exhaustiveFacetsCount = default(bool), bool exhaustiveNbHits = default(bool), bool exhaustiveTypo = default(bool), Dictionary> facets = default(Dictionary>), Dictionary facetsStats = default(Dictionary), int hitsPerPage = 20, string index = default(string), string indexUsed = default(string), string message = default(string), int nbHits = default(int), int nbPages = default(int), int nbSortedHits = default(int), int page = 0, string parsedQuery = default(string), int processingTimeMS = default(int), Object processingTimingsMS = default(Object), string queryAfterRemoval = default(string), Redirect redirect = default(Redirect), RenderingContent renderingContent = default(RenderingContent), int serverTimeMS = default(int), string serverUsed = default(string), Object userData = default(Object), List hits = default(List), string query = @"", string varParams = default(string)) : base() + { + this.HitsPerPage = hitsPerPage; + this.NbHits = nbHits; + this.NbPages = nbPages; + this.Page = page; + this.ProcessingTimeMS = processingTimeMS; + // to ensure "hits" is required (not null) + if (hits == null) + { + throw new ArgumentNullException("hits is a required property for SearchResponse and cannot be null"); + } + this.Hits = hits; + // to ensure "query" is required (not null) + if (query == null) + { + throw new ArgumentNullException("query is a required property for SearchResponse and cannot be null"); + } + this.Query = query; + // to ensure "varParams" is required (not null) + if (varParams == null) + { + throw new ArgumentNullException("varParams is a required property for SearchResponse and cannot be null"); + } + this.VarParams = varParams; + this.AbTestID = abTestID; + this.AbTestVariantID = abTestVariantID; + this.AroundLatLng = aroundLatLng; + this.AutomaticRadius = automaticRadius; + this.Exhaustive = exhaustive; + this.ExhaustiveFacetsCount = exhaustiveFacetsCount; + this.ExhaustiveNbHits = exhaustiveNbHits; + this.ExhaustiveTypo = exhaustiveTypo; + this.Facets = facets; + this.FacetsStats = facetsStats; + this.Index = index; + this.IndexUsed = indexUsed; + this.Message = message; + this.NbSortedHits = nbSortedHits; + this.ParsedQuery = parsedQuery; + this.ProcessingTimingsMS = processingTimingsMS; + this.QueryAfterRemoval = queryAfterRemoval; + this.Redirect = redirect; + this.RenderingContent = renderingContent; + this.ServerTimeMS = serverTimeMS; + this.ServerUsed = serverUsed; + this.UserData = userData; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// A/B test ID. This is only included in the response for indices that are part of an A/B test. + /// + /// A/B test ID. This is only included in the response for indices that are part of an A/B test. + [DataMember(Name = "abTestID", EmitDefaultValue = false)] + public int AbTestID { get; set; } + + /// + /// Variant ID. This is only included in the response for indices that are part of an A/B test. + /// + /// Variant ID. This is only included in the response for indices that are part of an A/B test. + [DataMember(Name = "abTestVariantID", EmitDefaultValue = false)] + public int AbTestVariantID { get; set; } + + /// + /// Computed geographical location. + /// + /// Computed geographical location. + [DataMember(Name = "aroundLatLng", EmitDefaultValue = false)] + public string AroundLatLng { get; set; } + + /// + /// Automatically-computed radius. + /// + /// Automatically-computed radius. + [DataMember(Name = "automaticRadius", EmitDefaultValue = false)] + public string AutomaticRadius { get; set; } + + /// + /// Gets or Sets Exhaustive + /// + [DataMember(Name = "exhaustive", EmitDefaultValue = false)] + public Exhaustive Exhaustive { get; set; } + + /// + /// See the `facetsCount` field of the `exhaustive` object in the response. + /// + /// See the `facetsCount` field of the `exhaustive` object in the response. + [DataMember(Name = "exhaustiveFacetsCount", EmitDefaultValue = true)] + [Obsolete] + public bool ExhaustiveFacetsCount { get; set; } + + /// + /// See the `nbHits` field of the `exhaustive` object in the response. + /// + /// See the `nbHits` field of the `exhaustive` object in the response. + [DataMember(Name = "exhaustiveNbHits", EmitDefaultValue = true)] + [Obsolete] + public bool ExhaustiveNbHits { get; set; } + + /// + /// See the `typo` field of the `exhaustive` object in the response. + /// + /// See the `typo` field of the `exhaustive` object in the response. + [DataMember(Name = "exhaustiveTypo", EmitDefaultValue = true)] + [Obsolete] + public bool ExhaustiveTypo { get; set; } + + /// + /// Mapping of each facet name to the corresponding facet counts. + /// + /// Mapping of each facet name to the corresponding facet counts. + [DataMember(Name = "facets", EmitDefaultValue = false)] + public Dictionary> Facets { get; set; } + + /// + /// Statistics for numerical facets. + /// + /// Statistics for numerical facets. + [DataMember(Name = "facets_stats", EmitDefaultValue = false)] + public Dictionary FacetsStats { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", IsRequired = true, EmitDefaultValue = true)] + public int HitsPerPage { get; set; } + + /// + /// Index name used for the query. + /// + /// Index name used for the query. + [DataMember(Name = "index", EmitDefaultValue = false)] + public string Index { get; set; } + + /// + /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. + /// + /// Index name used for the query. During A/B testing, the targeted index isn't always the index used by the query. + [DataMember(Name = "indexUsed", EmitDefaultValue = false)] + public string IndexUsed { get; set; } + + /// + /// Warnings about the query. + /// + /// Warnings about the query. + [DataMember(Name = "message", EmitDefaultValue = false)] + public string Message { get; set; } + + /// + /// Number of hits the search query matched. + /// + /// Number of hits the search query matched. + [DataMember(Name = "nbHits", IsRequired = true, EmitDefaultValue = true)] + public int NbHits { get; set; } + + /// + /// Number of pages of results for the current query. + /// + /// Number of pages of results for the current query. + [DataMember(Name = "nbPages", IsRequired = true, EmitDefaultValue = true)] + public int NbPages { get; set; } + + /// + /// Number of hits selected and sorted by the relevant sort algorithm. + /// + /// Number of hits selected and sorted by the relevant sort algorithm. + [DataMember(Name = "nbSortedHits", EmitDefaultValue = false)] + public int NbSortedHits { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", IsRequired = true, EmitDefaultValue = true)] + public int Page { get; set; } + + /// + /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. + /// + /// Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched. + [DataMember(Name = "parsedQuery", EmitDefaultValue = false)] + public string ParsedQuery { get; set; } + + /// + /// Time the server took to process the request, in milliseconds. + /// + /// Time the server took to process the request, in milliseconds. + [DataMember(Name = "processingTimeMS", IsRequired = true, EmitDefaultValue = true)] + public int ProcessingTimeMS { get; set; } + + /// + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + /// + /// Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues. + [DataMember(Name = "processingTimingsMS", EmitDefaultValue = false)] + public Object ProcessingTimingsMS { get; set; } + + /// + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + /// + /// Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set. + [DataMember(Name = "queryAfterRemoval", EmitDefaultValue = false)] + public string QueryAfterRemoval { get; set; } + + /// + /// Gets or Sets Redirect + /// + [DataMember(Name = "redirect", EmitDefaultValue = false)] + public Redirect Redirect { get; set; } + + /// + /// Gets or Sets RenderingContent + /// + [DataMember(Name = "renderingContent", EmitDefaultValue = false)] + public RenderingContent RenderingContent { get; set; } + + /// + /// Time the server took to process the request, in milliseconds. + /// + /// Time the server took to process the request, in milliseconds. + [DataMember(Name = "serverTimeMS", EmitDefaultValue = false)] + public int ServerTimeMS { get; set; } + + /// + /// Host name of the server that processed the request. + /// + /// Host name of the server that processed the request. + [DataMember(Name = "serverUsed", EmitDefaultValue = false)] + public string ServerUsed { get; set; } + + /// + /// Lets you store custom data in your indices. + /// + /// Lets you store custom data in your indices. + [DataMember(Name = "userData", EmitDefaultValue = false)] + public Object UserData { get; set; } + + /// + /// Gets or Sets Hits + /// + [DataMember(Name = "hits", IsRequired = true, EmitDefaultValue = true)] + public List Hits { get; set; } + + /// + /// Text to search for in an index. + /// + /// Text to search for in an index. + [DataMember(Name = "query", IsRequired = true, EmitDefaultValue = true)] + public string Query { get; set; } + + /// + /// URL-encoded string of all search parameters. + /// + /// URL-encoded string of all search parameters. + [DataMember(Name = "params", IsRequired = true, EmitDefaultValue = true)] + public string VarParams { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchResponse {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" AbTestID: ").Append(AbTestID).Append("\n"); + sb.Append(" AbTestVariantID: ").Append(AbTestVariantID).Append("\n"); + sb.Append(" AroundLatLng: ").Append(AroundLatLng).Append("\n"); + sb.Append(" AutomaticRadius: ").Append(AutomaticRadius).Append("\n"); + sb.Append(" Exhaustive: ").Append(Exhaustive).Append("\n"); + sb.Append(" ExhaustiveFacetsCount: ").Append(ExhaustiveFacetsCount).Append("\n"); + sb.Append(" ExhaustiveNbHits: ").Append(ExhaustiveNbHits).Append("\n"); + sb.Append(" ExhaustiveTypo: ").Append(ExhaustiveTypo).Append("\n"); + sb.Append(" Facets: ").Append(Facets).Append("\n"); + sb.Append(" FacetsStats: ").Append(FacetsStats).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" Index: ").Append(Index).Append("\n"); + sb.Append(" IndexUsed: ").Append(IndexUsed).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" NbPages: ").Append(NbPages).Append("\n"); + sb.Append(" NbSortedHits: ").Append(NbSortedHits).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" ParsedQuery: ").Append(ParsedQuery).Append("\n"); + sb.Append(" ProcessingTimeMS: ").Append(ProcessingTimeMS).Append("\n"); + sb.Append(" ProcessingTimingsMS: ").Append(ProcessingTimingsMS).Append("\n"); + sb.Append(" QueryAfterRemoval: ").Append(QueryAfterRemoval).Append("\n"); + sb.Append(" Redirect: ").Append(Redirect).Append("\n"); + sb.Append(" RenderingContent: ").Append(RenderingContent).Append("\n"); + sb.Append(" ServerTimeMS: ").Append(ServerTimeMS).Append("\n"); + sb.Append(" ServerUsed: ").Append(ServerUsed).Append("\n"); + sb.Append(" UserData: ").Append(UserData).Append("\n"); + sb.Append(" Hits: ").Append(Hits).Append("\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" VarParams: ").Append(VarParams).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchResponse); + } + + /// + /// Returns true if SearchResponse instances are equal + /// + /// Instance of SearchResponse to be compared + /// Boolean + public bool Equals(SearchResponse input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.AbTestID == input.AbTestID || + this.AbTestID.Equals(input.AbTestID) + ) && base.Equals(input) && + ( + this.AbTestVariantID == input.AbTestVariantID || + this.AbTestVariantID.Equals(input.AbTestVariantID) + ) && base.Equals(input) && + ( + this.AroundLatLng == input.AroundLatLng || + (this.AroundLatLng != null && + this.AroundLatLng.Equals(input.AroundLatLng)) + ) && base.Equals(input) && + ( + this.AutomaticRadius == input.AutomaticRadius || + (this.AutomaticRadius != null && + this.AutomaticRadius.Equals(input.AutomaticRadius)) + ) && base.Equals(input) && + ( + this.Exhaustive == input.Exhaustive || + (this.Exhaustive != null && + this.Exhaustive.Equals(input.Exhaustive)) + ) && base.Equals(input) && + ( + this.ExhaustiveFacetsCount == input.ExhaustiveFacetsCount || + this.ExhaustiveFacetsCount.Equals(input.ExhaustiveFacetsCount) + ) && base.Equals(input) && + ( + this.ExhaustiveNbHits == input.ExhaustiveNbHits || + this.ExhaustiveNbHits.Equals(input.ExhaustiveNbHits) + ) && base.Equals(input) && + ( + this.ExhaustiveTypo == input.ExhaustiveTypo || + this.ExhaustiveTypo.Equals(input.ExhaustiveTypo) + ) && base.Equals(input) && + ( + this.Facets == input.Facets || + this.Facets != null && + input.Facets != null && + this.Facets.SequenceEqual(input.Facets) + ) && base.Equals(input) && + ( + this.FacetsStats == input.FacetsStats || + this.FacetsStats != null && + input.FacetsStats != null && + this.FacetsStats.SequenceEqual(input.FacetsStats) + ) && base.Equals(input) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && base.Equals(input) && + ( + this.Index == input.Index || + (this.Index != null && + this.Index.Equals(input.Index)) + ) && base.Equals(input) && + ( + this.IndexUsed == input.IndexUsed || + (this.IndexUsed != null && + this.IndexUsed.Equals(input.IndexUsed)) + ) && base.Equals(input) && + ( + this.Message == input.Message || + (this.Message != null && + this.Message.Equals(input.Message)) + ) && base.Equals(input) && + ( + this.NbHits == input.NbHits || + this.NbHits.Equals(input.NbHits) + ) && base.Equals(input) && + ( + this.NbPages == input.NbPages || + this.NbPages.Equals(input.NbPages) + ) && base.Equals(input) && + ( + this.NbSortedHits == input.NbSortedHits || + this.NbSortedHits.Equals(input.NbSortedHits) + ) && base.Equals(input) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && base.Equals(input) && + ( + this.ParsedQuery == input.ParsedQuery || + (this.ParsedQuery != null && + this.ParsedQuery.Equals(input.ParsedQuery)) + ) && base.Equals(input) && + ( + this.ProcessingTimeMS == input.ProcessingTimeMS || + this.ProcessingTimeMS.Equals(input.ProcessingTimeMS) + ) && base.Equals(input) && + ( + this.ProcessingTimingsMS == input.ProcessingTimingsMS || + (this.ProcessingTimingsMS != null && + this.ProcessingTimingsMS.Equals(input.ProcessingTimingsMS)) + ) && base.Equals(input) && + ( + this.QueryAfterRemoval == input.QueryAfterRemoval || + (this.QueryAfterRemoval != null && + this.QueryAfterRemoval.Equals(input.QueryAfterRemoval)) + ) && base.Equals(input) && + ( + this.Redirect == input.Redirect || + (this.Redirect != null && + this.Redirect.Equals(input.Redirect)) + ) && base.Equals(input) && + ( + this.RenderingContent == input.RenderingContent || + (this.RenderingContent != null && + this.RenderingContent.Equals(input.RenderingContent)) + ) && base.Equals(input) && + ( + this.ServerTimeMS == input.ServerTimeMS || + this.ServerTimeMS.Equals(input.ServerTimeMS) + ) && base.Equals(input) && + ( + this.ServerUsed == input.ServerUsed || + (this.ServerUsed != null && + this.ServerUsed.Equals(input.ServerUsed)) + ) && base.Equals(input) && + ( + this.UserData == input.UserData || + (this.UserData != null && + this.UserData.Equals(input.UserData)) + ) && base.Equals(input) && + ( + this.Hits == input.Hits || + this.Hits != null && + input.Hits != null && + this.Hits.SequenceEqual(input.Hits) + ) && base.Equals(input) && + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && base.Equals(input) && + ( + this.VarParams == input.VarParams || + (this.VarParams != null && + this.VarParams.Equals(input.VarParams)) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + hashCode = (hashCode * 59) + this.AbTestID.GetHashCode(); + hashCode = (hashCode * 59) + this.AbTestVariantID.GetHashCode(); + if (this.AroundLatLng != null) + { + hashCode = (hashCode * 59) + this.AroundLatLng.GetHashCode(); + } + if (this.AutomaticRadius != null) + { + hashCode = (hashCode * 59) + this.AutomaticRadius.GetHashCode(); + } + if (this.Exhaustive != null) + { + hashCode = (hashCode * 59) + this.Exhaustive.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ExhaustiveFacetsCount.GetHashCode(); + hashCode = (hashCode * 59) + this.ExhaustiveNbHits.GetHashCode(); + hashCode = (hashCode * 59) + this.ExhaustiveTypo.GetHashCode(); + if (this.Facets != null) + { + hashCode = (hashCode * 59) + this.Facets.GetHashCode(); + } + if (this.FacetsStats != null) + { + hashCode = (hashCode * 59) + this.FacetsStats.GetHashCode(); + } + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + if (this.Index != null) + { + hashCode = (hashCode * 59) + this.Index.GetHashCode(); + } + if (this.IndexUsed != null) + { + hashCode = (hashCode * 59) + this.IndexUsed.GetHashCode(); + } + if (this.Message != null) + { + hashCode = (hashCode * 59) + this.Message.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NbHits.GetHashCode(); + hashCode = (hashCode * 59) + this.NbPages.GetHashCode(); + hashCode = (hashCode * 59) + this.NbSortedHits.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + if (this.ParsedQuery != null) + { + hashCode = (hashCode * 59) + this.ParsedQuery.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ProcessingTimeMS.GetHashCode(); + if (this.ProcessingTimingsMS != null) + { + hashCode = (hashCode * 59) + this.ProcessingTimingsMS.GetHashCode(); + } + if (this.QueryAfterRemoval != null) + { + hashCode = (hashCode * 59) + this.QueryAfterRemoval.GetHashCode(); + } + if (this.Redirect != null) + { + hashCode = (hashCode * 59) + this.Redirect.GetHashCode(); + } + if (this.RenderingContent != null) + { + hashCode = (hashCode * 59) + this.RenderingContent.GetHashCode(); + } + hashCode = (hashCode * 59) + this.ServerTimeMS.GetHashCode(); + if (this.ServerUsed != null) + { + hashCode = (hashCode * 59) + this.ServerUsed.GetHashCode(); + } + if (this.UserData != null) + { + hashCode = (hashCode * 59) + this.UserData.GetHashCode(); + } + if (this.Hits != null) + { + hashCode = (hashCode * 59) + this.Hits.GetHashCode(); + } + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.VarParams != null) + { + hashCode = (hashCode * 59) + this.VarParams.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + // AbTestVariantID (int) minimum + if (this.AbTestVariantID < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for AbTestVariantID, must be a value greater than or equal to 1.", new[] { "AbTestVariantID" }); + } + + if (this.AroundLatLng != null) + { + // AroundLatLng (string) pattern + Regex regexAroundLatLng = new Regex(@"^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$", RegexOptions.CultureInvariant); + if (!regexAroundLatLng.Match(this.AroundLatLng).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for AroundLatLng, must match a pattern of " + regexAroundLatLng, new[] { "AroundLatLng" }); + } + } + + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchResponses.cs b/algoliasearch/Search/Models/SearchResponses.cs new file mode 100644 index 000000000..208c497d7 --- /dev/null +++ b/algoliasearch/Search/Models/SearchResponses.cs @@ -0,0 +1,134 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchResponses + /// + [DataContract(Name = "searchResponses")] + public partial class SearchResponses : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchResponses() { } + /// + /// Initializes a new instance of the class. + /// + /// results (required). + public SearchResponses(List results = default(List)) + { + // to ensure "results" is required (not null) + if (results == null) + { + throw new ArgumentNullException("results is a required property for SearchResponses and cannot be null"); + } + this.Results = results; + } + + /// + /// Gets or Sets Results + /// + [DataMember(Name = "results", IsRequired = true, EmitDefaultValue = true)] + public List Results { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchResponses {\n"); + sb.Append(" Results: ").Append(Results).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchResponses); + } + + /// + /// Returns true if SearchResponses instances are equal + /// + /// Instance of SearchResponses to be compared + /// Boolean + public bool Equals(SearchResponses input) + { + if (input == null) + { + return false; + } + return + ( + this.Results == input.Results || + this.Results != null && + input.Results != null && + this.Results.SequenceEqual(input.Results) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Results != null) + { + hashCode = (hashCode * 59) + this.Results.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchResult.cs b/algoliasearch/Search/Models/SearchResult.cs new file mode 100644 index 000000000..55536b33e --- /dev/null +++ b/algoliasearch/Search/Models/SearchResult.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchResult + /// + [JsonConverter(typeof(SearchResultJsonConverter))] + [DataContract(Name = "searchResult")] + public partial class SearchResult : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SearchResponse. + public SearchResult(SearchResponse actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SearchForFacetValuesResponse. + public SearchResult(SearchForFacetValuesResponse actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(SearchForFacetValuesResponse)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SearchResponse)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: SearchForFacetValuesResponse, SearchResponse"); + } + } + } + + /// + /// Get the actual instance of `SearchResponse`. If the actual instance is not `SearchResponse`, + /// the InvalidClassException will be thrown + /// + /// An instance of SearchResponse + public SearchResponse GetterSearchResponse() + { + return (SearchResponse)this.ActualInstance; + } + + /// + /// Get the actual instance of `SearchForFacetValuesResponse`. If the actual instance is not `SearchForFacetValuesResponse`, + /// the InvalidClassException will be thrown + /// + /// An instance of SearchForFacetValuesResponse + public SearchForFacetValuesResponse GetterSearchForFacetValuesResponse() + { + return (SearchForFacetValuesResponse)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class SearchResult {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, SearchResult.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of SearchResult + /// + /// JSON string + /// An instance of SearchResult + public static SearchResult FromJson(string jsonString) + { + SearchResult newSearchResult = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newSearchResult; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SearchForFacetValuesResponse).GetProperty("AdditionalProperties") == null) + { + newSearchResult = new SearchResult(JsonConvert.DeserializeObject(jsonString, SearchResult.SerializerSettings)); + } + else + { + newSearchResult = new SearchResult(JsonConvert.DeserializeObject(jsonString, SearchResult.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SearchForFacetValuesResponse"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SearchForFacetValuesResponse: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SearchResponse).GetProperty("AdditionalProperties") == null) + { + newSearchResult = new SearchResult(JsonConvert.DeserializeObject(jsonString, SearchResult.SerializerSettings)); + } + else + { + newSearchResult = new SearchResult(JsonConvert.DeserializeObject(jsonString, SearchResult.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SearchResponse"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SearchResponse: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newSearchResult; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchResult); + } + + /// + /// Returns true if SearchResult instances are equal + /// + /// Instance of SearchResult to be compared + /// Boolean + public bool Equals(SearchResult input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for SearchResult + /// + public class SearchResultJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(SearchResult).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return SearchResult.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchRulesParams.cs b/algoliasearch/Search/Models/SearchRulesParams.cs new file mode 100644 index 000000000..82b078559 --- /dev/null +++ b/algoliasearch/Search/Models/SearchRulesParams.cs @@ -0,0 +1,245 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Rules search parameters. + /// + [DataContract(Name = "searchRulesParams")] + public partial class SearchRulesParams : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Anchoring + /// + [DataMember(Name = "anchoring", EmitDefaultValue = false)] + public Anchoring? Anchoring { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Rule object query. (default to ""). + /// anchoring. + /// Restricts responses to the specified [contextual rule](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#creating-contextual-rules).. + /// Requested page (the first page is page 0).. + /// Maximum number of hits per page. (default to 20). + /// Restricts responses to enabled rules. When not specified (default), _all_ rules are retrieved.. + /// Request options to send with the API call.. + public SearchRulesParams(string query = @"", Anchoring? anchoring = default(Anchoring?), string context = default(string), int page = default(int), int hitsPerPage = 20, bool? enabled = default(bool?), List requestOptions = default(List)) + { + // use default value if no "query" provided + this.Query = query ?? @""; + this.Anchoring = anchoring; + this.Context = context; + this.Page = page; + this.HitsPerPage = hitsPerPage; + this.Enabled = enabled; + this.RequestOptions = requestOptions; + } + + /// + /// Rule object query. + /// + /// Rule object query. + [DataMember(Name = "query", EmitDefaultValue = false)] + public string Query { get; set; } + + /// + /// Restricts responses to the specified [contextual rule](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#creating-contextual-rules). + /// + /// Restricts responses to the specified [contextual rule](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#creating-contextual-rules). + [DataMember(Name = "context", EmitDefaultValue = false)] + public string Context { get; set; } + + /// + /// Requested page (the first page is page 0). + /// + /// Requested page (the first page is page 0). + [DataMember(Name = "page", EmitDefaultValue = false)] + public int Page { get; set; } + + /// + /// Maximum number of hits per page. + /// + /// Maximum number of hits per page. + [DataMember(Name = "hitsPerPage", EmitDefaultValue = false)] + public int HitsPerPage { get; set; } + + /// + /// Restricts responses to enabled rules. When not specified (default), _all_ rules are retrieved. + /// + /// Restricts responses to enabled rules. When not specified (default), _all_ rules are retrieved. + [DataMember(Name = "enabled", EmitDefaultValue = true)] + public bool? Enabled { get; set; } + + /// + /// Request options to send with the API call. + /// + /// Request options to send with the API call. + [DataMember(Name = "requestOptions", EmitDefaultValue = false)] + public List RequestOptions { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchRulesParams {\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" Anchoring: ").Append(Anchoring).Append("\n"); + sb.Append(" Context: ").Append(Context).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" Enabled: ").Append(Enabled).Append("\n"); + sb.Append(" RequestOptions: ").Append(RequestOptions).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchRulesParams); + } + + /// + /// Returns true if SearchRulesParams instances are equal + /// + /// Instance of SearchRulesParams to be compared + /// Boolean + public bool Equals(SearchRulesParams input) + { + if (input == null) + { + return false; + } + return + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.Anchoring == input.Anchoring || + this.Anchoring.Equals(input.Anchoring) + ) && + ( + this.Context == input.Context || + (this.Context != null && + this.Context.Equals(input.Context)) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && + ( + this.Enabled == input.Enabled || + (this.Enabled != null && + this.Enabled.Equals(input.Enabled)) + ) && + ( + this.RequestOptions == input.RequestOptions || + this.RequestOptions != null && + input.RequestOptions != null && + this.RequestOptions.SequenceEqual(input.RequestOptions) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Anchoring.GetHashCode(); + if (this.Context != null) + { + hashCode = (hashCode * 59) + this.Context.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + if (this.Enabled != null) + { + hashCode = (hashCode * 59) + this.Enabled.GetHashCode(); + } + if (this.RequestOptions != null) + { + hashCode = (hashCode * 59) + this.RequestOptions.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Page (int) minimum + if (this.Page < (int)0) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Page, must be a value greater than or equal to 0.", new[] { "Page" }); + } + + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchRulesResponse.cs b/algoliasearch/Search/Models/SearchRulesResponse.cs new file mode 100644 index 000000000..185e979e0 --- /dev/null +++ b/algoliasearch/Search/Models/SearchRulesResponse.cs @@ -0,0 +1,180 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchRulesResponse + /// + [DataContract(Name = "searchRulesResponse")] + public partial class SearchRulesResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchRulesResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Fetched rules. (required). + /// Number of fetched rules. (required). + /// Current page. (required). + /// Number of pages. (required). + public SearchRulesResponse(List hits = default(List), int nbHits = default(int), int page = default(int), int nbPages = default(int)) + { + // to ensure "hits" is required (not null) + if (hits == null) + { + throw new ArgumentNullException("hits is a required property for SearchRulesResponse and cannot be null"); + } + this.Hits = hits; + this.NbHits = nbHits; + this.Page = page; + this.NbPages = nbPages; + } + + /// + /// Fetched rules. + /// + /// Fetched rules. + [DataMember(Name = "hits", IsRequired = true, EmitDefaultValue = true)] + public List Hits { get; set; } + + /// + /// Number of fetched rules. + /// + /// Number of fetched rules. + [DataMember(Name = "nbHits", IsRequired = true, EmitDefaultValue = true)] + public int NbHits { get; set; } + + /// + /// Current page. + /// + /// Current page. + [DataMember(Name = "page", IsRequired = true, EmitDefaultValue = true)] + public int Page { get; set; } + + /// + /// Number of pages. + /// + /// Number of pages. + [DataMember(Name = "nbPages", IsRequired = true, EmitDefaultValue = true)] + public int NbPages { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchRulesResponse {\n"); + sb.Append(" Hits: ").Append(Hits).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" NbPages: ").Append(NbPages).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchRulesResponse); + } + + /// + /// Returns true if SearchRulesResponse instances are equal + /// + /// Instance of SearchRulesResponse to be compared + /// Boolean + public bool Equals(SearchRulesResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Hits == input.Hits || + this.Hits != null && + input.Hits != null && + this.Hits.SequenceEqual(input.Hits) + ) && + ( + this.NbHits == input.NbHits || + this.NbHits.Equals(input.NbHits) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.NbPages == input.NbPages || + this.NbPages.Equals(input.NbPages) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Hits != null) + { + hashCode = (hashCode * 59) + this.Hits.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NbHits.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.NbPages.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchStrategy.cs b/algoliasearch/Search/Models/SearchStrategy.cs new file mode 100644 index 000000000..3851fdf95 --- /dev/null +++ b/algoliasearch/Search/Models/SearchStrategy.cs @@ -0,0 +1,43 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// - `none`: executes all queries. - `stopIfEnoughMatches`: executes queries one by one, stopping further query execution as soon as a query matches at least the `hitsPerPage` number of results. + /// + /// - `none`: executes all queries. - `stopIfEnoughMatches`: executes queries one by one, stopping further query execution as soon as a query matches at least the `hitsPerPage` number of results. + [JsonConverter(typeof(StringEnumConverter))] + public enum SearchStrategy + { + /// + /// Enum None for value: none + /// + [EnumMember(Value = "none")] + None = 1, + + /// + /// Enum StopIfEnoughMatches for value: stopIfEnoughMatches + /// + [EnumMember(Value = "stopIfEnoughMatches")] + StopIfEnoughMatches = 2 + } + +} diff --git a/algoliasearch/Search/Models/SearchSynonymsParams.cs b/algoliasearch/Search/Models/SearchSynonymsParams.cs new file mode 100644 index 000000000..dab598f20 --- /dev/null +++ b/algoliasearch/Search/Models/SearchSynonymsParams.cs @@ -0,0 +1,125 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchSynonymsParams + /// + [DataContract(Name = "searchSynonymsParams")] + public partial class SearchSynonymsParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Text to search for in an index. (default to ""). + public SearchSynonymsParams(string query = @"") + { + // use default value if no "query" provided + this.Query = query ?? @""; + } + + /// + /// Text to search for in an index. + /// + /// Text to search for in an index. + [DataMember(Name = "query", EmitDefaultValue = false)] + public string Query { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchSynonymsParams {\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchSynonymsParams); + } + + /// + /// Returns true if SearchSynonymsParams instances are equal + /// + /// Instance of SearchSynonymsParams to be compared + /// Boolean + public bool Equals(SearchSynonymsParams input) + { + if (input == null) + { + return false; + } + return + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchSynonymsResponse.cs b/algoliasearch/Search/Models/SearchSynonymsResponse.cs new file mode 100644 index 000000000..ccd5d006b --- /dev/null +++ b/algoliasearch/Search/Models/SearchSynonymsResponse.cs @@ -0,0 +1,177 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// SearchSynonymsResponse + /// + [DataContract(Name = "searchSynonymsResponse")] + public partial class SearchSynonymsResponse : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchSynonymsResponse() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// Synonym objects. (required). + /// Number of hits the search query matched. (required). + public SearchSynonymsResponse(List hits = default(List), int nbHits = default(int)) : base() + { + // to ensure "hits" is required (not null) + if (hits == null) + { + throw new ArgumentNullException("hits is a required property for SearchSynonymsResponse and cannot be null"); + } + this.Hits = hits; + this.NbHits = nbHits; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Synonym objects. + /// + /// Synonym objects. + [DataMember(Name = "hits", IsRequired = true, EmitDefaultValue = true)] + public List Hits { get; set; } + + /// + /// Number of hits the search query matched. + /// + /// Number of hits the search query matched. + [DataMember(Name = "nbHits", IsRequired = true, EmitDefaultValue = true)] + public int NbHits { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchSynonymsResponse {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append(" Hits: ").Append(Hits).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchSynonymsResponse); + } + + /// + /// Returns true if SearchSynonymsResponse instances are equal + /// + /// Instance of SearchSynonymsResponse to be compared + /// Boolean + public bool Equals(SearchSynonymsResponse input) + { + if (input == null) + { + return false; + } + return base.Equals(input) && + ( + this.Hits == input.Hits || + this.Hits != null && + input.Hits != null && + this.Hits.SequenceEqual(input.Hits) + ) && base.Equals(input) && + ( + this.NbHits == input.NbHits || + this.NbHits.Equals(input.NbHits) + ) + && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + if (this.Hits != null) + { + hashCode = (hashCode * 59) + this.Hits.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NbHits.GetHashCode(); + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchTypeDefault.cs b/algoliasearch/Search/Models/SearchTypeDefault.cs new file mode 100644 index 000000000..99c50a498 --- /dev/null +++ b/algoliasearch/Search/Models/SearchTypeDefault.cs @@ -0,0 +1,37 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// - `default`: perform a search query - `facet` [searches for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + /// + /// - `default`: perform a search query - `facet` [searches for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + [JsonConverter(typeof(StringEnumConverter))] + public enum SearchTypeDefault + { + /// + /// Enum Default for value: default + /// + [EnumMember(Value = "default")] + Default = 1 + } + +} diff --git a/algoliasearch/Search/Models/SearchTypeFacet.cs b/algoliasearch/Search/Models/SearchTypeFacet.cs new file mode 100644 index 000000000..82bff4d63 --- /dev/null +++ b/algoliasearch/Search/Models/SearchTypeFacet.cs @@ -0,0 +1,37 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// - `default`: perform a search query - `facet` [searches for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + /// + /// - `default`: perform a search query - `facet` [searches for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + [JsonConverter(typeof(StringEnumConverter))] + public enum SearchTypeFacet + { + /// + /// Enum Facet for value: facet + /// + [EnumMember(Value = "facet")] + Facet = 1 + } + +} diff --git a/algoliasearch/Search/Models/SearchUserIdsParams.cs b/algoliasearch/Search/Models/SearchUserIdsParams.cs new file mode 100644 index 000000000..3a686acde --- /dev/null +++ b/algoliasearch/Search/Models/SearchUserIdsParams.cs @@ -0,0 +1,195 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// OK + /// + [DataContract(Name = "searchUserIdsParams")] + public partial class SearchUserIdsParams : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchUserIdsParams() { } + /// + /// Initializes a new instance of the class. + /// + /// Query to search. The search is a prefix search with [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/) enabled. An empty query will retrieve all users. (required). + /// Cluster name.. + /// Page to retrieve (the first page is `0`, not `1`). (default to 0). + /// Number of hits per page. (default to 20). + public SearchUserIdsParams(string query = default(string), string clusterName = default(string), int page = 0, int hitsPerPage = 20) + { + // to ensure "query" is required (not null) + if (query == null) + { + throw new ArgumentNullException("query is a required property for SearchUserIdsParams and cannot be null"); + } + this.Query = query; + this.ClusterName = clusterName; + this.Page = page; + this.HitsPerPage = hitsPerPage; + } + + /// + /// Query to search. The search is a prefix search with [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/) enabled. An empty query will retrieve all users. + /// + /// Query to search. The search is a prefix search with [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/) enabled. An empty query will retrieve all users. + [DataMember(Name = "query", IsRequired = true, EmitDefaultValue = true)] + public string Query { get; set; } + + /// + /// Cluster name. + /// + /// Cluster name. + [DataMember(Name = "clusterName", EmitDefaultValue = false)] + public string ClusterName { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", EmitDefaultValue = false)] + public int Page { get; set; } + + /// + /// Number of hits per page. + /// + /// Number of hits per page. + [DataMember(Name = "hitsPerPage", EmitDefaultValue = false)] + public int HitsPerPage { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchUserIdsParams {\n"); + sb.Append(" Query: ").Append(Query).Append("\n"); + sb.Append(" ClusterName: ").Append(ClusterName).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchUserIdsParams); + } + + /// + /// Returns true if SearchUserIdsParams instances are equal + /// + /// Instance of SearchUserIdsParams to be compared + /// Boolean + public bool Equals(SearchUserIdsParams input) + { + if (input == null) + { + return false; + } + return + ( + this.Query == input.Query || + (this.Query != null && + this.Query.Equals(input.Query)) + ) && + ( + this.ClusterName == input.ClusterName || + (this.ClusterName != null && + this.ClusterName.Equals(input.ClusterName)) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Query != null) + { + hashCode = (hashCode * 59) + this.Query.GetHashCode(); + } + if (this.ClusterName != null) + { + hashCode = (hashCode * 59) + this.ClusterName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SearchUserIdsResponse.cs b/algoliasearch/Search/Models/SearchUserIdsResponse.cs new file mode 100644 index 000000000..5869cd0f4 --- /dev/null +++ b/algoliasearch/Search/Models/SearchUserIdsResponse.cs @@ -0,0 +1,216 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// userIDs data. + /// + [DataContract(Name = "searchUserIdsResponse")] + public partial class SearchUserIdsResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SearchUserIdsResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// User objects that match the query. (required). + /// Number of hits the search query matched. (required). + /// Page to retrieve (the first page is `0`, not `1`). (required) (default to 0). + /// Maximum number of hits per page. (required) (default to 20). + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + public SearchUserIdsResponse(List hits = default(List), int nbHits = default(int), int page = 0, int hitsPerPage = 20, string updatedAt = default(string)) + { + // to ensure "hits" is required (not null) + if (hits == null) + { + throw new ArgumentNullException("hits is a required property for SearchUserIdsResponse and cannot be null"); + } + this.Hits = hits; + this.NbHits = nbHits; + this.Page = page; + this.HitsPerPage = hitsPerPage; + // to ensure "updatedAt" is required (not null) + if (updatedAt == null) + { + throw new ArgumentNullException("updatedAt is a required property for SearchUserIdsResponse and cannot be null"); + } + this.UpdatedAt = updatedAt; + } + + /// + /// User objects that match the query. + /// + /// User objects that match the query. + [DataMember(Name = "hits", IsRequired = true, EmitDefaultValue = true)] + public List Hits { get; set; } + + /// + /// Number of hits the search query matched. + /// + /// Number of hits the search query matched. + [DataMember(Name = "nbHits", IsRequired = true, EmitDefaultValue = true)] + public int NbHits { get; set; } + + /// + /// Page to retrieve (the first page is `0`, not `1`). + /// + /// Page to retrieve (the first page is `0`, not `1`). + [DataMember(Name = "page", IsRequired = true, EmitDefaultValue = true)] + public int Page { get; set; } + + /// + /// Maximum number of hits per page. + /// + /// Maximum number of hits per page. + [DataMember(Name = "hitsPerPage", IsRequired = true, EmitDefaultValue = true)] + public int HitsPerPage { get; set; } + + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "updatedAt", IsRequired = true, EmitDefaultValue = true)] + public string UpdatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SearchUserIdsResponse {\n"); + sb.Append(" Hits: ").Append(Hits).Append("\n"); + sb.Append(" NbHits: ").Append(NbHits).Append("\n"); + sb.Append(" Page: ").Append(Page).Append("\n"); + sb.Append(" HitsPerPage: ").Append(HitsPerPage).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SearchUserIdsResponse); + } + + /// + /// Returns true if SearchUserIdsResponse instances are equal + /// + /// Instance of SearchUserIdsResponse to be compared + /// Boolean + public bool Equals(SearchUserIdsResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Hits == input.Hits || + this.Hits != null && + input.Hits != null && + this.Hits.SequenceEqual(input.Hits) + ) && + ( + this.NbHits == input.NbHits || + this.NbHits.Equals(input.NbHits) + ) && + ( + this.Page == input.Page || + this.Page.Equals(input.Page) + ) && + ( + this.HitsPerPage == input.HitsPerPage || + this.HitsPerPage.Equals(input.HitsPerPage) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Hits != null) + { + hashCode = (hashCode * 59) + this.Hits.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NbHits.GetHashCode(); + hashCode = (hashCode * 59) + this.Page.GetHashCode(); + hashCode = (hashCode * 59) + this.HitsPerPage.GetHashCode(); + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // HitsPerPage (int) maximum + if (this.HitsPerPage > (int)1000) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value less than or equal to 1000.", new[] { "HitsPerPage" }); + } + + // HitsPerPage (int) minimum + if (this.HitsPerPage < (int)1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for HitsPerPage, must be a value greater than or equal to 1.", new[] { "HitsPerPage" }); + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SemanticSearch.cs b/algoliasearch/Search/Models/SemanticSearch.cs new file mode 100644 index 000000000..fa301a09e --- /dev/null +++ b/algoliasearch/Search/Models/SemanticSearch.cs @@ -0,0 +1,125 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Settings for the semantic search part of NeuralSearch. Only used when `mode` is _neuralSearch_. + /// + [DataContract(Name = "semanticSearch")] + public partial class SemanticSearch : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Indices from which to collect click and conversion events. If null, the current index and replica group will be used as the event source.. + public SemanticSearch(List eventSources = default(List)) + { + this.EventSources = eventSources; + } + + /// + /// Indices from which to collect click and conversion events. If null, the current index and replica group will be used as the event source. + /// + /// Indices from which to collect click and conversion events. If null, the current index and replica group will be used as the event source. + [DataMember(Name = "eventSources", EmitDefaultValue = true)] + public List EventSources { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SemanticSearch {\n"); + sb.Append(" EventSources: ").Append(EventSources).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SemanticSearch); + } + + /// + /// Returns true if SemanticSearch instances are equal + /// + /// Instance of SemanticSearch to be compared + /// Boolean + public bool Equals(SemanticSearch input) + { + if (input == null) + { + return false; + } + return + ( + this.EventSources == input.EventSources || + this.EventSources != null && + input.EventSources != null && + this.EventSources.SequenceEqual(input.EventSources) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.EventSources != null) + { + hashCode = (hashCode * 59) + this.EventSources.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SnippetResult.cs b/algoliasearch/Search/Models/SnippetResult.cs new file mode 100644 index 000000000..a16db7a96 --- /dev/null +++ b/algoliasearch/Search/Models/SnippetResult.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// SnippetResult + /// + [JsonConverter(typeof(SnippetResultJsonConverter))] + [DataContract(Name = "snippetResult")] + public partial class SnippetResult : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of SnippetResultOption. + public SnippetResult(SnippetResultOption actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of Dictionary<string, SnippetResultOption>. + public SnippetResult(Dictionary actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(Dictionary)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(SnippetResultOption)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: Dictionary, SnippetResultOption"); + } + } + } + + /// + /// Get the actual instance of `SnippetResultOption`. If the actual instance is not `SnippetResultOption`, + /// the InvalidClassException will be thrown + /// + /// An instance of SnippetResultOption + public SnippetResultOption GetterSnippetResultOption() + { + return (SnippetResultOption)this.ActualInstance; + } + + /// + /// Get the actual instance of `Dictionary<string, SnippetResultOption>`. If the actual instance is not `Dictionary<string, SnippetResultOption>`, + /// the InvalidClassException will be thrown + /// + /// An instance of Dictionary<string, SnippetResultOption> + public Dictionary GetterDictionary() + { + return (Dictionary)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class SnippetResult {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, SnippetResult.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of SnippetResult + /// + /// JSON string + /// An instance of SnippetResult + public static SnippetResult FromJson(string jsonString) + { + SnippetResult newSnippetResult = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newSnippetResult; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(Dictionary).GetProperty("AdditionalProperties") == null) + { + newSnippetResult = new SnippetResult(JsonConvert.DeserializeObject>(jsonString, SnippetResult.SerializerSettings)); + } + else + { + newSnippetResult = new SnippetResult(JsonConvert.DeserializeObject>(jsonString, SnippetResult.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("Dictionary"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into Dictionary: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(SnippetResultOption).GetProperty("AdditionalProperties") == null) + { + newSnippetResult = new SnippetResult(JsonConvert.DeserializeObject(jsonString, SnippetResult.SerializerSettings)); + } + else + { + newSnippetResult = new SnippetResult(JsonConvert.DeserializeObject(jsonString, SnippetResult.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("SnippetResultOption"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into SnippetResultOption: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newSnippetResult; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SnippetResult); + } + + /// + /// Returns true if SnippetResult instances are equal + /// + /// Instance of SnippetResult to be compared + /// Boolean + public bool Equals(SnippetResult input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for SnippetResult + /// + public class SnippetResultJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(SnippetResult).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return SnippetResult.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/SnippetResultOption.cs b/algoliasearch/Search/Models/SnippetResultOption.cs new file mode 100644 index 000000000..4fbffad77 --- /dev/null +++ b/algoliasearch/Search/Models/SnippetResultOption.cs @@ -0,0 +1,148 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Snippeted attributes show parts of the matched attributes. Only returned when attributesToSnippet is non-empty. + /// + [DataContract(Name = "snippetResultOption")] + public partial class SnippetResultOption : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets MatchLevel + /// + [DataMember(Name = "matchLevel", IsRequired = true, EmitDefaultValue = true)] + public MatchLevel MatchLevel { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SnippetResultOption() { } + /// + /// Initializes a new instance of the class. + /// + /// Markup text with `facetQuery` matches highlighted. (required). + /// matchLevel (required). + public SnippetResultOption(string value = default(string), MatchLevel matchLevel = default(MatchLevel)) + { + // to ensure "value" is required (not null) + if (value == null) + { + throw new ArgumentNullException("value is a required property for SnippetResultOption and cannot be null"); + } + this.Value = value; + this.MatchLevel = matchLevel; + } + + /// + /// Markup text with `facetQuery` matches highlighted. + /// + /// Markup text with `facetQuery` matches highlighted. + [DataMember(Name = "value", IsRequired = true, EmitDefaultValue = true)] + public string Value { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SnippetResultOption {\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append(" MatchLevel: ").Append(MatchLevel).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SnippetResultOption); + } + + /// + /// Returns true if SnippetResultOption instances are equal + /// + /// Instance of SnippetResultOption to be compared + /// Boolean + public bool Equals(SnippetResultOption input) + { + if (input == null) + { + return false; + } + return + ( + this.Value == input.Value || + (this.Value != null && + this.Value.Equals(input.Value)) + ) && + ( + this.MatchLevel == input.MatchLevel || + this.MatchLevel.Equals(input.MatchLevel) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Value != null) + { + hashCode = (hashCode * 59) + this.Value.GetHashCode(); + } + hashCode = (hashCode * 59) + this.MatchLevel.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SortRemainingBy.cs b/algoliasearch/Search/Models/SortRemainingBy.cs new file mode 100644 index 000000000..35bb93688 --- /dev/null +++ b/algoliasearch/Search/Models/SortRemainingBy.cs @@ -0,0 +1,49 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// How to display the remaining items: - `count`: facet count (descending). - `alpha`: alphabetical (ascending). - `hidden`: show only pinned values. + /// + /// How to display the remaining items: - `count`: facet count (descending). - `alpha`: alphabetical (ascending). - `hidden`: show only pinned values. + [JsonConverter(typeof(StringEnumConverter))] + public enum SortRemainingBy + { + /// + /// Enum Count for value: count + /// + [EnumMember(Value = "count")] + Count = 1, + + /// + /// Enum Alpha for value: alpha + /// + [EnumMember(Value = "alpha")] + Alpha = 2, + + /// + /// Enum Hidden for value: hidden + /// + [EnumMember(Value = "hidden")] + Hidden = 3 + } + +} diff --git a/algoliasearch/Search/Models/Source.cs b/algoliasearch/Search/Models/Source.cs new file mode 100644 index 000000000..2e3c9961e --- /dev/null +++ b/algoliasearch/Search/Models/Source.cs @@ -0,0 +1,153 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Source. + /// + [DataContract(Name = "source")] + public partial class Source : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected Source() { } + /// + /// Initializes a new instance of the class. + /// + /// IP address range of the source. (required). + /// Source description.. + public Source(string varSource = default(string), string description = default(string)) + { + // to ensure "varSource" is required (not null) + if (varSource == null) + { + throw new ArgumentNullException("varSource is a required property for Source and cannot be null"); + } + this.VarSource = varSource; + this.Description = description; + } + + /// + /// IP address range of the source. + /// + /// IP address range of the source. + [DataMember(Name = "source", IsRequired = true, EmitDefaultValue = true)] + public string VarSource { get; set; } + + /// + /// Source description. + /// + /// Source description. + [DataMember(Name = "description", EmitDefaultValue = false)] + public string Description { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Source {\n"); + sb.Append(" VarSource: ").Append(VarSource).Append("\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Source); + } + + /// + /// Returns true if Source instances are equal + /// + /// Instance of Source to be compared + /// Boolean + public bool Equals(Source input) + { + if (input == null) + { + return false; + } + return + ( + this.VarSource == input.VarSource || + (this.VarSource != null && + this.VarSource.Equals(input.VarSource)) + ) && + ( + this.Description == input.Description || + (this.Description != null && + this.Description.Equals(input.Description)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.VarSource != null) + { + hashCode = (hashCode * 59) + this.VarSource.GetHashCode(); + } + if (this.Description != null) + { + hashCode = (hashCode * 59) + this.Description.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/StandardEntries.cs b/algoliasearch/Search/Models/StandardEntries.cs new file mode 100644 index 000000000..ee6505555 --- /dev/null +++ b/algoliasearch/Search/Models/StandardEntries.cs @@ -0,0 +1,165 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Key-value pairs of [supported language ISO codes](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/) and boolean values. + /// + [DataContract(Name = "standardEntries")] + public partial class StandardEntries : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Key-value pair of a language ISO code and a boolean value.. + /// Key-value pair of a language ISO code and a boolean value.. + /// Key-value pair of a language ISO code and a boolean value.. + public StandardEntries(Dictionary plurals = default(Dictionary), Dictionary stopwords = default(Dictionary), Dictionary compounds = default(Dictionary)) + { + this.Plurals = plurals; + this.Stopwords = stopwords; + this.Compounds = compounds; + } + + /// + /// Key-value pair of a language ISO code and a boolean value. + /// + /// Key-value pair of a language ISO code and a boolean value. + [DataMember(Name = "plurals", EmitDefaultValue = true)] + public Dictionary Plurals { get; set; } + + /// + /// Key-value pair of a language ISO code and a boolean value. + /// + /// Key-value pair of a language ISO code and a boolean value. + [DataMember(Name = "stopwords", EmitDefaultValue = true)] + public Dictionary Stopwords { get; set; } + + /// + /// Key-value pair of a language ISO code and a boolean value. + /// + /// Key-value pair of a language ISO code and a boolean value. + [DataMember(Name = "compounds", EmitDefaultValue = true)] + public Dictionary Compounds { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class StandardEntries {\n"); + sb.Append(" Plurals: ").Append(Plurals).Append("\n"); + sb.Append(" Stopwords: ").Append(Stopwords).Append("\n"); + sb.Append(" Compounds: ").Append(Compounds).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as StandardEntries); + } + + /// + /// Returns true if StandardEntries instances are equal + /// + /// Instance of StandardEntries to be compared + /// Boolean + public bool Equals(StandardEntries input) + { + if (input == null) + { + return false; + } + return + ( + this.Plurals == input.Plurals || + this.Plurals != null && + input.Plurals != null && + this.Plurals.SequenceEqual(input.Plurals) + ) && + ( + this.Stopwords == input.Stopwords || + this.Stopwords != null && + input.Stopwords != null && + this.Stopwords.SequenceEqual(input.Stopwords) + ) && + ( + this.Compounds == input.Compounds || + this.Compounds != null && + input.Compounds != null && + this.Compounds.SequenceEqual(input.Compounds) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Plurals != null) + { + hashCode = (hashCode * 59) + this.Plurals.GetHashCode(); + } + if (this.Stopwords != null) + { + hashCode = (hashCode * 59) + this.Stopwords.GetHashCode(); + } + if (this.Compounds != null) + { + hashCode = (hashCode * 59) + this.Compounds.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SynonymHit.cs b/algoliasearch/Search/Models/SynonymHit.cs new file mode 100644 index 000000000..4c08ce444 --- /dev/null +++ b/algoliasearch/Search/Models/SynonymHit.cs @@ -0,0 +1,265 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Synonym object. + /// + [DataContract(Name = "synonymHit")] + public partial class SynonymHit : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public SynonymType Type { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected SynonymHit() { } + /// + /// Initializes a new instance of the class. + /// + /// Unique identifier of a synonym object. (required). + /// type (required). + /// Words or phrases considered equivalent.. + /// Word or phrase to appear in query strings (for [`onewaysynonym`s](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/in-depth/one-way-synonyms/)).. + /// Word or phrase to appear in query strings (for [`altcorrection1` and `altcorrection2`](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/in-depth/synonyms-alternative-corrections/)).. + /// Words to be matched in records.. + /// [Placeholder token](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/in-depth/synonyms-placeholders/) to be put inside records. . + /// Query words that will match the [placeholder token](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/in-depth/synonyms-placeholders/).. + public SynonymHit(string objectID = default(string), SynonymType type = default(SynonymType), List synonyms = default(List), string input = default(string), string word = default(string), List corrections = default(List), string placeholder = default(string), List replacements = default(List)) + { + // to ensure "objectID" is required (not null) + if (objectID == null) + { + throw new ArgumentNullException("objectID is a required property for SynonymHit and cannot be null"); + } + this.ObjectID = objectID; + this.Type = type; + this.Synonyms = synonyms; + this.Input = input; + this.Word = word; + this.Corrections = corrections; + this.Placeholder = placeholder; + this.Replacements = replacements; + } + + /// + /// Unique identifier of a synonym object. + /// + /// Unique identifier of a synonym object. + [DataMember(Name = "objectID", IsRequired = true, EmitDefaultValue = true)] + public string ObjectID { get; set; } + + /// + /// Words or phrases considered equivalent. + /// + /// Words or phrases considered equivalent. + [DataMember(Name = "synonyms", EmitDefaultValue = false)] + public List Synonyms { get; set; } + + /// + /// Word or phrase to appear in query strings (for [`onewaysynonym`s](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/in-depth/one-way-synonyms/)). + /// + /// Word or phrase to appear in query strings (for [`onewaysynonym`s](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/in-depth/one-way-synonyms/)). + [DataMember(Name = "input", EmitDefaultValue = false)] + public string Input { get; set; } + + /// + /// Word or phrase to appear in query strings (for [`altcorrection1` and `altcorrection2`](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/in-depth/synonyms-alternative-corrections/)). + /// + /// Word or phrase to appear in query strings (for [`altcorrection1` and `altcorrection2`](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/in-depth/synonyms-alternative-corrections/)). + [DataMember(Name = "word", EmitDefaultValue = false)] + public string Word { get; set; } + + /// + /// Words to be matched in records. + /// + /// Words to be matched in records. + [DataMember(Name = "corrections", EmitDefaultValue = false)] + public List Corrections { get; set; } + + /// + /// [Placeholder token](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/in-depth/synonyms-placeholders/) to be put inside records. + /// + /// [Placeholder token](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/in-depth/synonyms-placeholders/) to be put inside records. + [DataMember(Name = "placeholder", EmitDefaultValue = false)] + public string Placeholder { get; set; } + + /// + /// Query words that will match the [placeholder token](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/in-depth/synonyms-placeholders/). + /// + /// Query words that will match the [placeholder token](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/in-depth/synonyms-placeholders/). + [DataMember(Name = "replacements", EmitDefaultValue = false)] + public List Replacements { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SynonymHit {\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Synonyms: ").Append(Synonyms).Append("\n"); + sb.Append(" Input: ").Append(Input).Append("\n"); + sb.Append(" Word: ").Append(Word).Append("\n"); + sb.Append(" Corrections: ").Append(Corrections).Append("\n"); + sb.Append(" Placeholder: ").Append(Placeholder).Append("\n"); + sb.Append(" Replacements: ").Append(Replacements).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as SynonymHit); + } + + /// + /// Returns true if SynonymHit instances are equal + /// + /// Instance of SynonymHit to be compared + /// Boolean + public bool Equals(SynonymHit input) + { + if (input == null) + { + return false; + } + return + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ) && + ( + this.Synonyms == input.Synonyms || + this.Synonyms != null && + input.Synonyms != null && + this.Synonyms.SequenceEqual(input.Synonyms) + ) && + ( + this.Input == input.Input || + (this.Input != null && + this.Input.Equals(input.Input)) + ) && + ( + this.Word == input.Word || + (this.Word != null && + this.Word.Equals(input.Word)) + ) && + ( + this.Corrections == input.Corrections || + this.Corrections != null && + input.Corrections != null && + this.Corrections.SequenceEqual(input.Corrections) + ) && + ( + this.Placeholder == input.Placeholder || + (this.Placeholder != null && + this.Placeholder.Equals(input.Placeholder)) + ) && + ( + this.Replacements == input.Replacements || + this.Replacements != null && + input.Replacements != null && + this.Replacements.SequenceEqual(input.Replacements) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + if (this.Synonyms != null) + { + hashCode = (hashCode * 59) + this.Synonyms.GetHashCode(); + } + if (this.Input != null) + { + hashCode = (hashCode * 59) + this.Input.GetHashCode(); + } + if (this.Word != null) + { + hashCode = (hashCode * 59) + this.Word.GetHashCode(); + } + if (this.Corrections != null) + { + hashCode = (hashCode * 59) + this.Corrections.GetHashCode(); + } + if (this.Placeholder != null) + { + hashCode = (hashCode * 59) + this.Placeholder.GetHashCode(); + } + if (this.Replacements != null) + { + hashCode = (hashCode * 59) + this.Replacements.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/SynonymType.cs b/algoliasearch/Search/Models/SynonymType.cs new file mode 100644 index 000000000..5ba75c04c --- /dev/null +++ b/algoliasearch/Search/Models/SynonymType.cs @@ -0,0 +1,61 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Synonym type. + /// + /// Synonym type. + [JsonConverter(typeof(StringEnumConverter))] + public enum SynonymType + { + /// + /// Enum Synonym for value: synonym + /// + [EnumMember(Value = "synonym")] + Synonym = 1, + + /// + /// Enum Onewaysynonym for value: onewaysynonym + /// + [EnumMember(Value = "onewaysynonym")] + Onewaysynonym = 2, + + /// + /// Enum Altcorrection1 for value: altcorrection1 + /// + [EnumMember(Value = "altcorrection1")] + Altcorrection1 = 3, + + /// + /// Enum Altcorrection2 for value: altcorrection2 + /// + [EnumMember(Value = "altcorrection2")] + Altcorrection2 = 4, + + /// + /// Enum Placeholder for value: placeholder + /// + [EnumMember(Value = "placeholder")] + Placeholder = 5 + } + +} diff --git a/algoliasearch/Search/Models/TagFilters.cs b/algoliasearch/Search/Models/TagFilters.cs new file mode 100644 index 000000000..e42deca5b --- /dev/null +++ b/algoliasearch/Search/Models/TagFilters.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// [Filter hits by tags](https://www.algolia.com/doc/api-reference/api-parameters/tagFilters/). + /// + [JsonConverter(typeof(TagFiltersJsonConverter))] + [DataContract(Name = "tagFilters")] + public partial class TagFilters : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of List<MixedSearchFilters>. + public TagFilters(List actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of string. + public TagFilters(string actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(List)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(string)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: List, string"); + } + } + } + + /// + /// Get the actual instance of `List<MixedSearchFilters>`. If the actual instance is not `List<MixedSearchFilters>`, + /// the InvalidClassException will be thrown + /// + /// An instance of List<MixedSearchFilters> + public List GetterList() + { + return (List)this.ActualInstance; + } + + /// + /// Get the actual instance of `string`. If the actual instance is not `string`, + /// the InvalidClassException will be thrown + /// + /// An instance of string + public string GetterString() + { + return (string)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class TagFilters {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, TagFilters.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of TagFilters + /// + /// JSON string + /// An instance of TagFilters + public static TagFilters FromJson(string jsonString) + { + TagFilters newTagFilters = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newTagFilters; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(List).GetProperty("AdditionalProperties") == null) + { + newTagFilters = new TagFilters(JsonConvert.DeserializeObject>(jsonString, TagFilters.SerializerSettings)); + } + else + { + newTagFilters = new TagFilters(JsonConvert.DeserializeObject>(jsonString, TagFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("List"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into List: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(string).GetProperty("AdditionalProperties") == null) + { + newTagFilters = new TagFilters(JsonConvert.DeserializeObject(jsonString, TagFilters.SerializerSettings)); + } + else + { + newTagFilters = new TagFilters(JsonConvert.DeserializeObject(jsonString, TagFilters.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("string"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into string: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newTagFilters; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TagFilters); + } + + /// + /// Returns true if TagFilters instances are equal + /// + /// Instance of TagFilters to be compared + /// Boolean + public bool Equals(TagFilters input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for TagFilters + /// + public class TagFiltersJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(TagFilters).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return TagFilters.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/TaskStatus.cs b/algoliasearch/Search/Models/TaskStatus.cs new file mode 100644 index 000000000..4c9271107 --- /dev/null +++ b/algoliasearch/Search/Models/TaskStatus.cs @@ -0,0 +1,43 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// _published_ if the task has been processed, _notPublished_ otherwise. + /// + /// _published_ if the task has been processed, _notPublished_ otherwise. + [JsonConverter(typeof(StringEnumConverter))] + public enum TaskStatus + { + /// + /// Enum Published for value: published + /// + [EnumMember(Value = "published")] + Published = 1, + + /// + /// Enum NotPublished for value: notPublished + /// + [EnumMember(Value = "notPublished")] + NotPublished = 2 + } + +} diff --git a/algoliasearch/Search/Models/TimeRange.cs b/algoliasearch/Search/Models/TimeRange.cs new file mode 100644 index 000000000..66cec90e5 --- /dev/null +++ b/algoliasearch/Search/Models/TimeRange.cs @@ -0,0 +1,140 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// TimeRange + /// + [DataContract(Name = "timeRange")] + public partial class TimeRange : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected TimeRange() { } + /// + /// Initializes a new instance of the class. + /// + /// Lower bound of the time range (Unix timestamp). (required). + /// Upper bound of the time range (Unix timestamp). (required). + public TimeRange(int from = default(int), int until = default(int)) + { + this.From = from; + this.Until = until; + } + + /// + /// Lower bound of the time range (Unix timestamp). + /// + /// Lower bound of the time range (Unix timestamp). + [DataMember(Name = "from", IsRequired = true, EmitDefaultValue = true)] + public int From { get; set; } + + /// + /// Upper bound of the time range (Unix timestamp). + /// + /// Upper bound of the time range (Unix timestamp). + [DataMember(Name = "until", IsRequired = true, EmitDefaultValue = true)] + public int Until { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TimeRange {\n"); + sb.Append(" From: ").Append(From).Append("\n"); + sb.Append(" Until: ").Append(Until).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TimeRange); + } + + /// + /// Returns true if TimeRange instances are equal + /// + /// Instance of TimeRange to be compared + /// Boolean + public bool Equals(TimeRange input) + { + if (input == null) + { + return false; + } + return + ( + this.From == input.From || + this.From.Equals(input.From) + ) && + ( + this.Until == input.Until || + this.Until.Equals(input.Until) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.From.GetHashCode(); + hashCode = (hashCode * 59) + this.Until.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/TypoTolerance.cs b/algoliasearch/Search/Models/TypoTolerance.cs new file mode 100644 index 000000000..62efa4d2f --- /dev/null +++ b/algoliasearch/Search/Models/TypoTolerance.cs @@ -0,0 +1,288 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; +using System.Reflection; + +namespace Algolia.Search.Search.Models +{ + /// + /// Controls whether [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/) is enabled and how it is applied. + /// + [JsonConverter(typeof(TypoToleranceJsonConverter))] + [DataContract(Name = "typoTolerance")] + public partial class TypoTolerance : AbstractOpenAPISchema, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of bool. + public TypoTolerance(bool actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + /// + /// Initializes a new instance of the class + /// with the class + /// + /// An instance of TypoToleranceEnum. + public TypoTolerance(TypoToleranceEnum actualInstance) + { + this.IsNullable = false; + this.SchemaType = "oneOf"; + this.ActualInstance = actualInstance; + } + + + private Object _actualInstance; + + /// + /// Gets or Sets ActualInstance + /// + public override Object ActualInstance + { + get + { + return _actualInstance; + } + set + { + if (value.GetType() == typeof(TypoToleranceEnum)) + { + this._actualInstance = value; + } + else if (value.GetType() == typeof(bool)) + { + this._actualInstance = value; + } + else + { + throw new ArgumentException("Invalid instance found. Must be the following types: TypoToleranceEnum, bool"); + } + } + } + + /// + /// Get the actual instance of `bool`. If the actual instance is not `bool`, + /// the InvalidClassException will be thrown + /// + /// An instance of bool + public bool GetterBool() + { + return (bool)this.ActualInstance; + } + + /// + /// Get the actual instance of `TypoToleranceEnum`. If the actual instance is not `TypoToleranceEnum`, + /// the InvalidClassException will be thrown + /// + /// An instance of TypoToleranceEnum + public TypoToleranceEnum GetterTypoToleranceEnum() + { + return (TypoToleranceEnum)this.ActualInstance; + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class TypoTolerance {\n"); + sb.Append(" ActualInstance: ").Append(this.ActualInstance).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public override string ToJson() + { + return JsonConvert.SerializeObject(this.ActualInstance, TypoTolerance.SerializerSettings); + } + + /// + /// Converts the JSON string into an instance of TypoTolerance + /// + /// JSON string + /// An instance of TypoTolerance + public static TypoTolerance FromJson(string jsonString) + { + TypoTolerance newTypoTolerance = null; + + if (string.IsNullOrEmpty(jsonString)) + { + return newTypoTolerance; + } + int match = 0; + List matchedTypes = new List(); + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(TypoToleranceEnum).GetProperty("AdditionalProperties") == null) + { + newTypoTolerance = new TypoTolerance(JsonConvert.DeserializeObject(jsonString, TypoTolerance.SerializerSettings)); + } + else + { + newTypoTolerance = new TypoTolerance(JsonConvert.DeserializeObject(jsonString, TypoTolerance.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("TypoToleranceEnum"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into TypoToleranceEnum: {1}", jsonString, exception.ToString())); + } + + try + { + // if it does not contains "AdditionalProperties", use SerializerSettings to deserialize + if (typeof(bool).GetProperty("AdditionalProperties") == null) + { + newTypoTolerance = new TypoTolerance(JsonConvert.DeserializeObject(jsonString, TypoTolerance.SerializerSettings)); + } + else + { + newTypoTolerance = new TypoTolerance(JsonConvert.DeserializeObject(jsonString, TypoTolerance.AdditionalPropertiesSerializerSettings)); + } + matchedTypes.Add("bool"); + match++; + } + catch (Exception exception) + { + // deserialization failed, try the next one + System.Diagnostics.Debug.WriteLine(string.Format("Failed to deserialize `{0}` into bool: {1}", jsonString, exception.ToString())); + } + + if (match == 0) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` cannot be deserialized into any schema defined."); + } + else if (match > 1) + { + throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + String.Join(",", matchedTypes)); + } + + // deserialization is considered successful at this point if no exception has been thrown. + return newTypoTolerance; + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as TypoTolerance); + } + + /// + /// Returns true if TypoTolerance instances are equal + /// + /// Instance of TypoTolerance to be compared + /// Boolean + public bool Equals(TypoTolerance input) + { + if (input == null) + return false; + + return this.ActualInstance.Equals(input.ActualInstance); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ActualInstance != null) + hashCode = hashCode * 59 + this.ActualInstance.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// Custom JSON converter for TypoTolerance + /// + public class TypoToleranceJsonConverter : JsonConverter + { + /// + /// To write the JSON string + /// + /// JSON writer + /// Object to be converted into a JSON string + /// JSON Serializer + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteRawValue((string)(typeof(TypoTolerance).GetMethod("ToJson").Invoke(value, null))); + } + + /// + /// To convert a JSON string into an object + /// + /// JSON reader + /// Object type + /// Existing value + /// JSON Serializer + /// The object converted from the JSON string + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType != JsonToken.Null) + { + return TypoTolerance.FromJson(JObject.Load(reader).ToString(Formatting.None)); + } + return null; + } + + /// + /// Check if the object can be converted + /// + /// Object type + /// True if the object can be converted + public override bool CanConvert(Type objectType) + { + return false; + } + } + +} diff --git a/algoliasearch/Search/Models/TypoToleranceEnum.cs b/algoliasearch/Search/Models/TypoToleranceEnum.cs new file mode 100644 index 000000000..950a03f2c --- /dev/null +++ b/algoliasearch/Search/Models/TypoToleranceEnum.cs @@ -0,0 +1,42 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Defines typoToleranceEnum + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum TypoToleranceEnum + { + /// + /// Enum Min for value: min + /// + [EnumMember(Value = "min")] + Min = 1, + + /// + /// Enum Strict for value: strict + /// + [EnumMember(Value = "strict")] + Strict = 2 + } + +} diff --git a/algoliasearch/Search/Models/UpdateApiKeyResponse.cs b/algoliasearch/Search/Models/UpdateApiKeyResponse.cs new file mode 100644 index 000000000..4c8d741cb --- /dev/null +++ b/algoliasearch/Search/Models/UpdateApiKeyResponse.cs @@ -0,0 +1,158 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// UpdateApiKeyResponse + /// + [DataContract(Name = "updateApiKeyResponse")] + public partial class UpdateApiKeyResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected UpdateApiKeyResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// API key. (required). + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + public UpdateApiKeyResponse(string key = default(string), string updatedAt = default(string)) + { + // to ensure "key" is required (not null) + if (key == null) + { + throw new ArgumentNullException("key is a required property for UpdateApiKeyResponse and cannot be null"); + } + this.Key = key; + // to ensure "updatedAt" is required (not null) + if (updatedAt == null) + { + throw new ArgumentNullException("updatedAt is a required property for UpdateApiKeyResponse and cannot be null"); + } + this.UpdatedAt = updatedAt; + } + + /// + /// API key. + /// + /// API key. + [DataMember(Name = "key", IsRequired = true, EmitDefaultValue = true)] + public string Key { get; set; } + + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "updatedAt", IsRequired = true, EmitDefaultValue = true)] + public string UpdatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class UpdateApiKeyResponse {\n"); + sb.Append(" Key: ").Append(Key).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as UpdateApiKeyResponse); + } + + /// + /// Returns true if UpdateApiKeyResponse instances are equal + /// + /// Instance of UpdateApiKeyResponse to be compared + /// Boolean + public bool Equals(UpdateApiKeyResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Key == input.Key || + (this.Key != null && + this.Key.Equals(input.Key)) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Key != null) + { + hashCode = (hashCode * 59) + this.Key.GetHashCode(); + } + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/UpdatedAtResponse.cs b/algoliasearch/Search/Models/UpdatedAtResponse.cs new file mode 100644 index 000000000..db16c4077 --- /dev/null +++ b/algoliasearch/Search/Models/UpdatedAtResponse.cs @@ -0,0 +1,149 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Response, taskID, and update timestamp. + /// + [DataContract(Name = "updatedAtResponse")] + public partial class UpdatedAtResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected UpdatedAtResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. (required). + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + public UpdatedAtResponse(long taskID = default(long), string updatedAt = default(string)) + { + this.TaskID = taskID; + // to ensure "updatedAt" is required (not null) + if (updatedAt == null) + { + throw new ArgumentNullException("updatedAt is a required property for UpdatedAtResponse and cannot be null"); + } + this.UpdatedAt = updatedAt; + } + + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + [DataMember(Name = "taskID", IsRequired = true, EmitDefaultValue = true)] + public long TaskID { get; set; } + + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "updatedAt", IsRequired = true, EmitDefaultValue = true)] + public string UpdatedAt { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class UpdatedAtResponse {\n"); + sb.Append(" TaskID: ").Append(TaskID).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as UpdatedAtResponse); + } + + /// + /// Returns true if UpdatedAtResponse instances are equal + /// + /// Instance of UpdatedAtResponse to be compared + /// Boolean + public bool Equals(UpdatedAtResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.TaskID == input.TaskID || + this.TaskID.Equals(input.TaskID) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.TaskID.GetHashCode(); + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/UpdatedAtWithObjectIdResponse.cs b/algoliasearch/Search/Models/UpdatedAtWithObjectIdResponse.cs new file mode 100644 index 000000000..7b2c7dc0b --- /dev/null +++ b/algoliasearch/Search/Models/UpdatedAtWithObjectIdResponse.cs @@ -0,0 +1,158 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Response, taskID, unique object identifier, and an update timestamp. + /// + [DataContract(Name = "updatedAtWithObjectIdResponse")] + public partial class UpdatedAtWithObjectIdResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. . + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format.. + /// Unique object identifier.. + public UpdatedAtWithObjectIdResponse(long taskID = default(long), string updatedAt = default(string), string objectID = default(string)) + { + this.TaskID = taskID; + this.UpdatedAt = updatedAt; + this.ObjectID = objectID; + } + + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + [DataMember(Name = "taskID", EmitDefaultValue = false)] + public long TaskID { get; set; } + + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "updatedAt", EmitDefaultValue = false)] + public string UpdatedAt { get; set; } + + /// + /// Unique object identifier. + /// + /// Unique object identifier. + [DataMember(Name = "objectID", EmitDefaultValue = false)] + public string ObjectID { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class UpdatedAtWithObjectIdResponse {\n"); + sb.Append(" TaskID: ").Append(TaskID).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as UpdatedAtWithObjectIdResponse); + } + + /// + /// Returns true if UpdatedAtWithObjectIdResponse instances are equal + /// + /// Instance of UpdatedAtWithObjectIdResponse to be compared + /// Boolean + public bool Equals(UpdatedAtWithObjectIdResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.TaskID == input.TaskID || + this.TaskID.Equals(input.TaskID) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ) && + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.TaskID.GetHashCode(); + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/UpdatedRuleResponse.cs b/algoliasearch/Search/Models/UpdatedRuleResponse.cs new file mode 100644 index 000000000..372d70b6e --- /dev/null +++ b/algoliasearch/Search/Models/UpdatedRuleResponse.cs @@ -0,0 +1,173 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// UpdatedRuleResponse + /// + [DataContract(Name = "updatedRuleResponse")] + public partial class UpdatedRuleResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected UpdatedRuleResponse() { } + /// + /// Initializes a new instance of the class. + /// + /// Unique object identifier. (required). + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. (required). + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. (required). + public UpdatedRuleResponse(string objectID = default(string), string updatedAt = default(string), long taskID = default(long)) + { + // to ensure "objectID" is required (not null) + if (objectID == null) + { + throw new ArgumentNullException("objectID is a required property for UpdatedRuleResponse and cannot be null"); + } + this.ObjectID = objectID; + // to ensure "updatedAt" is required (not null) + if (updatedAt == null) + { + throw new ArgumentNullException("updatedAt is a required property for UpdatedRuleResponse and cannot be null"); + } + this.UpdatedAt = updatedAt; + this.TaskID = taskID; + } + + /// + /// Unique object identifier. + /// + /// Unique object identifier. + [DataMember(Name = "objectID", IsRequired = true, EmitDefaultValue = true)] + public string ObjectID { get; set; } + + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + /// + /// Timestamp of the last update in [ISO 8601](https://wikipedia.org/wiki/ISO_8601) format. + [DataMember(Name = "updatedAt", IsRequired = true, EmitDefaultValue = true)] + public string UpdatedAt { get; set; } + + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + /// + /// Unique identifier of a task. A successful API response means that a task was added to a queue. It might not run immediately. You can check the task's progress with the `task` operation and this `taskID`. + [DataMember(Name = "taskID", IsRequired = true, EmitDefaultValue = true)] + public long TaskID { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class UpdatedRuleResponse {\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append(" UpdatedAt: ").Append(UpdatedAt).Append("\n"); + sb.Append(" TaskID: ").Append(TaskID).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as UpdatedRuleResponse); + } + + /// + /// Returns true if UpdatedRuleResponse instances are equal + /// + /// Instance of UpdatedRuleResponse to be compared + /// Boolean + public bool Equals(UpdatedRuleResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ) && + ( + this.UpdatedAt == input.UpdatedAt || + (this.UpdatedAt != null && + this.UpdatedAt.Equals(input.UpdatedAt)) + ) && + ( + this.TaskID == input.TaskID || + this.TaskID.Equals(input.TaskID) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + if (this.UpdatedAt != null) + { + hashCode = (hashCode * 59) + this.UpdatedAt.GetHashCode(); + } + hashCode = (hashCode * 59) + this.TaskID.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/UserHighlightResult.cs b/algoliasearch/Search/Models/UserHighlightResult.cs new file mode 100644 index 000000000..6c0f58397 --- /dev/null +++ b/algoliasearch/Search/Models/UserHighlightResult.cs @@ -0,0 +1,156 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// UserHighlightResult + /// + [DataContract(Name = "userHighlightResult")] + public partial class UserHighlightResult : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected UserHighlightResult() { } + /// + /// Initializes a new instance of the class. + /// + /// userID (required). + /// clusterName (required). + public UserHighlightResult(HighlightResult userID = default(HighlightResult), HighlightResult clusterName = default(HighlightResult)) + { + // to ensure "userID" is required (not null) + if (userID == null) + { + throw new ArgumentNullException("userID is a required property for UserHighlightResult and cannot be null"); + } + this.UserID = userID; + // to ensure "clusterName" is required (not null) + if (clusterName == null) + { + throw new ArgumentNullException("clusterName is a required property for UserHighlightResult and cannot be null"); + } + this.ClusterName = clusterName; + } + + /// + /// Gets or Sets UserID + /// + [DataMember(Name = "userID", IsRequired = true, EmitDefaultValue = true)] + public HighlightResult UserID { get; set; } + + /// + /// Gets or Sets ClusterName + /// + [DataMember(Name = "clusterName", IsRequired = true, EmitDefaultValue = true)] + public HighlightResult ClusterName { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class UserHighlightResult {\n"); + sb.Append(" UserID: ").Append(UserID).Append("\n"); + sb.Append(" ClusterName: ").Append(ClusterName).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as UserHighlightResult); + } + + /// + /// Returns true if UserHighlightResult instances are equal + /// + /// Instance of UserHighlightResult to be compared + /// Boolean + public bool Equals(UserHighlightResult input) + { + if (input == null) + { + return false; + } + return + ( + this.UserID == input.UserID || + (this.UserID != null && + this.UserID.Equals(input.UserID)) + ) && + ( + this.ClusterName == input.ClusterName || + (this.ClusterName != null && + this.ClusterName.Equals(input.ClusterName)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.UserID != null) + { + hashCode = (hashCode * 59) + this.UserID.GetHashCode(); + } + if (this.ClusterName != null) + { + hashCode = (hashCode * 59) + this.ClusterName.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/UserHit.cs b/algoliasearch/Search/Models/UserHit.cs new file mode 100644 index 000000000..88f04f537 --- /dev/null +++ b/algoliasearch/Search/Models/UserHit.cs @@ -0,0 +1,245 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// UserHit + /// + [DataContract(Name = "userHit")] + public partial class UserHit : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected UserHit() { } + /// + /// Initializes a new instance of the class. + /// + /// userID of the user. (required). + /// Cluster name. (required). + /// Number of records in the cluster. (required). + /// Data size taken by all the users assigned to the cluster. (required). + /// userID of the requested user. Same as userID. (required). + /// highlightResult (required). + public UserHit(string userID = default(string), string clusterName = default(string), int nbRecords = default(int), int dataSize = default(int), string objectID = default(string), UserHighlightResult highlightResult = default(UserHighlightResult)) + { + // to ensure "userID" is required (not null) + if (userID == null) + { + throw new ArgumentNullException("userID is a required property for UserHit and cannot be null"); + } + this.UserID = userID; + // to ensure "clusterName" is required (not null) + if (clusterName == null) + { + throw new ArgumentNullException("clusterName is a required property for UserHit and cannot be null"); + } + this.ClusterName = clusterName; + this.NbRecords = nbRecords; + this.DataSize = dataSize; + // to ensure "objectID" is required (not null) + if (objectID == null) + { + throw new ArgumentNullException("objectID is a required property for UserHit and cannot be null"); + } + this.ObjectID = objectID; + // to ensure "highlightResult" is required (not null) + if (highlightResult == null) + { + throw new ArgumentNullException("highlightResult is a required property for UserHit and cannot be null"); + } + this.HighlightResult = highlightResult; + } + + /// + /// userID of the user. + /// + /// userID of the user. + [DataMember(Name = "userID", IsRequired = true, EmitDefaultValue = true)] + public string UserID { get; set; } + + /// + /// Cluster name. + /// + /// Cluster name. + [DataMember(Name = "clusterName", IsRequired = true, EmitDefaultValue = true)] + public string ClusterName { get; set; } + + /// + /// Number of records in the cluster. + /// + /// Number of records in the cluster. + [DataMember(Name = "nbRecords", IsRequired = true, EmitDefaultValue = true)] + public int NbRecords { get; set; } + + /// + /// Data size taken by all the users assigned to the cluster. + /// + /// Data size taken by all the users assigned to the cluster. + [DataMember(Name = "dataSize", IsRequired = true, EmitDefaultValue = true)] + public int DataSize { get; set; } + + /// + /// userID of the requested user. Same as userID. + /// + /// userID of the requested user. Same as userID. + [DataMember(Name = "objectID", IsRequired = true, EmitDefaultValue = true)] + public string ObjectID { get; set; } + + /// + /// Gets or Sets HighlightResult + /// + [DataMember(Name = "_highlightResult", IsRequired = true, EmitDefaultValue = true)] + public UserHighlightResult HighlightResult { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class UserHit {\n"); + sb.Append(" UserID: ").Append(UserID).Append("\n"); + sb.Append(" ClusterName: ").Append(ClusterName).Append("\n"); + sb.Append(" NbRecords: ").Append(NbRecords).Append("\n"); + sb.Append(" DataSize: ").Append(DataSize).Append("\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append(" HighlightResult: ").Append(HighlightResult).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as UserHit); + } + + /// + /// Returns true if UserHit instances are equal + /// + /// Instance of UserHit to be compared + /// Boolean + public bool Equals(UserHit input) + { + if (input == null) + { + return false; + } + return + ( + this.UserID == input.UserID || + (this.UserID != null && + this.UserID.Equals(input.UserID)) + ) && + ( + this.ClusterName == input.ClusterName || + (this.ClusterName != null && + this.ClusterName.Equals(input.ClusterName)) + ) && + ( + this.NbRecords == input.NbRecords || + this.NbRecords.Equals(input.NbRecords) + ) && + ( + this.DataSize == input.DataSize || + this.DataSize.Equals(input.DataSize) + ) && + ( + this.ObjectID == input.ObjectID || + (this.ObjectID != null && + this.ObjectID.Equals(input.ObjectID)) + ) && + ( + this.HighlightResult == input.HighlightResult || + (this.HighlightResult != null && + this.HighlightResult.Equals(input.HighlightResult)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.UserID != null) + { + hashCode = (hashCode * 59) + this.UserID.GetHashCode(); + } + if (this.ClusterName != null) + { + hashCode = (hashCode * 59) + this.ClusterName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NbRecords.GetHashCode(); + hashCode = (hashCode * 59) + this.DataSize.GetHashCode(); + if (this.ObjectID != null) + { + hashCode = (hashCode * 59) + this.ObjectID.GetHashCode(); + } + if (this.HighlightResult != null) + { + hashCode = (hashCode * 59) + this.HighlightResult.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + if (this.UserID != null) + { + // UserID (string) pattern + Regex regexUserID = new Regex(@"^[a-zA-Z0-9 \-*.]+$", RegexOptions.CultureInvariant); + if (!regexUserID.Match(this.UserID).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UserID, must match a pattern of " + regexUserID, new[] { "UserID" }); + } + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/UserId.cs b/algoliasearch/Search/Models/UserId.cs new file mode 100644 index 000000000..54ee60517 --- /dev/null +++ b/algoliasearch/Search/Models/UserId.cs @@ -0,0 +1,198 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Unique user ID. + /// + [DataContract(Name = "userId")] + public partial class UserId : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected UserId() { } + /// + /// Initializes a new instance of the class. + /// + /// userID of the user. (required). + /// Cluster to which the user is assigned. (required). + /// Number of records belonging to the user. (required). + /// Data size used by the user. (required). + public UserId(string varUserID = default(string), string clusterName = default(string), int nbRecords = default(int), int dataSize = default(int)) + { + // to ensure "varUserID" is required (not null) + if (varUserID == null) + { + throw new ArgumentNullException("varUserID is a required property for UserId and cannot be null"); + } + this.VarUserID = varUserID; + // to ensure "clusterName" is required (not null) + if (clusterName == null) + { + throw new ArgumentNullException("clusterName is a required property for UserId and cannot be null"); + } + this.ClusterName = clusterName; + this.NbRecords = nbRecords; + this.DataSize = dataSize; + } + + /// + /// userID of the user. + /// + /// userID of the user. + [DataMember(Name = "userID", IsRequired = true, EmitDefaultValue = true)] + public string VarUserID { get; set; } + + /// + /// Cluster to which the user is assigned. + /// + /// Cluster to which the user is assigned. + [DataMember(Name = "clusterName", IsRequired = true, EmitDefaultValue = true)] + public string ClusterName { get; set; } + + /// + /// Number of records belonging to the user. + /// + /// Number of records belonging to the user. + [DataMember(Name = "nbRecords", IsRequired = true, EmitDefaultValue = true)] + public int NbRecords { get; set; } + + /// + /// Data size used by the user. + /// + /// Data size used by the user. + [DataMember(Name = "dataSize", IsRequired = true, EmitDefaultValue = true)] + public int DataSize { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class UserId {\n"); + sb.Append(" VarUserID: ").Append(VarUserID).Append("\n"); + sb.Append(" ClusterName: ").Append(ClusterName).Append("\n"); + sb.Append(" NbRecords: ").Append(NbRecords).Append("\n"); + sb.Append(" DataSize: ").Append(DataSize).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as UserId); + } + + /// + /// Returns true if UserId instances are equal + /// + /// Instance of UserId to be compared + /// Boolean + public bool Equals(UserId input) + { + if (input == null) + { + return false; + } + return + ( + this.VarUserID == input.VarUserID || + (this.VarUserID != null && + this.VarUserID.Equals(input.VarUserID)) + ) && + ( + this.ClusterName == input.ClusterName || + (this.ClusterName != null && + this.ClusterName.Equals(input.ClusterName)) + ) && + ( + this.NbRecords == input.NbRecords || + this.NbRecords.Equals(input.NbRecords) + ) && + ( + this.DataSize == input.DataSize || + this.DataSize.Equals(input.DataSize) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.VarUserID != null) + { + hashCode = (hashCode * 59) + this.VarUserID.GetHashCode(); + } + if (this.ClusterName != null) + { + hashCode = (hashCode * 59) + this.ClusterName.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NbRecords.GetHashCode(); + hashCode = (hashCode * 59) + this.DataSize.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + if (this.VarUserID != null) + { + // VarUserID (string) pattern + Regex regexVarUserID = new Regex(@"^[a-zA-Z0-9 \-*.]+$", RegexOptions.CultureInvariant); + if (!regexVarUserID.Match(this.VarUserID).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarUserID, must match a pattern of " + regexVarUserID, new[] { "VarUserID" }); + } + } + + yield break; + } + } + +} diff --git a/algoliasearch/Search/Models/Value.cs b/algoliasearch/Search/Models/Value.cs new file mode 100644 index 000000000..661e096b1 --- /dev/null +++ b/algoliasearch/Search/Models/Value.cs @@ -0,0 +1,139 @@ +// +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Algolia.Search.Search.Client.FileParameter; +using OpenAPIDateConverter = Algolia.Search.Search.Client.OpenAPIDateConverter; + +namespace Algolia.Search.Search.Models +{ + /// + /// Value + /// + [DataContract(Name = "value")] + public partial class Value : IEquatable, IValidatableObject + { + + /// + /// Gets or Sets SortRemainingBy + /// + [DataMember(Name = "sortRemainingBy", EmitDefaultValue = false)] + public SortRemainingBy? SortRemainingBy { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// Pinned order of facet lists.. + /// sortRemainingBy. + public Value(List order = default(List), SortRemainingBy? sortRemainingBy = default(SortRemainingBy?)) + { + this.Order = order; + this.SortRemainingBy = sortRemainingBy; + } + + /// + /// Pinned order of facet lists. + /// + /// Pinned order of facet lists. + [DataMember(Name = "order", EmitDefaultValue = false)] + public List Order { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Value {\n"); + sb.Append(" Order: ").Append(Order).Append("\n"); + sb.Append(" SortRemainingBy: ").Append(SortRemainingBy).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as Value); + } + + /// + /// Returns true if Value instances are equal + /// + /// Instance of Value to be compared + /// Boolean + public bool Equals(Value input) + { + if (input == null) + { + return false; + } + return + ( + this.Order == input.Order || + this.Order != null && + input.Order != null && + this.Order.SequenceEqual(input.Order) + ) && + ( + this.SortRemainingBy == input.SortRemainingBy || + this.SortRemainingBy.Equals(input.SortRemainingBy) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.Order != null) + { + hashCode = (hashCode * 59) + this.Order.GetHashCode(); + } + hashCode = (hashCode * 59) + this.SortRemainingBy.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +}