New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

discourse-js

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discourse-js

A client-side javascript wrapper for the discourse API.

  • 0.0.2
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-92.73%
Maintainers
1
Weekly downloads
 
Created
Source

Discourse-js

NPM Version

Installation

$ npm i discourse-js

Quick Start

import Discourse from "discourse-js";

const apiKey = "<api-key-from-discourse>";
const baseUrl = "<your-discourse-url>" || "http://localhost:3000";

const discourse = new Discourse(apiKey, baseUrl);

discourse.posts
  .create({
    api_username: "karluser",
    topic_id: 11,
    raw: "Hello World"
  })
  .then(res => console.log(res))
  .catch(err => console.log(err));

API

Topics

Get a Topic
discourse.topics
  .getTopic({ id })
  .then(res => console.log(response)}
  .catch(err => console.log(err))

Posts

Create a Post
discourse.posts
  .create({
    topic_id: 11,
    raw: "Hello World"
  })
  .then(res => console.log(res))
  .catch(err => console.log(err));
Like a Post
discourse.posts
  .like({ id: 72 })
  .then(res => console.log(res))
  .catch(err => console.log(err));
Unlike a Post
discourse.posts
  .unlike({ id: 72 })
  .then(res => console.log(res))
  .catch(err => console.log(err));

Note: You can only unlike a post within 5 - 10 minutes after you have liked it. Think of unlike more so like an undo.

See this post here and here for information around the undocumented time limit on unliking a liked post.

License

MIT

FAQs

Package last updated on 02 Oct 2018

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc