From a13ba2791f6993916f3f0cdbf30a371e83ee892d Mon Sep 17 00:00:00 2001
From: nisha-bhatia <67986960+nisha-bhatia@users.noreply.github.com>
Date: Fri, 15 Nov 2024 13:12:54 -0800
Subject: [PATCH 1/2] first gen
---
.../eng/scripts/Generate.ps1 | 1 -
.../src/Properties/launchSettings.json | 5 +
.../Client/Structure/Default/DefaultTests.cs | 1 -
.../ConditionalRequestHeaderTests.cs | 46 +++
.../conditional-request/Configuration.json | 6 +
.../SpecialHeaders.ConditionalRequest.sln | 48 +++
.../src/Generated/ConditionalRequestClient.cs | 53 ++++
.../ConditionalRequestClientOptions.cs | 12 +
.../SpecialHeaders.ConditionalRequest.csproj | 16 +
.../conditional-request/tspCodeModel.json | 273 ++++++++++++++++++
10 files changed, 459 insertions(+), 2 deletions(-)
create mode 100644 packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/SpecialHeaders/ConditionalRequests/ConditionalRequestHeaderTests.cs
create mode 100644 packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/Configuration.json
create mode 100644 packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/SpecialHeaders.ConditionalRequest.sln
create mode 100644 packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs
create mode 100644 packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/src/Generated/ConditionalRequestClientOptions.cs
create mode 100644 packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/src/SpecialHeaders.ConditionalRequest.csproj
create mode 100644 packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/tspCodeModel.json
diff --git a/packages/http-client-csharp/eng/scripts/Generate.ps1 b/packages/http-client-csharp/eng/scripts/Generate.ps1
index 05134142c8..f62eac962f 100644
--- a/packages/http-client-csharp/eng/scripts/Generate.ps1
+++ b/packages/http-client-csharp/eng/scripts/Generate.ps1
@@ -50,7 +50,6 @@ function IsSpecDir {
$failingSpecs = @(
Join-Path 'http' 'payload' 'pageable'
- Join-Path 'http' 'special-headers' 'conditional-request'
Join-Path 'http' 'type' 'model' 'flatten'
Join-Path 'http' 'type' 'model' 'templated'
)
diff --git a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Properties/launchSettings.json b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Properties/launchSettings.json
index f2d5ebb72d..9bc70cdecd 100644
--- a/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Properties/launchSettings.json
+++ b/packages/http-client-csharp/generator/Microsoft.Generator.CSharp/src/Properties/launchSettings.json
@@ -165,6 +165,11 @@
"commandName": "Executable",
"executablePath": "$(SolutionDir)/../dist/generator/Microsoft.Generator.CSharp.exe"
},
+ "http-special-headers-conditional-request": {
+ "commandLineArgs": "$(SolutionDir)/TestProjects/CadlRanch/http/special-headers/conditional-request -p StubLibraryPlugin",
+ "commandName": "Executable",
+ "executablePath": "$(SolutionDir)/../dist/generator/Microsoft.Generator.CSharp.exe"
+ },
"http-special-headers-repeatability": {
"commandLineArgs": "$(SolutionDir)/TestProjects/CadlRanch/http/special-headers/repeatability -p StubLibraryPlugin",
"commandName": "Executable",
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Client/Structure/Default/DefaultTests.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Client/Structure/Default/DefaultTests.cs
index ca0fa94f4e..fae20c8f35 100644
--- a/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Client/Structure/Default/DefaultTests.cs
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/Client/Structure/Default/DefaultTests.cs
@@ -35,7 +35,6 @@ public void Client_Structure_default_methods(Type client, string[] methodNames)
[CadlRanchTest]
public Task Client_Structure_default_One() => Test(async (host) =>
{
- //await new RenamedOperationClient(host, ClientType.RenamedOperation, null).RenamedOneAsync();
var response = await new ServiceClient(host, ClientType.Default).OneAsync();
Assert.AreEqual(204, response.GetRawResponse().Status);
});
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/SpecialHeaders/ConditionalRequests/ConditionalRequestHeaderTests.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/SpecialHeaders/ConditionalRequests/ConditionalRequestHeaderTests.cs
new file mode 100644
index 0000000000..4fa6365319
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch.Tests/Http/SpecialHeaders/ConditionalRequests/ConditionalRequestHeaderTests.cs
@@ -0,0 +1,46 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using System.Threading.Tasks;
+using NUnit.Framework;
+using SpecialHeaders.ConditionalRequest;
+using TestProjects.CadlRanch.Tests;
+
+namespace CadlRanchProjects.Tests.Http.SpecialHeaders.ConditionalRequests
+{
+ public class ConditionalRequestHeaderTests : CadlRanchTestBase
+ {
+ [CadlRanchTest]
+ public Task Special_Headers_Conditional_Request_PostIfMatch() => Test(async (host) =>
+ {
+ string ifMatch = new string("valid");
+ var response = await new ConditionalRequestClient(host, null).PostIfMatchAsync(ifMatch);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task Special_Headers_Conditional_Request_PostIfNoneMatch() => Test(async (host) =>
+ {
+ string ifNoneMatch = new string("invalid");
+ var response = await new ConditionalRequestClient(host, null).PostIfNoneMatchAsync(ifNoneMatch);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task Special_Headers_Conditional_Request_HeadIfModifiedSince() => Test(async (host) =>
+ {
+ DateTimeOffset ifModifiedSince = DateTimeOffset.Parse("Fri, 26 Aug 2022 14:38:00 GMT");
+ var response = await new ConditionalRequestClient(host, null).HeadIfModifiedSinceAsync(ifModifiedSince);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+
+ [CadlRanchTest]
+ public Task Special_Headers_Conditional_Request_PostIfUnmodifiedSince() => Test(async (host) =>
+ {
+ DateTimeOffset ifUnmodifiedSince = DateTimeOffset.Parse("Fri, 26 Aug 2022 14:38:00 GMT");
+ var response = await new ConditionalRequestClient(host, null).HeadIfModifiedSinceAsync(ifUnmodifiedSince);
+ Assert.AreEqual(204, response.GetRawResponse().Status);
+ });
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/Configuration.json b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/Configuration.json
new file mode 100644
index 0000000000..54ff8e4fd6
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/Configuration.json
@@ -0,0 +1,6 @@
+{
+ "output-folder": ".",
+ "namespace": "SpecialHeaders.ConditionalRequest",
+ "library-name": "SpecialHeaders.ConditionalRequest",
+ "use-model-reader-writer": true
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/SpecialHeaders.ConditionalRequest.sln b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/SpecialHeaders.ConditionalRequest.sln
new file mode 100644
index 0000000000..df8870de15
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/SpecialHeaders.ConditionalRequest.sln
@@ -0,0 +1,48 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29709.97
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpecialHeaders.ConditionalRequest", "src\SpecialHeaders.ConditionalRequest.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE}
+ EndGlobalSection
+EndGlobal
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs
new file mode 100644
index 0000000000..a3e8dd1e61
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs
@@ -0,0 +1,53 @@
+//
+
+#nullable disable
+
+using System;
+using System.ClientModel;
+using System.ClientModel.Primitives;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace SpecialHeaders.ConditionalRequest
+{
+ public partial class ConditionalRequestClient
+ {
+ public ConditionalRequestClient() : this(new Uri("http://localhost:3000"), new ConditionalRequestClientOptions()) => throw null;
+
+ public ConditionalRequestClient(Uri endpoint, ConditionalRequestClientOptions options) => throw null;
+
+ public ClientPipeline Pipeline => throw null;
+
+ public virtual ClientResult PostIfMatch(string ifMatch, RequestOptions options) => throw null;
+
+ public virtual Task PostIfMatchAsync(string ifMatch, RequestOptions options) => throw null;
+
+ public virtual ClientResult PostIfMatch(string ifMatch = null) => throw null;
+
+ public virtual Task PostIfMatchAsync(string ifMatch = null, CancellationToken cancellationToken = default) => throw null;
+
+ public virtual ClientResult PostIfNoneMatch(string ifNoneMatch, RequestOptions options) => throw null;
+
+ public virtual Task PostIfNoneMatchAsync(string ifNoneMatch, RequestOptions options) => throw null;
+
+ public virtual ClientResult PostIfNoneMatch(string ifNoneMatch = null) => throw null;
+
+ public virtual Task PostIfNoneMatchAsync(string ifNoneMatch = null, CancellationToken cancellationToken = default) => throw null;
+
+ public virtual ClientResult HeadIfModifiedSince(DateTimeOffset? ifModifiedSince, RequestOptions options) => throw null;
+
+ public virtual Task HeadIfModifiedSinceAsync(DateTimeOffset? ifModifiedSince, RequestOptions options) => throw null;
+
+ public virtual ClientResult HeadIfModifiedSince(DateTimeOffset? ifModifiedSince = null) => throw null;
+
+ public virtual Task HeadIfModifiedSinceAsync(DateTimeOffset? ifModifiedSince = null, CancellationToken cancellationToken = default) => throw null;
+
+ public virtual ClientResult PostIfUnmodifiedSince(DateTimeOffset? ifUnmodifiedSince, RequestOptions options) => throw null;
+
+ public virtual Task PostIfUnmodifiedSinceAsync(DateTimeOffset? ifUnmodifiedSince, RequestOptions options) => throw null;
+
+ public virtual ClientResult PostIfUnmodifiedSince(DateTimeOffset? ifUnmodifiedSince = null) => throw null;
+
+ public virtual Task PostIfUnmodifiedSinceAsync(DateTimeOffset? ifUnmodifiedSince = null, CancellationToken cancellationToken = default) => throw null;
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/src/Generated/ConditionalRequestClientOptions.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/src/Generated/ConditionalRequestClientOptions.cs
new file mode 100644
index 0000000000..924fd0111b
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/src/Generated/ConditionalRequestClientOptions.cs
@@ -0,0 +1,12 @@
+//
+
+#nullable disable
+
+using System.ClientModel.Primitives;
+
+namespace SpecialHeaders.ConditionalRequest
+{
+ public partial class ConditionalRequestClientOptions : ClientPipelineOptions
+ {
+ }
+}
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/src/SpecialHeaders.ConditionalRequest.csproj b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/src/SpecialHeaders.ConditionalRequest.csproj
new file mode 100644
index 0000000000..d130eaa44b
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/src/SpecialHeaders.ConditionalRequest.csproj
@@ -0,0 +1,16 @@
+
+
+ This is the SpecialHeaders.ConditionalRequest client library for developing .NET applications with rich experience.
+ SDK Code Generation SpecialHeaders.ConditionalRequest
+ 1.0.0-beta.1
+ SpecialHeaders.ConditionalRequest
+ netstandard2.0
+ latest
+ true
+
+
+
+
+
+
+
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/tspCodeModel.json b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/tspCodeModel.json
new file mode 100644
index 0000000000..1ee0e40c9e
--- /dev/null
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/tspCodeModel.json
@@ -0,0 +1,273 @@
+{
+ "$id": "1",
+ "Name": "SpecialHeaders.ConditionalRequest",
+ "ApiVersions": [],
+ "Enums": [],
+ "Models": [],
+ "Clients": [
+ {
+ "$id": "2",
+ "Name": "ConditionalRequestClient",
+ "Description": "Illustrates conditional request headers",
+ "Operations": [
+ {
+ "$id": "3",
+ "Name": "postIfMatch",
+ "ResourceName": "ConditionalRequest",
+ "Description": "Check when only If-Match in header is defined.",
+ "Accessibility": "public",
+ "Parameters": [
+ {
+ "$id": "4",
+ "Name": "ifMatch",
+ "NameInRequest": "If-Match",
+ "Description": "The request should only proceed if an entity matches this string.",
+ "Type": {
+ "$id": "5",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "Location": "Header",
+ "IsApiVersion": false,
+ "IsContentType": false,
+ "IsEndpoint": false,
+ "Explode": false,
+ "IsRequired": false,
+ "Kind": "Method",
+ "Decorators": [],
+ "SkipUrlEncoding": false
+ }
+ ],
+ "Responses": [
+ {
+ "$id": "6",
+ "StatusCodes": [
+ 204
+ ],
+ "BodyMediaType": "Json",
+ "Headers": [],
+ "IsErrorResponse": false
+ }
+ ],
+ "HttpMethod": "POST",
+ "RequestBodyMediaType": "None",
+ "Uri": "{endpoint}",
+ "Path": "/special-headers/conditional-request/if-match",
+ "BufferResponse": true,
+ "GenerateProtocolMethod": true,
+ "GenerateConvenienceMethod": true,
+ "CrossLanguageDefinitionId": "SpecialHeaders.ConditionalRequest.postIfMatch",
+ "Decorators": []
+ },
+ {
+ "$id": "7",
+ "Name": "postIfNoneMatch",
+ "ResourceName": "ConditionalRequest",
+ "Description": "Check when only If-None-Match in header is defined.",
+ "Accessibility": "public",
+ "Parameters": [
+ {
+ "$id": "8",
+ "Name": "ifNoneMatch",
+ "NameInRequest": "If-None-Match",
+ "Description": "The request should only proceed if no entity matches this string.",
+ "Type": {
+ "$id": "9",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "Location": "Header",
+ "IsApiVersion": false,
+ "IsContentType": false,
+ "IsEndpoint": false,
+ "Explode": false,
+ "IsRequired": false,
+ "Kind": "Method",
+ "Decorators": [],
+ "SkipUrlEncoding": false
+ }
+ ],
+ "Responses": [
+ {
+ "$id": "10",
+ "StatusCodes": [
+ 204
+ ],
+ "BodyMediaType": "Json",
+ "Headers": [],
+ "IsErrorResponse": false
+ }
+ ],
+ "HttpMethod": "POST",
+ "RequestBodyMediaType": "None",
+ "Uri": "{endpoint}",
+ "Path": "/special-headers/conditional-request/if-none-match",
+ "BufferResponse": true,
+ "GenerateProtocolMethod": true,
+ "GenerateConvenienceMethod": true,
+ "CrossLanguageDefinitionId": "SpecialHeaders.ConditionalRequest.postIfNoneMatch",
+ "Decorators": []
+ },
+ {
+ "$id": "11",
+ "Name": "headIfModifiedSince",
+ "ResourceName": "ConditionalRequest",
+ "Description": "Check when only If-Modified-Since in header is defined.",
+ "Accessibility": "public",
+ "Parameters": [
+ {
+ "$id": "12",
+ "Name": "ifModifiedSince",
+ "NameInRequest": "If-Modified-Since",
+ "Description": "A timestamp indicating the last modified time of the resource known to the\nclient. The operation will be performed only if the resource on the service has\nbeen modified since the specified time.",
+ "Type": {
+ "$id": "13",
+ "kind": "utcDateTime",
+ "name": "utcDateTime",
+ "encode": "rfc7231",
+ "wireType": {
+ "$id": "14",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "crossLanguageDefinitionId": "TypeSpec.utcDateTime",
+ "decorators": []
+ },
+ "Location": "Header",
+ "IsApiVersion": false,
+ "IsContentType": false,
+ "IsEndpoint": false,
+ "Explode": false,
+ "IsRequired": false,
+ "Kind": "Method",
+ "Decorators": [],
+ "SkipUrlEncoding": false
+ }
+ ],
+ "Responses": [
+ {
+ "$id": "15",
+ "StatusCodes": [
+ 204
+ ],
+ "BodyMediaType": "Json",
+ "Headers": [],
+ "IsErrorResponse": false
+ }
+ ],
+ "HttpMethod": "HEAD",
+ "RequestBodyMediaType": "None",
+ "Uri": "{endpoint}",
+ "Path": "/special-headers/conditional-request/if-modified-since",
+ "BufferResponse": true,
+ "GenerateProtocolMethod": true,
+ "GenerateConvenienceMethod": true,
+ "CrossLanguageDefinitionId": "SpecialHeaders.ConditionalRequest.headIfModifiedSince",
+ "Decorators": []
+ },
+ {
+ "$id": "16",
+ "Name": "postIfUnmodifiedSince",
+ "ResourceName": "ConditionalRequest",
+ "Description": "Check when only If-Unmodified-Since in header is defined.",
+ "Accessibility": "public",
+ "Parameters": [
+ {
+ "$id": "17",
+ "Name": "ifUnmodifiedSince",
+ "NameInRequest": "If-Unmodified-Since",
+ "Description": "A timestamp indicating the last modified time of the resource known to the\nclient. The operation will be performed only if the resource on the service has\nnot been modified since the specified time.",
+ "Type": {
+ "$id": "18",
+ "kind": "utcDateTime",
+ "name": "utcDateTime",
+ "encode": "rfc7231",
+ "wireType": {
+ "$id": "19",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string",
+ "decorators": []
+ },
+ "crossLanguageDefinitionId": "TypeSpec.utcDateTime",
+ "decorators": []
+ },
+ "Location": "Header",
+ "IsApiVersion": false,
+ "IsContentType": false,
+ "IsEndpoint": false,
+ "Explode": false,
+ "IsRequired": false,
+ "Kind": "Method",
+ "Decorators": [],
+ "SkipUrlEncoding": false
+ }
+ ],
+ "Responses": [
+ {
+ "$id": "20",
+ "StatusCodes": [
+ 204
+ ],
+ "BodyMediaType": "Json",
+ "Headers": [],
+ "IsErrorResponse": false
+ }
+ ],
+ "HttpMethod": "POST",
+ "RequestBodyMediaType": "None",
+ "Uri": "{endpoint}",
+ "Path": "/special-headers/conditional-request/if-unmodified-since",
+ "BufferResponse": true,
+ "GenerateProtocolMethod": true,
+ "GenerateConvenienceMethod": true,
+ "CrossLanguageDefinitionId": "SpecialHeaders.ConditionalRequest.postIfUnmodifiedSince",
+ "Decorators": []
+ }
+ ],
+ "Protocol": {
+ "$id": "21"
+ },
+ "Parameters": [
+ {
+ "$id": "22",
+ "Name": "endpoint",
+ "NameInRequest": "endpoint",
+ "Description": "Service host",
+ "Type": {
+ "$id": "23",
+ "kind": "url",
+ "name": "url",
+ "crossLanguageDefinitionId": "TypeSpec.url"
+ },
+ "Location": "Uri",
+ "IsApiVersion": false,
+ "IsResourceParameter": false,
+ "IsContentType": false,
+ "IsRequired": true,
+ "IsEndpoint": true,
+ "SkipUrlEncoding": false,
+ "Explode": false,
+ "Kind": "Client",
+ "DefaultValue": {
+ "$id": "24",
+ "Type": {
+ "$id": "25",
+ "kind": "string",
+ "name": "string",
+ "crossLanguageDefinitionId": "TypeSpec.string"
+ },
+ "Value": "http://localhost:3000"
+ }
+ }
+ ],
+ "Decorators": []
+ }
+ ]
+}
From 04e37f529c36f2c70fe6ada30c0344e64dba1b72 Mon Sep 17 00:00:00 2001
From: Dapeng Zhang
Date: Mon, 16 Dec 2024 15:44:20 +0800
Subject: [PATCH 2/2] regen
---
.../src/Generated/ConditionalRequestClient.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs
index a3e8dd1e61..579b7f5d14 100644
--- a/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs
+++ b/packages/http-client-csharp/generator/TestProjects/CadlRanch/http/special-headers/conditional-request/src/Generated/ConditionalRequestClient.cs
@@ -22,7 +22,7 @@ public partial class ConditionalRequestClient
public virtual Task PostIfMatchAsync(string ifMatch, RequestOptions options) => throw null;
- public virtual ClientResult PostIfMatch(string ifMatch = null) => throw null;
+ public virtual ClientResult PostIfMatch(string ifMatch = null, CancellationToken cancellationToken = default) => throw null;
public virtual Task PostIfMatchAsync(string ifMatch = null, CancellationToken cancellationToken = default) => throw null;
@@ -30,7 +30,7 @@ public partial class ConditionalRequestClient
public virtual Task PostIfNoneMatchAsync(string ifNoneMatch, RequestOptions options) => throw null;
- public virtual ClientResult PostIfNoneMatch(string ifNoneMatch = null) => throw null;
+ public virtual ClientResult PostIfNoneMatch(string ifNoneMatch = null, CancellationToken cancellationToken = default) => throw null;
public virtual Task PostIfNoneMatchAsync(string ifNoneMatch = null, CancellationToken cancellationToken = default) => throw null;
@@ -38,7 +38,7 @@ public partial class ConditionalRequestClient
public virtual Task HeadIfModifiedSinceAsync(DateTimeOffset? ifModifiedSince, RequestOptions options) => throw null;
- public virtual ClientResult HeadIfModifiedSince(DateTimeOffset? ifModifiedSince = null) => throw null;
+ public virtual ClientResult HeadIfModifiedSince(DateTimeOffset? ifModifiedSince = null, CancellationToken cancellationToken = default) => throw null;
public virtual Task HeadIfModifiedSinceAsync(DateTimeOffset? ifModifiedSince = null, CancellationToken cancellationToken = default) => throw null;
@@ -46,7 +46,7 @@ public partial class ConditionalRequestClient
public virtual Task PostIfUnmodifiedSinceAsync(DateTimeOffset? ifUnmodifiedSince, RequestOptions options) => throw null;
- public virtual ClientResult PostIfUnmodifiedSince(DateTimeOffset? ifUnmodifiedSince = null) => throw null;
+ public virtual ClientResult PostIfUnmodifiedSince(DateTimeOffset? ifUnmodifiedSince = null, CancellationToken cancellationToken = default) => throw null;
public virtual Task PostIfUnmodifiedSinceAsync(DateTimeOffset? ifUnmodifiedSince = null, CancellationToken cancellationToken = default) => throw null;
}