Add request options bag to high level requests and include Meta (#970)
Co-authored-by: Stephen Toub <stoub@microsoft.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
627de76ca6
commit
c447973972
1 changed files with 882 additions and 164 deletions
|
|
@ -26,7 +26,7 @@ public abstract class RequestParams
|
|||
public JsonObject? Meta { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets an opaque token that will be attached to any subsequent progress notifications.
|
||||
/// Gets the opaque token that will be attached to any subsequent progress notifications.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public ProgressToken? ProgressToken
|
||||
|
|
@ -48,21 +48,5 @@ public abstract class RequestParams
|
|||
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value is null)
|
||||
{
|
||||
Meta?.Remove("progressToken");
|
||||
}
|
||||
else
|
||||
{
|
||||
(Meta ??= [])["progressToken"] = value.Value.Token switch
|
||||
{
|
||||
string s => JsonValue.Create(s),
|
||||
long l => JsonValue.Create(l),
|
||||
_ => throw new InvalidOperationException("ProgressToken must be a string or a long.")
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue