From 5aadaca8909449c5095f100cd8577aeb79c75ab9 Mon Sep 17 00:00:00 2001 From: Florian Bernd Date: Wed, 4 Sep 2024 11:45:55 +0200 Subject: [PATCH] Fix `SourceConfigParam` url parameter serialization --- .../Types/Core/Search/SourceConfigParam.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/Elastic.Clients.Elasticsearch.Shared/Types/Core/Search/SourceConfigParam.cs diff --git a/src/Elastic.Clients.Elasticsearch.Shared/Types/Core/Search/SourceConfigParam.cs b/src/Elastic.Clients.Elasticsearch.Shared/Types/Core/Search/SourceConfigParam.cs new file mode 100644 index 00000000000..9a1fb940454 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Shared/Types/Core/Search/SourceConfigParam.cs @@ -0,0 +1,25 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. + +using System; + +using Elastic.Transport; + +#if ELASTICSEARCH_SERVERLESS +namespace Elastic.Clients.Elasticsearch.Serverless.Core.Search; +#else +namespace Elastic.Clients.Elasticsearch.Core.Search; +#endif + +public partial class SourceConfigParam : + IUrlParameter +{ + public string GetString(ITransportConfiguration settings) => + Tag switch + { + 0 => UrlFormatter.CreateString(Item1, settings)!, + 1 => UrlFormatter.CreateString(Item2, settings)!, + _ => throw new InvalidOperationException() + }; +}