diff --git a/src/Elastic.Clients.Elasticsearch.Shared/Types/Slices.cs b/src/Elastic.Clients.Elasticsearch.Shared/Types/Slices.cs new file mode 100644 index 00000000000..42fcbaa2879 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch.Shared/Types/Slices.cs @@ -0,0 +1,26 @@ +// 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 System.Globalization; + +using Elastic.Transport; + +#if ELASTICSEARCH_SERVERLESS +namespace Elastic.Clients.Elasticsearch.Serverless; +#else +namespace Elastic.Clients.Elasticsearch; +#endif + +public partial class Slices : + IUrlParameter +{ + public string GetString(ITransportConfiguration settings) => + Tag switch + { + 0 => Item1.ToString(CultureInfo.InvariantCulture), + 1 => UrlFormatter.CreateString(Item2, settings)!, + _ => throw new InvalidOperationException() + }; +}