Use `o` format for DateTimeOffset ISO serialization. (#727)

This commit is contained in:
Pavel Krymets 2020-05-05 11:36:07 -07:00 коммит произвёл GitHub
Родитель a5cce37553
Коммит 8941ac69d9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
47 изменённых файлов: 258 добавлений и 197 удалений

49
package-lock.json сгенерированный
Просмотреть файл

@ -9,9 +9,9 @@
"dev": true
},
"@microsoft.azure/autorest.testserver": {
"version": "2.10.32",
"resolved": "https://registry.npmjs.org/@microsoft.azure/autorest.testserver/-/autorest.testserver-2.10.32.tgz",
"integrity": "sha512-a3aq39CqGv8DXU7Cqjd8snKisyeV60qQLLJoPpb++yu9xCsBHlWkgeEV66kZEaO9N+Ys5OX9RbrgXB1ll2YUtg==",
"version": "2.10.33",
"resolved": "https://registry.npmjs.org/@microsoft.azure/autorest.testserver/-/autorest.testserver-2.10.33.tgz",
"integrity": "sha512-jKdH0DM5fhbl0VqG5+cPKuAeUnPlSjyXgSLlFOcPo8vyxNrQCVA3hCzlYZ33pklkvzuAF4cbVJpY79cHC2Qyhw==",
"dev": true,
"requires": {
"azure-storage": "^2.4.0",
@ -1003,13 +1003,27 @@
"dev": true
},
"hash-base": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz",
"integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=",
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz",
"integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==",
"dev": true,
"requires": {
"inherits": "^2.0.1",
"safe-buffer": "^5.0.1"
"inherits": "^2.0.4",
"readable-stream": "^3.6.0",
"safe-buffer": "^5.2.0"
},
"dependencies": {
"readable-stream": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
"integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
"dev": true,
"requires": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
"util-deprecate": "^1.0.1"
}
}
}
},
"http-errors": {
@ -1627,6 +1641,14 @@
"process-nextick-args": "~1.0.6",
"string_decoder": "~0.10.x",
"util-deprecate": "~1.0.1"
},
"dependencies": {
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
"dev": true
}
}
},
"rechoir": {
@ -2022,10 +2044,13 @@
"dev": true
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
"dev": true
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
"dev": true,
"requires": {
"safe-buffer": "~5.2.0"
}
},
"supports-color": {
"version": "7.1.0",

Просмотреть файл

@ -4,7 +4,7 @@
"description": "package.json intended for in-repo use only, package.json used for publishing is located in src/AutoRest.CSharp.V3/package.json",
"devDependencies": {
"@autorest/autorest": "https://github.com/Azure/autorest/releases/download/autorest-3.0.6222/autorest-autorest-3.0.6222.tgz",
"@microsoft.azure/autorest.testserver": "^2.10.32"
"@microsoft.azure/autorest.testserver": "^2.10.33"
},
"dependencies": {}
}

Просмотреть файл

@ -40,7 +40,7 @@ namespace AppConfiguration.Models
if (LastModified != null)
{
writer.WritePropertyName("last_modified");
writer.WriteStringValue(LastModified.Value, "S");
writer.WriteStringValue(LastModified.Value, "O");
}
if (Tags != null)
{
@ -120,7 +120,7 @@ namespace AppConfiguration.Models
{
continue;
}
lastModified = property.Value.GetDateTimeOffset("S");
lastModified = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("tags"))

Просмотреть файл

@ -28,12 +28,12 @@ namespace Azure.AI.FormRecognizer.Models
}
if (property.NameEquals("createdDateTime"))
{
createdDateTime = property.Value.GetDateTimeOffset("S");
createdDateTime = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("lastUpdatedDateTime"))
{
lastUpdatedDateTime = property.Value.GetDateTimeOffset("S");
lastUpdatedDateTime = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("analyzeResult"))

Просмотреть файл

@ -28,12 +28,12 @@ namespace Azure.AI.FormRecognizer.Models
}
if (property.NameEquals("createdDateTime"))
{
createdDateTime = property.Value.GetDateTimeOffset("S");
createdDateTime = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("lastUpdatedDateTime"))
{
lastUpdatedDateTime = property.Value.GetDateTimeOffset("S");
lastUpdatedDateTime = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("copyResult"))

Просмотреть файл

@ -33,12 +33,12 @@ namespace Azure.AI.FormRecognizer.Models
}
if (property.NameEquals("createdDateTime"))
{
createdDateTime = property.Value.GetDateTimeOffset("S");
createdDateTime = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("lastUpdatedDateTime"))
{
lastUpdatedDateTime = property.Value.GetDateTimeOffset("S");
lastUpdatedDateTime = property.Value.GetDateTimeOffset("O");
continue;
}
}

Просмотреть файл

@ -32,7 +32,7 @@ namespace Azure.AI.FormRecognizer.Models
}
if (property.NameEquals("lastUpdatedDateTime"))
{
lastUpdatedDateTime = property.Value.GetDateTimeOffset("S");
lastUpdatedDateTime = property.Value.GetDateTimeOffset("O");
continue;
}
}

Просмотреть файл

