Skip to content

Commit a38a250

Browse files
committed
Remove ConsumedThing.name. Move getLinks() to experimental extensions section. Add getProperties(), getActions(), getEvents().
Signed-off-by: Zoltan Kis <[email protected]>
1 parent a76fbca commit a38a250

File tree

1 file changed

+80
-64
lines changed

1 file changed

+80
-64
lines changed

index.html

Lines changed: 80 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -508,10 +508,7 @@ <h2>The <dfn>ConsumedThing</dfn> interface</h2>
508508
</p>
509509
<pre class="idl">
510510
interface ConsumedThing {
511-
readonly attribute DOMString name;
512-
void setName(DOMString name);
513511
ThingDescription getThingDescription();
514-
sequence&lt;TDLink&gt; getLinks();
515512
Promise&lt;any&gt; invokeAction(DOMString name, any parameters);
516513
Promise&lt;void&gt; writeProperty(DOMString name, any value);
517514
Promise&lt;any&gt; readProperty(DOMString name);
@@ -522,19 +519,8 @@ <h2>The <dfn>ConsumedThing</dfn> interface</h2>
522519
</pre>
523520
<p>
524521
<code>ConsumedThing</code> represents a local proxy object of the remote <a>Thing</a>.
525-
<ul>
526-
<li>
527-
The <dfn>name</dfn> read-only attribute represents the user given name of the <a>Thing</a>.
528-
</li>
529-
</ul>
530522
</p>
531523

532-
<section> <h3>The <dfn>setName()</dfn> method</h3>
533-
<p>
534-
Takes a <code>name</code> parameter and sets the name of the <a>Thing</a>, as used in applications. Applications can provide a maximum 128 bytes long name, but implementations may reject (by throwing a `RangeError`) or truncate the provided name, depending on the capabilities of the underlying platform. Setting <code>name</code> throws `TypeError` on other invalid (not string) input.
535-
</p>
536-
</section>
537-
538524
<section> <h3>The <dfn>getThingDescription()</dfn> method</h3>
539525
<p>
540526
Returns the <a>Thing Description</a> of the <a>Thing</a>.
@@ -544,41 +530,6 @@ <h2>The <dfn>ConsumedThing</dfn> interface</h2>
544530
</p>
545531
</section>
546532

547-
<section> <h3>The <dfn>getLinks()</dfn> method</h3>
548-
<p>
549-
Returns the list of linked resources in <a>Thing Description</a> of the <a>Thing</a> in the form of a list of <a>TDLink</a> objects.
550-
</p>
551-
<section data-dfn-for="TDLink" >
552-
<h4>The <dfn>TDLink</dfn> dictionary</h4>
553-
<p>
554-
Contains a hyperlink reference, a relation type and a media type.
555-
</p>
556-
<pre class="idl">
557-
dictionary TDLink {
558-
required USVString href;
559-
USVString mediaType;
560-
DOMString rel;
561-
};
562-
</pre>
563-
<p>The <a>TDLink</a> dictionary contains the following properties:
564-
<ul>
565-
<li>
566-
The <dfn>href</dfn> attribute represents a <a>hyperlink reference</a>.
567-
</li>
568-
<li>
569-
The <dfn>rel</dfn> attribute represents a <a>relation type</a>.
570-
</li>
571-
<li>
572-
The <dfn>mediaType</dfn> attribute represents a <a>IANA media type</a>.
573-
</li>
574-
</ul>
575-
</p>
576-
</section> <!-- TDLink -->
577-
</section>
578-
579-
580-
581-
582533
<section> <h3>The <dfn>invokeAction()</dfn> method</h3>
583534
<p>
584535
Takes the <a>Action</a> name from the <var>name</var> argument and the list of parameters, then requests from the underlying platform and the <a>Protocol Bindings</a> to invoke the <a>Action</a> on the remote <a>Thing</a> and return the result. Returns a <code><a>Promise</a></code> that resolves with the return value or rejects with an <a>Error</a>.
@@ -668,11 +619,11 @@ <h2>The <dfn>ExposedThing</dfn> interface</h2>
668619
Promise&lt;void&gt; unregister(optional USVString directory);
669620
Promise&lt;void&gt; emitEvent(DOMString eventName, any payload);
670621
// define Thing Description modifiers
671-
ExposedThing addProperty(ThingPropertyInit property);
622+
ExposedThing addProperty(ThingProperty property);
672623
ExposedThing removeProperty(DOMString name);
673-
ExposedThing addAction(ThingActionInit action);
624+
ExposedThing addAction(ThingAction action);
674625
ExposedThing removeAction(DOMString name);
675-
ExposedThing addEvent(ThingEventInit event);
626+
ExposedThing addEvent(ThingEvent event);
676627
ExposedThing removeEvent(DOMString name);
677628
// define request handlers
678629
ExposedThing setActionHandler(ActionHandler action, optional DOMString actionName);
@@ -731,10 +682,10 @@ <h4>The <dfn>DataSchema</dfn> type</h4>
731682
<p>
732683
Adds a <a>Property</a> defined by the argument and updates the <a>Thing Description</a>. Throws on error. Returns a reference to the same object for supporting chaining.
733684
</p>
734-
<section data-dfn-for="ThingPropertyInit" data-link-for="ThingPropertyInit">
735-
<h4>The <dfn>ThingPropertyInit</dfn> dictionary</h4>
685+
<section data-dfn-for="ThingProperty" data-link-for="ThingProperty">
686+
<h4>The <dfn>ThingProperty</dfn> dictionary</h4>
736687
<pre class="idl">
737-
dictionary ThingPropertyInit: SemanticAnnotations {
688+
dictionary ThingProperty: SemanticAnnotations {
738689
required DOMString name;
739690
required DataSchema schema;
740691
any value;
@@ -769,19 +720,19 @@ <h4>The <dfn>ThingPropertyInit</dfn> dictionary</h4>
769720

770721
<section> <h3>The <dfn>addAction()</dfn> method</h3>
771722
<p>
772-
Adds an <a>Action</a> to the <a>Thing</a> object as defined by the <code>action</code> argument of type <a>ThingActionInit</a> and updates the <a>Thing Description</a>. Throws on error. Returns a reference to the same object for supporting chaining.
723+
Adds an <a>Action</a> to the <a>Thing</a> object as defined by the <code>action</code> argument of type <a>ThingAction</a> and updates the <a>Thing Description</a>. Throws on error. Returns a reference to the same object for supporting chaining.
773724
</p>
774-
<section data-dfn-for="ThingActionInit">
775-
<h4>The <dfn>ThingActionInit</dfn> dictionary</h4>
725+
<section data-dfn-for="ThingAction">
726+
<h4>The <dfn>ThingAction</dfn> dictionary</h4>
776727
<pre class="idl">
777-
dictionary ThingActionInit: SemanticAnnotations {
728+
dictionary ThingAction: SemanticAnnotations {
778729
required DOMString name;
779730
DataSchema inputSchema;
780731
DataSchema outputSchema;
781732
};
782733
</pre>
783734
<p>
784-
The <a>ThingActionInit</a> dictionary describes the arguments and the return value.
735+
The <a>ThingAction</a> dictionary describes the arguments and the return value.
785736
<ul>
786737
<li>The <dfn>name</dfn> attribute provides the <a>Action</a> name.</li>
787738
<li>The <dfn>inputSchema</dfn> attribute provides the description of the input arguments (argument list is represented by an object). If missing, it means the action does not accept arguments.</li>
@@ -799,12 +750,12 @@ <h4>The <dfn>ThingActionInit</dfn> dictionary</h4>
799750

800751
<section> <h3>The <dfn>addEvent()</dfn> method</h3>
801752
<p>
802-
Adds an event to the <a>Thing</a> object as defined by the <code>event</code> argument of type <a>ThingEventInit</a> and updates the <a>Thing Description</a>. Throws on error. Returns a reference to the same object for supporting chaining.
753+
Adds an event to the <a>Thing</a> object as defined by the <code>event</code> argument of type <a>ThingEvent</a> and updates the <a>Thing Description</a>. Throws on error. Returns a reference to the same object for supporting chaining.
803754
</p>
804-
<section data-dfn-for="ThingEventInit">
805-
<h4>The <dfn>ThingEventInit</dfn> dictionary</h4>
755+
<section data-dfn-for="ThingEvent">
756+
<h4>The <dfn>ThingEvent</dfn> dictionary</h4>
806757
<pre class="idl">
807-
dictionary ThingEventInit: SemanticAnnotations {
758+
dictionary ThingEvent: SemanticAnnotations {
808759
required DOMString name;
809760
DataSchema schema;
810761
};
@@ -975,6 +926,71 @@ <h2>Examples</h2>
975926
</section> <!-- ExposedThing Examples -->
976927
</section> <!-- ExposedThing -->
977928

929+
<section class="informative" data-dfn-for="ConsumedThing">
930+
<h2>Experimental extensions to the <strong>ConsumedThing</strong> interface</h2>
931+
<p>
932+
The <a>ThingDescription</a> related functionality, such as enumerating <a>Properties</a>, <a>Action</a>s, <a>Event</a>s and links (introspection) is an API extension that is out of scope for this specification. However, the draft interfaces are defined here for informative purposes.
933+
</p>
934+
<pre class="idl">
935+
partial interface ConsumedThing {
936+
sequence&lt;ThingProperty&gt; getProperties();
937+
sequence&lt;ThingAction&gt; getActions();
938+
sequence&lt;ThingEvent&gt; getEvents();
939+
sequence&lt;TDLink&gt; getLinks();
940+
};
941+
</pre>
942+
943+
<section> <h3>The <dfn>getProperties()</dfn> method</h3>
944+
<p>
945+
Returns the list of <a>Properties</a> defined in the <a>Thing Description</a> of the <a>Thing</a> in the form of a list of <a>ThingProperty</a> objects.
946+
</p>
947+
</section>
948+
949+
<section> <h3>The <dfn>getActions()</dfn> method</h3>
950+
<p>
951+
Returns the list of <a>Action</a>s defined in the <a>Thing Description</a> of the <a>Thing</a> in the form of a list of <a>ThingAction</a> objects.
952+
</p>
953+
</section>
954+
955+
<section> <h3>The <dfn>getEvents()</dfn> method</h3>
956+
<p>
957+
Returns the list of <a>Event</a>s defined in the <a>Thing Description</a> of the <a>Thing</a> in the form of a list of <a>ThingEvent</a> objects.
958+
</p>
959+
</section>
960+
961+
<section> <h3>The <dfn>getLinks()</dfn> method</h3>
962+
<p>
963+
Returns the list of linked resources in <a>Thing Description</a> of the <a>Thing</a> in the form of a list of <a>TDLink</a> objects.
964+
</p>
965+
<section data-dfn-for="TDLink" >
966+
<h4>The <dfn>TDLink</dfn> dictionary</h4>
967+
<p>
968+
Contains a hyperlink reference, a relation type and a media type.
969+
</p>
970+
<pre class="idl">
971+
dictionary TDLink {
972+
required USVString href;
973+
USVString mediaType;
974+
DOMString rel;
975+
};
976+
</pre>
977+
<p>The <a>TDLink</a> dictionary contains the following properties:
978+
<ul>
979+
<li>
980+
The <dfn>href</dfn> attribute represents a <a>hyperlink reference</a>.
981+
</li>
982+
<li>
983+
The <dfn>rel</dfn> attribute represents a <a>relation type</a>.
984+
</li>
985+
<li>
986+
The <dfn>mediaType</dfn> attribute represents a <a>IANA media type</a>. For <a>TD</a>s there will be registered media types, so applications will be able to check whether an `href` link points to a <a>TD</a>, i.e. whether the link is fetcheable with this API.
987+
</li>
988+
</ul>
989+
</p>
990+
</section> <!-- TDLink -->
991+
</section>
992+
</section>
993+
978994
<section data-dfn-for="Observable" class="informative">
979995
<h2>Observables</h2>
980996
<p>

0 commit comments

Comments
 (0)