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

@svgator/sdk-backend

v1.0.5

Published

Node.js backend SDK for SVGator API

Downloads

235

Readme

JavaScript BackEnd SDK

This Node.js SDK lets your application connect to your users' SVGator projects, after they authorized the access using the Frontend SDK. Please note that SVGator strongly recommends the usage of the Backend SDK over direct API calls.

Before You Start

In order to use SVGator's API & SDKs, one first must obtain an SVGator Application. To do so, please email [email protected], providing your SVGator account ID and the desired usage of your SVGator application.

The API keys one should receive from [email protected] are shown below:

| Name | Description | Notes | Sample Value | |------|------|------------|----------| | app_id | Application ID |prefixed with "ai_", followed by 32 alphanumeric chars|ai_b1357de7kj1j3ljd80aadz1eje782f2k| | secret_key | Secret Key |prefixed with "sk_", followed by 32 alphanumeric chars|sk_58ijx87f45596ylv5jeb1a5vicdd92i4|

Creating an application on the fly is also possible using appId=dynamic, yet this feature comes with restrictions. For a multi-user implementation follow the steps above instead.

Requirements

  • nodejs >= 7.6

Installation

Run the following command in the directory where you want to install the module

npm i @svgator/sdk-backend

Usage

const SVGatorBackend  = require("@svgator/sdk-backend");
// You may also import our module by:
// import SVGatorBackend from "@svgator/sdk-backend";

let auth_code = 'ac_...';
let app_id = 'ai_...';
let secret_key = 'sk_...';
            
async function run(){

    let svgator = new SVGatorBackend({app_id, secret_key});

    // obtain an access_token based on the auth_code received on front-end
    let {access_token, customer_id} = await svgator.token.get(auth_code);

    // read all SVG projects for a user. limit & offset arguments are optional
    let limit = 1000;
    let offset = 0;
    let {projects} = await svgator.projects.getAll(access_token, customer_id, limit, offset);

    let project_id = projects[0].id;

    // read a single SVG project based on ID
    let {project} = await svgator.projects.get(access_token, project_id);

    // obtain the animated SVG from SVGator
    return svgator.projects.export(access_token, project.id);
}

// output the first animated SVG from the user's account
run()
.then((svg)=>console.log(svg))
.finally(()=>process.exit());