@ -530,28 +530,11 @@ namespace Azure.AI.FormRecognizer
}
}
/// <summary> Copy custom model stored in this resource (the source) to user specified target Form Recognizer resource. </summary>
/// <param name="originalResponse"> The original response from starting the operation. </param>
/// <param name="createOriginalHttpMessage"> Creates the HTTP message used for the original request. </param>
internal Operation<Response> CreateCopyCustomModel(Response originalResponse, Func<HttpMessage> createOriginalHttpMessage)
{
if (originalResponse == null)
{
throw new ArgumentNullException(nameof(originalResponse));
}
if (createOriginalHttpMessage == null)
{
throw new ArgumentNullException(nameof(createOriginalHttpMessage));
}
return ArmOperationHelpers.Create(_pipeline, _clientDiagnostics, originalResponse, RequestMethod.Post, "ServiceClient.StartCopyCustomModel", OperationFinalStateVia.Location, createOriginalHttpMessage);
}
/// <summary> Copy custom model stored in this resource (the source) to user specified target Form Recognizer resource. </summary>
/// <param name="modelId"> Model identifier. </param>
/// <param name="copyRequest"> Copy request parameters. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual async ValueTask<Operation<Response>> StartCopyCustomModelAsync(Guid modelId, CopyRequest copyRequest, CancellationToken cancellationToken = default)
public virtual async ValueTask<ServiceCopyCustomModelOperation> StartCopyCustomModelAsync(Guid modelId, CopyRequest copyRequest, CancellationToken cancellationToken = default)
{
if (copyRequest == null)
{
@ -563,7 +546,7 @@ namespace Azure.AI.FormRecognizer
try
{
var originalResponse = await RestClient.CopyCustomModelAsync(modelId, copyRequest, cancellationToken).ConfigureAwait(false);
return CreateCopyCustomModel(originalResponse, () => RestClient.CreateCopyCustomModelRequest(modelId, copyRequest));
return new ServiceCopyCustomModelOperation(_clientDiagnostics, _pipeline, RestClient.CreateCopyCustomModelRequest(modelId, copyRequest).Request, originalResponse);
}
catch (Exception e)
{
@ -576,7 +559,7 @@ namespace Azure.AI.FormRecognizer
/// <param name="modelId"> Model identifier. </param>
/// <param name="copyRequest"> Copy request parameters. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
public virtual Operation<Response> StartCopyCustomModel(Guid modelId, CopyRequest copyRequest, CancellationToken cancellationToken = default)
public virtual ServiceCopyCustomModelOperation StartCopyCustomModel(Guid modelId, CopyRequest copyRequest, CancellationToken cancellationToken = default)
{
if (copyRequest == null)
{
@ -588,7 +571,7 @@ namespace Azure.AI.FormRecognizer
try
{
var originalResponse = RestClient.CopyCustomModel(modelId, copyRequest, cancellationToken);
return CreateCopyCustomModel(originalResponse, () => RestClient.CreateCopyCustomModelRequest(modelId, copyRequest));
return new ServiceCopyCustomModelOperation(_clientDiagnostics, _pipeline, RestClient.CreateCopyCustomModelRequest(modelId, copyRequest).Request, originalResponse);
}
catch (Exception e)
{

Просмотреть файл

@ -0,0 +1,62 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// <auto-generated/>
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Core.Pipeline;
namespace Azure.AI.FormRecognizer
{
/// <summary> Copy custom model stored in this resource (the source) to user specified target Form Recognizer resource. </summary>
public partial class ServiceCopyCustomModelOperation : Operation<Response>, IOperationSource<Response>
{
private readonly ArmOperationHelpers<Response> _operation;
internal ServiceCopyCustomModelOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response)
{
_operation = new ArmOperationHelpers<Response>(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ServiceCopyCustomModelOperation");
}
/// <inheritdoc />
public override string Id => _operation.Id;
/// <inheritdoc />
public override Response Value => _operation.Value;
/// <inheritdoc />
public override bool HasCompleted => _operation.HasCompleted;
/// <inheritdoc />
public override bool HasValue => _operation.HasValue;
/// <inheritdoc />
public override Response GetRawResponse() => _operation.GetRawResponse();
/// <inheritdoc />
public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken);
/// <inheritdoc />
public override ValueTask<Response> UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken);
/// <inheritdoc />
public override ValueTask<Response<Response>> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken);
/// <inheritdoc />
public override ValueTask<Response<Response>> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken);
Response IOperationSource<Response>.CreateResult(Response response, CancellationToken cancellationToken)
{
return response;
}
async ValueTask<Response> IOperationSource<Response>.CreateResultAsync(Response response, CancellationToken cancellationToken)
{
return await new ValueTask<Response>(response);
}
}
}

Просмотреть файл

@ -34,10 +34,10 @@ namespace Azure.Management.Storage.Models
if (SharedAccessStartTime != null)
{
writer.WritePropertyName("signedStart");
writer.WriteStringValue(SharedAccessStartTime.Value, "S");
writer.WriteStringValue(SharedAccessStartTime.Value, "O");
}
writer.WritePropertyName("signedExpiry");
writer.WriteStringValue(SharedAccessExpiryTime, "S");
writer.WriteStringValue(SharedAccessExpiryTime, "O");
if (KeyToSign != null)
{
writer.WritePropertyName("keyToSign");

Просмотреть файл

@ -57,7 +57,7 @@ namespace Azure.Management.Storage.Models
if (LastModifiedTime != null)
{
writer.WritePropertyName("lastModifiedTime");
writer.WriteStringValue(LastModifiedTime.Value, "S");
writer.WriteStringValue(LastModifiedTime.Value, "O");
}
if (LeaseStatus != null)
{
@ -202,7 +202,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
lastModifiedTime = property0.Value.GetDateTimeOffset("S");
lastModifiedTime = property0.Value.GetDateTimeOffset("O");
continue;
}
if (property0.NameEquals("leaseStatus"))

Просмотреть файл

@ -18,7 +18,7 @@ namespace Azure.Management.Storage.Models
{
writer.WriteStartObject();
writer.WritePropertyName("timeToRestore");
writer.WriteStringValue(TimeToRestore, "S");
writer.WriteStringValue(TimeToRestore, "O");
writer.WritePropertyName("blobRanges");
writer.WriteStartArray();
foreach (var item in BlobRanges)
@ -37,7 +37,7 @@ namespace Azure.Management.Storage.Models
{
if (property.NameEquals("timeToRestore"))
{
timeToRestore = property.Value.GetDateTimeOffset("S");
timeToRestore = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("blobRanges"))

Просмотреть файл

@ -46,12 +46,12 @@ namespace Azure.Management.Storage.Models
if (CreationTime != null)
{
writer.WritePropertyName("creationTime");
writer.WriteStringValue(CreationTime.Value, "S");
writer.WriteStringValue(CreationTime.Value, "O");
}
if (LastModifiedTime != null)
{
writer.WritePropertyName("lastModifiedTime");
writer.WriteStringValue(LastModifiedTime.Value, "S");
writer.WriteStringValue(LastModifiedTime.Value, "O");
}
if (KeyVaultProperties != null)
{
@ -129,7 +129,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
creationTime = property0.Value.GetDateTimeOffset("S");
creationTime = property0.Value.GetDateTimeOffset("O");
continue;
}
if (property0.NameEquals("lastModifiedTime"))
@ -138,7 +138,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
lastModifiedTime = property0.Value.GetDateTimeOffset("S");
lastModifiedTime = property0.Value.GetDateTimeOffset("O");
continue;
}
if (property0.NameEquals("keyVaultProperties"))

Просмотреть файл

@ -24,7 +24,7 @@ namespace Azure.Management.Storage.Models
if (LastEnabledTime != null)
{
writer.WritePropertyName("lastEnabledTime");
writer.WriteStringValue(LastEnabledTime.Value, "S");
writer.WriteStringValue(LastEnabledTime.Value, "O");
}
if (KeyType != null)
{
@ -56,7 +56,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
lastEnabledTime = property.Value.GetDateTimeOffset("S");
lastEnabledTime = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("keyType"))

Просмотреть файл

@ -42,7 +42,7 @@ namespace Azure.Management.Storage.Models
if (LastModifiedTime != null)
{
writer.WritePropertyName("lastModifiedTime");
writer.WriteStringValue(LastModifiedTime.Value, "S");
writer.WriteStringValue(LastModifiedTime.Value, "O");
}
if (Metadata != null)
{
@ -83,7 +83,7 @@ namespace Azure.Management.Storage.Models
if (DeletedTime != null)
{
writer.WritePropertyName("deletedTime");
writer.WriteStringValue(DeletedTime.Value, "S");
writer.WriteStringValue(DeletedTime.Value, "O");
}
if (RemainingRetentionDays != null)
{
@ -98,7 +98,7 @@ namespace Azure.Management.Storage.Models
if (AccessTierChangeTime != null)
{
writer.WritePropertyName("accessTierChangeTime");
writer.WriteStringValue(AccessTierChangeTime.Value, "S");
writer.WriteStringValue(AccessTierChangeTime.Value, "O");
}
if (AccessTierStatus != null)
{
@ -181,7 +181,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
lastModifiedTime = property0.Value.GetDateTimeOffset("S");
lastModifiedTime = property0.Value.GetDateTimeOffset("O");
continue;
}
if (property0.NameEquals("metadata"))
@ -256,7 +256,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
deletedTime = property0.Value.GetDateTimeOffset("S");
deletedTime = property0.Value.GetDateTimeOffset("O");
continue;
}
if (property0.NameEquals("remainingRetentionDays"))
@ -283,7 +283,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
accessTierChangeTime = property0.Value.GetDateTimeOffset("S");
accessTierChangeTime = property0.Value.GetDateTimeOffset("O");
continue;
}
if (property0.NameEquals("accessTierStatus"))

Просмотреть файл

@ -42,7 +42,7 @@ namespace Azure.Management.Storage.Models
if (LastModifiedTime != null)
{
writer.WritePropertyName("lastModifiedTime");
writer.WriteStringValue(LastModifiedTime.Value, "S");
writer.WriteStringValue(LastModifiedTime.Value, "O");
}
if (Metadata != null)
{
@ -83,7 +83,7 @@ namespace Azure.Management.Storage.Models
if (DeletedTime != null)
{
writer.WritePropertyName("deletedTime");
writer.WriteStringValue(DeletedTime.Value, "S");
writer.WriteStringValue(DeletedTime.Value, "O");
}
if (RemainingRetentionDays != null)
{
@ -98,7 +98,7 @@ namespace Azure.Management.Storage.Models
if (AccessTierChangeTime != null)
{
writer.WritePropertyName("accessTierChangeTime");
writer.WriteStringValue(AccessTierChangeTime.Value, "S");
writer.WriteStringValue(AccessTierChangeTime.Value, "O");
}
if (AccessTierStatus != null)
{
@ -181,7 +181,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
lastModifiedTime = property0.Value.GetDateTimeOffset("S");
lastModifiedTime = property0.Value.GetDateTimeOffset("O");
continue;
}
if (property0.NameEquals("metadata"))
@ -256,7 +256,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
deletedTime = property0.Value.GetDateTimeOffset("S");
deletedTime = property0.Value.GetDateTimeOffset("O");
continue;
}
if (property0.NameEquals("remainingRetentionDays"))
@ -283,7 +283,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
accessTierChangeTime = property0.Value.GetDateTimeOffset("S");
accessTierChangeTime = property0.Value.GetDateTimeOffset("O");
continue;
}
if (property0.NameEquals("accessTierStatus"))

Просмотреть файл

@ -24,7 +24,7 @@ namespace Azure.Management.Storage.Models
if (LastSyncTime != null)
{
writer.WritePropertyName("lastSyncTime");
writer.WriteStringValue(LastSyncTime.Value, "S");
writer.WriteStringValue(LastSyncTime.Value, "O");
}
if (CanFailover != null)
{
@ -56,7 +56,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
lastSyncTime = property.Value.GetDateTimeOffset("S");
lastSyncTime = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("canFailover"))

Просмотреть файл

@ -39,7 +39,7 @@ namespace Azure.Management.Storage.Models
if (LastKeyRotationTimestamp != null)
{
writer.WritePropertyName("lastKeyRotationTimestamp");
writer.WriteStringValue(LastKeyRotationTimestamp.Value, "S");
writer.WriteStringValue(LastKeyRotationTimestamp.Value, "O");
}
writer.WriteEndObject();
}
@ -95,7 +95,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
lastKeyRotationTimestamp = property.Value.GetDateTimeOffset("S");
lastKeyRotationTimestamp = property.Value.GetDateTimeOffset("O");
continue;
}
}

Просмотреть файл

@ -57,7 +57,7 @@ namespace Azure.Management.Storage.Models
if (LastModifiedTime != null)
{
writer.WritePropertyName("lastModifiedTime");
writer.WriteStringValue(LastModifiedTime.Value, "S");
writer.WriteStringValue(LastModifiedTime.Value, "O");
}
if (LeaseStatus != null)
{
@ -202,7 +202,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
lastModifiedTime = property0.Value.GetDateTimeOffset("S");
lastModifiedTime = property0.Value.GetDateTimeOffset("O");
continue;
}
if (property0.NameEquals("leaseStatus"))

Просмотреть файл

@ -36,7 +36,7 @@ namespace Azure.Management.Storage.Models
if (LastModifiedTime != null)
{
writer.WritePropertyName("lastModifiedTime");
writer.WriteStringValue(LastModifiedTime.Value, "S");
writer.WriteStringValue(LastModifiedTime.Value, "O");
}
if (Policy != null)
{
@ -93,7 +93,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
lastModifiedTime = property0.Value.GetDateTimeOffset("S");
lastModifiedTime = property0.Value.GetDateTimeOffset("O");
continue;
}
if (property0.NameEquals("policy"))

Просмотреть файл

@ -42,7 +42,7 @@ namespace Azure.Management.Storage.Models
if (EnabledTime != null)
{
writer.WritePropertyName("enabledTime");
writer.WriteStringValue(EnabledTime.Value, "S");
writer.WriteStringValue(EnabledTime.Value, "O");
}
if (SourceAccount != null)
{
@ -126,7 +126,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
enabledTime = property0.Value.GetDateTimeOffset("S");
enabledTime = property0.Value.GetDateTimeOffset("O");
continue;
}
if (property0.NameEquals("sourceAccount"))

Просмотреть файл

@ -26,7 +26,7 @@ namespace Azure.Management.Storage.Models
if (LastEnabledTime != null)
{
writer.WritePropertyName("lastEnabledTime");
writer.WriteStringValue(LastEnabledTime.Value, "S");
writer.WriteStringValue(LastEnabledTime.Value, "O");
}
writer.WriteEndObject();
}
@ -58,7 +58,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
lastEnabledTime = property.Value.GetDateTimeOffset("S");
lastEnabledTime = property.Value.GetDateTimeOffset("O");
continue;
}
}

