Code Monkey home page Code Monkey logo

lib-js's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

lib-js's Issues

Question: how can I programmaticaly create shared-access tokens ?

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!

Call Batch does not seem to work (Nodejs)

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] }

Nodejs adding attachment without filename

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 ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.