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

@plattar/plattar-services

v1.157.1

Published

Plattar SDK for interfacing with Remote Plattar Services such as Configurators, File Converters and Asset Optimisers

Downloads

145

Readme

install size NPM License

plattar-services allows interfacing with Remote Plattar Services such as Configurators, File Converters and Asset Optimisers.

Quick Use

// Minified Version ES2015 & ES2019 (Latest)
https://cdn.jsdelivr.net/npm/@plattar/plattar-services/build/es2015/plattar-services.min.js
https://cdn.jsdelivr.net/npm/@plattar/plattar-services/build/es2019/plattar-services.min.js

// Standard Version ES2015 & ES2019 (Latest)
https://cdn.jsdelivr.net/npm/@plattar/plattar-services/build/es2015/plattar-services.js
https://cdn.jsdelivr.net/npm/@plattar/plattar-services/build/es2019/plattar-services.js

Installation

  • Install using npm
npm install @plattar/plattar-services

Configurator Example

const configurator = new PlattarServices.Configurator();

// add SceneProduct and ProductVariation mapping to our configurator
// if using plattar-api objects, the attributes will be hashed aswell
configurator.addSceneProduct("e6d79450-4e5a-11ec-8441-19fd21954ae9", "568b63d0-3af6-11e9-8543-4d96b548a86f");
configurator.addSceneProduct("e6d890b0-4e5a-11ec-b6da-dfb7e6b01d2b", "c8bc3d40-3af6-11e9-8e4f-fb10e27e3a41");
configurator.addSceneProduct("e6d66ae0-4e5a-11ec-94a1-cf20ab6b8fd4", "1bf213e0-3af7-11e9-bb39-dbde969e139c");
// configurator also aupports adding models without variations
configurator.addModel("15e26685-fdda-806c-bd62-70f57594ea38");

// output configuration as USDZ - default is glb
configurator.output = "usdz";

// execute on staging objects - default is production
configurator.server = "staging";

configurator.get().then((data) => {
    // this says if the object is returned from cache or generated new
    console.log("cache_status - " + data.cache_status);
    // this is the full url to the final generated object
    console.log("filename - " + data.filename);
    // this is the request/file hash used for caching
    console.log("hash - " + data.hash);
}).catch((err) => {
    console.error(err);
});

Virtual Try On (VTO) Example

const configurator = new PlattarServices.Configurator();

// add SceneProduct and ProductVariation mapping to our configurator
// if using plattar-api objects, the attributes will be hashed aswell
configurator.addProduct("bc136a6c-1abf-699b-f122-e72e43b32d2a", "e49e93a0-427f-11ec-acd9-9d5725e9cdf9");

// output configuration as Apple Reality USDZ - default is glb
// this model will track onto the users-face. The alignment 
// can be changed via the Plattar CMS!
configurator.output = "vto";

// execute on staging objects - default is production
configurator.server = "staging";

configurator.get().then((data) => {
    // this says if the object is returned from cache or generated new
    console.log("cache_status - " + data.cache_status);
    // this is the full url to the final generated object
    console.log("filename - " + data.filename);
    // this is the request/file hash used for caching
    console.log("hash - " + data.hash);
}).catch((err) => {
    console.error(err);
});

Model Converter Example

const converter = new PlattarServices.ModelConverter();

// the FileModel id, this can be a string or FileModel instance
converter.model = "0d8c6d90-0b88-11ec-b58b-ffbce2e5da06";
// output model as USDZ - default is glb
converter.output = "usdz";
// execute on staging objects - default is production
converter.server = "staging";

converter.get().then((data) => {
    // this says if the object is returned from cache or generated new
    console.log("cache_status - " + data.cache_status);
    // this is the full url to the final generated object
    console.log("filename - " + data.filename);
    // this is the request/file hash used for caching
    console.log("hash - " + data.hash);
}).catch((err) => {
    console.error(err);
});