0.0.16 • Published 5 years ago

pedial-sdk v0.0.16

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

pedial-sdk

installation

yarn add pedial-sdk

or

npm install --save pedial-sdk

init project

const pedial = require('pedial-sdk');

const config = {
  url: 'http://SDK_URL',
  apiKey: 'YOUR_API_KEY',
  projectId: YOUR_PROJECT_ID,
};

pedial.init(config);

Note: you need to call pedial.init(config) before calling any of the commands below.

Note: all the examples below use async / await, but they will also work with promises.

get project informations

try {
  const projectInfo = pedial.getProject();
  console.log(projectInfo);
} catch(e) {
  console.error(e.message);
}

upload a file for certification

try {
  const result = await pedial.uploadFileForCertification({
    description: 'Sample Yarn File, to see if it can be certified ?',
    tags: ['yarn', 'dummy example'],
    path: './yarn.lock'
  });
  console.log(`Done. Remaining storage : ${result.remainingStorage} bytes`);
} catch(e) {
  console.error(e.message);
}

upload content for certification

try {
  const result = await pedial.uploadContentForCertification({
    name: 'My First Poem',
    description: 'This is my first poem, I hope you will enjoy it.',
    tags: ['poetry'],
    content: `
      Roses are red,
      Violets are blue,
      This is my first poem,
      from me, through Pedial, to you
    `
  });
  console.log(`Done. Remaining storage : ${result.remainingStorage} bytes`);
} catch(e) {
  console.error(e.message);
}

give a link (hash) to a file for certification, without uploading

Your file won't be copied to Pedial's server.

You will need to provide a hash for the file.

try {
  await pedial.linkFileForCertification({
    description: 'Some file I want to certify but certainly not upload.',
    tags: ['personal file', 'family'],
    filename: 'MyWeddingMovie.mp4',
    url: 'SOME_URL_IF_ANY',
    hash: 'FILE_HASH',
  });
  console.log('Done.');
} catch(e) {
  console.error(e.message);
}
0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago