Socket
Socket
Sign inDemoInstall

zimnews-api

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    zimnews-api

The Javascript SDK for the ZimNews API.


Version published
Weekly downloads
2
Maintainers
1
Install size
8.03 kB
Created
Weekly downloads
 

Readme

Source

ZimNews API Javascript SDK

Official documentation available at https://zimnews-api.firebaseapp.com

Installation

Node.js

npm i --save zimnews-api

Browser

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/zimnews-api/index.js">

Usage

var ZimNews = require('zimnews-api'),
    zn = new ZimNews("api_key");

ES6 Import

import ZimNews from 'zimnews-api'
let zm = new ZimNews("api_key");

You can get your API Key from the documentation site.

Methods

.getNews(options)

Promise which returns an array of Stories.

.getSources(options)

Promise which returns an array of Sources.

.getCategories(options)

Promise which returns an array of Categories.

Options

OptionRequiredDefault
limit - number of items returnedNo25
category - of stories to return.NoAll
source - name of source to return. See docs for list of sources.NoAll

Examples

With async/await

(async ()=>{
    let stories = await zm.getNews({limit:10,category:'Business'})
    console.log(stories);
})()

With Promises

zm.getNews({limit:10,category:'Entertainment'}).then(stories=>{
    console.log(stories);
}).catch(e=>{
    console.log(e);
})

Keywords

FAQs

Last updated on 24 Jan 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc