Skip to content

Commit 99f2794

Browse files
Aleksander Sjåfjellasjafjell
authored andcommitted
Sørger for at klienten ikke får breaking changes
Det er et poeng på nåværende tidpspunkt at vi ikke bumper en major-versjon av klienten for å få brukere av versjon 5 til å oppgradere for bedre håndtering av polling-execption
1 parent 9478beb commit 99f2794

File tree

5 files changed

+26
-8
lines changed

5 files changed

+26
-8
lines changed

Digipost.Signature.Api.Client.Direct/DirectClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private JobStatusResponse CreateOkResponse(string requestContent, HttpResponseMe
151151
private JobStatusResponse CreateNoContentResponse(HttpResponseMessage requestResult)
152152
{
153153
_logger.LogDebug("Received empty response. No jobs have had their status changed.");
154-
return JobStatusResponse.NoChanges(RequestHelper.GetNextPermittedPollTime(requestResult));
154+
return JobStatusResponse.NoChangesWithPollTime(RequestHelper.GetNextPermittedPollTime(requestResult));
155155
}
156156

157157
private static JobStatusResponse ParseResponseToJobStatusResponse(string requestContent, DateTime nextPermittedPollTime)

Digipost.Signature.Api.Client.Direct/JobStatusResponse.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,22 @@ namespace Digipost.Signature.Api.Client.Direct
88
{
99
public class JobStatusResponse
1010
{
11-
public static JobStatusResponse NoChanges(DateTime nextPermittedPollTime)
11+
[Obsolete("Use NoChangesWithPollTime instead, as this can be removed without further notice.") ]
12+
public static JobStatusResponse NoChanges = new JobStatusResponse(null, null, JobStatus.NoChanges, null, null, DateTime.Now);
13+
14+
public static JobStatusResponse NoChangesWithPollTime(DateTime nextPermittedPollTime)
1215
{
1316
return new JobStatusResponse(null, null, JobStatus.NoChanges, null, null, nextPermittedPollTime);
1417
}
1518

16-
private long? _jobId;
19+
private readonly long? _jobId;
1720

21+
[Obsolete("Use constructor with DateTime instead, as this can be removed without further notice.")]
22+
public JobStatusResponse(long? jobId, string jobReference, JobStatus status, JobReferences references, List<Signature> signatures)
23+
: this(jobId, jobReference, status, references, signatures, DateTime.Now)
24+
{
25+
}
26+
1827
public JobStatusResponse(long? jobId, string jobReference, JobStatus status, JobReferences references, List<Signature> signatures, DateTime nextPermittedPollTime )
1928
{
2029
_jobId = jobId;

Digipost.Signature.Api.Client.Portal/DataTransferObjects/DataTransferObjectConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace Digipost.Signature.Api.Client.Portal.DataTransferObjects
1111
{
12-
internal class DataTransferObjectConverter
12+
internal static class DataTransferObjectConverter
1313
{
1414
public static portalsignaturejobrequest ToDataTransferObject(Job job)
1515
{

Digipost.Signature.Api.Client.Portal/JobStatusChanged.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,20 @@ namespace Digipost.Signature.Api.Client.Portal
77
{
88
public class JobStatusChanged
99
{
10-
public static JobStatusChanged NoChanges(DateTime nextPermittedPollTime)
10+
[Obsolete("Use NoChangesWithPollTime instead, as this can be removed without further notice.")]
11+
public static JobStatusChanged NoChanges = new JobStatusChanged(0, null, JobStatus.NoChanges, null, null, DateTime.Now);
12+
13+
public static JobStatusChanged NoChangesWithPollTime(DateTime nextPermittedPollTime)
1114
{
1215
return new JobStatusChanged(0, null, JobStatus.NoChanges, null, null, nextPermittedPollTime);
13-
}
14-
16+
}
17+
18+
[Obsolete("Use constructor with DateTime instead, as this can be removed without further notice.")]
19+
public JobStatusChanged(long jobId, string jobReference, JobStatus status, ConfirmationReference confirmationReference, List<Signature> signatures)
20+
: this(jobId, jobReference, status, confirmationReference, signatures, DateTime.Now)
21+
{
22+
}
23+
1524
public JobStatusChanged(long jobId, string jobReference, JobStatus status, ConfirmationReference confirmationReference, List<Signature> signatures, DateTime nextPermittedPollTime)
1625
{
1726
JobId = jobId;

Digipost.Signature.Api.Client.Portal/PortalClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public async Task<JobStatusChanged> GetStatusChange(Sender sender = null)
9595
private JobStatusChanged CreateNoContentResponse(HttpResponseMessage requestResult)
9696
{
9797
_logger.LogDebug("No content response received.");
98-
return JobStatusChanged.NoChanges(RequestHelper.GetNextPermittedPollTime(requestResult));
98+
return JobStatusChanged.NoChangesWithPollTime(RequestHelper.GetNextPermittedPollTime(requestResult));
9999
}
100100

101101
private JobStatusChanged CreateOkResponse(string requestContent, HttpResponseMessage requestResult)

0 commit comments

Comments
 (0)