You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: hf-data/tutorial.md
+61-62Lines changed: 61 additions & 62 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -398,7 +398,7 @@ resultTreatment.push(
398
398
## Create a sharing
399
399
400
400
Once data from the tracking task has been collected, the app is designed to allow the user to share his data with a third-party.
401
-
The section "**Sharings**" enables the user to create a sharing that consists of an URL link with a Pryv apiEndpoint that displays the visualization from the tracking test. The code for the sharing creation is contained in the section **Sharings** of the file [script.js](script.js).
401
+
The section "**Sharings**" enables the user to create a sharing that consists of a URL link with a Pryv apiEndpoint that displays the visualization from the tracking test. The code for the sharing creation is contained in the section **Sharings** of the file [script.js](script.js).
402
402
In order to create a sharing, we add a listener to the *Create* button:
403
403
404
404
```javascript
@@ -418,54 +418,54 @@ async function createSharing() {
418
418
```
419
419
It will first fetch values for the scope of the sharing ('streamId' for permissions), in our case "read" level on the stream "**HF Demo**":
It will package those values into an [accesses.create](https://api.pryv.com/reference/#create-access) API call.
426
425
```javascript
427
-
constres=awaitpryvHF.pryvConn.api([
428
-
{
429
-
method:'accesses.create',
430
-
params: {
431
-
name: name,
432
-
permissions: permissions
433
-
}
434
-
}]);
435
-
consterror= res[0].error;
436
-
if (error !=null) {
437
-
displayError(error);
438
-
return;
426
+
constresults=awaitpryvHF.pryvConn.api([
427
+
// https://github.com/pryv/lib-js#api-calls
428
+
{
429
+
method:'accesses.create', // creates the selected access: https://api.pryv.com/reference/#create-access
430
+
params: {
431
+
name: name,
432
+
permissions: permissions
433
+
}
439
434
}
440
-
updateSharings();
441
-
}
435
+
]);
436
+
consterror= results[0].error;
437
+
if (error !=null) {
438
+
displayError(error);
439
+
return;
440
+
}
441
+
updateSharings();
442
442
```
443
443
444
-
This call is made using [pryConn.api()](https://github.com/pryv/lib-js#api-calls) method.
444
+
This call is made using [pryvConn.api()](https://github.com/pryv/lib-js#api-calls) method.
445
445
446
-
The sharings of the user are also displayed using the function **updateSharings()** that performs a [get.accesses](https://api.pryv.com/reference/#get-accesses) API call:
446
+
The sharings of the user are also displayed using the function **updateSharings()** that performs an [accesses.get](https://api.pryv.com/reference/#get-accesses) API call:
In the same way, the function **deleteSharing()** enables to delete the selected access by the user by performing an [accesses.delete](https://api.pryv.com/reference/#delete-access) API call.
468
+
In the same way, the function **deleteSharing()** enables to delete the access selected by the user by performing an [accesses.delete](https://api.pryv.com/reference/#delete-access) API call.
469
469
470
470
```javascript
471
471
asyncfunctiondeleteSharing(accessId) {
@@ -490,55 +490,54 @@ The recipient of the link can open the data visualization by clicking on the cho
490
490
- the **Desktop version** contains the drawing performed with the mouse tracker
491
491
- the **Mobile version** displays the recording of the phone orientation
492
492
493
-
The code for the visualization mode is contained in the section **Visualization only** of the file [script.js](script.js).
493
+
The code for the visualization mode is contained in the [js/view_only.js](js/view_only.js).
494
494
495
495
This will load the app already authenticated, by passing the `pryvApiEndpoint` parameter in the function *buildVisualizationOnly(apiEndpoint, urlParams)*.
0 commit comments