Skip to content

Commit 0e66c1b

Browse files
committed
Storage
1 parent 5947c46 commit 0e66c1b

File tree

4 files changed

+6
-36
lines changed

4 files changed

+6
-36
lines changed

dotnet/src/webdriver/BiDi/Modules/Storage/DeleteCookiesCommand.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Storage;
2626
internal class DeleteCookiesCommand(DeleteCookiesCommandParameters @params)
2727
: Command<DeleteCookiesCommandParameters>(@params, "storage.deleteCookies");
2828

29-
internal record DeleteCookiesCommandParameters : CommandParameters
30-
{
31-
public CookieFilter? Filter { get; set; }
32-
33-
public PartitionDescriptor? Partition { get; set; }
34-
}
29+
internal record DeleteCookiesCommandParameters(CookieFilter? Filter, PartitionDescriptor? Partition) : CommandParameters;
3530

3631
public record DeleteCookiesOptions : GetCookiesOptions;
3732

dotnet/src/webdriver/BiDi/Modules/Storage/GetCookiesCommand.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Storage;
3030
internal class GetCookiesCommand(GetCookiesCommandParameters @params)
3131
: Command<GetCookiesCommandParameters>(@params, "storage.getCookies");
3232

33-
internal record GetCookiesCommandParameters : CommandParameters
34-
{
35-
public CookieFilter? Filter { get; set; }
36-
37-
public PartitionDescriptor? Partition { get; set; }
38-
}
33+
internal record GetCookiesCommandParameters(CookieFilter? Filter, PartitionDescriptor? Partition) : CommandParameters;
3934

4035
public record GetCookiesOptions : CommandOptions
4136
{

dotnet/src/webdriver/BiDi/Modules/Storage/SetCookieCommand.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ namespace OpenQA.Selenium.BiDi.Modules.Storage;
2727
internal class SetCookieCommand(SetCookieCommandParameters @params)
2828
: Command<SetCookieCommandParameters>(@params, "storage.setCookie");
2929

30-
internal record SetCookieCommandParameters(PartialCookie Cookie) : CommandParameters
31-
{
32-
public PartitionDescriptor? Partition { get; set; }
33-
}
30+
internal record SetCookieCommandParameters(PartialCookie Cookie, PartitionDescriptor? Partition) : CommandParameters;
3431

3532
public record PartialCookie(string Name, Network.BytesValue Value, string Domain)
3633
{

dotnet/src/webdriver/BiDi/Modules/Storage/StorageModule.cs

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,38 +28,21 @@ public class StorageModule(Broker broker) : Module(broker)
2828
{
2929
public async Task<GetCookiesResult> GetCookiesAsync(GetCookiesOptions? options = null)
3030
{
31-
var @params = new GetCookiesCommandParameters();
32-
33-
if (options is not null)
34-
{
35-
@params.Filter = options.Filter;
36-
@params.Partition = options.Partition;
37-
}
31+
var @params = new GetCookiesCommandParameters(options?.Filter, options?.Partition);
3832

3933
return await Broker.ExecuteCommandAsync<GetCookiesCommand, GetCookiesResult>(new GetCookiesCommand(@params), options).ConfigureAwait(false);
4034
}
4135

4236
public async Task<DeleteCookiesResult> DeleteCookiesAsync(DeleteCookiesOptions? options = null)
4337
{
44-
var @params = new DeleteCookiesCommandParameters();
45-
46-
if (options is not null)
47-
{
48-
@params.Filter = options.Filter;
49-
@params.Partition = options.Partition;
50-
}
38+
var @params = new DeleteCookiesCommandParameters(options?.Filter, options?.Partition);
5139

5240
return await Broker.ExecuteCommandAsync<DeleteCookiesCommand, DeleteCookiesResult>(new DeleteCookiesCommand(@params), options).ConfigureAwait(false);
5341
}
5442

5543
public async Task<SetCookieResult> SetCookieAsync(PartialCookie cookie, SetCookieOptions? options = null)
5644
{
57-
var @params = new SetCookieCommandParameters(cookie);
58-
59-
if (options is not null)
60-
{
61-
@params.Partition = options.Partition;
62-
}
45+
var @params = new SetCookieCommandParameters(cookie, options?.Partition);
6346

6447
return await Broker.ExecuteCommandAsync<SetCookieCommand, SetCookieResult>(new SetCookieCommand(@params), options).ConfigureAwait(false);
6548
}

0 commit comments

Comments
 (0)