diff --git a/packages/http-client-csharp/eng/scripts/Spector-Helper.psm1 b/packages/http-client-csharp/eng/scripts/Spector-Helper.psm1 index 4cc8b7db67b..addc61d373f 100644 --- a/packages/http-client-csharp/eng/scripts/Spector-Helper.psm1 +++ b/packages/http-client-csharp/eng/scripts/Spector-Helper.psm1 @@ -5,7 +5,6 @@ $failingSpecs = @( Join-Path 'http' 'type' 'model' 'templated' Join-Path 'http' 'type' 'file' Join-Path 'http' 'client' 'naming' # pending until https://github.com/microsoft/typespec/issues/5653 is resolved - Join-Path 'http' 'streaming' 'jsonl' Join-Path 'http' 'type' 'union' 'discriminated' # pending design Join-Path 'http' 'authentication' 'noauth' 'union' # pending design ) diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ScmMethodProviderCollection.cs b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ScmMethodProviderCollection.cs index c85805768e9..fb2ad27ddd8 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ScmMethodProviderCollection.cs +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator.ClientModel/src/Providers/ScmMethodProviderCollection.cs @@ -804,7 +804,17 @@ private IReadOnlyList GetProtocolMethodArguments(Dictionary [inputClient], inputModels: () => [streamModel]); + + var client = ScmCodeModelGenerator.Instance.TypeFactory.CreateClient(inputClient); + Assert.IsNotNull(client); + + var methodCollection = new ScmMethodProviderCollection(serviceMethod, client!); + var convenienceMethod = methodCollection.FirstOrDefault( + m => m.Signature.Parameters.Any(p => p.Name == "stream") && m.Signature.Name == "Send"); + Assert.IsNotNull(convenienceMethod); + + var methodBody = convenienceMethod!.BodyStatements!.ToDisplayString(); + // Verify that BinaryContent.Create() wraps the property access + Assert.IsTrue(methodBody.Contains("BinaryContent.Create(stream.Body)"), + $"Expected 'BinaryContent.Create(stream.Body)' in method body but got: {methodBody}"); + } + [Test] public async Task MissingOperationParamsResultInNamedArgsForSubsequent() { diff --git a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Properties/launchSettings.json b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Properties/launchSettings.json index 49a7be36212..35321ef4d32 100644 --- a/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Properties/launchSettings.json +++ b/packages/http-client-csharp/generator/Microsoft.TypeSpec.Generator/src/Properties/launchSettings.json @@ -210,6 +210,11 @@ "commandName": "Executable", "executablePath": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.exe" }, + "http-streaming-jsonl": { + "commandLineArgs": "$(SolutionDir)/TestProjects/Spector/http/streaming/jsonl -g StubLibraryGenerator", + "commandName": "Executable", + "executablePath": "$(SolutionDir)/../dist/generator/Microsoft.TypeSpec.Generator.exe" + }, "http-type-array": { "commandLineArgs": "$(SolutionDir)/TestProjects/Spector/http/type/array -g StubLibraryGenerator", "commandName": "Executable", diff --git a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs index 659c42158d9..793f3eb27a1 100644 --- a/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs +++ b/packages/http-client-csharp/generator/TestProjects/Local/Sample-TypeSpec/src/Generated/SampleTypeSpecClient.cs @@ -334,7 +334,7 @@ public virtual ClientResult NoContentType(Wrapper info, Cancella { Argument.AssertNotNull(info, nameof(info)); - ClientResult result = NoContentType(info.P2, info.P1, info.Action, cancellationToken.ToRequestOptions()); + ClientResult result = NoContentType(info.P2, info.P1, BinaryContent.Create(info.Action), cancellationToken.ToRequestOptions()); return ClientResult.FromValue((RoundTripModel)result, result.GetRawResponse()); } @@ -347,7 +347,7 @@ public virtual async Task> NoContentTypeAsync(Wrapp { Argument.AssertNotNull(info, nameof(info)); - ClientResult result = await NoContentTypeAsync(info.P2, info.P1, info.Action, cancellationToken.ToRequestOptions()).ConfigureAwait(false); + ClientResult result = await NoContentTypeAsync(info.P2, info.P1, BinaryContent.Create(info.Action), cancellationToken.ToRequestOptions()).ConfigureAwait(false); return ClientResult.FromValue((RoundTripModel)result, result.GetRawResponse()); } diff --git a/packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Streaming/Jsonl/JsonlTests.cs b/packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Streaming/Jsonl/JsonlTests.cs new file mode 100644 index 00000000000..8a4d01c6004 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector.Tests/Http/Streaming/Jsonl/JsonlTests.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; +using NUnit.Framework; +using Streaming.Jsonl; + +namespace TestProjects.Spector.Tests.Http.Streaming.Jsonl +{ + public class JsonlTests : SpectorTestBase + { + private const string ExpectedJsonl = "{\"desc\": \"one\"}\n{\"desc\": \"two\"}\n{\"desc\": \"three\"}"; + + [SpectorTest] + public Task BasicSend() => Test(async (host) => + { + var client = new JsonlClient(host, null).GetBasicClient(); + var stream = StreamingJsonlModelFactory.JsonlStreamInfo(BinaryData.FromString(ExpectedJsonl)); + var response = await client.SendAsync(stream); + + Assert.AreEqual(204, response.GetRawResponse().Status); + }); + + [SpectorTest] + public Task BasicReceive() => Test(async (host) => + { + var client = new JsonlClient(host, null).GetBasicClient(); + var response = await client.ReceiveAsync(); + + Assert.AreEqual(200, response.GetRawResponse().Status); + BinaryDataAssert.AreEqual(BinaryData.FromString(ExpectedJsonl), response.Value); + }); + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector.Tests/TestProjects.Spector.Tests.csproj b/packages/http-client-csharp/generator/TestProjects/Spector.Tests/TestProjects.Spector.Tests.csproj index 906ffbe2cc8..622b118be20 100644 --- a/packages/http-client-csharp/generator/TestProjects/Spector.Tests/TestProjects.Spector.Tests.csproj +++ b/packages/http-client-csharp/generator/TestProjects/Spector.Tests/TestProjects.Spector.Tests.csproj @@ -52,8 +52,9 @@ - + + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/Configuration.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/Configuration.json new file mode 100644 index 00000000000..6759355fc55 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/Configuration.json @@ -0,0 +1,3 @@ +{ + "package-name": "Streaming.Jsonl" +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/Streaming.Jsonl.NuGet.targets b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/Streaming.Jsonl.NuGet.targets new file mode 100644 index 00000000000..9df53f09f6f --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/Streaming.Jsonl.NuGet.targets @@ -0,0 +1,6 @@ + + + + + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/Streaming.Jsonl.slnx b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/Streaming.Jsonl.slnx new file mode 100644 index 00000000000..1bed5659651 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/Streaming.Jsonl.slnx @@ -0,0 +1,3 @@ + + + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/Basic.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/Basic.cs new file mode 100644 index 00000000000..e42f3bd9131 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/Basic.cs @@ -0,0 +1,38 @@ +// + +#nullable disable + +using System; +using System.ClientModel; +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using TypeSpec.Http.Streams; + +namespace Streaming.Jsonl._Basic +{ + public partial class Basic + { + protected Basic() => throw null; + + internal Basic(ClientPipeline pipeline, Uri endpoint) => throw null; + + public ClientPipeline Pipeline => throw null; + + public virtual ClientResult Send(BinaryContent content, RequestOptions options = null) => throw null; + + public virtual Task SendAsync(BinaryContent content, RequestOptions options = null) => throw null; + + public virtual ClientResult Send(JsonlStreamInfo stream, CancellationToken cancellationToken = default) => throw null; + + public virtual Task SendAsync(JsonlStreamInfo stream, CancellationToken cancellationToken = default) => throw null; + + public virtual ClientResult Receive(RequestOptions options) => throw null; + + public virtual Task ReceiveAsync(RequestOptions options) => throw null; + + public virtual ClientResult Receive(CancellationToken cancellationToken = default) => throw null; + + public virtual Task> ReceiveAsync(CancellationToken cancellationToken = default) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/JsonlClient.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/JsonlClient.cs new file mode 100644 index 00000000000..c3631096e25 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/JsonlClient.cs @@ -0,0 +1,27 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Streaming.Jsonl._Basic; + +namespace Streaming.Jsonl +{ + public partial class JsonlClient + { + public JsonlClient() : this(new Uri("http://localhost:3000"), new JsonlClientOptions()) => throw null; + + internal JsonlClient(AuthenticationPolicy authenticationPolicy, Uri endpoint, JsonlClientOptions options) => throw null; + + public JsonlClient(Uri endpoint, JsonlClientOptions options) : this(null, endpoint, options) => throw null; + + [Experimental("SCME0002")] + public JsonlClient(JsonlClientSettings settings) : this(AuthenticationPolicy.Create(settings), settings?.Endpoint, settings?.Options) => throw null; + + public ClientPipeline Pipeline => throw null; + + public virtual Basic GetBasicClient() => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/JsonlClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/JsonlClientOptions.cs new file mode 100644 index 00000000000..ca587048a82 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/JsonlClientOptions.cs @@ -0,0 +1,18 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Streaming.Jsonl +{ + public partial class JsonlClientOptions : ClientPipelineOptions + { + public JsonlClientOptions() => throw null; + + [Experimental("SCME0002")] + internal JsonlClientOptions(IConfigurationSection section) : base(section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/JsonlClientSettings.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/JsonlClientSettings.cs new file mode 100644 index 00000000000..2a2ff69d3f2 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/JsonlClientSettings.cs @@ -0,0 +1,29 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Diagnostics.CodeAnalysis; +using Microsoft.Extensions.Configuration; + +namespace Streaming.Jsonl +{ + [Experimental("SCME0002")] + public partial class JsonlClientSettings : ClientSettings + { + public Uri Endpoint + { + get => throw null; + set => throw null; + } + + public JsonlClientOptions Options + { + get => throw null; + set => throw null; + } + + protected override void BindCore(IConfigurationSection section) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/Models/JsonlStreamInfo.Serialization.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/Models/JsonlStreamInfo.Serialization.cs new file mode 100644 index 00000000000..e73943d2a92 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/Models/JsonlStreamInfo.Serialization.cs @@ -0,0 +1,33 @@ +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace TypeSpec.Http.Streams +{ + public partial class JsonlStreamInfo : IJsonModel + { + internal JsonlStreamInfo() => throw null; + + protected virtual JsonlStreamInfo PersistableModelCreateCore(BinaryData data, ModelReaderWriterOptions options) => throw null; + + protected virtual BinaryData PersistableModelWriteCore(ModelReaderWriterOptions options) => throw null; + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => throw null; + + JsonlStreamInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => throw null; + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => throw null; + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) => throw null; + + JsonlStreamInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + + protected virtual JsonlStreamInfo JsonModelCreateCore(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/Models/JsonlStreamInfo.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/Models/JsonlStreamInfo.cs new file mode 100644 index 00000000000..329b85831df --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/Models/JsonlStreamInfo.cs @@ -0,0 +1,13 @@ +// + +#nullable disable + +using System; + +namespace TypeSpec.Http.Streams +{ + public partial class JsonlStreamInfo + { + public BinaryData Body => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/Models/StreamingJsonlContext.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/Models/StreamingJsonlContext.cs new file mode 100644 index 00000000000..72c30a8eee7 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/Models/StreamingJsonlContext.cs @@ -0,0 +1,15 @@ +// + +#nullable disable + +using System.ClientModel.Primitives; +using Streaming.Jsonl._Basic; +using TypeSpec.Http.Streams; + +namespace Streaming.Jsonl +{ + [ModelReaderWriterBuildable(typeof(JsonlStreamInfo))] + public partial class StreamingJsonlContext : ModelReaderWriterContext + { + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/StreamingJsonlModelFactory.cs b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/StreamingJsonlModelFactory.cs new file mode 100644 index 00000000000..ef20b8c14c3 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/StreamingJsonlModelFactory.cs @@ -0,0 +1,16 @@ +// + +#nullable disable + +using System; +using Streaming.Jsonl._Basic; +using TypeSpec.Http.Streams; + +namespace Streaming.Jsonl +{ + public static partial class StreamingJsonlModelFactory + { + + public static JsonlStreamInfo JsonlStreamInfo(BinaryData body = default) => throw null; + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/schema/ConfigurationSchema.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/schema/ConfigurationSchema.json new file mode 100644 index 00000000000..cd18484e8b4 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Generated/schema/ConfigurationSchema.json @@ -0,0 +1,40 @@ +{ + "type": "object", + "properties": { + "Clients": { + "type": "object", + "properties": { + "JsonlClient": { + "type": "object", + "description": "Configuration for JsonlClient.", + "properties": { + "Endpoint": { + "type": "string", + "format": "uri", + "description": "Gets or sets the Endpoint." + }, + "Credential": { + "$ref": "#/definitions/credential" + }, + "Options": { + "$ref": "#/definitions/jsonlClientOptions" + } + } + } + }, + "additionalProperties": { + "type": "object", + "description": "Configuration for a named client instance." + } + } + }, + "definitions": { + "jsonlClientOptions": { + "allOf": [ + { + "$ref": "#/definitions/options" + } + ] + } + } +} diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Streaming.Jsonl.csproj b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Streaming.Jsonl.csproj new file mode 100644 index 00000000000..1f7ceff1fb3 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/src/Streaming.Jsonl.csproj @@ -0,0 +1,20 @@ + + + This is the Streaming.Jsonl client library for developing .NET applications with rich experience. + SDK Code Generation Streaming.Jsonl + 1.0.0-beta.1 + Streaming.Jsonl + netstandard2.0;net8.0 + latest + true + + + + + + + + + + + diff --git a/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/tspCodeModel.json b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/tspCodeModel.json new file mode 100644 index 00000000000..59eb319b509 --- /dev/null +++ b/packages/http-client-csharp/generator/TestProjects/Spector/http/streaming/jsonl/tspCodeModel.json @@ -0,0 +1,490 @@ +{ + "name": "Streaming.Jsonl", + "apiVersions": [], + "enums": [], + "constants": [ + { + "$id": "1", + "kind": "constant", + "name": "SendRequestContentType", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "2", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/jsonl", + "decorators": [] + }, + { + "$id": "3", + "kind": "constant", + "name": "JsonlStreamInfoContentType", + "namespace": "TypeSpec.Http.Streams", + "usage": "None", + "valueType": { + "$id": "4", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/jsonl", + "decorators": [] + }, + { + "$id": "5", + "kind": "constant", + "name": "SendRequestContentType1", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "6", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/jsonl", + "decorators": [] + }, + { + "$id": "7", + "kind": "constant", + "name": "SendRequestContentType2", + "namespace": "", + "usage": "None", + "valueType": { + "$id": "8", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/jsonl", + "decorators": [] + } + ], + "models": [ + { + "$id": "9", + "kind": "model", + "name": "Info", + "namespace": "Streaming.Jsonl.Basic", + "crossLanguageDefinitionId": "Streaming.Jsonl.Basic.Info", + "usage": "Input,Output,Json", + "decorators": [], + "serializationOptions": {}, + "properties": [ + { + "$id": "10", + "kind": "property", + "name": "desc", + "type": { + "$id": "11", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Streaming.Jsonl.Basic.Info.desc", + "serializationOptions": {}, + "isHttpMetadata": false + } + ] + }, + { + "$id": "12", + "kind": "model", + "name": "JsonlStreamInfo", + "namespace": "TypeSpec.Http.Streams", + "crossLanguageDefinitionId": "TypeSpec.Http.Streams.JsonlStream", + "usage": "None", + "doc": "", + "decorators": [], + "serializationOptions": {}, + "properties": [ + { + "$id": "13", + "kind": "property", + "name": "contentType", + "type": { + "$ref": "3" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "TypeSpec.Http.Streams.JsonlStream.contentType", + "serializationOptions": {}, + "isHttpMetadata": true + }, + { + "$id": "14", + "kind": "property", + "name": "body", + "type": { + "$id": "15", + "kind": "bytes", + "name": "bytes", + "crossLanguageDefinitionId": "", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "TypeSpec.Http.Streams.JsonlStream.body", + "serializationOptions": {}, + "isHttpMetadata": false + } + ] + } + ], + "clients": [ + { + "$id": "16", + "kind": "client", + "name": "JsonlClient", + "namespace": "Streaming.Jsonl", + "doc": "Test of jsonl streaming.", + "methods": [], + "parameters": [ + { + "$id": "17", + "kind": "endpoint", + "name": "endpoint", + "serializedName": "endpoint", + "doc": "Service host", + "type": { + "$id": "18", + "kind": "url", + "name": "endpoint", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "isApiVersion": false, + "optional": false, + "scope": "Client", + "isEndpoint": true, + "defaultValue": { + "type": { + "$id": "19", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "http://localhost:3000" + }, + "serverUrlTemplate": "{endpoint}", + "skipUrlEncoding": false, + "readOnly": false, + "crossLanguageDefinitionId": "Streaming.Jsonl.endpoint" + } + ], + "initializedBy": 1, + "decorators": [], + "crossLanguageDefinitionId": "Streaming.Jsonl", + "apiVersions": [], + "children": [ + { + "$id": "20", + "kind": "client", + "name": "Basic", + "namespace": "Streaming.Jsonl.Basic", + "methods": [ + { + "$id": "21", + "kind": "basic", + "name": "send", + "accessibility": "public", + "apiVersions": [], + "operation": { + "$id": "22", + "name": "send", + "resourceName": "Basic", + "accessibility": "public", + "parameters": [ + { + "$id": "23", + "kind": "header", + "name": "contentType", + "serializedName": "Content-Type", + "type": { + "$ref": "1" + }, + "isApiVersion": false, + "optional": false, + "isContentType": true, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "TypeSpec.Http.Streams.JsonlStream.contentType", + "methodParameterSegments": [ + { + "$id": "24", + "kind": "method", + "name": "stream", + "serializedName": "stream", + "type": { + "$ref": "12" + }, + "location": "", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "Streaming.Jsonl.Basic.send.stream", + "readOnly": false, + "access": "public", + "decorators": [] + }, + { + "$id": "25", + "kind": "method", + "name": "contentType", + "serializedName": "contentType", + "type": { + "$ref": "3" + }, + "location": "", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "TypeSpec.Http.Streams.JsonlStream.contentType", + "readOnly": false, + "access": "public", + "decorators": [] + } + ] + }, + { + "$id": "26", + "kind": "body", + "name": "body", + "serializedName": "body", + "type": { + "$ref": "15" + }, + "isApiVersion": false, + "contentTypes": [ + "application/jsonl" + ], + "defaultContentType": "application/jsonl", + "optional": false, + "scope": "Method", + "decorators": [], + "readOnly": false, + "crossLanguageDefinitionId": "TypeSpec.Http.Streams.JsonlStream.body", + "methodParameterSegments": [ + { + "$ref": "24" + }, + { + "$id": "27", + "kind": "method", + "name": "body", + "serializedName": "body", + "type": { + "$ref": "15" + }, + "location": "", + "isApiVersion": false, + "optional": false, + "scope": "Method", + "crossLanguageDefinitionId": "TypeSpec.Http.Streams.JsonlStream.body", + "readOnly": false, + "access": "public", + "decorators": [] + } + ] + } + ], + "responses": [ + { + "statusCodes": [ + 204 + ], + "headers": [], + "isErrorResponse": false + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/streaming/jsonl/basic/send", + "requestMediaTypes": [ + "application/jsonl" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Streaming.Jsonl.Basic.send", + "decorators": [], + "namespace": "Streaming.Jsonl.Basic" + }, + "parameters": [ + { + "$ref": "24" + } + ], + "response": {}, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Streaming.Jsonl.Basic.send" + }, + { + "$id": "28", + "kind": "basic", + "name": "receive", + "accessibility": "public", + "apiVersions": [], + "operation": { + "$id": "29", + "name": "receive", + "resourceName": "Basic", + "accessibility": "public", + "parameters": [ + { + "$id": "30", + "kind": "header", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "5" + }, + "isApiVersion": false, + "optional": false, + "isContentType": false, + "scope": "Constant", + "readOnly": false, + "decorators": [], + "crossLanguageDefinitionId": "Streaming.Jsonl.Basic.receive.accept", + "methodParameterSegments": [ + { + "$id": "31", + "kind": "method", + "name": "accept", + "serializedName": "Accept", + "type": { + "$ref": "5" + }, + "location": "Header", + "isApiVersion": false, + "optional": false, + "scope": "Constant", + "crossLanguageDefinitionId": "Streaming.Jsonl.Basic.receive.accept", + "readOnly": false, + "access": "public", + "decorators": [] + } + ] + } + ], + "responses": [ + { + "statusCodes": [ + 200 + ], + "bodyType": { + "$id": "32", + "kind": "bytes", + "name": "bytes", + "crossLanguageDefinitionId": "", + "decorators": [] + }, + "headers": [ + { + "name": "contentType", + "nameInResponse": "content-type", + "type": { + "$ref": "7" + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/jsonl" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/streaming/jsonl/basic/receive", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Streaming.Jsonl.Basic.receive", + "decorators": [], + "namespace": "Streaming.Jsonl.Basic" + }, + "parameters": [ + { + "$ref": "31" + } + ], + "response": { + "type": { + "$ref": "32" + } + }, + "isOverride": false, + "generateConvenient": true, + "generateProtocol": true, + "crossLanguageDefinitionId": "Streaming.Jsonl.Basic.receive" + } + ], + "parameters": [ + { + "$id": "33", + "kind": "endpoint", + "name": "endpoint", + "serializedName": "endpoint", + "doc": "Service host", + "type": { + "$id": "34", + "kind": "url", + "name": "endpoint", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "isApiVersion": false, + "optional": false, + "scope": "Client", + "isEndpoint": true, + "defaultValue": { + "type": { + "$id": "35", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "http://localhost:3000" + }, + "serverUrlTemplate": "{endpoint}", + "skipUrlEncoding": false, + "readOnly": false, + "crossLanguageDefinitionId": "Streaming.Jsonl.Basic.endpoint" + } + ], + "initializedBy": 0, + "decorators": [], + "crossLanguageDefinitionId": "Streaming.Jsonl.Basic", + "apiVersions": [], + "parent": { + "$ref": "16" + }, + "isMultiServiceClient": false + } + ], + "isMultiServiceClient": false + } + ] +}