Просмотреть файл

@ -40,12 +40,12 @@ namespace Azure.Management.Storage.Models
if (SharedAccessStartTime != null)
{
writer.WritePropertyName("signedStart");
writer.WriteStringValue(SharedAccessStartTime.Value, "S");
writer.WriteStringValue(SharedAccessStartTime.Value, "O");
}
if (SharedAccessExpiryTime != null)
{
writer.WritePropertyName("signedExpiry");
writer.WriteStringValue(SharedAccessExpiryTime.Value, "S");
writer.WriteStringValue(SharedAccessExpiryTime.Value, "O");
}
if (Identifier != null)
{

Просмотреть файл

@ -85,7 +85,7 @@ namespace Azure.Management.Storage.Models
if (LastGeoFailoverTime != null)
{
writer.WritePropertyName("lastGeoFailoverTime");
writer.WriteStringValue(LastGeoFailoverTime.Value, "S");
writer.WriteStringValue(LastGeoFailoverTime.Value, "O");
}
if (SecondaryLocation != null)
{
@ -100,7 +100,7 @@ namespace Azure.Management.Storage.Models
if (CreationTime != null)
{
writer.WritePropertyName("creationTime");
writer.WriteStringValue(CreationTime.Value, "S");
writer.WriteStringValue(CreationTime.Value, "O");
}
if (CustomDomain != null)
{
@ -341,7 +341,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
lastGeoFailoverTime = property0.Value.GetDateTimeOffset("S");
lastGeoFailoverTime = property0.Value.GetDateTimeOffset("O");
continue;
}
if (property0.NameEquals("secondaryLocation"))
@ -368,7 +368,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
creationTime = property0.Value.GetDateTimeOffset("S");
creationTime = property0.Value.GetDateTimeOffset("O");
continue;
}
if (property0.NameEquals("customDomain"))

Просмотреть файл

@ -24,7 +24,7 @@ namespace Azure.Management.Storage.Models
if (Timestamp != null)
{
writer.WritePropertyName("timestamp");
writer.WriteStringValue(Timestamp.Value, "S");
writer.WriteStringValue(Timestamp.Value, "O");
}
if (ObjectIdentifier != null)
{
@ -68,7 +68,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
timestamp = property.Value.GetDateTimeOffset("S");
timestamp = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("objectIdentifier"))

Просмотреть файл

@ -29,7 +29,7 @@ namespace Azure.Management.Storage.Models
if (Timestamp != null)
{
writer.WritePropertyName("timestamp");
writer.WriteStringValue(Timestamp.Value, "S");
writer.WriteStringValue(Timestamp.Value, "O");
}
if (ObjectIdentifier != null)
{
@ -83,7 +83,7 @@ namespace Azure.Management.Storage.Models
{
continue;
}
timestamp = property.Value.GetDateTimeOffset("S");
timestamp = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("objectIdentifier"))

Просмотреть файл

@ -18,10 +18,10 @@ namespace Azure.Storage.Tables.Models
{
writer.WriteStartElement(nameHint ?? "AccessPolicy");
writer.WriteStartElement("Start");
writer.WriteValue(Start, "S");
writer.WriteValue(Start, "O");
writer.WriteEndElement();
writer.WriteStartElement("Expiry");
writer.WriteValue(Expiry, "S");
writer.WriteValue(Expiry, "O");
writer.WriteEndElement();
writer.WriteStartElement("Permission");
writer.WriteValue(Permission);
@ -36,11 +36,11 @@ namespace Azure.Storage.Tables.Models
string permission = default;
if (element.Element("Start") is XElement startElement)
{
start = startElement.GetDateTimeOffsetValue("S");
start = startElement.GetDateTimeOffsetValue("O");
}
if (element.Element("Expiry") is XElement expiryElement)
{
expiry = expiryElement.GetDateTimeOffsetValue("S");
expiry = expiryElement.GetDateTimeOffsetValue("O");
}
if (element.Element("Permission") is XElement permissionElement)
{

Просмотреть файл

@ -48,7 +48,7 @@ namespace CognitiveSearch.Models
{
continue;
}
startTime = property.Value.GetDateTimeOffset("S");
startTime = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("endTime"))
@ -57,7 +57,7 @@ namespace CognitiveSearch.Models
{
continue;
}
endTime = property.Value.GetDateTimeOffset("S");
endTime = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("errors"))

Просмотреть файл

@ -21,7 +21,7 @@ namespace CognitiveSearch.Models
if (StartTime != null)
{
writer.WritePropertyName("startTime");
writer.WriteStringValue(StartTime.Value, "S");
writer.WriteStringValue(StartTime.Value, "O");
}
writer.WriteEndObject();
}
@ -43,7 +43,7 @@ namespace CognitiveSearch.Models
{
continue;
}
startTime = property.Value.GetDateTimeOffset("S");
startTime = property.Value.GetDateTimeOffset("O");
continue;
}
}

