Skip to content

Commit

Permalink
fix: remove default resolution when creating an archive
Browse files Browse the repository at this point in the history
  • Loading branch information
Tr00d committed Feb 26, 2024
1 parent dad79a5 commit 6570363
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
"hasAudio": true,
"hasVideo": true,
"outputMode": "composed",
"resolution": "640x480",
"streamMode": "auto"
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void Build_ShouldReturnSuccess_WithDefaultValues() =>
request.HasVideo.Should().BeTrue();
request.Name.Should().BeNone();
request.OutputMode.Should().Be(OutputMode.Composed);
request.Resolution.Should().Be(RenderResolution.StandardDefinitionLandscape);
request.Resolution.Should().BeNone();
request.StreamMode.Should().Be(StreamMode.Auto);
request.Layout.Should().Be(default(Layout));
});
Expand Down
2 changes: 2 additions & 0 deletions Vonage/Common/JsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Vonage.Common.Failures;
using Vonage.Common.Monads;
using Vonage.Common.Serialization;
using Vonage.Server;

namespace Vonage.Common;

Expand All @@ -29,6 +30,7 @@ public JsonSerializer()
this.settings.Converters.Add(new ColorJsonConverter());
this.settings.Converters.Add(new PhoneNumberJsonConverter());
this.settings.Converters.Add(new EmailJsonConverter());
this.settings.Converters.Add(new EnumDescriptionJsonConverter<RenderResolution>());
}

/// <summary>
Expand Down
4 changes: 3 additions & 1 deletion Vonage/Video/Archives/CreateArchive/CreateArchiveRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ namespace Vonage.Video.Archives.CreateArchive;
/// outputMode property to "individual", the call to the REST method results in an error.
/// </summary>
[JsonPropertyOrder(6)]
public RenderResolution Resolution { get; internal init; }
[JsonConverter(typeof(MaybeJsonConverter<RenderResolution>))]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public Maybe<RenderResolution> Resolution { get; internal init; }

/// <inheritdoc />
[JsonPropertyOrder(0)]
Expand Down
30 changes: 15 additions & 15 deletions Vonage/Video/Archives/CreateArchive/CreateArchiveRequestBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,22 @@ namespace Vonage.Video.Archives.CreateArchive;

internal class CreateArchiveRequestBuilder : IBuilderForSessionId, IBuilderForApplicationId, IBuilderForOptional
{
private Guid applicationId;
private bool hasAudio = true;
private bool hasVideo = true;
private Guid applicationId;
private Layout layout;
private Maybe<string> name = Maybe<string>.None;
private Maybe<string> name;
private OutputMode outputMode = OutputMode.Composed;
private RenderResolution resolution = RenderResolution.StandardDefinitionLandscape;
private StreamMode streamMode = StreamMode.Auto;
private Maybe<RenderResolution> resolution;
private string sessionId;
private StreamMode streamMode = StreamMode.Auto;

/// <inheritdoc />
public IBuilderForSessionId WithApplicationId(Guid value)
{
this.applicationId = value;
return this;
}

/// <inheritdoc />
public Result<CreateArchiveRequest> Create() =>
Expand Down Expand Up @@ -49,13 +56,6 @@ public IBuilderForOptional DisableVideo()
return this;
}

/// <inheritdoc />
public IBuilderForSessionId WithApplicationId(Guid value)
{
this.applicationId = value;
return this;
}

/// <inheritdoc />
public IBuilderForOptional WithArchiveLayout(Layout value)
{
Expand Down Expand Up @@ -85,16 +85,16 @@ public IBuilderForOptional WithRenderResolution(RenderResolution value)
}

/// <inheritdoc />
public IBuilderForOptional WithSessionId(string value)
public IBuilderForOptional WithStreamMode(StreamMode value)
{
this.sessionId = value;
this.streamMode = value;
return this;
}

/// <inheritdoc />
public IBuilderForOptional WithStreamMode(StreamMode value)
public IBuilderForOptional WithSessionId(string value)
{
this.streamMode = value;
this.sessionId = value;
return this;
}

Expand Down

0 comments on commit 6570363

Please sign in to comment.