npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@feup-infolab/node-b2share-v2

v4.0.1

Published

(Under construction)

Downloads

2

Readme

node-b2share-v2

Build Status Coverage Status npm version Codacy Badge Codacy Badge Chat on gitter

(The build may be in "failing" status due to temporary downtime of the B2Share Training Website at the time of the CI Build. This server is used to simulate the API requests and test the client. Do not worry, as this is normal.).

What is this?

This is a JavaScript wrapper for the EUDAT B2Share V2 API.

Developed in the context of the DataPublication@UPorto data pilot, it supports the B2Share V2 API.

Usage

Install

npm i @feup-infolab/node-b2share-v2

Use in your project

Warning: Make sure you create the access token for the respective host. For instance if you are interacting with the training url(trng-b2share.eudat.eu), create the access token for this host in https://trng-b2share.eudat.eu/user, if you are using the main url create the token in https://b2share.eudat.eu/user

var B2ShareClient = require('node-b2share-v2');

/**
 * Initiates the B2ShareClient
 * @param host the host required to execute the requests(ex: trng-b2share.eudat.eu)
 * @param access_token the user's access token
 * @constructor
 */
var client = new B2ShareClient(url, access_token) 

//API calls
/**
 * Lists the communities, no arguments needed
 * @param callback
 */
client.listCommunities(function(err, communities)

/**
 * Gets a specific community schema
 * @param communityID the community id you want the schema from
 * @param callback
 */
client.getCommunitySchema(communityID, function(err, schema)

/**
 * List all the records, no arguments needed
 * @param callback
 */
client.listAllRecords(function(err,records)

/**
 * List records for a specific community
 * @param communityID the community id you want the records from
 * @param callback
 */
client.listRecordsPerCommunity(communityId, function(err, records)

/**
 * Search records by query string
 * @param queryString the query string
 * @param callback
 */
client.searchRecords(queryString, function(err, records)

/**
 * Search for drafts, no other parameters required
 * @param callback
 */
client.searchDrafts(function(err, drafts)

/**
 * Gets a specific record
 * @param recordID the record id of the record who want the information from
 * @param callback
 */
client.getSpecificRecord(recordID, function(err, record)

/**
 * Creates a draft record
 * @param data json object with basic information about the object, eg: {"titles":[{"title":"TestRest"}], "community":"e9b9792e-79fb-4b07-b6b4-b9c2bd06d095", "open_access":true, "community_specific": {}};
 * @param callback
 */
client.createADraftRecord(data, function(err, draft)

/**
 * Uploads a file into a draft record
 * @param info a json object with info(bucketID and the absolute file path) about the file eg: {"fileBucketID":"547485748754854875fgf", "absFilePath": "/Users/np/Desktop/docs/thisIsATxtFile.txt"}
 * @param callback
 */
client.uploadFileIntoDraftRecord(info, buffer, function(err, file)

/**
 * Gets the uploaded files in a specific record
 * @param fileBucketID the file bucket id
 * @param callback
 */
client.listUploadedFilesInRecord(fileBucketID, function(err, files)

/**
 * Updates a draft record metadata
 * @param recordID the record id of the draft
 * @param jsonPatchFormatData the content of the update, follows the json patch format ex: { "op": "replace", "path": "/titles/0/title", "value": "FINAL" }
 * @param callback
 */
client.updateDraftRecordMetadata(recordID, jsonPatchFormatData, function(err, draft)

/**
 * Submits a draft for publication
 * @param recordID the record id to submit for publication
 * @param callback
 */
client.submitDraftRecordForPublication(recordID, function(err, record)