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

oc-news-js

v0.1.1

Published

Javascript client for the ownCloud news app for node and the browser

Downloads

10

Readme

oc-news-js

Javascript client for the ownCloud news app for node and the browser

installing

For node or browserify

  • npm install --save oc-news-js
  • var Client = require('oc-news-js')

For plain browser usage

  • Include build/news.js or build/news.min.js

Usage

var client = new Client('https://example.com/owncloud', 'username', 'password');

Structure

  • src/ source files
  • lib/ prebuild files for npm using npm run build-npm
  • build/ prebuild files for the browser using npm run build-browser, npm run release

API

All functions return a promise and can also be used with es7 style async/await

  • Client
  • client.listFolders(): Promise<Folder[]>
  • client.newFolder(name): Promise<Folder>
  • client.listFeeds(): Promise<Feed[]>
  • client.newFeed(url, folderId): Promise<Feed>
  • client.getItems(size = 20, offset = null, getRead = true, oldestFirst = false): Promise<Item[]>
  • client.getStarredItems(size = 20, offset = null, getRead = true, oldestFirst = false): Promise<Item[]>
  • client.getNewItems(lastModifed): Promise<Item[]>
  • client.getVersion(): Promise<string>
  • client.getStatus(): Promise<Status>
  • Folder
  • folder.id: int
  • folder.name: string
  • folder.rename(newName): Promise<>
  • folder.delete(): Promise<>
  • folder.markAsRead(newestItemId): Promise<>
  • folder.listFeeds(): Promise<Feed[]>
  • folder.getItems(size = 20, offset = null, getRead = true, oldestFirst = false): Promise<Item[]>
  • folder.getNewItems(lastModifed): Promise<Item[]>
  • Feed
  • feed.id: int
  • feed.url: string
  • feed.title: string
  • feed.favIconLink: string
  • feed.added: int as unix timestamp
  • feed.folderId: int
  • feed.unreadCount: int
  • feed.ordering: int 0 for default, 1 oldest first, 2 newest first
  • feed.link: string
  • feed.pinned: bool
  • feed.rename(newName): Promise<>
  • feed.delete(): Promise<>
  • feed.move(newFolderId): Promise<>
  • feed.markAsRead(newestItemId): Promise<>
  • feed.getItems(size = 20, offset = null, getRead = true, oldestFirst = false): Promise<Item[]>
  • feed.getNewItems(lastModifed): Promise<Item[]>
  • Item
  • item.id: int
  • item.guid: string
  • item.guidHash: string
  • item.url: string
  • item.title: string
  • item.author: string
  • item.pubDate: int as unix timestamp
  • item.body: string
  • item.enclosureMime: string
  • item.enclosureLink: string
  • item.feedId: int
  • item.unread: bool
  • item.starred: bool
  • item.lastModified: int as unix timestamp
  • item.markAsRead(): Promise<>
  • item.markAsUnread(): Promise<>
  • item.markAsStarred(): Promise<>
  • item.markAsUnstarred(): Promise<>
  • Status
  • status.version: string as 'x.y.z'
  • status.improperlyConfiguredCron: bool

Additional information about the meaning of fields, methods or arguments can be find in the API documentation for the news client

Example

  • Using es6/es7 style syntax:
var client = new Client('http://localhost/owncloud', 'test', 'test');

async function listItems () {
	const items = await client.getItems();
	console.log(items);
}

listItems();
  • Using es5 style syntax:
var client = new Client('http://localhost/owncloud', 'test', 'test');

client.getItems().then(function (items) {
	console.log(items);
});