3
"name": "Content Hub JS API",
4
"description": "Ubuntu App Platform Content Hub JavaScript API docs",
9
"name": "content-hub.js",
36
"file": "content-hub.js",
38
"description": "ContentHub is the entry point to resource io transfer\n from/to remote applications (peers)."
43
"name": "ContentTransfer",
44
"shortname": "ContentTransfer",
50
"module": "ContentHub",
52
"file": "content-hub.js",
54
"description": "ContentTransfer is an object created by the ContentHub to\n and allows one to properly setup and manage a data\n transfer between two peers.",
57
"\n\n var api = external.getUnityObject('1.0');\n var hub = api.ContentHub;\n\n var pictureContentType = hub.ContentType.Pictures;\n\n hub.defaultSourceForType(\n pictureContentType\n , function(peer) {\n hub.importContentForPeer(\n pictureContentType,\n peer,\n function(transfer) {\n [setup the transfer options and store]\n transfer.start(function(state) { [...] });\n });\n });"
61
"name": "ContentPeer",
62
"shortname": "ContentPeer",
68
"module": "ContentHub",
70
"file": "content-hub.js",
72
"description": "ContentPeer is an object returned by the ContentHub.\n It represents a remote peer that can be used in a request\n to import, export or share content.",
75
"\n\n var api = external.getUnityObject('1.0');\n var hub = api.ContentHub;\n\n var pictureContentType = hub.ContentType.Pictures;\n\n hub.defaultSourceForType(\n pictureContentType\n , function(peer) {\n [do something with the peer]\n });"
79
"name": "ContentStore",
80
"shortname": "ContentStore",
86
"module": "ContentHub",
88
"file": "content-hub.js",
90
"description": "ContentStore is an object returned by the ContentHub.\n\n It represents a location where the resources imported or\n exported from a peer during a transfer operation are to be\n either saved or found.",
93
"\n\n var api = external.getUnityObject('1.0');\n var hub = api.ContentHub;\n\n var pictureContentType = hub.ContentType.Pictures;\n\n hub.defaultStoreForType(pictureContentType, function(store) {\n [do something with the store]\n });"
98
"shortname": "ContentHub",
104
"module": "ContentHub",
106
"file": "content-hub.js",
108
"description": "The ContentHub object.",
115
"file": "content-hub.js",
117
"description": "Retrieves the current store.\n\nIf the callback parameter is not set, the current \"local\" value is retrieved.",
118
"itemtype": "method",
123
"description": "(optional)",
124
"type": "Function(String)"
127
"class": "ContentTransfer",
128
"module": "ContentHub"
131
"file": "content-hub.js",
133
"description": "Sets the current store for the ContentTransfer.",
134
"itemtype": "method",
140
"type": "ContentStore"
144
"description": "(optional) called when the store has been updated",
148
"class": "ContentTransfer",
149
"module": "ContentHub"
152
"file": "content-hub.js",
154
"description": "Retrieves the current state.\n\nIf the callback parameter is not set, the current \"local\" value is retrieved.",
155
"itemtype": "method",
160
"description": "(optional)",
161
"type": "Function(ContentTransfer.State)"
164
"class": "ContentTransfer",
165
"module": "ContentHub"
168
"file": "content-hub.js",
170
"description": "Sets the state of the transfer.",
171
"itemtype": "method",
177
"type": "ContentTransfer.State"
181
"description": "called when the state has been updated",
185
"class": "ContentTransfer",
186
"module": "ContentHub"
189
"file": "content-hub.js",
191
"description": "Notifies the listener when the state of the transfer changes.",
192
"itemtype": "method",
193
"name": "onStateChanged",
198
"type": "Function(ContentTransfer.State)"
201
"class": "ContentTransfer",
202
"module": "ContentHub"
205
"file": "content-hub.js",
207
"description": "Retrieves the current selection type.",
208
"itemtype": "method",
209
"name": "selectionType",
214
"type": "Function(ContentTransfer.SelectionType)"
217
"class": "ContentTransfer",
218
"module": "ContentHub"
221
"file": "content-hub.js",
223
"description": "Sets the selection type (single or multiple).",
224
"itemtype": "method",
225
"name": "setSelectionType",
228
"name": "selectionType",
230
"type": "ContentTransfer.SelectionType"
234
"description": "called when the state has been updated",
238
"class": "ContentTransfer",
239
"module": "ContentHub"
242
"file": "content-hub.js",
244
"description": "Retrieves the current transfer direction.\n\nIf the callback parameter is not set, the current \"local\" value is retrieved.",
245
"itemtype": "method",
250
"description": "(optional)",
251
"type": "Function(ContentTransfer.Direction)"
254
"class": "ContentTransfer",
255
"module": "ContentHub"
258
"file": "content-hub.js",
260
"description": "Sets the transfer direction (import or export).",
261
"itemtype": "method",
262
"name": "setDirection",
267
"type": "ContentTransfer.Direction"
271
"description": "called when the state has been updated",
275
"class": "ContentTransfer",
276
"module": "ContentHub"
279
"file": "content-hub.js",
281
"description": "Retrieves the list of items associated with the ContentTransfer.",
282
"itemtype": "method",
287
"description": "} )}",
288
"type": "Function( Objectname: , url:"
291
"class": "ContentTransfer",
292
"module": "ContentHub"
295
"file": "content-hub.js",
297
"description": "Sets the list of items for the associated ContentTransfer (used when exporting).",
298
"itemtype": "method",
304
"type": "Array of Objectname: String, url: String"
308
"description": "called when the state has been updated",
312
"class": "ContentTransfer",
313
"module": "ContentHub"
316
"file": "content-hub.js",
318
"description": "Starts a transfer",
319
"itemtype": "method",
325
"type": "Function(ContentTransfer.State)"
328
"class": "ContentTransfer",
329
"module": "ContentHub"
332
"file": "content-hub.js",
334
"description": "Sets State to ContentTransfer.Finalized and cleans up temporary files.",
335
"itemtype": "method",
337
"class": "ContentTransfer",
338
"module": "ContentHub"
341
"file": "content-hub.js",
343
"description": "Destroys the remote object. This proxy object is not valid anymore.",
344
"itemtype": "method",
346
"class": "ContentTransfer",
347
"module": "ContentHub"
350
"file": "content-hub.js",
352
"description": "Retrieves the app Id of the associated peer.\n\nIf the callback parameter is not set, the current \"local\" value is retrieved.",
353
"itemtype": "method",
356
"description": "Application Id for this peer",
362
"description": "(optional)",
363
"type": "Function(String)"
366
"class": "ContentPeer",
367
"module": "ContentHub"
370
"file": "content-hub.js",
372
"description": "Sets the app Id of the associated peer.",
373
"itemtype": "method",
383
"description": "called when the appId has been updated",
387
"class": "ContentPeer",
388
"module": "ContentHub"
391
"file": "content-hub.js",
393
"description": "Retrieves the specific ContentHandler for this peer.\n\nIf the callback parameter is not set, the current \"local\" value is retrieved.",
394
"itemtype": "method",
397
"description": "ContentHandler for this peer",
403
"description": "(optional)",
404
"type": "Function(String)"
407
"class": "ContentPeer",
408
"module": "ContentHub"
411
"file": "content-hub.js",
413
"description": "Sets specific ContentHandler for this peer.",
414
"itemtype": "method",
415
"name": "setHandler",
420
"type": "ContentHandler"
424
"description": "called when the appId has been updated",
428
"class": "ContentPeer",
429
"module": "ContentHub"
432
"file": "content-hub.js",
434
"description": "Retrieves the specific ContentType for this peer.\n\nIf the callback parameter is not set, the current \"local\" value is retrieved.",
435
"itemtype": "method",
436
"name": "contentType",
438
"description": "ContentType for this peer",
444
"description": "(optional)",
445
"type": "Function(String)"
448
"class": "ContentPeer",
449
"module": "ContentHub"
452
"file": "content-hub.js",
454
"description": "Sets specific ContentType for this peer.",
455
"itemtype": "method",
456
"name": "setContentType",
459
"name": "contentType",
461
"type": "ContentType"
465
"description": "called when the content type has been updated",
469
"class": "ContentPeer",
470
"module": "ContentHub"
473
"file": "content-hub.js",
475
"description": "Retrieves the specific SelectionType for this peer.\n\nIf the callback parameter is not set, the current \"local\" value is retrieved.",
476
"itemtype": "method",
477
"name": "selectionType",
479
"description": "ContentTransfer.SelectionType for this peer",
485
"description": "(optional)",
486
"type": "Function(String)"
489
"class": "ContentPeer",
490
"module": "ContentHub"
493
"file": "content-hub.js",
495
"description": "Sets specific SelectionType for this peer.",
496
"itemtype": "method",
497
"name": "setSelectionType",
500
"name": "selectionType",
502
"type": "ContentTransfer.SelectionType"
506
"description": "called when the content type has been updated",
510
"class": "ContentPeer",
511
"module": "ContentHub"
514
"file": "content-hub.js",
516
"description": "Retrieves the name of the associated peer.\n\nIf the callback parameter is not set, the current \"local\" value is retrieved.",
517
"itemtype": "method",
522
"description": "(optional)",
523
"type": "Function(String)"
526
"class": "ContentPeer",
527
"module": "ContentHub"
530
"file": "content-hub.js",
532
"description": "Returns true if the peer is a default one, false otherwise.\n\nIf the callback parameter is not set, the current \"local\" value is retrieved.",
533
"itemtype": "method",
534
"name": "isDefaultPeer",
538
"description": "(optional)",
539
"type": "Function(Bool)"
542
"class": "ContentPeer",
543
"module": "ContentHub"
546
"file": "content-hub.js",
548
"description": "Request to exchange content with this ContentPeer.",
549
"itemtype": "method",
554
"description": "Called with the resulting content transfer",
555
"type": "Function(ContentTransfer)"
558
"class": "ContentPeer",
559
"module": "ContentHub"
562
"file": "content-hub.js",
564
"description": "Request to import content from this ContentPeer and use a ContentStore for permanent storage.",
565
"itemtype": "method",
566
"name": "requestForStore",
570
"description": "Store used as a permanent storage",
571
"type": "ContentStore"
575
"description": "Called with the resulting content transfer",
576
"type": "Function(ContentTransfer)"
579
"class": "ContentPeer",
580
"module": "ContentHub"
583
"file": "content-hub.js",
585
"description": "Destroys the remote object. This proxy object is not valid anymore.",
586
"itemtype": "method",
588
"class": "ContentPeer",
589
"module": "ContentHub"
592
"file": "content-hub.js",
594
"description": "Retrieves the uri of the associated store.\n\nIf the callback parameter is not set, the current \"local\" value is retrieved.",
595
"itemtype": "method",
598
"description": "current uri",
604
"description": "(optional)",
605
"type": "Function(String)"
608
"class": "ContentStore",
609
"module": "ContentHub"
612
"file": "content-hub.js",
614
"description": "Retrieves the current scope.\n\nIf the callback parameter is not set, the current \"local\" value is retrieved.",
615
"itemtype": "method",
618
"description": "current scope",
619
"type": "ContentScope"
624
"description": "(optional)",
625
"type": "Function(ContentScope)"
628
"class": "ContentStore",
629
"module": "ContentHub"
632
"file": "content-hub.js",
634
"description": "Sets the current scope.",
635
"itemtype": "method",
641
"type": "ContentScope"
645
"description": "called when the scope has been updated",
649
"class": "ContentStore",
650
"module": "ContentHub"
653
"file": "content-hub.js",
655
"description": "Destroys the remote object. This proxy object is not valid anymore.",
656
"itemtype": "method",
658
"class": "ContentStore",
659
"module": "ContentHub"
662
"file": "content-hub.js",
664
"description": "ContentType is an enumeration of well known content types.\n\n Values:\n\n Pictures\n\n Documents\n \n Music\n\n Contacts\n\n Videos\n\n Links",
666
"itemtype": "property",
667
"name": "ContentType",
670
"\n\n var api = external.getUnityObject('1.0');\n var hub = api.ContentHub;\n\n var pictureContentType = hub.ContentType.Pictures;"
672
"class": "ContentHub",
673
"module": "ContentHub"
676
"file": "content-hub.js",
678
"description": "ContentHandler is an enumeration of well known content handlers.\n\n Values:\n\n Source\n\n Destination\n\n Share",
680
"itemtype": "property",
681
"name": "ContentHandler",
683
"class": "ContentHub",
684
"module": "ContentHub"
687
"file": "content-hub.js",
689
"description": "ContentScope is an enumeration of well known scope types.\n\n Values:\n\n System\n\n User\n\n App",
691
"itemtype": "property",
692
"name": "ContentScope",
694
"class": "ContentHub",
695
"module": "ContentHub"
698
"file": "content-hub.js",
700
"description": "ContentTransfer.State is an enumeration of the state of a given ongoing ContentTransfer.\n\n Values:\n\n Created: Transfer created, waiting to be initiated.\n\n Initiated: Transfer has been initiated.\n\n InProgress: Transfer is in progress.\n\n Charged: Transfer is charged with items and ready to be collected.\n\n Collected: Items in the transfer have been collected.\n\n Aborted: Transfer has been aborted.\n\n Finalized: Transfer has been finished and cleaned up.\n\n Downloaded: Download specified by downloadId has completed.\n\n Downloading: Transfer is downloading item specified by downloadId.",
702
"itemtype": "property",
703
"name": "ContentTransfer.State",
706
"\n\n var api = external.getUnityObject('1.0');\n var hub = api.ContentHub;\n\n var transferState = hub.ContentTransfer.State;\n var pictureContentType = hub.ContentType.Pictures;\n\n hub.importContentForPeer(\n pictureContentType,\n peer,\n function(transfer) {\n hub.defaultStoreForType(pictureContentType, function(store) {\n transfer.setStore(store, function() {\n transfer.start(function(state) {\n if (transferState.Aborted === state) {\n [...]\n }\n [...]\n });\n });\n });\n });\n"
708
"class": "ContentHub",
709
"module": "ContentHub"
712
"file": "content-hub.js",
714
"description": "ContentTransfer.Direction is an enumeration of the directions of a given ContentTransfer.\n\n Values:\n\n Import\n\n Export\n\n Share",
716
"itemtype": "property",
717
"name": "ContentTransfer.Direction",
719
"class": "ContentHub",
720
"module": "ContentHub"
723
"file": "content-hub.js",
725
"description": "ContentTransfer.SelectionType is an enumeration of the directions of a given ContentTransfer.\n\n Values:\n\n Single: Transfer should contain a single item\n\n Multiple: Transfer can contain multiple items",
727
"itemtype": "property",
728
"name": "ContentTransfer.SelectionType",
730
"class": "ContentHub",
731
"module": "ContentHub"
734
"file": "content-hub.js",
736
"description": "Creates a ContentPeer object for the given source type.",
737
"itemtype": "method",
742
"description": "A dictionary of parameters to filter the result. The filtering keys are:\n- contentType: desired ContentType\n- handler: desired ContentHandler",
747
"description": "Callback that receives the result or null",
748
"type": "Function(List of ContentPeer objects)"
751
"class": "ContentHub",
752
"module": "ContentHub"
755
"file": "content-hub.js",
757
"description": "Creates a ContentStore object for the given scope type.",
758
"itemtype": "method",
763
"description": "The content scope for the store",
764
"type": "ContentScope"
768
"description": "Callback that receives the result or null",
769
"type": "Function(ContentStore)"
772
"class": "ContentHub",
773
"module": "ContentHub"
776
"file": "content-hub.js",
778
"description": "Launches the content peer picker ui that allows the user to select a peer.",
779
"itemtype": "method",
780
"name": "launchContentPeerPicker",
784
"description": "A dictionary of parameters to filter the result. The filtering keys are:\n- contentType: desired ContentType\n- handler: desired ContentHandler\n- showTitle: boolean value indicating if the title should be visible",
788
"name": "onPeerSelected",
789
"description": "Called when the user has selected a peer",
790
"type": "Function(ContentPeer)"
793
"name": "onCancelPressed",
794
"description": "Called when the user has pressed cancel",
798
"class": "ContentHub",
799
"module": "ContentHub"
802
"file": "content-hub.js",
804
"description": "Sets a handler that is to be called when the current application is the\ntarget of an export request.",
805
"itemtype": "method",
806
"name": "onExportRequested",
810
"description": "Function when one requests a resource to be exported.\n The corresponding ContentTransfer is provided as a parameter.",
811
"type": "Function(ContentTransfer)"
815
"\n \n var api = external.getUnityObject(1.0);\n var hub = api.ContentHub;\n \n var transferState = hub.ContentTransfer.State;\n \n function _exportRequested(transfer) {\n var url = window.location.href;\n url = url.substr(0, url.lastIndexOf('/')+1) + 'img/ubuntuone-music.png';\n \n transfer.setItems([{name: 'Ubuntu One', url: url}],\n function() {\n transfer.setState(hub.ContentTransfer.State.Charged);\n });\n };\n \n hub.onExportRequested(_exportRequested);\n "
817
"class": "ContentHub",
818
"module": "ContentHub"
821
"file": "content-hub.js",
823
"description": "Sets a handler that is to be called when the current application is the\ntarget of an share request.",
824
"itemtype": "method",
825
"name": "onShareRequested",
829
"description": "Function when one requests a resource to be shared.\n The corresponding ContentTransfer is provided as a parameter.",
830
"type": "Function(ContentTransfer)"
834
"\n\n var api = external.getUnityObject(1.0);\n var hub = api.ContentHub;\n\n var transferState = hub.ContentTransfer.State;\n\n function _shareRequested(transfer) {\n };\n\n hub.onShareRequested(_shareRequested);\n"
836
"class": "ContentHub",
837
"module": "ContentHub"
840
"file": "content-hub.js",
842
"description": "Sets a handler that is to be called when the current application is the\ntarget of an import request.",
843
"itemtype": "method",
844
"name": "onImportRequested",
848
"description": "Function when one requests a resource to be imported.\n The corresponding ContentTransfer is provided as a parameter.",
849
"type": "Function(ContentTransfer)"
853
"\n\n var api = external.getUnityObject(1.0);\n var hub = api.ContentHub;\n\n var transferState = hub.ContentTransfer.State;\n\n function _importRequested(transfer) {\n };\n\n hub.onImportRequested(_importRequested);\n"
855
"class": "ContentHub",
856
"module": "ContentHub"
859
"file": "content-hub.js",
861
"description": "Creates a ContentStore object for the given ContentPeer.",
862
"itemtype": "method",
863
"name": "api.importContent",
867
"description": "type of the content to import",
868
"type": "ContentType"
872
"description": "peer who's content should be imported",
873
"type": "ContentPeer"
876
"name": "transferOptions",
877
"description": "a dictionary of transfer options. The options are the following:\n- multipleFiles {Bool}: specified if a transfer should involve multiple files or not\n- scope {ContentScope}: specifies the location where the transferred files should be copied to",
882
"description": "called when the transfer has failed",
883
"type": "Function(reason:)"
887
"description": ")} called when the transfer has been a success and items are available",
888
"type": "Function(Array of ContentItem"
891
"class": "ContentHub",
892
"module": "ContentHub"
895
"file": "content-hub.js",
899
"class": "ContentHub",
900
"module": "ContentHub"
905
"message": "Missing item type",
906
"line": " content-hub.js:934"
b'\\ No newline at end of file'