Skip to content

Commit 1671c64

Browse files
committed
PR review changes
1 parent 36362b7 commit 1671c64

30 files changed

Lines changed: 189 additions & 47 deletions

Assets/Plugins/StreamChat/Core/Helpers/EnumeratedStructExt.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,12 @@ internal static class EnumeratedStructExt
1919

2020
return domain?.LoadFromDto(dto.Value) ?? default(TDomain).LoadFromDto(dto.Value);
2121
}
22+
23+
public static TDTO? TrySaveNullableStructToDto<TDomain, TDTO>(this TDomain? domain)
24+
where TDomain : struct, IEquatable<TDomain>, ISavableTo<TDTO>
25+
where TDTO : struct, IEnumeratedStruct<TDTO>
26+
{
27+
return domain?.SaveToDto();
28+
}
2229
}
2330
}

Assets/Plugins/StreamChat/Core/Helpers/ILoadableFromExt.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System;
2-
using StreamChat.Core.InternalDTO.Models;
32
using StreamChat.Core.LowLevelClient;
4-
using StreamChat.Core.LowLevelClient.Models;
53

64
namespace StreamChat.Core.Helpers
75
{

Assets/Plugins/StreamChat/Core/InternalDTO/Models/ChannelConfigWithInfoInternalDTO.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ internal partial class ChannelConfigWithInfoInternalDTO
2121

2222
[Newtonsoft.Json.JsonProperty("automod", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
2323
[Newtonsoft.Json.JsonConverter(typeof(StreamChat.Core.Serialization.EnumeratedStructConverter<AutomodTypeInternalDTO>))]
24-
public AutomodTypeInternalDTO Automod { get; set; }
24+
public AutomodTypeInternalDTO? Automod { get; set; }
2525

2626
[Newtonsoft.Json.JsonProperty("automod_behavior", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
2727
[Newtonsoft.Json.JsonConverter(typeof(StreamChat.Core.Serialization.EnumeratedStructConverter<AutomodBehaviourTypeInternalDTO>))]
28-
public AutomodBehaviourTypeInternalDTO AutomodBehavior { get; set; }
28+
public AutomodBehaviourTypeInternalDTO? AutomodBehavior { get; set; }
2929

3030
[Newtonsoft.Json.JsonProperty("automod_thresholds", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
3131
public ThresholdsInternalDTO AutomodThresholds { get; set; }

Assets/Plugins/StreamChat/Core/InternalDTO/Models/DeviceInternalDTO.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ internal partial class DeviceInternalDTO
3030

3131
[Newtonsoft.Json.JsonProperty("push_provider", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
3232
[Newtonsoft.Json.JsonConverter(typeof(StreamChat.Core.Serialization.EnumeratedStructConverter<PushProviderTypeInternalDTO>))]
33-
public PushProviderTypeInternalDTO PushProvider { get; set; }
33+
public PushProviderTypeInternalDTO? PushProvider { get; set; }
3434

3535
[Newtonsoft.Json.JsonProperty("push_provider_name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
3636
public string PushProviderName { get; set; }

Assets/Plugins/StreamChat/Core/InternalDTO/Requests/ChannelConfigRequestInternalDTO.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal partial class ChannelConfigRequestInternalDTO
2525

2626
[Newtonsoft.Json.JsonProperty("blocklist_behavior", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
2727
[Newtonsoft.Json.JsonConverter(typeof(StreamChat.Core.Serialization.EnumeratedStructConverter<AutomodBehaviourTypeInternalDTO>))]
28-
public AutomodBehaviourTypeInternalDTO BlocklistBehavior { get; set; }
28+
public AutomodBehaviourTypeInternalDTO? BlocklistBehavior { get; set; }
2929

3030
[Newtonsoft.Json.JsonProperty("commands", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
3131
public System.Collections.Generic.List<string> Commands { get; set; }

Assets/Plugins/StreamChat/Core/InternalDTO/Requests/ImageSizeRequestInternalDTO.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ internal partial class ImageSizeRequestInternalDTO
2222
/// </summary>
2323
[Newtonsoft.Json.JsonProperty("crop", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
2424
[Newtonsoft.Json.JsonConverter(typeof(StreamChat.Core.Serialization.EnumeratedStructConverter<ImageCropTypeInternalDTO>))]
25-
public ImageCropTypeInternalDTO Crop { get; set; }
25+
public ImageCropTypeInternalDTO? Crop { get; set; }
2626

2727
/// <summary>
2828
/// Target image height
@@ -35,7 +35,7 @@ internal partial class ImageSizeRequestInternalDTO
3535
/// </summary>
3636
[Newtonsoft.Json.JsonProperty("resize", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
3737
[Newtonsoft.Json.JsonConverter(typeof(StreamChat.Core.Serialization.EnumeratedStructConverter<ImageResizeTypeInternalDTO>))]
38-
public ImageResizeTypeInternalDTO Resize { get; set; }
38+
public ImageResizeTypeInternalDTO? Resize { get; set; }
3939

4040
/// <summary>
4141
/// Target image width

Assets/Plugins/StreamChat/Core/InternalDTO/Requests/MessageRequestTypeInternalDTO.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace StreamChat.Core.InternalDTO.Requests
1919
{
2020
public string Value { get; }
2121

22-
public static readonly MessageRequestTypeInternalDTO Regular = new MessageRequestTypeInternalDTO("''regular");
22+
public static readonly MessageRequestTypeInternalDTO Regular = new MessageRequestTypeInternalDTO("regular");
2323
public static readonly MessageRequestTypeInternalDTO System = new MessageRequestTypeInternalDTO("system");
2424

2525
public MessageRequestTypeInternalDTO(string value)

Assets/Plugins/StreamChat/Core/LowLevelClient/API/ChannelApi.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ public async Task<SyncResponse> SyncAsync(SyncRequest syncRequest)
148148
return dto.ToDomain<SyncResponseInternalDTO, SyncResponse>();
149149
}
150150

151-
public async Task<StreamCurrentUnreadCounts> GetUnreadCountsAsync()
151+
public async Task<CurrentUnreadCounts> GetUnreadCountsAsync()
152152
{
153153
var dto = await _internalChannelApi.GetUnreadCountsAsync();
154-
return dto.ToDomain<WrappedUnreadCountsResponseInternalDTO, StreamCurrentUnreadCounts>();
154+
return dto.ToDomain<WrappedUnreadCountsResponseInternalDTO, CurrentUnreadCounts>();
155155
}
156156

157157
private readonly IInternalChannelApi _internalChannelApi;

Assets/Plugins/StreamChat/Core/LowLevelClient/API/DeviceApi.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using StreamChat.Core.LowLevelClient.API.Internal;
66
using StreamChat.Core.LowLevelClient.Requests;
77
using StreamChat.Core.LowLevelClient.Responses;
8-
using StreamChat.Core.Requests;
98
using StreamChat.Core.Responses;
109

1110
namespace StreamChat.Core.LowLevelClient.API
@@ -23,10 +22,10 @@ public async Task<ApiResponse> AddDeviceAsync(CreateDeviceRequest device)
2322
return dto.ToDomain<ResponseInternalDTO, ApiResponse>();
2423
}
2524

26-
public async Task<StreamListDevicesResponse> ListDevicesAsync(string userId)
25+
public async Task<ListDevicesResponse> ListDevicesAsync(string userId)
2726
{
2827
var dto = await _internalDeviceApi.ListDevicesAsync(userId);
29-
return dto.ToDomain<ListDevicesResponseInternalDTO, StreamListDevicesResponse>();
28+
return dto.ToDomain<ListDevicesResponseInternalDTO, ListDevicesResponse>();
3029
}
3130

3231

Assets/Plugins/StreamChat/Core/LowLevelClient/API/IChannelApi.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using StreamChat.Core.LowLevelClient.Models;
44
using StreamChat.Core.LowLevelClient.Requests;
55
using StreamChat.Core.LowLevelClient.Responses;
6-
using StreamChat.Core.Responses;
76

87
namespace StreamChat.Core.LowLevelClient.API
98
{
@@ -155,6 +154,6 @@ Task<MarkReadResponse> MarkReadAsync(string channelType, string channelId,
155154
//StreamTodo: perhaps we can skip this declaration and use the Internal one directly
156155
Task<SyncResponse> SyncAsync(SyncRequest syncRequest);
157156

158-
Task<StreamCurrentUnreadCounts> GetUnreadCountsAsync();
157+
Task<CurrentUnreadCounts> GetUnreadCountsAsync();
159158
}
160159
}

0 commit comments

Comments
 (0)