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

mm-integration

v1.0.0

Published

Wrapper around Schibsted multimedia integrations

Downloads

152

Readme

mm-integration

A wrapper around Schibsted's Multimedia integrations for use in the browser and on the server.

const Integration = require('mm-integration')
Integration.defaults.auth = {
  username: process.env['MM_API_PROD_USERNAME'],
  password: process.env['MM_API_PROD_PASSWORD'],
}

// Creating an integration
const myIntegration = new Integration('<p>Hello world!</p>')
await myIntegration.save()
console.log('Integration created at', myIntegration.url)

// Updating an integration
myIntegration.title = 'Hello world!'
await myIntegration.save()
console.log('Integration updated')

// Deleting an integration
await myIntegration.delete()
console.log('Integration deleted')

Integration

Kind: global class

new Integration([opts])

Create an instance representing an MM integration

| Param | Type | Default | Description | | --- | --- | --- | --- | | [opts] | String | Object | | Can be a string representing the integration's html body or an object of options | | [opts.id] | String | | The server-side id of the integration | | [opts.url] | String | | The URL from which the CMS will fetch the integration. If you want to programmatically update an existing integration, you will need to provide both the id and the url. This is unexpected and not ideal, but unfortunately the Content API provides no way to access the URL of an integration, given its ID. | | [opts.html] | String | '' | The HTML body of the integration. | | [opts.author] | String | '' | Author name to be associated with the integration. | | [opts.title] | String | '' | Title to be associated with the integration. | | [opts.base] | String | 'https://enrichment.api.plan3.se/proxy/content/v3/publication/bt/multimedias' | The base URL of the API, without a trailing slash. | | [opts.auth] | String | {username: '', password: ''} | An object with your credentials for the multimedia API, containing username and password properties. All options can also be set and changed by setting the instance properties. |

integration.save() ⇒ Promise

Saves the integration to the server, either creating a new one or updating an existing one as appropriate

Kind: instance method of Integration Returns: Promise - A promise as returned by fetch()

integration.delete() ⇒ Promise

Requests the server to delete an existing integration

Kind: instance method of Integration Returns: Promise - A promise as returned by fetch()

Integration.defaults

You can globally set the defaults for all new Integrations by modifying the Integration.defaults static object. This can contain the same options as the opts object you can pass into new Integration(opts).

Note that while you can globally set the id or url properties, this is almost certainly a bad idea.

To get a fresh objects with the "default defaults", you can call Integration.getDefaults().

Kind: static property of Integration Example

// Reset the global defaults:
Integration.defaults = Integration.getDefaults()