Просмотреть файл

@ -507,7 +507,7 @@ namespace AutoRest.CSharp.V3.Generation.Writers
public static string? ToFormatSpecifier(this SerializationFormat format) => format switch
{
SerializationFormat.DateTime_RFC1123 => "R",
SerializationFormat.DateTime_ISO8601 => "S",
SerializationFormat.DateTime_ISO8601 => "O",
SerializationFormat.Date_ISO8601 => "D",
SerializationFormat.DateTime_Unix => "U",
SerializationFormat.Bytes_Base64Url => "U",

Просмотреть файл

@ -64,18 +64,12 @@ namespace Azure.Core
public static DateTimeOffset GetDateTimeOffset(in this JsonElement element, string format) => format switch
{
"D" => element.GetDateTimeOffset(),
"S" => DateTimeOffset.Parse(element.GetString(), CultureInfo.InvariantCulture),
"R" => DateTimeOffset.Parse(element.GetString(), CultureInfo.InvariantCulture),
"U" => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()),
_ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format))
_ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format)
};
public static TimeSpan GetTimeSpan(in this JsonElement element, string format) => format switch
{
"P" => XmlConvert.ToTimeSpan(element.GetString()),
"T" => TimeSpan.ParseExact(element.GetString(), "T", CultureInfo.InvariantCulture),
_ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format))
};
public static TimeSpan GetTimeSpan(in this JsonElement element, string format) =>
TypeFormatters.ParseTimeSpan(element.GetString(), format);
public static char GetChar(this in JsonElement element)
{

Просмотреть файл

@ -18,18 +18,14 @@ namespace Azure.Core
public static string ToString(DateTimeOffset value, string format) => format switch
{
"D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture),
"S" when value.Offset == TimeSpan.Zero => value.ToString("yyyy-MM-ddTHH:mm:ss.fffZ", CultureInfo.InvariantCulture),
"S" => value.ToString("O", CultureInfo.InvariantCulture),
"R" => value.ToString("R", CultureInfo.InvariantCulture),
"U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture),
_ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format))
_ => value.ToString(format, CultureInfo.InvariantCulture)
};
public static string ToString(TimeSpan value, string format) => format switch
{
"P" => XmlConvert.ToString(value),
"T" => value.ToString("T", CultureInfo.InvariantCulture),
_ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format))
_ => value.ToString(format, CultureInfo.InvariantCulture)
};
public static string ToBase64UrlString(byte[] value)
@ -110,5 +106,14 @@ namespace Azure.Core
throw new InvalidOperationException("Malformed input");
}
}
public static DateTimeOffset ParseDateTimeOffset(string value, string format) =>
DateTimeOffset.Parse(value, CultureInfo.InvariantCulture);
public static TimeSpan ParseTimeSpan(string value, string format) => format switch
{
"P" => XmlConvert.ToTimeSpan(value),
_ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture)
};
}
}

