-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathresources.html
More file actions
1453 lines (1444 loc) · 52.9 KB
/
resources.html
File metadata and controls
1453 lines (1444 loc) · 52.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html class=" js flexbox flexboxlegacy canvas canvastext webgl no-touch geolocation postmessage websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Resources - LIME Protocol</title>
<link href="./files/bootstrap.css" rel="stylesheet">
<link href="./files/lime.css" rel="stylesheet">
<link href="./files/json-highlight.css" rel="stylesheet">
</head>
<body data-feedly-mini="yes">
<header>
<div class="navbar navbar-default navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">LIME Protocol</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">Specification</a></li>
<li><a href="content-types.html">Content Types</a></li>
<li><a href="resources.html">Resources</a></li>
<li><a href="libraries.html">Libraries</a></li>
<li><a href="loh.html">LIME over HTTP</a></li>
<li><a href="about.html">About</a></li>
</ul>
</div>
</div>
</div>
</header>
<div class="container body-content">
<div class="row">
<div class="col-md-10" role="main">
<h1 class="page-header">Resources</h1>
<div class="alert alert-warning">This specification is a <strong>work in progress</strong> and is subject to change without notice.</div>
<p>
Every connected node on a LIME network has its own set of resources that can be queried or changed by another nodes through commands, if they have the permissions for that.
Besides that, the domain servers can store resources for the domain identities, providing services like account and contact management.
</p>
<p>This page suggests some common resource types that can be available in some the protocol implementations, but they are not part of the core specification.</p>
<h2 id="account">Account</h2>
<p>Represents an user account information.</p>
<h4>URI template</h4>
<pre>
lime://{ownerIdentity}/account
</pre>
<h4>MIME type</h4>
<pre>
application/vnd.lime.account+json
</pre>
<h4>JSON schema</h4>
<pre>
<code class="json-schema">
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "account",
"type": "object",
"properties": {
"fullName": {
"type": "string"
},
"address": {
"type": "string"
},
"city": {
"type": "string"
},
"email": {
"type": "string"
},
"phoneNumber": {
"type": "string"
},
"photoUri": {
"type": "string",
"format": "uri"
},
"cellPhoneNumber": {
"type": "string"
},
"gender": {
"type": "string"
},
"timezone": {
"type": "integer"
},
"culture": {
"type": "string"
},
"extras": {
"type": "object"
},
"isTemporary": {
"type": "boolean"
},
"password": {
"type": "string"
},
"oldPassword": {
"type": "string"
},
"inboxSize": {
"type": "integer",
"minimum": 0
},
"allowGuestSender": {
"type": "boolean"
},
"allowUnknownSender": {
"type": "boolean"
},
"storeMessageContent": {
"type": "boolean"
},
"encryptMessageContent": {
"type": "boolean"
}
}
}
</code>
</pre>
<h4>Properties</h4>
<ul>
<li>
<strong>fullName</strong> - The user full name.
</li>
<li>
<strong>address</strong> - The user address.
</li>
<li>
<strong>city</strong> - The user city name.
</li>
<li>
<strong>email</strong> - The user e-mail address.
</li>
<li>
<strong>phoneNumber</strong> - The user phone number.
</li>
<li>
<strong>photoUri</strong> - The user photo URI.
</li>
<li>
<strong>cellPhoneNumber</strong> - The user cellphone number.
</li>
<li>
<strong>gender</strong> - The user gender (male/female).
</li>
<li>
<strong>timezone</strong> - The user timezone relative to GMT.
</li>
<li>
<strong>culture</strong> - The user culture info, in the IETF language tag format.
</li>
<li>
<strong>extras</strong> - A generic JSON property to store any key/value strings.
</li>
<li>
<strong>isTemporary</strong> - Indicates that the account is temporary is valid only in the current session. The default value is false.
</li>
<li>
<strong>password</strong> - Base64 representation of the account password. Only valid on set commands during the account creation or update.
</li>
<li>
<strong>oldPassword</strong> - Base64 representation of the account password. Only valid on set commands during the account password update.
</li>
<li>
<strong>inboxSize</strong> - Size of account inbox for storing offline messages. The default value is 0.
</li>
<li>
<strong>allowGuestSender</strong> - Indicates if this account allows receive messages from users with guest sessions.
</li>
<li>
<strong>allowUnknownSender</strong> - Indicates if this account allows receive messages from users that are not in the account contact list.
</li>
<li>
<strong>storeMessageContent</strong> - Indicates if the content of messages from this account should be stored in the server. Note that for offline messages, this will always happens.
</li>
<li>
<strong>encryptMessageContent</strong> - Indicates if the content of messages from this account should be encrypted in the server.
</li>
</ul>
<h4>Example</h4>
<p>Setting the account information:</p>
<pre>
C:
<code class="json">
{
"id": "f6b9160c-7539-4369-aa1d-c3b51380a524",
"from": "saul@breakingbad.com/office",
"method": "set",
"uri": "/account",
"type": "application/vnd.lime.account+json",
"resource": {
"fullName": "Saul McGill Goodman",
"phoneNumber": "+15055034455",
"city": "Albuquerque",
"password": "a2V2aW5jb3N0bmVy",
"allowGuestSender": false
}
}
</code>
S:
<code class="json">
{
"id": "f6b9160c-7539-4369-aa1d-c3b51380a524",
"to": "saul@breakingbad.com/office",
"method": "set",
"status": "success"
}
</code>
</pre>
<hr />
<h2 id="capability">Capability</h2>
<p>Represents the messaging capabilities of a node in a session.</p>
<h4>URI template</h4>
<pre>
lime://{ownerIdentity}/capability
</pre>
<h4>MIME type</h4>
<pre>
application/vnd.lime.capability+json
</pre>
<h4>JSON Schema</h4>
<pre>
<code class="json-schema">
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "capability",
"type": "object",
"properties": {
"contentTypes": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[-\w]+/[-\w.]+(\+json)$"
}
},
"resourceTypes": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[-\w]+/[-\w.]+(\+json)$"
}
},
}
}
</code>
</pre>
<h4>Properties</h4>
<ul>
<li>
<strong>contentTypes</strong> - Indicates the message content types that the session node is able to handle. By default, the server delivers all messages types to the nodes.
</li>
<li>
<strong>resourceTypes</strong> - Indicates the command resource types that the session node is able to handle. By default, the server blocks all command addressed to the nodes.
</li>
</ul>
<h4>Example</h4>
<p>Get the current session capabilities:</p>
<pre>
<code class="json">
C:
{
"id": "d1ad793d-2bf2-42f2-a843-65c7b518e601",
"from": "walterjr@breakingbad.com/home",
"method": "get",
"uri": "/capability"
}
</code>
<code class="json">
S:
{
"id": "d1ad793d-2bf2-42f2-a843-65c7b518e601",
"from": "server@breakingbad.com/machine1",
"to": "walterjr@breakingbad.com/home",
"method": "get",
"result": "success",
"type": "application/vnd.lime.capability+json",
"resource": {
"contentTypes": [
"application/vnd.lime.text+json",
"application/vnd.lime.chatstate+json",
],
"resourceTypes": [
"application/vnd.lime.ping+json"
]
}
}
</code>
</pre>
<hr />
<h2 id="receipt">Receipt</h2>
<p>Represents the events that the client wants to receive.</p>
<h4>URI template</h4>
<pre>
lime://{ownerIdentity}/receipt
</pre>
<h4>MIME type</h4>
<pre>
application/vnd.lime.receipt+json
</pre>
<h4>JSON Schema</h4>
<pre>
<code class="json-schema">
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "receipt",
"type": "object",
"properties": {
"events" : {
"enum": [
"failed",
"accepted",
"validated",
"authorized",
"dispatched",
"received",
"consumed"
]
},
}
}
</code>
</pre>
<h4>Properties</h4>
<ul>
<li>
<strong>events</strong> - Indicates the events that you want the server to send info about. By default, the server will notificate only failed events.
</li>
</ul>
<h4>Example</h4>
<p>Set to accept all events:</p>
<pre>
<code class="json">
C:
{
"id": "2f158480-8c4e-4987-94e5-e4b960622f4b",
"method": "set",
"from": "walterjr@breakingbad.com/home",
"uri": "/receipt",
"type": "application/vnd.lime.receipt+json",
"resource": {
"events": [
"failed",
"accepted",
"validated",
"authorized",
"dispatched",
"received",
"consumed"
]
}
}
</code>
<code class="json">
S:
{
"method": "set",
"status": "success",
"id": "2f158480-8c4e-4987-94e5-e4b960622f4b",
"from": "server@breakingbad.com/machine1",
"to": "walterjr@breakingbad.com/home"
}
</code>
</pre>
<hr />
<h2 id="delegation">Delegation</h2>
<p>
Represents a delegation to send envelopes on behalf of another identity of the same network. The delegation can be constrained to specific envelope types. It can be revoked through a <em>delete</em> command.
</p>
<p>
In some cases, the delegation is issued automatically by the server. For instance if a node adds an identity to his roster, a node with this identity can <em>get</em> the <em>presence</em> resource on his behalf in the server.
</p>
<h4>URI template</h4>
<pre>
lime://{ownerIdentity}/delegations
</pre>
<h4>MIME type</h4>
<pre>
application/vnd.lime.delegation+json
</pre>
<h4>JSON Schema</h4>
<pre>
<code class="json-schema">
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "delegation",
"type": "object",
"properties": {
"target": {
"type": "string",
"pattern": "^(?:([^\"&'/:<>@@]{1,1023})@@)?([^/@@]{1,1023})(?:/(.{1,1023}))?$"
},
"envelopeTypes": {
"type": "array",
"items": {
"enum": [
"message",
"notification",
"command"
]
}
},
"messages": {
"type": "array",
"items": {
"type": "string"
}
},
"notifications": {
"type": "array",
"items": {
"enum": [
"received",
"consumed",
"failed"
]
}
},
"commands": {
"type": "array",
"items": {
"method" : {
"enum": [
"get",
"set",
"delete",
"observe"
]
},
"uri" : {
"title": "limeUri",
"type": "string",
"pattern": "^((lime://)(\w\.?-?)+@@?(\w\.?-?@@?)+)?(/(\w\.?-?@@?)+)+(\?{1}((\w+=\w+)&?)+)?$"
},
"status": {
"enum": [
"success",
"failure"
]
}
}
},
},
"required" : [ "target" ]
}
</code>
</pre>
<h4>Properties</h4>
<ul>
<li>
<strong>target</strong> - The target node which will receive the delegation.
</li>
<li>
<strong>envelopeTypes</strong> - The envelope types for delegation. If none is specified, indicates that all envelope types should be delegated.
</li>
<li>
<strong>messages</strong> - Message constraints for delegation. If not present, the delegation is given without any restriction for the message envelope type. Each item in the array define the following properties:
<ul>
<li>
<strong>type</strong> - The MIME type of the content type for delegation.
</li>
</ul>
</li>
<li>
<strong>notifications</strong> - Notification constraints for delegation. If not present, the delegation is given without any restriction for the notification envelope type. Each item in the array define the following properties:
<ul>
<li>
<strong>event</strong> - The event type for delegation.
</li>
</ul>
</li>
<li>
<strong>commands</strong> - Command constraints for delegation. If not present, the delegation is given without any restriction for the command envelope type. Each item in the array define the following properties:
<ul>
<li>
<strong>method</strong> - The method for delegation. If not present, The delegation is given for any method in the specified URI.
</li>
<li>
<strong>uri</strong> - The resource URI fo delegation.
</li>
<li>
<strong>status</strong> - The comand status for delegation. If not present, The delegation is given for any status in the specified URI.
</li>
</ul>
</li>
</ul>
<h4>Example</h4>
<pre>
1 - The delegate begins the process sending a delegate request to the issuer:
<code class="json">
{
"id": "e33e1659-b98f-4822-ba3d-e4a23f346907",
"from": "saul@breakingbad.com/office",
"to": "heisenberg@breakingbad.com",
"method": "get",
"uri": "/delegations",
"type": "application/vnd.lime.delegation+json",
"resource": {
"destinations" : [
"jesse@breakingbad.com",
"guywhoknowsaguy@breakingbad.com",
],
"commands": [
{
"type": "application/vnd.lime.presence+json",
"methods": [ "get" ]
},
{
"type": "application/vnd.lime.account+json",
"methods": [ "get", "set" ]
}
],
"messages": [
"application/vnd.lime.text+json"
]
}
}
</code>
2 - The issuer sends a set command to the server:
<code class="json">
{
"id": "e5a071c5-11f1-49e6-bcac-f2595876a8a2",
"from": "heisenberg@breakingbad.com/home",
"method": "set",
"type": "application/vnd.lime.delegation+json",
"resource": {
"target": "saul@breakingbad.com/office",
"destinations" : [
"jesse@breakingbad.com",
"guywhoknowsaguy@breakingbad.com",
],
"commands": [
{
"type": "application/vnd.lime.presence+json",
"methods": [ "get" ]
},
{
"type": "application/vnd.lime.account+json",
"methods": [ "get", "set" ]
}
],
"messages": [
"application/vnd.lime.text+json"
]
}
}
</code>
3 - The server acknowledges:
<code class="json">
{
"id": "e5a071c5-11f1-49e6-bcac-f2595876a8a2",
"to": "heisenberg@breakingbad.com/home",
"method": "set",
"type": "application/vnd.lime.delegation+json",
"result": "success"
}
</code>
4 - The issuer acknowledges:
<code class="json">
{
"id": "e33e1659-b98f-4822-ba3d-e4a23f346907",
"from": "heisenberg@breakingbad.com/home",
"to": "saul@breakingbad.com/office",
"method": "get",
"type": "application/vnd.lime.delegation+json",
"resource": {
"destinations" : [
"jesse@breakingbad.com",
"guywhoknowsaguy@breakingbad.com",
],
"commands": [
{
"type": "application/vnd.lime.presence+json",
"methods": [ "get" ]
},
{
"type": "application/vnd.lime.account+json",
"methods": [ "get", "set" ]
}
],
"messages": [
"application/vnd.lime.text+json"
]
}
}
</code>
5 - The delegate sends a message on behalf of the issuer:
<code class="json">
{
"from": "heisenberg@breakingbad.com",
"pp": "saul@breakingbad.com/office",
"to": "jesse@breakingbad.com",
"type": "application/vnd.lime.text+json",
"content": {
"text": "Let's meet at the office."
}
}
</code>
</pre>
<hr />
<h2 id="group">Group</h2>
<p>Allows the nodes to manage the groups that they owns or participates.</p>
<h4>URI templates</h4>
<pre>
lime://{ownerIdentity}/groups
lime://{ownerIdentity}/groups/{groupIdentity}
</pre>
<h4>MIME type</h4>
<pre>
application/vnd.lime.group+json
</pre>
<h4>JSON Schema</h4>
<pre>
<code class="json-schema">
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "group",
"type": "object",
"properties": {
"groups" : {
"title": "group",
"type": "object",
"properties": {
"identity": {
"title": "identity",
"type": "string",
"pattern": "^(?:([^\"&'/:<>@@]{1,1023})@@)?([^/@@]{1,1023})$"
},
"name" : {
"type": "string"
},
"photoUri": {
"type": "string",
"format": "uri"
},
"creator": {
"title": "identity",
"type": "string",
"pattern": "^(?:([^\"&'/:<>@@]{1,1023})@@)?([^/@@]{1,1023})$"
},
"created": {
"type": "string",
"format": "date-time"
},
"type" : {
"enum": [ "temporary", "public", "private" ]
},
"members" : {
"title": "limeUri",
"type": "string",
"pattern": "^((lime://)(\w\.?-?)+@@?(\w\.?-?@@?)+)?(/(\w\.?-?@@?)+)+(\?{1}((\w+=\w+)&?)+)?$"
}
},
"required" : [ "identity" ]
}
}
}
</code>
</pre>
<h4>Properties</h4>
<ul>
<li>
<strong>groups</strong> - List of groups that the node owns or participates. Every group can have the following properties:
<ul>
<li>
<strong>identity</strong> - Identity of the group, in the <em>group-id@groups.domain.com</em> format.
The <em>groups</em> subdomain is needed because that's the name of the application that handle the group messaging.
</li>
<li>
<strong>name</strong> - Name of the group.
</li>
<li>
<strong>photoUri</strong> - Photo URI of the group.
</li>
<li>
<strong>creator</strong> - Identity of the creator of the group.
</li>
<li>
<strong>created</strong> - Date and time of creation of the group.
</li>
<li>
<strong>type</strong> - Type of the group. The possible values are:
<ul>
<li>
<strong>temporary</strong> - The group exists while the owner session that created it is active.
This type of group is useful for mass message sending, since the groups application is optimized to send large amounts of messages. The temporary groups are private.
</li>
<li>
<strong>private</strong> - The group is not discoverable and someone can join only if is invited by owner or a moderator.
</li>
<li>
<strong>public</strong> - Any authenticated node in the domain can join the group.
</li>
</ul>
</li>
<li>
<strong>members</strong> - The URI to the group members resource.
</li>
</ul>
</li>
</ul>
<h4>Examples</h4>
<p>Getting all groups:</p>
<pre>
C:
<code class="json">
{
"id": "2aac8738-5507-44bf-b85a-30e146250fa3",
"from": "gus@breakingbad.com/pollos",
"method": "get",
"uri": "/groups"
}
</code>
S:
<code class="json">
{
"id": "2aac8738-5507-44bf-b85a-30e146250fa3",
"from": "server@breakingbad.com/machine1",
"to": "gus@breakingbad.com/pollos",
"method": "get",
"result": "success",
"type": "application/vnd.lime.collection+json",
"resource": {
"total": 3,
"itemType": "application/vnd.lime.group+json",
"items": [
{
"identity": "methcookers@groups.breakingbad.com",
"name": "Meth cookers",
"type": "private",
"members": "/groups/methcookers@groups.breakingbad.com/members"
},
{
"identity": "pollos@groups.breakingbad.com",
"name": "Los Pollos Hermanos Staff",
"type": "public",
"members": "/groups/pollos@groups.breakingbad.com/members"
},
{
"identity": "police@groups.breakingbad.com",
"name": "Albuquerque Police Department officers and supporters",
"type": "public",
"members": "/groups/police@groups.breakingbad.com/members"
}
]
}
}
</code>
</pre>
<p>Getting specific group:</p>
<pre>
C:
<code class="json">
{
"id": "2aac8738-5507-44bf-b85a-30e146250fa3",
"from": "gus@breakingbad.com/pollos",
"method": "get",
"uri": "/groups/pollos@groups.breakingbad.com"
}
</code>
S:
<code class="json">
{
"id": "2aac8738-5507-44bf-b85a-30e146250fa3",
"from": "server@breakingbad.com/machine1",
"to": "gus@breakingbad.com/pollos",
"method": "get",
"result": "success",
"type": "application/vnd.lime.group+json",
"resource": {
"identity": "pollos@groups.breakingbad.com",
"name": "Los Pollos Hermanos Staff",
"type": "public",
"members": "/groups/pollos@groups.breakingbad.com/members"
}
}
</code>
</pre>
<hr />
<h2 id="member">Member</h2>
<p>Allows the nodes to manage the members of the groups that they owns or participates.</p>
<h4>URI templates</h4>
<pre>
lime://{ownerIdentity}/groups/{groupIdentity}/members
lime://{ownerIdentity}/groups/{groupIdentity}/members/{memberIdentity}
lime://{ownerIdentity}/groups/{groupIdentity}/members/{memberIdentity}/{memberInstance}
</pre>
<h4>MIME type</h4>
<pre>
application/vnd.lime.group+json
</pre>
<h4>JSON Schema</h4>
<pre>
<code class="json-schema">
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "member",
"type": "object",
"properties": {
"identity": {
"title": "address",
"type": "string",
"pattern": "^(?:([^\"&'/:<>@@]{1,1023})@@)?([^/@@]{1,1023})(?:/(.{1,1023}))?$"
},
"role": {
"enum": [ "listener", "member", "moderator", "owner" ]
}
},
"required": [ "identity" ]
}
</code>
</pre>
<h4>Properties</h4>
<ul>
<li>
<strong>address</strong> - The address of the member, in the <em>name@domain/instance</em> format, being the instance information optional.
</li>
<li>
<strong>role</strong> - The role of the identity in the group. The possible values are:
<ul>
<li>
<strong>listener</strong> - The member can only receive messages from the group, and doesn't have permission to send.
</li>
<li>
<strong>member</strong> - The member can send and receive messages to the group. It's the default value.
</li>
<li>
<strong>moderator</strong> - The member can send and receive messages to the group and can <em>kick</em> and <em>ban</em> contacts from it.
</li>
<li>
<strong>owner</strong> - The owner have the permission to manage moderators, change and delete the group.
</li>
</ul>
</li>
</ul>
<h4>Examples</h4>
<p>Getting all group members:</p>
<pre>
C:
<code class="json">
{
"id": "2aac8738-5507-44bf-b85a-30e146250fa3",
"from": "gus@breakingbad.com/pollos",
"method": "get",
"uri": "/groups/pollos@groups.breakingbad.com/members"
}
</code>
S:
<code class="json">
{
"id": "2aac8738-5507-44bf-b85a-30e146250fa3",
"from": "server@breakingbad.com/machine1",
"to": "gus@breakingbad.com/pollos",
"method": "get",
"result": "success",
"type": "application/vnd.lime.collection+json",
"resource": {
"total": 3,
"itemType": "application/vnd.lime.groupmember+json",
"items": [
{
"address": "mike@breakingbad.com",
"role": "moderator"
},
{
"address": "ww@breakingbad.com"
},
{
"address": "jesse@breakingbad.com"
},
{
"address": "gale@breakingbad.com"
},
{
"address": "victor@breakingbad.com",
"role": "listener"
}
]
}
}
</code>
</pre>
<p>Set specific group member:</p>
<pre>
C:
<code class="json">
{
"id": "2aac8738-5507-44bf-b85a-30e146250fa3",
"from": "gus@breakingbad.com/pollos",
"method": "set",
"uri": "/groups/pollos@groups.breakingbad.com/members",
"type": "application/vnd.lime.groupmember+json",
"resource": {
"identity": "mike@breakingbad.com",
"role": "moderator"
}
}
</code>
S:
<code class="json">
{
"id": "2aac8738-5507-44bf-b85a-30e146250fa3",
"from": "server@breakingbad.com/machine1",
"to": "gus@breakingbad.com/pollos",
"method": "get",
"result": "success"
}
</code>
</pre>
<hr />
<h2 id="ping">Ping</h2>
<p>Allows the nodes to test the network connectivity.</p>
<h4>URI templates</h4>
<pre>
lime://{ownerIdentity}/ping
</pre>
<h4>MIME type</h4>
<pre>
application/vnd.lime.ping+json
</pre>
<h4>JSON Schema</h4>
<pre>
<code class="json-schema">
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ping",
"type": "object"
}
</code>
</pre>
<h4>Example</h4>
<p>Ping request from the server:</p>
<pre>
S:
<code class="json">
{
"id": "2aac8738-5507-44bf-b85a-30e146250fa3",
"from": "server@breakingbad.com/server1",
"to": "saul@breakingbad.com/tv",
"method": "get",
"uri": "/ping"
}
</code>
C:
<code class="json">
{
"id": "2aac8738-5507-44bf-b85a-30e146250fa3",
"from": "saul@breakingbad.com/tv",
"to": "server@breakingbad.com/server1",
"method": "get",
"result": "success",
"type": "application/vnd.lime.ping+json",
"resource": {}
}
</code>
</pre>
<hr />
<h2 id="presence">Presence</h2>
<p>Represents the availability status of a node in a network. A node can only receive envelopes from another nodes in the network if it sets its presence to an available status (except from the server, who always <em>knows</em> if a node is available or node, since this information is enforced by the existing session). In a new session, the node starts with a <em>unavailable</em> status.</p>
<h4>URI templates</h4>
<pre>
lime://{ownerIdentity}/presence
</pre>
<h4>MIME type</h4>
<pre>
application/vnd.lime.presence+json
</pre>
<h4>JSON Schema</h4>
<pre>
<code class="json-schema">
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "presence",
"type": "object",
"properties": {
"status": {
"enum": [
"unavailable",
"available",
"busy",
"away"
]
},
"message" : {
"type": "string"
},
"routingRule" : {
"enum": [
"instance",