3using System.Threading.Tasks;
23 : base(
"/ProposeContract")
58 await
Response.SendResponse(
new NotSupportedException(
"Proposing new contracts not permitted. Broker does not support smart contracts."));
77 if (
Posted.Decoded is XmlDocument Doc)
98 StringBuilder sb =
new StringBuilder();
104 ParsedContract.Contract.ForMachines = Doc.DocumentElement;
108 else if (
Posted.Decoded is
bool Command)
123 PageVariables[
"Contract"] =
Contract;
126 PageVariables.
Remove(
"Contract");
134 catch (XmlException ex)
Contains information about a response to a content request.
Helps with common XML-related tasks.
static XmlException AnnotateException(XmlException ex)
Creates a new XML Exception object, with reference to the source XML file, for information.
static XmlDocument ParseXml(string Xml)
Parses an XML Document from its string representation.
Static class managing the runtime environment of the IoT Gateway.
static IUser AssertUserAuthenticated(HttpRequest Request, string Privilege)
Makes sure a request is being made from a session with a successful user login.
static ContractsClient ContractsClient
XMPP Contracts Client, if such a compoent is available on the XMPP broker.
Proposes a new smart contract
async Task POST(HttpRequest Request, HttpResponse Response)
Executes the POST method on the resource.
ProposeContract()
Proposes a new smart contract
override bool UserSessions
If the resource uses user sessions.
bool AllowsPOST
If the POST method is allowed.
override bool HandlesSubPaths
If the resource handles sub-paths.
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repe...
The server understood the request, but is refusing to fulfill it. Authorization will not help and the...
Represents an HTTP request.
Represets a response of an HTTP client request.
Base class for all synchronous HTTP resources. A synchronous resource responds within the method hand...
static Variables GetPageVariables(HttpRequest Request)
Gets the variable collection for the current page.
Decoded data posted to the resource
Access to the current request.
Access to the current response.
Contains the definition of a contract
static Task< ParsedContract > Parse(XmlDocument Xml)
Validates a contract XML Document, and returns the contract definition in it.
Parameter[] Parameters
Defined parameters for the smart contract.
Duration? ArchiveRequired
Requied time to archive a signed smart contract, after it becomes obsolete.
HumanReadableText[] ForHumans
Human-readable contents of the contract.
Duration? ArchiveOptional
Optional time to archive a signed smart contract, after it becomes obsolete, and after its required a...
bool CanActAsTemplate
If the contract can act as a template for other contracts.
XmlElement ForMachines
Machine-readable contents of the contract.
Role[] Roles
Roles defined in the smart contract.
DateTime? SignAfter
Signatures will only be accepted after this point in time.
ContractParts PartsMode
How parts are defined in the smart contract.
static string NormalizeXml(string Xml)
Normalizes XML.
Part[] Parts
Defined parts for the smart contract.
Duration? Duration
Duration of the contract. Is counted from the time it is signed by the required parties.
DateTime? SignBefore
Signatures will only be accepted until this point in time.
string Namespace
Namespace used when serializing the identity for signatures.
ContractVisibility Visibility
Contrat Visibility
Task< Contract > CreateContractAsync(XmlElement ForMachines, HumanReadableText[] ForHumans, Role[] Roles, Part[] Parts, Parameter[] Parameters, ContractVisibility Visibility, ContractParts PartsMode, Duration? Duration, Duration? ArchiveRequired, Duration? ArchiveOptional, DateTime? SignAfter, DateTime? SignBefore, bool CanActAsTemplate)
Creates a new contract.
Contains information about a parsed contract.
bool ParametersValid
If parameter values in the contract are valid.
bool HasStatus
If a status element was found.
Contract Contract
Contract object
Contains information about a variable.
virtual bool TryGetVariable(string Name, out Variable Variable)
Tries to get a variable object, given its name.
virtual bool Remove(string VariableName)
Removes a varaiable from the collection.
POST Interface for HTTP resources.
ContractParts
How the parts of the contract are defined.