Просмотреть файл

@ -76,10 +76,10 @@ namespace Azure.Core
writer.WriteStringValue(g);
break;
case DateTimeOffset dateTimeOffset:
writer.WriteStringValue(dateTimeOffset,"S");
writer.WriteStringValue(dateTimeOffset,"O");
break;
case DateTime dateTime:
writer.WriteStringValue(dateTime, "S");
writer.WriteStringValue(dateTime, "O");
break;
case IEnumerable<KeyValuePair<string, object>> enumerable:
writer.WriteStartObject();

Просмотреть файл

@ -20,19 +20,11 @@ namespace Azure.Core
public static DateTimeOffset GetDateTimeOffsetValue(this XElement element, string format) => format switch
{
"D" => (DateTimeOffset)element,
"S" => DateTimeOffset.Parse(element.Value, CultureInfo.InvariantCulture),
"R" => DateTimeOffset.Parse(element.Value, CultureInfo.InvariantCulture),
"U" => DateTimeOffset.FromUnixTimeSeconds((long)element),
_ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format))
};
public static TimeSpan GetTimeSpanValue(this XElement element, string format) => format switch
{
"P" => XmlConvert.ToTimeSpan(element.Value),
_ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format))
_ => TypeFormatters.ParseDateTimeOffset(element.Value, format)
};
public static TimeSpan GetTimeSpanValue(this XElement element, string format) => TypeFormatters.ParseTimeSpan(element.Value, format);
#pragma warning disable CA1801 //Parameter format of method GetObjectValue is never used. Remove the parameter or use it in the method body.
public static object GetObjectValue(this XElement element, string format)
#pragma warning restore

