Use TimeToLive (TimeSpan?) instead of TtlMs (long?) in public APIs (#1644)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: PranavSenthilnathan <12225508+PranavSenthilnathan@users.noreply.github.com> Co-authored-by: halter73 <54385+halter73@users.noreply.github.com> Co-authored-by: Pranav Senthilnathan <pranas@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
9ba1f47d77
commit
3368bb7349
1 changed files with 30 additions and 85 deletions
|
|
@ -64,10 +64,10 @@ public abstract class GetTaskResult : Result
|
|||
public required DateTimeOffset LastUpdatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the time-to-live duration from creation in milliseconds, or <see langword="null"/> for unlimited.
|
||||
/// Gets or sets the time-to-live duration from creation, or <see langword="null"/> for unlimited.
|
||||
/// </summary>
|
||||
[JsonPropertyName("ttlMs")]
|
||||
public long? TtlMs { get; set; }
|
||||
public TimeSpan? TimeToLive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the suggested polling interval in milliseconds.
|
||||
|
|
@ -245,7 +245,7 @@ public abstract class GetTaskResult : Result
|
|||
};
|
||||
|
||||
taskResult.StatusMessage = statusMessage;
|
||||
taskResult.TtlMs = ttlMs;
|
||||
taskResult.TimeToLive = ttlMs is null ? null : TimeSpan.FromMilliseconds(ttlMs.Value);
|
||||
taskResult.PollIntervalMs = pollIntervalMs;
|
||||
taskResult.ResultType = resultType;
|
||||
taskResult.Meta = meta;
|
||||
|
|
@ -287,9 +287,9 @@ public abstract class GetTaskResult : Result
|
|||
writer.WriteString("createdAt", value.CreatedAt);
|
||||
writer.WriteString("lastUpdatedAt", value.LastUpdatedAt);
|
||||
|
||||
if (value.TtlMs is not null)
|
||||
if (value.TimeToLive is not null)
|
||||
{
|
||||
writer.WriteNumber("ttlMs", value.TtlMs.Value);
|
||||
writer.WriteNumber("ttlMs", (long)value.TimeToLive.Value.TotalMilliseconds);
|
||||
}
|
||||
|
||||
if (value.PollIntervalMs is not null)
|
||||
|
|
|
|||
Loading…
Reference in a new issue