Class BowireScriptSession
- Namespace
- Kuestenlogik.Bowire.Scripting
- Assembly
- Kuestenlogik.Bowire.dll
The pre-request and post-response scripts of one run (#672): the runner,
the values scripts share across the run (ctx.vars.captured) and the
sandbox limits from configuration. Used by bowire test, and since
#1059 by bowire call and the MCP tool bowire.invoke.
public sealed class BowireScriptSession
- Inheritance
-
BowireScriptSession
- Inherited Members
Constructors
BowireScriptSession(BowireScriptLimits, IBowireScriptRunner?)
The pre-request and post-response scripts of one run (#672): the runner,
the values scripts share across the run (ctx.vars.captured) and the
sandbox limits from configuration. Used by bowire test, and since
#1059 by bowire call and the MCP tool bowire.invoke.
public BowireScriptSession(BowireScriptLimits limits, IBowireScriptRunner? runner)
Parameters
limitsBowireScriptLimitsrunnerIBowireScriptRunner
Properties
CollectionVarsJson
#1111 — ctx.vars.collection for the run, as a JSON object: the
caller seeds it from the collection or flow and may store it after.
public string CollectionVarsJson { get; set; }
Property Value
SendRequest
#1111 — how a script's ctx.sendRequest goes out (see
Through(BowireProtocolRegistry)); null: it fails, saying it is
not available here.
public Func<BowireScriptSendRequest, CancellationToken, Task<BowireScriptSendResponse>>? SendRequest { get; set; }
Property Value
Methods
FromConfiguration(IConfiguration?)
The installed runner, with limits read from Bowire:Scripting:*.
public static BowireScriptSession FromConfiguration(IConfiguration? cfg)
Parameters
cfgIConfiguration
Returns
RunPost(string, string, string, string, BowireScriptRequest, BowireScriptResponse, IDictionary<string, string>, ICollection<string>)
Run source against the response. Returns the failure to report, or null.
public string? RunPost(string source, string protocol, string service, string method, BowireScriptRequest request, BowireScriptResponse response, IDictionary<string, string> environment, ICollection<string> log)
Parameters
sourcestringprotocolstringservicestringmethodstringrequestBowireScriptRequestresponseBowireScriptResponseenvironmentIDictionary<string, string>logICollection<string>
Returns
RunPostAsync(string, string, string, string, BowireScriptRequest, BowireScriptResponse, IDictionary<string, string>, ICollection<string>, CancellationToken)
#1111 — RunPost(string, string, string, string, BowireScriptRequest, BowireScriptResponse, IDictionary<string, string>, ICollection<string>) for a script that may await.
public Task<string?> RunPostAsync(string source, string protocol, string service, string method, BowireScriptRequest request, BowireScriptResponse response, IDictionary<string, string> environment, ICollection<string> log, CancellationToken ct = default)
Parameters
sourcestringprotocolstringservicestringmethodstringrequestBowireScriptRequestresponseBowireScriptResponseenvironmentIDictionary<string, string>logICollection<string>ctCancellationToken
Returns
RunPre(string, string, string, string, BowireScriptRequest, IDictionary<string, string>, ICollection<string>)
Run source before the call. Returns the failure to
report, or null. Without an installed engine a script is a
failure, never skipped: a run that ignored it would report a request
that was not the one tested.
public string? RunPre(string source, string protocol, string service, string method, BowireScriptRequest request, IDictionary<string, string> environment, ICollection<string> log)
Parameters
sourcestringprotocolstringservicestringmethodstringrequestBowireScriptRequestenvironmentIDictionary<string, string>logICollection<string>
Returns
RunPreAsync(string, string, string, string, BowireScriptRequest, IDictionary<string, string>, ICollection<string>, CancellationToken)
#1111 — RunPre(string, string, string, string, BowireScriptRequest, IDictionary<string, string>, ICollection<string>) for a script that may await: a
ctx.sendRequest goes out through SendRequest.
public Task<string?> RunPreAsync(string source, string protocol, string service, string method, BowireScriptRequest request, IDictionary<string, string> environment, ICollection<string> log, CancellationToken ct = default)
Parameters
sourcestringprotocolstringservicestringmethodstringrequestBowireScriptRequestenvironmentIDictionary<string, string>logICollection<string>ctCancellationToken
Returns
ShapeOf(string?)
public static string ShapeOf(string? protocol)
Parameters
protocolstring