Catalog npm
PACKAGE EXPLORERView in registry

2sucres-api

npm

Wrapper Node.JS autour de l'API 2sucres

Versions collected9
Direct dependencies15From release 1.1.2
Last observed20 Oct, 19:19 UTC

README

Current package documentation

2sucres-api

Installation

yarn add 2sucres-api

Utilisation

const apiFactory = require('2sucres-api')
const api = apiFactory(cookies, csrfToken)

const TOPIC_ID = 1
const MESSAGE_ID = 1

/**
 * Récupère le nombre de messages d'un topic
 * et l'indique dans le message original du topic
 */
async function run () {
  const topic = await api.getTopic(TOPIC_ID)
  const messageCount = topic.messageCount
  await api.editMessage(MESSAGE_ID, `Le topic contient ${messageCount} message(s)`)
}

run().catch(err => {
  // global error handling
  console.error(err.stack)
  process.exit(1)
})

API

Functions

clearNotifications()

Supprime les notifications

deleteTopic(topicId)

Supprime un topic

editMessage(messageId, content)

Édite un message

getMessage(messageId) ⇒ message

Récupère les informations d'un message par son id

getMessages(topicId, page) ⇒ Array.<message>

Retourne la liste des messages d'une page d'un topic

getNotifications(clear)

Récupère la liste des notifications

getTopicEnd(topicId)

Récupère la fin du topic

getTopic(topicId, page) ⇒ topic

Récupère les informations d'un topic

getTopics(page, forumId) ⇒ Array.<topic>

Récupère la liste des topics

lockTopic(topicId)

Lock un topic

postMessage(topicId, content)

Poste un message

postTopic(title, content, options)

Poste un topic

unlockTopic(topicId)

Délock un topic

updateTitle(topicId, title)

Met à jour le titre d'un topic

clearNotifications()

Supprime les notifications

Kind: global function

deleteTopic(topicId)

Supprime un topic

Kind: global function

ParamType
topicIdnumber

editMessage(messageId, content)

Édite un message

Kind: global function

ParamType
messageIdnumber
contentstring

getMessage(messageId) ⇒ message

Récupère les informations d'un message par son id

Kind: global function

ParamType
messageIdnumber

getMessages(topicId, page) ⇒ Array.<message>

Retourne la liste des messages d'une page d'un topic

Kind: global function

ParamTypeDefault
topicIdnumber
pagenumber1

getNotifications(clear)

Récupère la liste des notifications

Kind: global function

ParamTypeDefaultDescription
clearbooleanfalsesi vrai, supprime les notifications après les avoir récupérées

getTopicEnd(topicId)

Récupère la fin du topic

Kind: global function

ParamType
topicIdnumber

getTopic(topicId, page) ⇒ topic

Récupère les informations d'un topic

Kind: global function

ParamTypeDefault
topicIdnumber
pagenumber1

getTopics(page, forumId) ⇒ Array.<topic>

Récupère la liste des topics

Kind: global function

ParamTypeDefault
pagenumber1
forumIdnumber1

lockTopic(topicId)

Lock un topic

Kind: global function

ParamType
topicIdnumber

postMessage(topicId, content)

Poste un message

Kind: global function

ParamType
topicIdnumber
contentstring

postTopic(title, content, options)

Poste un topic

Kind: global function

ParamType
titlestring
contentstring
optionsobject

unlockTopic(topicId)

Délock un topic

Kind: global function

ParamType
topicIdnumber

updateTitle(topicId, title)

Met à jour le titre d'un topic

Kind: global function

ParamType
topicIdnumber
titlestring

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 9

Collected releases
VersionPublishedDirect dependenciesOpen version
1.1.2Registry latest31 Dec 201815
1.1.131 Dec 201815
1.1.029 Dec 201813
1.0.319 Dec 201813
1.0.218 Dec 201813
1.0.118 Dec 201813
1.0.018 Dec 201813
0.0.217 Dec 20183
0.0.122 Jul 20183

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
taigah/2sucres-api

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:19 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:7b8555c94d8f22fda80a4dc0d7ee8dd74864b3ead73a90738dad9ead8d2c9a39