diff --git a/Src/Notion.Client/Models/Blocks/Color.cs b/Src/Notion.Client/Models/Blocks/Color.cs
index 46e38e2..ec6cc28 100644
--- a/Src/Notion.Client/Models/Blocks/Color.cs
+++ b/Src/Notion.Client/Models/Blocks/Color.cs
@@ -39,6 +39,9 @@ public enum Color
[EnumMember(Value = "gray_background")]
GrayBackground,
+ [EnumMember(Value = "default_background")]
+ DefaultBackground,
+
[EnumMember(Value = "brown_background")]
BrownBackground,
diff --git a/Src/Notion.Client/Models/CustomEmojiObject.cs b/Src/Notion.Client/Models/CustomEmojiObject.cs
new file mode 100644
index 0000000..f682b65
--- /dev/null
+++ b/Src/Notion.Client/Models/CustomEmojiObject.cs
@@ -0,0 +1,25 @@
+using Newtonsoft.Json;
+
+namespace Notion.Client
+{
+ public class CustomEmojiObject : IPageIcon
+ {
+ [JsonProperty("type")]
+ public virtual string Type { get; set; }
+
+ [JsonProperty("custom_emoji")]
+ public Info Emoji { get; set; }
+
+ public class Info
+ {
+ [JsonProperty("id")]
+ public string Id { get; set; }
+
+ [JsonProperty("name")]
+ public string Name { get; set; }
+
+ [JsonProperty("url")]
+ public string Url { get; set; }
+ }
+ }
+}
diff --git a/Src/Notion.Client/Models/Page/IPageIcon.cs b/Src/Notion.Client/Models/Page/IPageIcon.cs
index b9ebea5..44f8385 100644
--- a/Src/Notion.Client/Models/Page/IPageIcon.cs
+++ b/Src/Notion.Client/Models/Page/IPageIcon.cs
@@ -7,6 +7,7 @@ namespace Notion.Client
[JsonSubtypes.KnownSubTypeAttribute(typeof(EmojiObject), "emoji")]
[JsonSubtypes.KnownSubTypeAttribute(typeof(FileObject), "file")]
[JsonSubtypes.KnownSubTypeAttribute(typeof(FileObject), "external")]
+ [JsonSubtypes.KnownSubTypeAttribute(typeof(CustomEmojiObject), "custom_emoji")]
public interface IPageIcon
{
[JsonProperty("type")]
diff --git a/Src/Notion.Client/Notion.Client.csproj b/Src/Notion.Client/Notion.Client.csproj
index c7e96e0..95626f9 100644
--- a/Src/Notion.Client/Notion.Client.csproj
+++ b/Src/Notion.Client/Notion.Client.csproj
@@ -16,13 +16,13 @@
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
+
+
+
+
diff --git a/Src/Notion.Client/RestClient/RestClient.cs b/Src/Notion.Client/RestClient/RestClient.cs
index 59a848f..1874dd7 100644
--- a/Src/Notion.Client/RestClient/RestClient.cs
+++ b/Src/Notion.Client/RestClient/RestClient.cs
@@ -22,8 +22,6 @@ public class RestClient : IRestClient
ContractResolver = new DefaultContractResolver { NamingStrategy = new CamelCaseNamingStrategy() }
};
- private HttpClient _httpClient;
-
public RestClient(ClientOptions options)
{
_options = MergeOptions(options);
@@ -36,7 +34,7 @@ public async Task GetAsync(
JsonSerializerSettings serializerSettings = null,
CancellationToken cancellationToken = default)
{
- var response = await SendAsync(uri, HttpMethod.Get, queryParams, headers,
+ using var response = await SendAsync(uri, HttpMethod.Get, queryParams, headers,
cancellationToken: cancellationToken);
return await response.ParseStreamAsync(serializerSettings);
@@ -56,7 +54,7 @@ void AttachContent(HttpRequestMessage httpRequest)
Encoding.UTF8, "application/json");
}
- var response = await SendAsync(uri, HttpMethod.Post, queryParams, headers, AttachContent,
+ using var response = await SendAsync(uri, HttpMethod.Post, queryParams, headers, AttachContent,
cancellationToken);
return await response.ParseStreamAsync(serializerSettings);
@@ -76,7 +74,7 @@ void AttachContent(HttpRequestMessage httpRequest)
httpRequest.Content = new StringContent(serializedBody, Encoding.UTF8, "application/json");
}
- var response = await SendAsync(uri, new HttpMethod("PATCH"), queryParams, headers, AttachContent,
+ using var response = await SendAsync(uri, new HttpMethod("PATCH"), queryParams, headers, AttachContent,
cancellationToken);
return await response.ParseStreamAsync(serializerSettings);
@@ -88,7 +86,7 @@ public async Task DeleteAsync(
IDictionary headers = null,
CancellationToken cancellationToken = default)
{
- await SendAsync(uri, HttpMethod.Delete, queryParams, headers, null, cancellationToken);
+ using var _ = await SendAsync(uri, HttpMethod.Delete, queryParams, headers, null, cancellationToken);
}
private static ClientOptions MergeOptions(ClientOptions options)
@@ -141,7 +139,7 @@ private async Task SendAsync(
Action attachContent = null,
CancellationToken cancellationToken = default)
{
- EnsureHttpClient();
+ using var client = GetHttpClient();
requestUri = AddQueryString(requestUri, queryParams);
@@ -156,7 +154,7 @@ private async Task SendAsync(
attachContent?.Invoke(httpRequest);
- var response = await _httpClient.SendAsync(httpRequest, cancellationToken);
+ var response = await client.SendAsync(httpRequest, cancellationToken);
if (!response.IsSuccessStatusCode)
{
@@ -174,17 +172,13 @@ private static void AddHeaders(HttpRequestMessage request, IDictionary> queryParams)