Просмотреть файл

@ -2932,7 +2932,7 @@ namespace body_array
List<DateTimeOffset> array = new List<DateTimeOffset>();
foreach (var item in document.RootElement.EnumerateArray())
{
array.Add(item.GetDateTimeOffset("S"));
array.Add(item.GetDateTimeOffset("O"));
}
value = array;
}
@ -2964,7 +2964,7 @@ namespace body_array
List<DateTimeOffset> array = new List<DateTimeOffset>();
foreach (var item in document.RootElement.EnumerateArray())
{
array.Add(item.GetDateTimeOffset("S"));
array.Add(item.GetDateTimeOffset("O"));
}
value = array;
}
@ -2989,7 +2989,7 @@ namespace body_array
content.JsonWriter.WriteStartArray();
foreach (var item in arrayBody)
{
content.JsonWriter.WriteStringValue(item, "S");
content.JsonWriter.WriteStringValue(item, "O");
}
content.JsonWriter.WriteEndArray();
request.Content = content;
@ -3071,7 +3071,7 @@ namespace body_array
List<DateTimeOffset> array = new List<DateTimeOffset>();
foreach (var item in document.RootElement.EnumerateArray())
{
array.Add(item.GetDateTimeOffset("S"));
array.Add(item.GetDateTimeOffset("O"));
}
value = array;
}
@ -3103,7 +3103,7 @@ namespace body_array
List<DateTimeOffset> array = new List<DateTimeOffset>();
foreach (var item in document.RootElement.EnumerateArray())
{
array.Add(item.GetDateTimeOffset("S"));
array.Add(item.GetDateTimeOffset("O"));
}
value = array;
}
@ -3147,7 +3147,7 @@ namespace body_array
List<DateTimeOffset> array = new List<DateTimeOffset>();
foreach (var item in document.RootElement.EnumerateArray())
{
array.Add(item.GetDateTimeOffset("S"));
array.Add(item.GetDateTimeOffset("O"));
}
value = array;
}
@ -3179,7 +3179,7 @@ namespace body_array
List<DateTimeOffset> array = new List<DateTimeOffset>();
foreach (var item in document.RootElement.EnumerateArray())
{
array.Add(item.GetDateTimeOffset("S"));
array.Add(item.GetDateTimeOffset("O"));
}
value = array;
}

Просмотреть файл

@ -23,7 +23,7 @@ namespace body_complex.Models
writer.WriteNumberValue(Age.Value);
}
writer.WritePropertyName("birthday");
writer.WriteStringValue(Birthday, "S");
writer.WriteStringValue(Birthday, "O");
writer.WritePropertyName("fishtype");
writer.WriteStringValue(Fishtype);
if (Species != null)
@ -67,7 +67,7 @@ namespace body_complex.Models
}
if (property.NameEquals("birthday"))
{
birthday = property.Value.GetDateTimeOffset("S");
birthday = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("fishtype"))

Просмотреть файл

@ -19,12 +19,12 @@ namespace body_complex.Models
if (Field != null)
{
writer.WritePropertyName("field");
writer.WriteStringValue(Field.Value, "S");
writer.WriteStringValue(Field.Value, "O");
}
if (Now != null)
{
writer.WritePropertyName("now");
writer.WriteStringValue(Now.Value, "S");
writer.WriteStringValue(Now.Value, "O");
}
writer.WriteEndObject();
}
@ -41,7 +41,7 @@ namespace body_complex.Models
{
continue;
}
field = property.Value.GetDateTimeOffset("S");
field = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("now"))
@ -50,7 +50,7 @@ namespace body_complex.Models
{
continue;
}
now = property.Value.GetDateTimeOffset("S");
now = property.Value.GetDateTimeOffset("O");
continue;
}
}

Просмотреть файл

@ -33,7 +33,7 @@ namespace body_complex.Models
writer.WriteNumberValue(Age.Value);
}
writer.WritePropertyName("birthday");
writer.WriteStringValue(Birthday, "S");
writer.WriteStringValue(Birthday, "O");
writer.WritePropertyName("fishtype");
writer.WriteStringValue(Fishtype);
if (Species != null)
@ -97,7 +97,7 @@ namespace body_complex.Models
}
if (property.NameEquals("birthday"))
{
birthday = property.Value.GetDateTimeOffset("S");
birthday = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("fishtype"))

Просмотреть файл

