mirror of
https://github.com/LukeHagar/plexcsharp.git
synced 2025-12-06 20:47:49 +00:00
ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.129.1
This commit is contained in:
41
PlexAPI/Utils/IsoDateTimeSerializer.cs
Normal file
41
PlexAPI/Utils/IsoDateTimeSerializer.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace PlexAPI.Utils
|
||||
{
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
internal class IsoDateTimeSerializer: JsonConverter
|
||||
{
|
||||
public override bool CanConvert(Type objectType) =>
|
||||
objectType == typeof(DateTime);
|
||||
|
||||
public override bool CanRead => false;
|
||||
|
||||
public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer) =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
writer.WriteValue("null");
|
||||
return;
|
||||
}
|
||||
|
||||
DateTime time = (DateTime)value;
|
||||
// The built-in Iso converter coerces to local time;
|
||||
// This standardizes to UTC.
|
||||
writer.WriteValue(time.ToUniversalTime().ToString("o", CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user