From 411b44ff7619d2279c11411422d19d869a6ae186 Mon Sep 17 00:00:00 2001 From: Seth Hendrick Date: Wed, 27 Nov 2024 11:12:22 -0500 Subject: [PATCH] Do not include embedded content if its not specified. Leave null --- src/X.Bluesky/BlueskyClient.cs | 5 +++-- src/X.Bluesky/Models/Post.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/X.Bluesky/BlueskyClient.cs b/src/X.Bluesky/BlueskyClient.cs index e9dcf85..e6c97f4 100644 --- a/src/X.Bluesky/BlueskyClient.cs +++ b/src/X.Bluesky/BlueskyClient.cs @@ -1,4 +1,5 @@ using System.Collections.Frozen; +using System.Globalization; using System.Net.Http.Headers; using System.Security.Authentication; using System.Text; @@ -127,7 +128,7 @@ private async Task CreatePost(string text, Uri? url) } // Fetch the current time in ISO 8601 format, with "Z" to denote UTC - var now = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ"); + var now = DateTime.UtcNow.ToString("o", CultureInfo.InvariantCulture); var facetBuilder = new FacetBuilder(); var facets = facetBuilder.GetFacets(text); @@ -212,4 +213,4 @@ private async Task CreatePost(string text, Uri? url) // This throws an exception if the HTTP response status is an error code. response.EnsureSuccessStatusCode(); } -} \ No newline at end of file +} diff --git a/src/X.Bluesky/Models/Post.cs b/src/X.Bluesky/Models/Post.cs index 4d66f16..4be2790 100644 --- a/src/X.Bluesky/Models/Post.cs +++ b/src/X.Bluesky/Models/Post.cs @@ -11,7 +11,7 @@ public record Post public string CreatedAt { get; set; } = ""; - public Embed Embed { get; set; } = new(); + public Embed? Embed { get; set; } = null; public List Langs { get; set; } = new();