@ -28,7 +28,7 @@ namespace body_complex.Models
writer.WriteNumberValue(Age.Value);
}
writer.WritePropertyName("birthday");
writer.WriteStringValue(Birthday, "S");
writer.WriteStringValue(Birthday, "O");
writer.WritePropertyName("fishtype");
writer.WriteStringValue(Fishtype);
if (Species != null)
@ -82,7 +82,7 @@ namespace body_complex.Models
}
if (property.NameEquals("birthday"))
{
birthday = property.Value.GetDateTimeOffset("S");
birthday = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("fishtype"))

Просмотреть файл

@ -23,7 +23,7 @@ namespace body_complex.Models
writer.WriteNumberValue(Age.Value);
}
writer.WritePropertyName("birthday");
writer.WriteStringValue(Birthday, "S");
writer.WriteStringValue(Birthday, "O");
writer.WritePropertyName("fishtype");
writer.WriteStringValue(Fishtype);
if (Species != null)
@ -76,7 +76,7 @@ namespace body_complex.Models
}
if (property.NameEquals("birthday"))
{
birthday = property.Value.GetDateTimeOffset("S");
birthday = property.Value.GetDateTimeOffset("O");
continue;
}
if (property.NameEquals("fishtype"))

Просмотреть файл

@ -58,7 +58,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -78,7 +78,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -110,7 +110,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -130,7 +130,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -162,7 +162,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -182,7 +182,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -214,7 +214,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -234,7 +234,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -253,7 +253,7 @@ namespace body_datetime
request.Uri = uri;
request.Headers.Add("Content-Type", "application/json");
using var content = new Utf8JsonRequestContent();
content.JsonWriter.WriteStringValue(datetimeBody, "S");
content.JsonWriter.WriteStringValue(datetimeBody, "O");
request.Content = content;
return message;
}
@ -301,7 +301,7 @@ namespace body_datetime
request.Uri = uri;
request.Headers.Add("Content-Type", "application/json");
using var content = new Utf8JsonRequestContent();
content.JsonWriter.WriteStringValue(datetimeBody, "S");
content.JsonWriter.WriteStringValue(datetimeBody, "O");
request.Content = content;
return message;
}
@ -362,7 +362,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -382,7 +382,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -414,7 +414,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -434,7 +434,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -466,7 +466,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -486,7 +486,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -505,7 +505,7 @@ namespace body_datetime
request.Uri = uri;
request.Headers.Add("Content-Type", "application/json");
using var content = new Utf8JsonRequestContent();
content.JsonWriter.WriteStringValue(datetimeBody, "S");
content.JsonWriter.WriteStringValue(datetimeBody, "O");
request.Content = content;
return message;
}
@ -566,7 +566,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -586,7 +586,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -618,7 +618,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -638,7 +638,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -657,7 +657,7 @@ namespace body_datetime
request.Uri = uri;
request.Headers.Add("Content-Type", "application/json");
using var content = new Utf8JsonRequestContent();
content.JsonWriter.WriteStringValue(datetimeBody, "S");
content.JsonWriter.WriteStringValue(datetimeBody, "O");
request.Content = content;
return message;
}
@ -718,7 +718,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -738,7 +738,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -770,7 +770,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -790,7 +790,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -809,7 +809,7 @@ namespace body_datetime
request.Uri = uri;
request.Headers.Add("Content-Type", "application/json");
using var content = new Utf8JsonRequestContent();
content.JsonWriter.WriteStringValue(datetimeBody, "S");
content.JsonWriter.WriteStringValue(datetimeBody, "O");
request.Content = content;
return message;
}
@ -870,7 +870,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -890,7 +890,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -909,7 +909,7 @@ namespace body_datetime
request.Uri = uri;
request.Headers.Add("Content-Type", "application/json");
using var content = new Utf8JsonRequestContent();
content.JsonWriter.WriteStringValue(datetimeBody, "S");
content.JsonWriter.WriteStringValue(datetimeBody, "O");
request.Content = content;
return message;
}
@ -970,7 +970,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -990,7 +990,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -1009,7 +1009,7 @@ namespace body_datetime
request.Uri = uri;
request.Headers.Add("Content-Type", "application/json");
using var content = new Utf8JsonRequestContent();
content.JsonWriter.WriteStringValue(datetimeBody, "S");
content.JsonWriter.WriteStringValue(datetimeBody, "O");
request.Content = content;
return message;
}
@ -1070,7 +1070,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:
@ -1090,7 +1090,7 @@ namespace body_datetime
{
DateTimeOffset value = default;
using var document = JsonDocument.Parse(message.Response.ContentStream);
value = document.RootElement.GetDateTimeOffset("S");
value = document.RootElement.GetDateTimeOffset("O");
return Response.FromValue(value, message.Response);
}
default:

Просмотреть файл

