NodeJS(TypeScript) SDK For V2EX

Overview

V2EX NodeJS SDK

NodeJS(TypeScript) SDK For V2EX(https://www.v2ex.com)

Install

npm i --save @chyroc/v2ex-api

Usage

New Client

get token from https://www.v2ex.com/settings/tokens

import V2EX from "@chyroc/v2ex-api";

const token = process.env.V2EX_TOKEN || ''
const client = new V2EX({token, timeout: 10000})

Get Notifications

const getNotifications = async (client: V2EX) => {
  const {notifications, total} = await client.getNotifications({page: 1})
  console.log('notifications:', notifications)
  console.log('total:', total)
}

Delete Notification

const deleteNotification = async (client: V2EX) => {
  await client.deleteNotification({notificationID: 1})
}

Get Profile

const getProfile = async (client: V2EX) => {
  const profile = await client.getProfile()
  console.log('profile', profile)
}

Get Token

const getToken = async (client: V2EX) => {
  const token = await client.getToken()
  console.log('token', token)
}

Create Token

const createToken = async (client: V2EX) => {
  const token = await client.createToken({
    scope: TokenScope.everything,
    expiration: TokenExpiration.D30,
  })
  console.log('token', token)
}

Get Node

const getNode = async (client: V2EX) => {
  const node = await client.getNode({nodeName: 'python'})
  console.log('node', node)
}

Get Topic By Node

const getTopicByNode = async (client: V2EX) => {
  const topics = await client.getTopicByNode({nodeName: 'python', page: 2})
  console.log('topics', topics)
}

Get Topic

const getTopic = async (client: V2EX) => {
  const topic = await client.getTopic({topicID: 1})
  console.log('topic', topic)
}

Get Topic Reply

const getTopicReply = async (client: V2EX) => {
  const topicReply = await client.getTopicReply({topicID: 1, page: 2})
  console.log('topicReply', topicReply)
}

Get Plane

const getPlanes = async (client: V2EX) => {
  const plane = await client.getPlanes()
  console.log('plane', plane)
}
You might also like...

A sdk scaffold with typescript.

sdk-scaffold A sdk scaffold with vite & typescript. Start git clone --depth=1 https://github.com/Alioth1017/sdk-scaffold my-sdk cd my-sdk pnpm i confi

Sep 7, 2022

CLI Progress Bar implemented in NodeJS to track Time, ETA and Steps for any long running jobs in any loops in JS, NodeJS code

CLI Progress Bar implemented in NodeJS to track Time, ETA and Steps for any long running jobs in any loops in JS, NodeJS code

NodeJS-ProgressBar CLI Progress Bar for NodeJS and JavaScript to track Time, ETA and Steps for any long running jobs in any loops in JS, NodeJS code D

Nov 14, 2022

microCMS JavaScript SDK.

microCMS JavaScript SDK It helps you to use microCMS from JavaScript and Node.js applications. Getting Started Install Install npm package. $ npm inst

Dec 31, 2022

Lazerpay SDK allows you accept payments easily in your react application

Lazerpay SDK allows you accept payments easily in your react application

Lazerpay Official react sdk Lazerpay SDK allows you accept payments easily in your react application Installation npm install lazerpay-react Usage imp

Nov 20, 2022

Firebase SDK 9 + Google Sign In + Chrome Extension Manifest Version 3 + Webpack

Firebase SDK 9 + Google Sign In + Chrome Extension Manifest Version 3 + Webpack Demo Find this Chrome Extension Setup and working demo here or on Yout

Dec 28, 2022

js-sdk for multichain storage service

js-sdk for multichain storage service

js-mcs-sdk Table of Contents Introduction Prerequisites MCS API Usage Installation Getting Started Documentation Contributing Introduction A client li

Aug 5, 2022

Codemod scripts to update AWS SDK for JavaScript APIs.

aws-sdk-js-codemod This repository contains a collection of codemod scripts for use with JSCodeshift that help update AWS SDK for JavaScript APIs. The

Jan 2, 2023

This SDK helps developers get started with the on-chain tools provided by Metaplex.

This SDK helps developers get started with the on-chain tools provided by Metaplex.

Metaplex JavaScript SDK ⛔️ DO NOT USE IN PRODUCTION, THIS SDK IS IN VERY EARLY ALPHA STAGES! This SDK helps developers get started with the on-chain t

Dec 27, 2022

TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy

Atlas SDK atlas_sdk is a TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy Links Docs Import Replace LATEST_VERSION with current latest versi

Dec 26, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
The iofod SDK provides developers with the ability to interact with the main iofod interface within the Web worker, enabling rapid development of iofod extensions through the SDK.

iofod-sdk English | 简体中文 The iofod SDK provides developers with the ability to interact with the main iofod interface within the Web worker, enabling

iofod, Inc. 47 Oct 17, 2022
A CLI tool to create a NodeJS project with TypeScript CTSP is a CLI tool to make easier to start a new NodeJS project and configure Typescript on it.

CTSP- Create TS Project A CLI tool to create a NodeJS project with TypeScript CTSP is a CLI tool to make easier to start a new NodeJS project and conf

Jean Rodríguez 7 Sep 13, 2022
The NodeJS server SDK for Charon.

Charon - NodeJS Server SDK This is the NodeJS server SDK for Charon: A new form of secure, passwordless authentication. The SDK currently serves as a

null 2 Apr 8, 2022
Autoinspector SDK for nodejs.

Autoinspector Node.js SDK The Autoinspector Node library provides convenient access to the Autoinspector API from applications written in server-side

Autoinspector 2 Jan 27, 2022
Temporal-time-utils - This is a library with some reusable functions for Temporal.io TypeScript SDK

temporal-time-utils This is a library with some reusable functions for Temporal.io TypeScript SDK: sleepUntil: sleep to a specific date, instead of by

swyx 15 Oct 18, 2022
Anagolay Network Javascript SDK written in Typescript

Anagolay Network Javascript SDK written in Typescript. This repo will contain the bindings to Anagolay Network with the sane defaults for pallet usage

Anagolay Network 4 Nov 26, 2022
A JavaScript (and TypeScript) SDK for the ScreenshotOne.com API to take screenshots of any URL

jssdk An official Screenshot API client for JavaScript and TypeScript. It takes minutes to start taking screenshots. Just sign up to get access and se

ScreenshotOne.com 7 Oct 15, 2022