1.1.2 • Published 5 years ago

2sucres-api v1.1.2

Weekly downloads
33
License
MIT
Repository
github
Last release
5 years ago

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

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
1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.2

5 years ago

0.0.1

6 years ago