@ -2731,7 +2731,7 @@ namespace body_dictionary
Dictionary<string, DateTimeOffset> dictionary = new Dictionary<string, DateTimeOffset>();
foreach (var property in document.RootElement.EnumerateObject())
{
dictionary.Add(property.Name, property.Value.GetDateTimeOffset("S"));
dictionary.Add(property.Name, property.Value.GetDateTimeOffset("O"));
}
value = dictionary;
}
@ -2763,7 +2763,7 @@ namespace body_dictionary
Dictionary<string, DateTimeOffset> dictionary = new Dictionary<string, DateTimeOffset>();
foreach (var property in document.RootElement.EnumerateObject())
{
dictionary.Add(property.Name, property.Value.GetDateTimeOffset("S"));
dictionary.Add(property.Name, property.Value.GetDateTimeOffset("O"));
}
value = dictionary;
}
@ -2789,7 +2789,7 @@ namespace body_dictionary
foreach (var item in arrayBody)
{
content.JsonWriter.WritePropertyName(item.Key);
content.JsonWriter.WriteStringValue(item.Value, "S");
content.JsonWriter.WriteStringValue(item.Value, "O");
}
content.JsonWriter.WriteEndObject();
request.Content = content;
@ -2871,7 +2871,7 @@ namespace body_dictionary
Dictionary<string, DateTimeOffset> dictionary = new Dictionary<string, DateTimeOffset>();
foreach (var property in document.RootElement.EnumerateObject())
{
dictionary.Add(property.Name, property.Value.GetDateTimeOffset("S"));
dictionary.Add(property.Name, property.Value.GetDateTimeOffset("O"));
}
value = dictionary;
}
@ -2903,7 +2903,7 @@ namespace body_dictionary
Dictionary<string, DateTimeOffset> dictionary = new Dictionary<string, DateTimeOffset>();
foreach (var property in document.RootElement.EnumerateObject())
{
dictionary.Add(property.Name, property.Value.GetDateTimeOffset("S"));
dictionary.Add(property.Name, property.Value.GetDateTimeOffset("O"));
}
value = dictionary;
}
@ -2947,7 +2947,7 @@ namespace body_dictionary
Dictionary<string, DateTimeOffset> dictionary = new Dictionary<string, DateTimeOffset>();
foreach (var property in document.RootElement.EnumerateObject())
{
dictionary.Add(property.Name, property.Value.GetDateTimeOffset("S"));
dictionary.Add(property.Name, property.Value.GetDateTimeOffset("O"));
}
value = dictionary;
}
@ -2979,7 +2979,7 @@ namespace body_dictionary
Dictionary<string, DateTimeOffset> dictionary = new Dictionary<string, DateTimeOffset>();
foreach (var property in document.RootElement.EnumerateObject())
{
dictionary.Add(property.Name, property.Value.GetDateTimeOffset("S"));
dictionary.Add(property.Name, property.Value.GetDateTimeOffset("O"));
}
value = dictionary;
}

Просмотреть файл

@ -1050,7 +1050,7 @@ namespace header
uri.AppendPath("/header/param/prim/datetime", false);
request.Uri = uri;
request.Headers.Add("scenario", scenario);
request.Headers.Add("value", value, "S");
request.Headers.Add("value", value, "O");
return message;
}

Просмотреть файл

@ -1031,7 +1031,7 @@ namespace url
var uri = new RawRequestUriBuilder();
uri.AppendRaw(host, false);
uri.AppendPath("/paths/datetime/2012-01-01T01%3A01%3A01Z/", false);
uri.AppendPath(new DateTimeOffset(2012, 1, 1, 1, 1, 1, 0, TimeSpan.Zero), "S", true);
uri.AppendPath(new DateTimeOffset(2012, 1, 1, 1, 1, 1, 0, TimeSpan.Zero), "O", true);
request.Uri = uri;
return message;
}
@ -1074,7 +1074,7 @@ namespace url
var uri = new RawRequestUriBuilder();
uri.AppendRaw(host, false);
uri.AppendPath("/paths/datetime/null/", false);
uri.AppendPath(dateTimePath, "S", true);
uri.AppendPath(dateTimePath, "O", true);
request.Uri = uri;
return message;
}

Просмотреть файл

@ -1216,7 +1216,7 @@ namespace url
var uri = new RawRequestUriBuilder();
uri.AppendRaw(host, false);
uri.AppendPath("/queries/datetime/2012-01-01T01%3A01%3A01Z", false);
uri.AppendQuery("dateTimeQuery", new DateTimeOffset(2012, 1, 1, 1, 1, 1, 0, TimeSpan.Zero), "S", true);
uri.AppendQuery("dateTimeQuery", new DateTimeOffset(2012, 1, 1, 1, 1, 1, 0, TimeSpan.Zero), "O", true);
request.Uri = uri;
return message;
}
@ -1261,7 +1261,7 @@ namespace url
uri.AppendPath("/queries/datetime/null", false);
if (dateTimeQuery != null)
{
uri.AppendQuery("dateTimeQuery", dateTimeQuery.Value, "S", true);
uri.AppendQuery("dateTimeQuery", dateTimeQuery.Value, "O", true);
}
request.Uri = uri;
return message;

Просмотреть файл

@ -18,10 +18,10 @@ namespace xml_service.Models
{
writer.WriteStartElement(nameHint ?? "AccessPolicy");
writer.WriteStartElement("Start");
writer.WriteValue(Start, "S");
writer.WriteValue(Start, "O");
writer.WriteEndElement();
writer.WriteStartElement("Expiry");
writer.WriteValue(Expiry, "S");
writer.WriteValue(Expiry, "O");
writer.WriteEndElement();
writer.WriteStartElement("Permission");
writer.WriteValue(Permission);
@ -36,11 +36,11 @@ namespace xml_service.Models
string permission = default;
if (element.Element("Start") is XElement startElement)
{
start = startElement.GetDateTimeOffsetValue("S");
start = startElement.GetDateTimeOffsetValue("O");
}
if (element.Element("Expiry") is XElement expiryElement)
{
expiry = expiryElement.GetDateTimeOffsetValue("S");
expiry = expiryElement.GetDateTimeOffsetValue("O");
}
if (element.Element("Permission") is XElement permissionElement)
{

Просмотреть файл

@ -32,7 +32,7 @@ namespace xml_service.Models
if (Expiration != null)
{
writer.WriteStartElement("expiration");
writer.WriteValue(Expiration.Value, "S");
writer.WriteValue(Expiration.Value, "O");
writer.WriteEndElement();
}
writer.WriteEndElement();
@ -53,7 +53,7 @@ namespace xml_service.Models
}
if (element.Element("expiration") is XElement expirationElement)
{
expiration = expirationElement.GetDateTimeOffsetValue("S");
expiration = expirationElement.GetDateTimeOffsetValue("O");
}
return new Banana(name, flavor, expiration);
}