Git Product home page Git Product logo

airplake-cnode's Introduction

airplake-cnode

CNodejs Restful API Adaptor, detail about Cnodejs.org API, please check https://cnodejs.org/api.

Progress

Topic

  • Create
  • Open
  • Update
  • Get Topic List

Topic Collect

  • Collect Topic
  • Cancel Topic
  • List All Collect

Topic Comment

  • New Replies
  • New Ups

User

  • Login Name
  • Access Token Check

Message

  • Unread Count
  • Get read/unread Messages
  • Mark all read

Install

npm i airplake-cnode

Example

Setup for CNode Access Token

process.env.CNODE_TOKEN='Fill Your CNODE Access Token Here'

Topic.open

var Cnode = require('airplake-cnode');

var main = async () => {

    var topicId = '58e208b7ccbecc24201d9513';
    var result = await Cnode.topic.open(topicId);
    result = JSON.parse(result.body);
    if(result.success){
        console.log(result);
        let post = result.data
        // TODO
    }
}

main();

Topic.create

var Cnode = require('airplake-cnode');

var main = async () => {
    var post = {
        title: '这是一个测试',
        tab: 'share',
        content: '这是一个测试文章,如果打扰请见谅,稍后会马上删除。'
    }
    var result = await Cnode.topic.create(post);
    result = JSON.parse(result.body);
    if(result.success){
        console.log(result);
        // TODO
    }
}

main();

Topic.update

var Cnode = require('airplake-cnode');

var main = async () => {

    var topicId = '58e208b7ccbecc24201d9513';
    var newPost = {
        topic_id: topicId,
        title: '这是一篇测试主题,如有打扰请谅解,稍后会尽快删除!',
        tab: 'share', //ask, share, job,
        content: '这是测试的内容,如有打扰请谅解 ' + new Date().toISOString()
    }
    
    var result = await Cnode.topic.update(newPost);
    result = JSON.parse(result.body);
    if(result.success){
        console.log(result);
        // TODO
    }
}

airplake-cnode's People

Contributors

wenqingyu avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.