npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wykop

v1.1.18

Published

Wrapper for the new Wykop API v3 written in NodeJS

Downloads

9

Readme

WykopJS

A wrapper for the new Wykop API v3 written in NodeJS

  • Still a work-in-progress
  • No need to worry about new tokens or refresh tokens
  • Most common objects are wrapped in a class
  • The "Documentation" is currently just a list of functions that are available with their return value
  • Wykop.pl seems to be working on the API, they might occasionally break something
  • For an example inplementation see WykopMonitorJS

Getting started

Add the package

npm i wykop

Import WykopJS and initialise

const Wykop = require('wykop');
const w = new Wykop({ /*config*/ });

Examples

Here we get the list of upvotes from the newest post currently on the homepage:

const upvotes = await w.getHomepage({ sort: 'newest' }).items[0].getUpvotes();

The wrapper 'wraps' most response data in classes that have their own functions, so for example, we can use the list of upvotes from the previous example and check the activity of the first upvoter like this:

const activity = await upvotes.items[0].user.getActions()

instead of like this (which but would also work):

const activity = await w.getProfile(upvotes.items[0].user.username).getActions()

Here's the full code of the simple example above in CommonJS:

const Wykop = require('wykop');

(async () => {
    const w = new Wykop({
        token: '<your-token>'
    });

    // get the list of upvotes from the newest post currently on the homepage
    const upvotes = await w.getHomepage({ sort: 'newest' }).items[0].getUpvotes();

    // get the latest activity of the first upvoter
    const activity = await upvotes.items[0].user.getActions();

    console.log(activity);
})();

"Documentation"

new Wykop(config)

This constructs a new instance of WykopJS, available options are:

| Option | Default | Description | | --- | --- | --- | | config.appkey | null | <optional> The appkey you received from Wykop (1) | | config.secret | null | <optional> The secret you received from Wykop (1) | | config.token | null | <optional> Your access token (1) | | config.rtoken | null | <optional> Your refresh token (1) | | config.environment | https://wykop.pl/api/v3 | <optional> The environment (we probably never need this) | | config.proxies | true | <optional> Proxies allow for Promise chaining but you can turn them off here. This option wraps a Proxy around the new Wykop({ /*config*/ }) object | | config.debug | false | <optional> Mostly just logs the requests and responses we get from the API |

(1) For an instance to successfully initialize, you need to provide at least (a) an appkey and a secret, (b) a rtoken or (c) a token. The best option is to provide an appkey and secret, that way we can generate tokens whenever we need a new one and you don't need to keep track of them. The second best option is to provide a rtoken, you'll be logged in and we can generate new tokens, but you'll need to keep track of the latest rtoken somewhere, so you can easily create a new Wykop instance. The last option is to provide a token but you'll be limited by the expiration date on the token, so it'll just stop working after some time

Available functions directly on the Wykop object:

w.entry('1234')
// returns an empty Entry object that can be used to access its class functions
w.entryComment({ id: '4321', entryId: 1234 })
// returns an empty EntryComment object that can be used to access its class functions
w.link('1234')
// returns an empty Link object that can be used to access its class functions
w.linkComment({ id: '4321', linkId: '1234' })
// returns an empty LinkComment object that can be used to access its class functions
w.linkRelated({ id: '4321', linkId: '1234' })
// returns an empty LinkRelated object that can be used to access its class functions
w.article('1234')
// returns an empty Article object that can be used to access its class functions
w.draft('3hbh2jg3b')
// returns an empty Draft object that can be used to access its class functions
w.profile('wykop')
// returns an empty Profile object that can be used to access its class functions
w.tag('heheszki')
// returns an empty Tag object that can be used to access its class functions
w.conversation('wykop')
// returns an empty Conversation object that can be used to access its class functions
w.badge('3hbh2jg3b')
// returns an empty Badge object that can be used to access its class functions
w.bucket('3hbh2jg3b')
// returns an empty Bucket object that can be used to access its class functions
w.getEntry('1234')
// returns a Promise that resolves to an Entry object
w.getEntryComment({ id: '4321', entryId: '1234' })
// returns a Promise that resolves to an EntryComment object
w.submitEntry({ content: 'Hello World!', photo: '3hbh2jg3b', embed: '3hbh2jg3b', survey: '3hbh2jg3b', adult: false })
// returns a Promise that resolves to an Entry object
w.submitEntryComment({ entryId: '1234', content: 'Hello again!', photo: '3hbh2jg3b', embed: '3hbh2jg3b', adult: false })
// returns a Promise that resolves to an EntryComment object
w.createSurvey({ question: 'Pizza or Pasta?', answers: ['Pizza', 'Pasta'], entryId: '1234' })
// returns a Promise that resolves to a string
w.createEmbed('https://youtube.com/watch?v=123456789')
// returns a Promise that resolves to an object, where object.key is the embed 'id'
w.createPhoto({ type: 'comments', url: 'https://cataas.com/cat/says/hello%20world!' })
// returns a Promise that resolves to an object, where object.key is the photo 'id'
w.uploadPhoto({ type: 'links', file: await Buffer.from(image.data, 'binary'), fileName: 'wykop-js-image' })
// returns a Promise that resolves to an object, where object.key is the photo 'id'
w.removePhoto('3hbh2jg3b')
// returns a Promise that resolves to an empty string
w.getLink('1234')
// returns a Promise that resolves to a Link object
w.getLinkComment({ id: '4321', linkId: '1234' })
// returns a Promise that resolves to a LinkComment object
w.getLinkRelated({ id: '4321', linkId: '1234' })
// returns a Promise that resolves to a LinkRelated object
w.createURLDraft('https://cataas.com/#/')
// returns a Promise that resolves to a Draft object
w.getArticle('1234')
// returns a Promise that resolves to an Article object
w.createArticleDraft({ 
    title: 'Hello world!', 
    // The format used for the 'content' seems to be https://editorjs.io
    content: '{"time":1112470620000,"blocks":[{"type":"paragraph","data":{"text":"This is an example that just shows a string"}}],"version":"21.3.7"}', 
    html: "Anything random, don't think this is used" 
})
// returns a Promise that resolves to a Draft object
w.getDraft('3hbh2jg3b')
// returns a Promise that resolves to a Draft object
w.getConversation('wykop')
// returns a Promise that resolves to a Conversation object
w.getTag('heheszki')
// returns a Promise that resolves to a Tag object
w.getTagContent('heheszki', { sort: 'best' })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Entry and Link objects
w.getProfile('m__b')
// returns a Promise that resolves to a Profile object
w.getMe()
// returns a Promise that resolves to a Profile object
w.getMeShort()
// returns a Promise that resolves to a Profile object
w.getBadge('rocznica')
// returns a Promise that resolves to a Badge object
w.getHomepage({ sort: 'newest', category: null, bucket: '3hbh2jg3b', page: '3hbh2jg3b' })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link and Entry objects
w.getUpcomming({ sort: 'digged', category: '3hbh2jg3b', bucket: null, page: 3 })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link and Entry objects
w.getUpcommingCount({ category: null, bucket: null })
// returns a Promise that resolves to a string
w.getLinkByURL('https://wykop.pl')
// returns a Promise that resolves to a Link object
w.getHits({ sort: 'all', year: null, month: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link objects
w.getEntryHits({ sort: 'all', year: null, month: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Entry objects
w.getMicroblog({ sort: 'hot', lastUpdate: '12', category: null, bucket: '3hbh2jg3b', page: '10' })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Entry objects
w.getNewerEntriesCount({ lastId: '1234', category: '3hbh2jg3b' })
// returns a Promise that resolves to a string
w.getFavoriteContent({ sort: 'oldest', type: 'entry', page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link, LinkComment, Entry and EntryComment objects
w.getObservedContent({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link and Entry objects
w.getObservedUsersContent({ page: 4 })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link and Entry objects
w.getNewerObservedUsersContentCount({ date: w.formatDate(new Date), lastId: null })
// returns a Promise that resolves to a string
w.getObservedTagsContent({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link and Entry objects
w.getObservedDiscussionsContent({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link, LinkComment and Entry objects
w.getAutocompleteSuggestionsForTag('wyko')
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Tag objects
w.getAutocompleteSuggestionsForUser('wyko')
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objects
w.getPopularTags()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Tag objects
w.getPopularAuthoredTags()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Tag objects
w.getSearchContent('wykop api', { type: 'all', sort: null, votes: null, dateFrom: w.formatDate(new Date), dateTo: null, tags: null, users: null, category: null, bucket: null, domains: null, page: null })
// type === 'all' -> returns an object, where object.links.items is a list of Link objects, object.entries.items is a list of Entry objects and object.users.items is a list of Profile objects
// type !== 'all' -> returns a Listing object, where Listing.items is a list of either Link, Entry or Profile objects
w.getNotificationStatus()
// returns a Promise that resolves to an object
w.getPersonalNotifications({ page: 2 })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of PersonalNotification objects
w.markPersonalNotificationsAsRead()
// returns a Promise that resolves to an empty string
w.removePersonalNotifications()
// returns a Promise that resolves to an empty string
w.getTagNotifications({ page: '2' })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of TagNotification objects
w.markTagNotificationsAsRead()
// returns a Promise that resolves to an empty string
w.removeTagNotifications()
// returns a Promise that resolves to an empty string
w.getDiscussionNotifications({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of PmNotification objects
w.markDiscussionNotificationsAsRead()
// returns a Promise that resolves to an empty string
w.removeDiscussionNotifications()
// returns a Promise that resolves to an empty string
w.getPMNotifications({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of PmNotification objects
w.markPmNotificationsAsRead()
// returns a Promise that resolves to an empty string
w.removePmNotifications()
// returns a Promise that resolves to an empty string
w.getOpenConversation()
// returns a Promise that resolves to a Conversation object
w.markAllConversationsAsRead()
// returns a Promise that resolves to an empty string
w.getConversations({ 'wyko' })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Conversation objects
w.getCategories()
// returns a Promise that resolves to an object
w.getBucket('3hbh2jg3b')
// returns a Promise that resolves to a Bucket object
w.getUserCategories()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Bucket objects
w.getBucketStatus()
// returns a Promise that resolves to an object
w.addBucket({ title: 'My first category', query: '#wykop @wykop', defaultPage: 'home' })
// returns a Promise that resolves to a Bucket object
w.getBucketContentPreview('#wykop @wykop')
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link and Entry objects
w.getBadges()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Badge objects
w.getRanking({ page: 10 })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objects
w.getMyRank()
// returns a Promise that resolves to an object
w.login(username, password, { captcha: '3hbh2jg3b' })
// returns a Promise that resolves to an object with a token and rtoken OR an object with a token in case the user has 2FA turned on
w.logout()
// returns a Promise that resolves to an empty string
w.submit2FACode({ token: '3hbh2jg3b', code: '123123' })
// returns a Promise that resolves to an object with a token and rtoken
w.submit2FARecoveryCode({ token: '3hbh2jg3b', code: '12D12D' })
// returns a Promise that resolves to an object with a token and rtoken - 2FA is now off
w.requestPasswordReset('[email protected]')
// returns a Promise that resolves to an empty string
w.submitPasswordReset({ token: '3hbh2jg3b', password: 'my-new-password' })
// returns a Promise that resolves to an empty string
w.registerNewAccount({ username: 'username123', email: '[email protected]', password: 'my-password', phone: '123543678' })
// returns a Promise that resolves to a string that can then be used to confirm the SMS code
w.rerequestRegistrationSMS({ hash: '3hbh2jg3b' })
// returns a Promise that resolves to an empty string
w.submitRegistrationSMS({ hash: '3hbh2jg3b', code: '123123' })
// returns a Promise that resolves to an empty string
w.submitRegistrationEmailToken({ '3hbh2jg3b' })
// returns a Promise that resolves to an object with a token and rtoken
w.getWykopConnectURL()
// returns a Promise that resolves to an object
w.acceptWykopConnectPermissions('3hbh2jg3b', { send_message: true, read_profile: false, add_comment: false, add_link: false, add_entry: false, add_vote: false })
// returns a Promise that resolves to an object with a token and rtoken as well as the redirect_url
w.getAccountBlockades()
// returns a Promise that resolves to an object
w.requestAccountBlockadeSMS()
// returns a Promise that resolves to empty string?
w.rerequestAccountBlockadeSMS()
// returns a Promise that resolves to empty string?
w.submitAccountBlockadeSMS('123123')
// returns a Promise that resolves to empty string?
w.submitAccountBlockadeCaptcha('123123')
// returns a Promise that resolves to empty string?
w.acceptTermsAndConditions()
// returns a Promise that resolves to empty string?
w.getAccountSettings()
// returns a Promise that resolves to an AccountSettings object
w.getProfileSettings()
// returns a Promise that resolves to an ProfileSettings object
w.getPhone()
// returns a Promise that resolves to a string
w.requestChangePhoneNumber('123543678')
// returns a Promise that resolves to an empty string OR an object with a token in case the user has 2FA turned on
w.submitChangePhoneNumberSMS('123123')
// returns a Promise that resolves to an empty string
w.getEmail()
// returns a Promise that resolves to a string
w.requestChangeEmail()
// returns a Promise that resolves to an empty string OR an object with a token in case the user has 2FA turned on
w.submitChangeEmail()
// returns a Promise that resolves to an empty string
w.requestAccountDeletion()
// returns a Promise that resolves to an empty string OR an object with a token in case the user has 2FA turned on
w.confirmAccountDeletion()
// returns a Promise that resolves to an empty string
w.requestAccountDataCopy()
// returns a Promise that resolves to an empty string OR an object with a token in case the user has 2FA turned on
w.requestAccountDataTransfer()
// returns a Promise that resolves to an empty string OR an object with a token in case the user has 2FA turned on
w.is2FAEnabled()
// returns a Promise that resolves to a boolean
w.get2FASecret({ type: '1' })
// returns a Promise that resolves to a string
w.activate2FA({ code: '123456', type: '1' })
// returns a Promise that resolves with your recovery code
w.deactivate2FA({ password: 'itspassword', code: '123456' })
// returns a Promise that resolves to an empty string
w.handle2FACodeRequired(async ({ type, token }) => {
    // Here you would request user input and then call w.submit2FACode() with the token and 2FA code
})
// this callback will be called whenever a 2FA code is required. Returns a Promise that resolves to undefined
w.getUserSessions()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objects
w.removeUserSession('12341234')
// returns a Promise that resolves to null
w.removeOtherUserSessions()
// returns a Promise that resolves to null
w.getConnectApplications()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objects
w.removeConnectApplication('12341234')
// returns a Promise that resolves to null
w.getBlacklistedUsers()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objects
w.addUserToBlacklist()
// returns a Promise that resolves to the Wykop object
w.removeUserFromBlacklist()
// returns a Promise that resolves to the Wykop object
w.getBlacklistedTags()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Tag objects
w.addTagToBlacklist()
// returns a Promise that resolves to the Wykop object
w.removeTagFromBlacklist()
// returns a Promise that resolves to the Wykop object
w.getBlacklistedDomains()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objects
w.addDomainToBlacklist()
// returns a Promise that resolves to the Wykop object
w.removeDomainFromBlacklist()
// returns a Promise that resolves to the Wykop object
w.getDoodle()
// returns a Promise that resolves to an object
w.getAccountColors()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objects
w.getAccountColor('orange')
// returns a Promise that resolves to an object
w.submitSupportMessage({ reason: w.supportReasons.technicalProblems, email: '[email protected]', message: 'Please help!', file: null, info: null, url: null })
// returns a Promise that resolves to the Wykop object
w.submitGDPRMessage({ '[email protected]', message: 'Please help with my data!' })
// returns a Promise that resolves to the Wykop object
w.getReportedContent({ page: 2 })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objects
w.generateReportURL({ linkId: '1234', entryId: null, linkCommentId: null, entryCommentId: null, profile: null, relatedId: null })
// returns a Promise that resolves to a string (URL)
w.getModeratedContent({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objects
w.submitAppeal({ reportId: '1234', content: 'This should not have been deleted!' })
// returns a Promise that resolves to the Wykop object
w.getAppeals({ page: 5 })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objects
w.customRequest({ method: 'GET', url: '/entries/1234' })
// this method takes a standard Axios Request: https://axios-http.com/docs/req_config
// returns a Promise that resolves to a standard Axios Response: https://axios-http.com/docs/res_schema
w.getToken()
// returns a Promise that resolves to your token (string)
w.formatDate(new Date())
// returns a Promise that resolves to a date formatted to be generally accepted by the Wykop API
w.saveConnectTokens({ token: '3hbh2jg3b', rtoken: '3hbh2jg3b' })
// returns a Promise that resolves to an object with the token and rtoken
w.databaseExtract()
// returns a Promise that resolves to an object with the current config - you can use this before closing your app to save the config for upcoming instances, so you don't need to provide a new rtoken/token every time. When using an appkey and secret, this is not necessary 
w.getTokenExpireDate()
// returns a Promise that resolves to a Date object
w.hasTokenExpired()
// returns a Promise that resolves to a boolean
w.getLoggedUsername()
// returns a Promise that resolves to your username
w.isLogged()
// returns a Promise that resolves to a boolean

Available functions on Entry objects:

After getting an entry, either from a listing like w.getMicroblog() or directly from w.getEntry('1234'), you can then start interacting with the Entry object

entry.get()
// returns a Promise that resolves to an Entry object - you can use this to refresh
entry.getComment('4321')
// returns a Promise that resolves to an EntryComment object
entry.getComments()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of EntryComment objects
entry.getNewerCommentsCount({ date: w.formatDate(new Date) })
// returns a Promise that resolves to a string
entry.submitComment({ content = 'Nice entry you have there!', photo = null, embed = null, adult = false })
// returns a Promise that resolves to an EntryComment object
entry.edit({ content: 'Hello yet again!', photo: null, embed: null, survey: null, adult = false })
// returns a Promise that resolves to an Entry object
entry.remove()
// returns a Promise that resolves to an empty string
entry.getUpvoters()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objects
entry.upvote()
// returns a Promise that resolves to the Entry object
entry.unvote()
// returns a Promise that resolves to the Entry object
entry.favorite()
// returns a Promise that resolves to the Entry object
entry.observe()
// returns a Promise that resolves to the Entry object
entry.unobserve()
// returns a Promise that resolves to the Entry object
entry.unfavorite()
// returns a Promise that resolves to the Entry object
entry.surveyVote('2') 
// returns a Promise that resolves to the Entry object

Available functions on EntryComment objects:

Similarly to the entry above, we can interact directly with EntryComment objects

comment.get()
// returns a Promise that resolves to an EntryComment object - you can use this to refresh
comment.edit({ content: 'Nice entry you have there!', photo: '3hbh2jg3b', embed: '3hbh2jg3b', adult: true }) 
// returns a Promise that resolves to an EntryComment object
comment.remove()
// returns a Promise that resolves to an empty string
comment.getUpvoters()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objects
comment.upvote()
// returns a Promise that resolves to an EntryComment object
comment.unvote()
// returns a Promise that resolves to an EntryComment object
comment.favorite()
// returns a Promise that resolves to an EntryComment object
comment.unfavorite()
// returns a Promise that resolves to an EntryComment object

Available functions on Link objects:

link.get()
// returns a Promise that resolves to a Link object - you can use this to refresh
link.getComment('4321')
// returns a Promise that resolves to a LinkComment object
link.submitComment({ content: 'Nice link!', photo: '3hbh2jg3b', embed: '3hbh2jg3b', adult: false })
// returns a Promise that resolves to a LinkComment object
link.getComments({ page, sort, ama })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of LinkComment objects
link.getRelatedLinks()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of LinkRelated objects
link.submitRelatedLink({ title, url, adult })
// returns a Promise that resolves to a LinkRelated object
link.edit({ title: 'Hello again :)', description: 'Something interesting!', tags: ['heheszki', 'polityka'], photo: null, adult: true })
// returns a Promise that resolves to a Link object
link.remove()
// returns a Promise that resolves to an empty string
link.upvote()
// returns a Promise that resolves to the Link object
link.downvote({ reason: link.downvoteReason.duplicate })
// returns a Promise that resolves to the Link object
link.unvote()
// returns a Promise that resolves to the Link object
link.observe()
// returns a Promise that resolves to the Link object
link.unobserve()
// returns a Promise that resolves to the Link object
link.favorite()
// returns a Promise that resolves to the Link object
link.unfavorite()
// returns a Promise that resolves to the Link object
link.toggleMuteAMA()
// returns a Promise that resolves to the Link object
link.finishAMA()
// returns a Promise that resolves to the Link object
link.getUpvotes()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objects
link.getDownvotes()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objects
link.getCounters()
// returns a Promise that resolves to an object
link.getRedirectURL()
// returns a Promise that resolves to a string (URL)

Available functions on LinkComment objects:

comment.get()
// returns a Promise that resolves to a LinkComment object - you can use this to refresh
comment.getComments({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of LinkComment objects
comment.submitComment({ content: 'Nice link!', photo: '3hbh2jg3b', embed: '3hbh2jg3b', adult: true })
// returns a Promise that resolves to a LinkComment object
comment.edit({ content: 'Nice link!', photo: '3hbh2jg3b', embed: '3hbh2jg3b', adult: true })
// returns a Promise that resolves to the LinkComment object
comment.remove()
// returns a Promise that resolves to an empty string
comment.upvote()
// returns a Promise that resolves to the LinkComment object
comment.downvote()
// returns a Promise that resolves to the LinkComment object
comment.unvote()
// returns a Promise that resolves to the LinkComment object
comment.observe()
// returns a Promise that resolves to the LinkComment object
comment.unobserve()
// returns a Promise that resolves to the LinkComment object
comment.favorite()
// returns a Promise that resolves to the LinkComment object
comment.unfavorite()
// returns a Promise that resolves to the LinkComment object

Available functions on LinkRelated objects:

related.get()
// returns a Promise that resolves to a LinkRelated object - you can use this to refresh
related.edit({ title: 'Related to your link', url: 'https://example.com', adult: false })
// returns a Promise that resolves to the LinkRelated object
related.remove()
// returns a Promise that resolves to an empty string
related.upvote()
// returns a Promise that resolves to the LinkRelated object
related.downvote()
// returns a Promise that resolves to the LinkRelated object
related.unvote()
// returns a Promise that resolves to the LinkRelated object

Available functions on Draft objects:

draft.get()
// returns a Promise that resolves to a Draft object - you can use this to refresh
draft.edit({ title, description, tags, photo, adult = false, selectedImage })
// returns a Promise that resolves to a Draft object
draft.remove()
// returns a Promise that resolves to an empty string
draft.publish({ title, description, tags, photo, adult = false, selectedImage })
// returns a Promise that resolves to an empty string

Available functions on Article objects:

article.get()
// returns a Promise that resolves to an Article object - you can use this to refresh
article.edit({ title: 'Edited title!', content: 'Edited description', html: 'Random string' })
// returns a Promise that resolves to an Article object
article.remove()
// returns a Promise that resolves to an empty string

Available functions on ArticleHistory objects:

history.get()
// returns a Promise that resolves to an Article object

Available functions on Conversation objects:

conversation.get()
// returns a Promise that resolves to an Conversation object - you can use this to refresh
conversation.message('Hello!', { photo: '3hbh2jg3b', embed: '3hbh2jg3b' })
// returns a Promise that resolves to the Conversation object
conversation.clearHistory()
// returns a Promise that resolves to the Conversation object
conversation.isNewerMessageAvailable()
// returns a Promise that resolves to a boolean

Available functions on Profile objects:

profile.get()
// returns a Promise that resolves to a Profile object - you can use this to refresh
profile.getActions({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link and Entry objects
profile.getLinksAdded({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link objects
profile.getLinksPublished({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link objects
profile.getLinksUpvoted({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link objects
profile.getLinksDownvoted({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link objects
profile.getLinksCommented({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link objects
profile.getLinksRelated({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of LinkRelated objects
profile.getEntriesAdded({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Entry objects
profile.getEntriesUpvoted({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Entry objects
profile.getEntriesCommented({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Entry objects
profile.getBadges()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Badge objects
profile.getAuthoredTags()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Tag objects
profile.getFollowedTags({ page: null})
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Tag objects
profile.getFollowedUsers({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objects
profile.getFollowers({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objects
profile.getNote()
// returns a Promise that resolves to a string
profile.createNote({ content: 'Seems like a nice guy' })
// returns a Promise that resolves to the Profile object
profile.clearNote()
// returns a Promise that resolves to the Profile object
profile.getConversation()
// returns a Promise that resolves to a Conversation object
profile.observe()
// returns a Promise that resolves to the Profile object
profile.unobserve()
// returns a Promise that resolves to the Profile object
profile.blacklist()
// returns a Promise that resolves to the Profile object
profile.unblacklist()
// returns a Promise that resolves to the Profile object

Available functions on Tag objects:

tag.get()
// returns a Promise that resolves to a Tag object - you can use this to refresh
tag.getContent({ page: null, sort: 'newest', type: 'all', year: null, month: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link and Entry objects
tag.getNewerContentCount({ sort: 'newest', type: 'entry', date: '2021-01-01 10:11:12', lastId: null })
// returns a Promise that resolves to a string
tag.getRelatedTags()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Tag objects
tag.getCoauthors()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objects
tag.addCoauthor({ username: 'wykop' }) 
// returns a Promise that resolves to the Tag object
tag.removeCoauthor({ username: 'm__b' }) 
// returns a Promise that resolves to the Tag object
tag.edit({ photo: '3hbh2jg3b', description: 'This tag is about tags' }) 
// returns a Promise that resolves to the Tag object
tag.observe()
// returns a Promise that resolves to the Tag object
tag.unobserve()
// returns a Promise that resolves to the Tag object
tag.notify()
// returns a Promise that resolves to the Tag object
tag.mute()
// returns a Promise that resolves to the Tag object
tag.blacklist()
// returns a Promise that resolves to the Tag object
tag.unblacklist()
// returns a Promise that resolves to the Tag object

Available functions on Badge objects:

badge.get()
// returns a Promise that resolves to a Badge object - you can use this to refresh
badge.getUsers()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objects

Available functions on Bucket objects:

bucket.get()
// returns a Promise that resolves to a Bucket object - you can use this to refresh
bucket.getContent({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link and Entry objects
bucket.edit({ title: 'New title!', query: '#tags @users keywords', defaultPage: 'entries' })
// returns a Promise that resolves to the Bucket object
bucket.remove()
// returns a Promise that resolves to an empty string

Available functions on PersonalNotification, TagNotification, PmNotification and DiscussionNotification objects:

notification.get()
// returns a Promise that resolves to a Notification object - you can use this to refresh
notification.markAsRead()
// returns a Promise that resolves to the Notification object
notification.remove()
// returns a Promise that resolves to an empty string

Available functions on AccountSettings objects:

settings.get()
// returns a Promise that resolves to a AccountSettings object - you can use this to refresh
settings.update({ show_online: true })
// returns a Promise that resolves to the updated AccountSettings object

Available functions on ProfileSettings objects:

settings.get()
// returns a Promise that resolves to a ProfileSettings object - you can use this to refresh
settings.update({ name: '', gender: '', city: '', website: '', public_email: '', facebook: '', twitter: '', instagram: '', about: ''})
// returns a Promise that resolves to the updated ProfileSettings object
settings.submitAvatar('3hbh2jg3b')
// returns a Promise that resolves to the ProfileSettings object
settings.removeAvatar()
// returns a Promise that resolves to the ProfileSettings object
settings.submitBackground('3hbh2jg3b')
// returns a Promise that resolves to the ProfileSettings object
settings.removeBackground()
// returns a Promise that resolves to the ProfileSettings object

Available functions on Listing objects:

listing.stream()
// returns a Promise that resolves to an AsyncGeneratorFunction that yields items from the current page and all sequential pages

Available functions on Pagination objects:

pagination.get()
// returns a Promise that resolves to a Listing object - you can use this to refresh
pagination.next()
// returns a Promise that resolves to a Listing object
pagination.prev()
// returns a Promise that resolves to a Listing object

TODO

  • Better documentation than just this list
  • More testing