2using System.Collections.Generic;
4using System.Threading.Tasks;
30 : base(
"Tokens/AddXmlNote",
31 new KeyValuePair<Type,
Expression>(typeof(Dictionary<string, object>), new
Expression(jsonPattern)),
50 string TokenId = (string)Parameters[
"PTokenId"].AssociatedObjectValue;
51 bool Personal = (bool)Parameters[
"PPersonal"].AssociatedObjectValue;
54 object Obj = Parameters[
"PNote"].AssociatedObjectValue;
59 if (Obj is
string Xml)
64 Doc =
new XmlDocument()
66 PreserveWhitespace =
true
71 (string, Dictionary<string, ValidationSchema>) P = await
XmppServerModule.Legal.ValidateContent(Doc);
72 if (!
string.IsNullOrEmpty(P.Item1))
75 LocalName = Doc.DocumentElement.LocalName;
76 Namespace = Doc.DocumentElement.NamespaceURI;
78 else if (Obj is XmlDocument Doc2)
80 Xml = Doc2.DocumentElement.OuterXml;
81 LocalName = Doc2.DocumentElement.LocalName;
82 Namespace = Doc2.DocumentElement.NamespaceURI;
84 (string, Dictionary<string, ValidationSchema>) P = await
XmppServerModule.Legal.ValidateContent(Doc2);
85 if (!
string.IsNullOrEmpty(P.Item1))
88 else if (Obj is XmlElement E)
91 LocalName = E.LocalName;
92 Namespace = E.NamespaceURI;
94 Doc =
new XmlDocument()
96 PreserveWhitespace =
true
100 (string, Dictionary<string, ValidationSchema>) P = await
XmppServerModule.Legal.ValidateContent(Doc);
101 if (!
string.IsNullOrEmpty(P.Item1))
120 Timestamp = DateTime.UtcNow,
123 LocalName = LocalName,
124 Namespace = Namespace
137 Timestamp = DateTime.UtcNow,
140 LocalName = LocalName,
141 Namespace = Namespace,
149 StringBuilder sb =
new StringBuilder();
152 Doc =
new XmlDocument()
154 PreserveWhitespace =
true
156 Doc.LoadXml(Xml.ToString());
A Named dictionary is a dictionary, with a local name and a namespace. Use it to return content that ...
Static class managing loading of resources stored as embedded resources or in content files.
static string LoadResourceAsText(string ResourceName)
Loads a text resource from an embedded resource.
Helps with common XML-related tasks.
static bool IsValidXml(string Xml)
Checks if a string is valid XML
Static class managing the runtime environment of the IoT Gateway.
static CaseInsensitiveString Domain
Domain name.
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repe...
Represents an HTTP request.
Represets a response of an HTTP client request.
async Task Return(object Object)
Returns an object to the client. This method can only be called once per response,...
The server has not found anything matching the Request-URI. No indication is given of whether the con...
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static async Task Insert(object Object)
Inserts an object into the default collection of the database.
Class managing a script expression.
An xml note logged on the token from an external source.
An xml note logged on the token.
void Serialize(StringBuilder Xml)
Serializes the event to XML.
Abstract base class for token events containing notes made by the owner.
Marketplace processor, brokering sales of items via tenders and offers defined in smart contracts.
Duration? ArchiveOptional
Duration after which token expires, and the required archiving time, the token can optionally be arch...
CaseInsensitiveString OwnerJid
JID of Current owner of token
Duration? ArchiveRequired
Duration after which token expires, the token is required to be archived.
DateTime Expires
Expiry date of token.
CaseInsensitiveString TokenId
Token ID
Abstract base class for agent resources supporting the POST method.
static AccountUser AssertUserAuthenticated(HttpRequest Request)
Makes sure the request is made by an authenticated API user.
const string AgentNamespace
https://waher.se/Schema/BrokerAgent.xsd
Adds a text note on a token.
Adds an XML note on a token.
AddXmlNote()
Adds an XML note on a token.
override async Task POST(HttpRequest Request, HttpResponse Response, Dictionary< string, IElement > Parameters)
Executes the POST method on the resource.
Service Module hosting the XMPP broker and its components.