Class CommandResponse
Message sent in response to a Command by an petabridge.cmd host.
Inheritance
CommandResponse
Assembly: Petabridge.Cmd.Common.dll
Syntax
public class CommandResponse : INoSerializationVerificationNeeded
Constructors
CommandResponse(string, bool, IReadOnlyDictionary<string, string[]>)
Creates a new command response object.
Declaration
public CommandResponse(string msg, bool final = true, IReadOnlyDictionary<string, string[]> structuredData = null)
Parameters
| Type |
Name |
Description |
| string |
msg |
The message from the server.
|
| bool |
final |
If true, indicates that the server is done sending responses for this particular request.
|
| IReadOnlyDictionary<string, string[]> |
structuredData |
Semantic data that can be used by the client for other types of rich response formatting.
|
CommandResponse(string, long, bool, IReadOnlyDictionary<string, string[]>)
Creates a new command response object.
Declaration
public CommandResponse(string msg, long sessionId, bool final = true, IReadOnlyDictionary<string, string[]> structuredData = null)
Parameters
| Type |
Name |
Description |
| string |
msg |
The message from the server.
|
| long |
sessionId |
The id of the client session this request is correlated to.
|
| bool |
final |
If true, indicates that the server is done sending responses for this particular request.
|
| IReadOnlyDictionary<string, string[]> |
structuredData |
Semantic data that can be used by the client for other types of rich response formatting.
|
Fields
Empty
Special case. Used to terminate a response stream.
Declaration
public static readonly CommandResponse Empty
Field Value
EmptyStructuredData
A default, empty value for structured data.
Declaration
public static readonly Dictionary<string, string[]> EmptyStructuredData
Field Value
Properties
CommandType
Defines the schema used for the formatting of this command
Declaration
public CommandType CommandType { get; }
Property Value
Final
For streaming responses, indicates that this is the final message in the stream
Declaration
public bool Final { get; }
Property Value
IsError
Indicates that this is an error message
Declaration
public virtual bool IsError { get; }
Property Value
Msg
The raw message that will be printed back onto the console
Declaration
public string Msg { get; }
Property Value
SessionId
The id of the client session correlated with this response.
Declaration
public long SessionId { get; }
Property Value
StructuredData
Optional. A string dictionary containing structured data that can be formatted and used by clients
in more semantically-friendly ways.
Declaration
public IReadOnlyDictionary<string, string[]> StructuredData { get; }
Property Value
Methods
Equals(CommandResponse)
Declaration
protected bool Equals(CommandResponse other)
Parameters
Returns
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
| Type |
Name |
Description |
| object |
obj |
|
Returns
Overrides
FromValidationErrors(IEnumerable<ValidationError>)
Declaration
public static CommandResponse FromValidationErrors(IEnumerable<ValidationError> errors)
Parameters
Returns
FromValidationErrors(IEnumerable<ValidationError>, long)
Declaration
public static CommandResponse FromValidationErrors(IEnumerable<ValidationError> errors, long sessionId)
Parameters
Returns
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
ToString()
Declaration
public override string ToString()
Returns
Overrides
WithSessionId(long)
Declaration
public virtual CommandResponse WithSessionId(long sessionId)
Parameters
| Type |
Name |
Description |
| long |
sessionId |
|
Returns
Implements