You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

cnn-antools-push-api

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cnn-antools-push-api

Node wrapper for interacting with the Apple News Push API, a.k.a, pApi

1.0.1
latest
Source
npmnpm
Version published
Weekly downloads
5
25%
Maintainers
1
Weekly downloads
 
Created
Source

CNN Content Retriever

A package designed to wrap Apple News's Push API

  • [createReference]
  • [deleteArticle]
  • [deleteReference]
  • [getArticle]
  • [getChannel]
  • [getChannelArticles]
  • [getSection]
  • [getSections]
  • [notificationPost]
  • [search]
  • [sendArticle]
  • [sendRequest]
  • [updateReference]

Requirements

Read these "requirements" as "only tested with".

  • Node.js 7.x+

Install

$ npm install --save --save-exact cnn-antools-push-api

The --save-exact is up to you. We recommend saving exact versions.

Ruby 2.1.2p95+

I will be requeired that the calling application have the apple ruby papi client installed

Usage

This is intended to be used as a dependency in a larger application. Refer to the the below example and the real example.js, that you can run with node example/example.js.

'use strict';

const PushApi = require('cnn-antools-push-api'),
    pushApi = new PushApi('<channelId>', '<apiKeyId>', '<apiKeySecret>', 'https://news-api.apple.com', '</path/to/papi/>'),
    articleData = {
        articleId: 'articleId of existing article or undefined',
        revision: 'revision id is this is update or undefined',
        articleStatus: '<add or update>',
        savePath: '<local directory Path for folder that holds the article.json>',
        sectionIds: '<sectionId>,<sectionId>,...',
        isCandidateToBeFeatured: false,
        isDevelopingStory: false
    };

pushApi.sendArticle(articleData)
    .then((stdout) => {
        console.log(`This is the published article ${stdout}`);
    })
    .catch((err) => {
        console.log(`some Problem happened: ${err}`);
    });


pushApi.deleteArticle('<articleId').then((result) => {
    console.log(`Article deleted: ${result}`);
}).catch((result) => {
    console.error(`DELETE article error: ${JSON.stringify(result.error)}`);
    console.error(`DELETE article body: ${result.body}`);
});

});

ESDoc Documentation

You can generate and view the docs locally with the commands below. The open command will only work on MacOS.

$ npm run generate-docs
$ open docs/index.html

NPM scripts

  • generate-authors - Generates AUTHORS.md.
  • generate-changelog - Generates output to put in CHANGELOG.md.
  • generate-coverage - Generates a code coverage report in /coverage.
  • generate-docs - Generates ESDoc documentation in /docs.
  • test - Runs all tests.
  • update-apply - Updates package.json with dependency updates.
  • update-check - Outputs if any dependency updates are needed.

Environment variables

  • DEBUG=cnn-antools-push-api:* - Set to enable visible debug logging to console.

Developer notes

  • Always develop on the node version specified in the .nvmrc file. If nvm is used typing nvm install in the terminal will insure the correct version is used.

  • Contributors should be familiar with the Contributors Guide

  • Collaborators should be familiar with the Collaborator Guide

  • The current Project Owner (PO) of this project is Alex Sover (@dsover).

Licensing

See LICENSE.md for details.

♥︎ Make good art - Neil Gaiman

Keywords

Apple

FAQs

Package last updated on 18 May 2017

Did you know?

Socket

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