4using System.Threading.Tasks;
30 : base(
"Tokens/AddTextNote",
31 new KeyValuePair<Type,
Expression>(typeof(Dictionary<string, object>), new
Expression(jsonPattern)),
50 string TokenId = (string)Parameters[
"PTokenId"].AssociatedObjectValue;
51 string Note = (string)Parameters[
"PNote"].AssociatedObjectValue;
52 bool Personal = (bool)Parameters[
"PPersonal"].AssociatedObjectValue;
69 Timestamp = DateTime.UtcNow,
70 TokenId = Token.TokenId
75 await AssertApprovedExternalSource(Request,
Token, BareJid);
84 Timestamp = DateTime.UtcNow,
93 StringBuilder Xml =
new StringBuilder();
96 XmlDocument Doc =
XML.
ParseXml(Xml.ToString(),
true);
104 internal static async Task AssertApprovedExternalSource(
HttpRequest Request,
Token Token,
string FromBareJid)
114 if (Machine.CurrentState is
null)
117 if (Machine.CurrentState.HasEnded)
120 if (!Machine.CurrentState.ContainsSource(FromBareJid))
121 throw new ForbiddenException(Request,
"You are not an approved external part for this token.");
124 throw new ForbiddenException(Request,
"You are not an approved external part for this token.");
A Named dictionary is a dictionary, with a local name and a namespace. Use it to return content that ...
Helps with common XML-related tasks.
static XmlDocument ParseXml(string Xml)
Parses an XML Document from its string representation.
Static class managing the runtime environment of the IoT Gateway.
static CaseInsensitiveString Domain
Domain name.
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.
Task Return(Exception ex)
Returns an error to the client.
The server has not found anything matching the Request-URI. No indication is given of whether the con...
The server is currently unable to handle the request due to a temporary overloading or maintenance of...
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.
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.
Class managing a script expression.
A text note logged on the token from an external source.
A text 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.
bool HasStateMachine
If the token has an associated state-machine.
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
bool IsExternalPart(CaseInsensitiveString BareJid)
Checks if a JID is an external part in the creation of the contract.
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.
override async Task POST(HttpRequest Request, HttpResponse Response, Dictionary< string, IElement > Parameters)
Executes the POST method on the resource.
AddTextNote()
Adds a text note on a token.