pryv / lib-js Goto Github PK
View Code? Open in Web Editor NEWPryv's Javascript library
License: Other
Pryv's Javascript library
License: Other
I would like to create a pryv token from my Nodejs app, is it possible? I am using this web app http://pryv.github.io/app-web-access/?pryvServiceInfoUrl={URL} to create my admin user (with manage level permissions) and I would like to give users shared accesses to different endpoints of my instance.
To be clear, it is the 'Share a slice' feature on the dashboard. Is there a way to directly write it in javascript?
Thank you very much!
This may start with a PoC (& draft PR) to explore the design, which could be shown to the client for validation.
const apiCalls = [
{
"method": "streams.create",
"params": { "id": "heart", "name": "Heart" }
},
{
"method": "events.create",
"params": { "time": 1385046854.282, "streamId": "heart", "type": "frequency/bpm", "content": 90 }
},
{
"method": "events.create",
"params": { "time": 1385046854.283, "streamId": "heart", "type": "frequency/bpm", "content": 120 }
}
]
try {
const result = await connection.api(apiCalls)
} catch (e) {
// handle error
}
streams.create method works, but not the events.create. When using this, the events output correctly in the const result (getting no error), but actually do not save on the Pryv instance. Indeed, get request on the events returns :
[Node] {
[Node] eventsCount: 0,
[Node] meta: {
[Node] apiVersion: '1.5.17',
[Node] serverTime: 1600107856.999,
[Node] serial: '2019061301'
[Node] }
[Node] }
Instead the stated.id is set to initialized.
Line 54 in ba081d9
Hello,
I'm trying to create an event with a picture attached in Nodejs, but not from a file, as it is coming from a PubSub system in a base64 encoded string. I tried the following:
const image = ""; // My image in base64
// 1.
await connection.createEventWithFile({
type: 'picture/attached',
streamId: 'my-stream'
}, image); // --> error as expected
// 2.
await connection.createEventWithFile({
type: 'picture/attached',
streamId: 'my-stream'
}, Buffer.from(image)); // --> no attachment in event
// 3.
await connection.api([
// ...
{
method: "events.create",
params: {
streamId: 'my-stream',
type: "picture/base64",
content: {
payload: image,
format: 'jpg',
filename: 'my-picture.jpg'
}
}
}
]); // -> event.content === '[object Object]', do I do something wrong here?
I also tried using the Nodejs form-data module but it didn't work well with superagent
.
Do you have any solution ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.