2using System.Collections.Generic;
4using System.Threading.Tasks;
28 : base(
"Tokens/AddTextNote",
29 new KeyValuePair<Type,
Expression>(typeof(Dictionary<string, object>), new
Expression(jsonPattern)),
48 string TokenId = (string)Parameters[
"PTokenId"].AssociatedObjectValue;
49 string Note = (string)Parameters[
"PNote"].AssociatedObjectValue;
50 bool Personal = (bool)Parameters[
"PPersonal"].AssociatedObjectValue;
67 Timestamp = DateTime.UtcNow,
68 TokenId = Token.TokenId
73 await AssertApprovedExternalSource(
Token, BareJid);
82 Timestamp = DateTime.UtcNow,
91 StringBuilder Xml =
new StringBuilder();
94 XmlDocument Doc =
new XmlDocument()
96 PreserveWhitespace =
true
98 Doc.LoadXml(Xml.ToString());
106 internal static async Task AssertApprovedExternalSource(
Token Token,
string FromBareJid)
116 if (Machine.CurrentState is
null)
119 if (Machine.CurrentState.HasEnded)
122 if (!Machine.CurrentState.ContainsSource(FromBareJid))
123 throw new ForbiddenException(
"You are not an approved external part for this token.");
126 throw new ForbiddenException(
"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 ...
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.
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.
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...
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.
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.