wykop v1.1.18
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 wykopImport 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);
})();- See also: Example: Simple wołacz
"Documentation"
new Wykop(config)WykopfunctionsEntryfunctionsEntryCommentfunctionsLinkfunctionsLinkCommentfunctionsLinkRelatedfunctionsDraftfunctionsArticlefunctionsArticleHistoryfunctionsConversationfunctionsProfilefunctionsTagfunctionsBadgefunctionsBucketfunctionsNotificationfunctionsAccountSettingsfunctionsProfileSettingsfunctionsListingfunctionsPaginationfunctions
new Wykop(config)
This constructs a new instance of WykopJS, available options are:
| Option | Default | Description |
|---|---|---|
config.appkey | null | \ The appkey you received from Wykop (1) |
config.secret | null | \ The secret you received from Wykop (1) |
config.token | null | \ Your access token (1) |
config.rtoken | null | \ Your refresh token (1) |
config.environment | https://wykop.pl/api/v3 | \ The environment (we probably never need this) |
config.proxies | true | \ 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 | \ 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 functionsw.entryComment({ id: '4321', entryId: 1234 })
// returns an empty EntryComment object that can be used to access its class functionsw.link('1234')
// returns an empty Link object that can be used to access its class functionsw.linkComment({ id: '4321', linkId: '1234' })
// returns an empty LinkComment object that can be used to access its class functionsw.linkRelated({ id: '4321', linkId: '1234' })
// returns an empty LinkRelated object that can be used to access its class functionsw.article('1234')
// returns an empty Article object that can be used to access its class functionsw.draft('3hbh2jg3b')
// returns an empty Draft object that can be used to access its class functionsw.profile('wykop')
// returns an empty Profile object that can be used to access its class functionsw.tag('heheszki')
// returns an empty Tag object that can be used to access its class functionsw.conversation('wykop')
// returns an empty Conversation object that can be used to access its class functionsw.badge('3hbh2jg3b')
// returns an empty Badge object that can be used to access its class functionsw.bucket('3hbh2jg3b')
// returns an empty Bucket object that can be used to access its class functionsw.getEntry('1234')
// returns a Promise that resolves to an Entry objectw.getEntryComment({ id: '4321', entryId: '1234' })
// returns a Promise that resolves to an EntryComment objectw.submitEntry({ content: 'Hello World!', photo: '3hbh2jg3b', embed: '3hbh2jg3b', survey: '3hbh2jg3b', adult: false })
// returns a Promise that resolves to an Entry objectw.submitEntryComment({ entryId: '1234', content: 'Hello again!', photo: '3hbh2jg3b', embed: '3hbh2jg3b', adult: false })
// returns a Promise that resolves to an EntryComment objectw.createSurvey({ question: 'Pizza or Pasta?', answers: ['Pizza', 'Pasta'], entryId: '1234' })
// returns a Promise that resolves to a stringw.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 stringw.getLink('1234')
// returns a Promise that resolves to a Link objectw.getLinkComment({ id: '4321', linkId: '1234' })
// returns a Promise that resolves to a LinkComment objectw.getLinkRelated({ id: '4321', linkId: '1234' })
// returns a Promise that resolves to a LinkRelated objectw.createURLDraft('https://cataas.com/#/')
// returns a Promise that resolves to a Draft objectw.getArticle('1234')
// returns a Promise that resolves to an Article objectw.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 objectw.getDraft('3hbh2jg3b')
// returns a Promise that resolves to a Draft objectw.getConversation('wykop')
// returns a Promise that resolves to a Conversation objectw.getTag('heheszki')
// returns a Promise that resolves to a Tag objectw.getTagContent('heheszki', { sort: 'best' })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Entry and Link objectsw.getProfile('m__b')
// returns a Promise that resolves to a Profile objectw.getMe()
// returns a Promise that resolves to a Profile objectw.getMeShort()
// returns a Promise that resolves to a Profile objectw.getBadge('rocznica')
// returns a Promise that resolves to a Badge objectw.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 objectsw.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 objectsw.getUpcommingCount({ category: null, bucket: null })
// returns a Promise that resolves to a stringw.getLinkByURL('https://wykop.pl')
// returns a Promise that resolves to a Link objectw.getHits({ sort: 'all', year: null, month: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link objectsw.getEntryHits({ sort: 'all', year: null, month: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Entry objectsw.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 objectsw.getNewerEntriesCount({ lastId: '1234', category: '3hbh2jg3b' })
// returns a Promise that resolves to a stringw.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 objectsw.getObservedContent({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link and Entry objectsw.getObservedUsersContent({ page: 4 })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link and Entry objectsw.getNewerObservedUsersContentCount({ date: w.formatDate(new Date), lastId: null })
// returns a Promise that resolves to a stringw.getObservedTagsContent({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link and Entry objectsw.getObservedDiscussionsContent({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link, LinkComment and Entry objectsw.getAutocompleteSuggestionsForTag('wyko')
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Tag objectsw.getAutocompleteSuggestionsForUser('wyko')
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objectsw.getPopularTags()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Tag objectsw.getPopularAuthoredTags()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Tag objectsw.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 objectsw.getNotificationStatus()
// returns a Promise that resolves to an objectw.getPersonalNotifications({ page: 2 })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of PersonalNotification objectsw.markPersonalNotificationsAsRead()
// returns a Promise that resolves to an empty stringw.removePersonalNotifications()
// returns a Promise that resolves to an empty stringw.getTagNotifications({ page: '2' })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of TagNotification objectsw.markTagNotificationsAsRead()
// returns a Promise that resolves to an empty stringw.removeTagNotifications()
// returns a Promise that resolves to an empty stringw.getDiscussionNotifications({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of PmNotification objectsw.markDiscussionNotificationsAsRead()
// returns a Promise that resolves to an empty stringw.removeDiscussionNotifications()
// returns a Promise that resolves to an empty stringw.getPMNotifications({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of PmNotification objectsw.markPmNotificationsAsRead()
// returns a Promise that resolves to an empty stringw.removePmNotifications()
// returns a Promise that resolves to an empty stringw.getOpenConversation()
// returns a Promise that resolves to a Conversation objectw.markAllConversationsAsRead()
// returns a Promise that resolves to an empty stringw.getConversations({ 'wyko' })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Conversation objectsw.getCategories()
// returns a Promise that resolves to an objectw.getBucket('3hbh2jg3b')
// returns a Promise that resolves to a Bucket objectw.getUserCategories()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Bucket objectsw.getBucketStatus()
// returns a Promise that resolves to an objectw.addBucket({ title: 'My first category', query: '#wykop @wykop', defaultPage: 'home' })
// returns a Promise that resolves to a Bucket objectw.getBucketContentPreview('#wykop @wykop')
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link and Entry objectsw.getBadges()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Badge objectsw.getRanking({ page: 10 })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objectsw.getMyRank()
// returns a Promise that resolves to an objectw.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 onw.logout()
// returns a Promise that resolves to an empty stringw.submit2FACode({ token: '3hbh2jg3b', code: '123123' })
// returns a Promise that resolves to an object with a token and rtokenw.submit2FARecoveryCode({ token: '3hbh2jg3b', code: '12D12D' })
// returns a Promise that resolves to an object with a token and rtoken - 2FA is now offw.requestPasswordReset('email@example.com')
// returns a Promise that resolves to an empty stringw.submitPasswordReset({ token: '3hbh2jg3b', password: 'my-new-password' })
// returns a Promise that resolves to an empty stringw.registerNewAccount({ username: 'username123', email: 'email@example.com', password: 'my-password', phone: '123543678' })
// returns a Promise that resolves to a string that can then be used to confirm the SMS codew.rerequestRegistrationSMS({ hash: '3hbh2jg3b' })
// returns a Promise that resolves to an empty stringw.submitRegistrationSMS({ hash: '3hbh2jg3b', code: '123123' })
// returns a Promise that resolves to an empty stringw.submitRegistrationEmailToken({ '3hbh2jg3b' })
// returns a Promise that resolves to an object with a token and rtokenw.getWykopConnectURL()
// returns a Promise that resolves to an objectw.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_urlw.getAccountBlockades()
// returns a Promise that resolves to an objectw.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 objectw.getProfileSettings()
// returns a Promise that resolves to an ProfileSettings objectw.getPhone()
// returns a Promise that resolves to a stringw.requestChangePhoneNumber('123543678')
// returns a Promise that resolves to an empty string OR an object with a token in case the user has 2FA turned onw.submitChangePhoneNumberSMS('123123')
// returns a Promise that resolves to an empty stringw.getEmail()
// returns a Promise that resolves to a stringw.requestChangeEmail()
// returns a Promise that resolves to an empty string OR an object with a token in case the user has 2FA turned onw.submitChangeEmail()
// returns a Promise that resolves to an empty stringw.requestAccountDeletion()
// returns a Promise that resolves to an empty string OR an object with a token in case the user has 2FA turned onw.confirmAccountDeletion()
// returns a Promise that resolves to an empty stringw.requestAccountDataCopy()
// returns a Promise that resolves to an empty string OR an object with a token in case the user has 2FA turned onw.requestAccountDataTransfer()
// returns a Promise that resolves to an empty string OR an object with a token in case the user has 2FA turned onw.is2FAEnabled()
// returns a Promise that resolves to a booleanw.get2FASecret({ type: '1' })
// returns a Promise that resolves to a stringw.activate2FA({ code: '123456', type: '1' })
// returns a Promise that resolves with your recovery codew.deactivate2FA({ password: 'itspassword', code: '123456' })
// returns a Promise that resolves to an empty stringw.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 undefinedw.getUserSessions()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objectsw.removeUserSession('12341234')
// returns a Promise that resolves to nullw.removeOtherUserSessions()
// returns a Promise that resolves to nullw.getConnectApplications()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objectsw.removeConnectApplication('12341234')
// returns a Promise that resolves to nullw.getBlacklistedUsers()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objectsw.addUserToBlacklist()
// returns a Promise that resolves to the Wykop objectw.removeUserFromBlacklist()
// returns a Promise that resolves to the Wykop objectw.getBlacklistedTags()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Tag objectsw.addTagToBlacklist()
// returns a Promise that resolves to the Wykop objectw.removeTagFromBlacklist()
// returns a Promise that resolves to the Wykop objectw.getBlacklistedDomains()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objectsw.addDomainToBlacklist()
// returns a Promise that resolves to the Wykop objectw.removeDomainFromBlacklist()
// returns a Promise that resolves to the Wykop objectw.getDoodle()
// returns a Promise that resolves to an objectw.getAccountColors()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objectsw.getAccountColor('orange')
// returns a Promise that resolves to an objectw.submitSupportMessage({ reason: w.supportReasons.technicalProblems, email: 'email@example.com', message: 'Please help!', file: null, info: null, url: null })
// returns a Promise that resolves to the Wykop objectw.submitGDPRMessage({ 'email@example.com', message: 'Please help with my data!' })
// returns a Promise that resolves to the Wykop objectw.getReportedContent({ page: 2 })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objectsw.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 objectsw.submitAppeal({ reportId: '1234', content: 'This should not have been deleted!' })
// returns a Promise that resolves to the Wykop objectw.getAppeals({ page: 5 })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objectsw.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_schemaw.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 APIw.saveConnectTokens({ token: '3hbh2jg3b', rtoken: '3hbh2jg3b' })
// returns a Promise that resolves to an object with the token and rtokenw.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 objectw.hasTokenExpired()
// returns a Promise that resolves to a booleanw.getLoggedUsername()
// returns a Promise that resolves to your usernamew.isLogged()
// returns a Promise that resolves to a booleanAvailable 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 refreshentry.getComment('4321')
// returns a Promise that resolves to an EntryComment objectentry.getComments()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of EntryComment objectsentry.getNewerCommentsCount({ date: w.formatDate(new Date) })
// returns a Promise that resolves to a stringentry.submitComment({ content = 'Nice entry you have there!', photo = null, embed = null, adult = false })
// returns a Promise that resolves to an EntryComment objectentry.edit({ content: 'Hello yet again!', photo: null, embed: null, survey: null, adult = false })
// returns a Promise that resolves to an Entry objectentry.remove()
// returns a Promise that resolves to an empty stringentry.getUpvoters()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objectsentry.upvote()
// returns a Promise that resolves to the Entry objectentry.unvote()
// returns a Promise that resolves to the Entry objectentry.favorite()
// returns a Promise that resolves to the Entry objectentry.observe()
// returns a Promise that resolves to the Entry objectentry.unobserve()
// returns a Promise that resolves to the Entry objectentry.unfavorite()
// returns a Promise that resolves to the Entry objectentry.surveyVote('2')
// returns a Promise that resolves to the Entry objectAvailable 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 refreshcomment.edit({ content: 'Nice entry you have there!', photo: '3hbh2jg3b', embed: '3hbh2jg3b', adult: true })
// returns a Promise that resolves to an EntryComment objectcomment.remove()
// returns a Promise that resolves to an empty stringcomment.getUpvoters()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objectscomment.upvote()
// returns a Promise that resolves to an EntryComment objectcomment.unvote()
// returns a Promise that resolves to an EntryComment objectcomment.favorite()
// returns a Promise that resolves to an EntryComment objectcomment.unfavorite()
// returns a Promise that resolves to an EntryComment objectAvailable functions on Link objects:
link.get()
// returns a Promise that resolves to a Link object - you can use this to refreshlink.getComment('4321')
// returns a Promise that resolves to a LinkComment objectlink.submitComment({ content: 'Nice link!', photo: '3hbh2jg3b', embed: '3hbh2jg3b', adult: false })
// returns a Promise that resolves to a LinkComment objectlink.getComments({ page, sort, ama })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of LinkComment objectslink.getRelatedLinks()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of LinkRelated objectslink.submitRelatedLink({ title, url, adult })
// returns a Promise that resolves to a LinkRelated objectlink.edit({ title: 'Hello again :)', description: 'Something interesting!', tags: ['heheszki', 'polityka'], photo: null, adult: true })
// returns a Promise that resolves to a Link objectlink.remove()
// returns a Promise that resolves to an empty stringlink.upvote()
// returns a Promise that resolves to the Link objectlink.downvote({ reason: link.downvoteReason.duplicate })
// returns a Promise that resolves to the Link objectlink.unvote()
// returns a Promise that resolves to the Link objectlink.observe()
// returns a Promise that resolves to the Link objectlink.unobserve()
// returns a Promise that resolves to the Link objectlink.favorite()
// returns a Promise that resolves to the Link objectlink.unfavorite()
// returns a Promise that resolves to the Link objectlink.toggleMuteAMA()
// returns a Promise that resolves to the Link objectlink.finishAMA()
// returns a Promise that resolves to the Link objectlink.getUpvotes()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objectslink.getDownvotes()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of objectslink.getCounters()
// returns a Promise that resolves to an objectlink.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 refreshcomment.getComments({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of LinkComment objectscomment.submitComment({ content: 'Nice link!', photo: '3hbh2jg3b', embed: '3hbh2jg3b', adult: true })
// returns a Promise that resolves to a LinkComment objectcomment.edit({ content: 'Nice link!', photo: '3hbh2jg3b', embed: '3hbh2jg3b', adult: true })
// returns a Promise that resolves to the LinkComment objectcomment.remove()
// returns a Promise that resolves to an empty stringcomment.upvote()
// returns a Promise that resolves to the LinkComment objectcomment.downvote()
// returns a Promise that resolves to the LinkComment objectcomment.unvote()
// returns a Promise that resolves to the LinkComment objectcomment.observe()
// returns a Promise that resolves to the LinkComment objectcomment.unobserve()
// returns a Promise that resolves to the LinkComment objectcomment.favorite()
// returns a Promise that resolves to the LinkComment objectcomment.unfavorite()
// returns a Promise that resolves to the LinkComment objectAvailable functions on LinkRelated objects:
related.get()
// returns a Promise that resolves to a LinkRelated object - you can use this to refreshrelated.edit({ title: 'Related to your link', url: 'https://example.com', adult: false })
// returns a Promise that resolves to the LinkRelated objectrelated.remove()
// returns a Promise that resolves to an empty stringrelated.upvote()
// returns a Promise that resolves to the LinkRelated objectrelated.downvote()
// returns a Promise that resolves to the LinkRelated objectrelated.unvote()
// returns a Promise that resolves to the LinkRelated objectAvailable functions on Draft objects:
draft.get()
// returns a Promise that resolves to a Draft object - you can use this to refreshdraft.edit({ title, description, tags, photo, adult = false, selectedImage })
// returns a Promise that resolves to a Draft objectdraft.remove()
// returns a Promise that resolves to an empty stringdraft.publish({ title, description, tags, photo, adult = false, selectedImage })
// returns a Promise that resolves to an empty stringAvailable functions on Article objects:
article.get()
// returns a Promise that resolves to an Article object - you can use this to refresharticle.edit({ title: 'Edited title!', content: 'Edited description', html: 'Random string' })
// returns a Promise that resolves to an Article objectarticle.remove()
// returns a Promise that resolves to an empty stringAvailable functions on ArticleHistory objects:
history.get()
// returns a Promise that resolves to an Article objectAvailable functions on Conversation objects:
conversation.get()
// returns a Promise that resolves to an Conversation object - you can use this to refreshconversation.message('Hello!', { photo: '3hbh2jg3b', embed: '3hbh2jg3b' })
// returns a Promise that resolves to the Conversation objectconversation.clearHistory()
// returns a Promise that resolves to the Conversation objectconversation.isNewerMessageAvailable()
// returns a Promise that resolves to a booleanAvailable functions on Profile objects:
profile.get()
// returns a Promise that resolves to a Profile object - you can use this to refreshprofile.getActions({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link and Entry objectsprofile.getLinksAdded({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link objectsprofile.getLinksPublished({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link objectsprofile.getLinksUpvoted({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link objectsprofile.getLinksDownvoted({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link objectsprofile.getLinksCommented({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link objectsprofile.getLinksRelated({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of LinkRelated objectsprofile.getEntriesAdded({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Entry objectsprofile.getEntriesUpvoted({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Entry objectsprofile.getEntriesCommented({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Entry objectsprofile.getBadges()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Badge objectsprofile.getAuthoredTags()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Tag objectsprofile.getFollowedTags({ page: null})
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Tag objectsprofile.getFollowedUsers({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objectsprofile.getFollowers({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objectsprofile.getNote()
// returns a Promise that resolves to a stringprofile.createNote({ content: 'Seems like a nice guy' })
// returns a Promise that resolves to the Profile objectprofile.clearNote()
// returns a Promise that resolves to the Profile objectprofile.getConversation()
// returns a Promise that resolves to a Conversation objectprofile.observe()
// returns a Promise that resolves to the Profile objectprofile.unobserve()
// returns a Promise that resolves to the Profile objectprofile.blacklist()
// returns a Promise that resolves to the Profile objectprofile.unblacklist()
// returns a Promise that resolves to the Profile objectAvailable functions on Tag objects:
tag.get()
// returns a Promise that resolves to a Tag object - you can use this to refreshtag.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 objectstag.getNewerContentCount({ sort: 'newest', type: 'entry', date: '2021-01-01 10:11:12', lastId: null })
// returns a Promise that resolves to a stringtag.getRelatedTags()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Tag objectstag.getCoauthors()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objectstag.addCoauthor({ username: 'wykop' })
// returns a Promise that resolves to the Tag objecttag.removeCoauthor({ username: 'm__b' })
// returns a Promise that resolves to the Tag objecttag.edit({ photo: '3hbh2jg3b', description: 'This tag is about tags' })
// returns a Promise that resolves to the Tag objecttag.observe()
// returns a Promise that resolves to the Tag objecttag.unobserve()
// returns a Promise that resolves to the Tag objecttag.notify()
// returns a Promise that resolves to the Tag objecttag.mute()
// returns a Promise that resolves to the Tag objecttag.blacklist()
// returns a Promise that resolves to the Tag objecttag.unblacklist()
// returns a Promise that resolves to the Tag objectAvailable functions on Badge objects:
badge.get()
// returns a Promise that resolves to a Badge object - you can use this to refreshbadge.getUsers()
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Profile objectsAvailable functions on Bucket objects:
bucket.get()
// returns a Promise that resolves to a Bucket object - you can use this to refreshbucket.getContent({ page: null })
// returns a Promise that resolves to a Listing object, where Listing.items is a list of Link and Entry objectsbucket.edit({ title: 'New title!', query: '#tags @users keywords', defaultPage: 'entries' })
// returns a Promise that resolves to the Bucket objectbucket.remove()
// returns a Promise that resolves to an empty stringAvailable functions on PersonalNotification, TagNotification, PmNotification and DiscussionNotification objects:
notification.get()
// returns a Promise that resolves to a Notification object - you can use this to refreshnotification.markAsRead()
// returns a Promise that resolves to the Notification objectnotification.remove()
// returns a Promise that resolves to an empty stringAvailable functions on AccountSettings objects:
settings.get()
// returns a Promise that resolves to a AccountSettings object - you can use this to refreshsettings.update({ show_online: true })
// returns a Promise that resolves to the updated AccountSettings objectAvailable functions on ProfileSettings objects:
settings.get()
// returns a Promise that resolves to a ProfileSettings object - you can use this to refreshsettings.update({ name: '', gender: '', city: '', website: '', public_email: '', facebook: '', twitter: '', instagram: '', about: ''})
// returns a Promise that resolves to the updated ProfileSettings objectsettings.submitAvatar('3hbh2jg3b')
// returns a Promise that resolves to the ProfileSettings objectsettings.removeAvatar()
// returns a Promise that resolves to the ProfileSettings objectsettings.submitBackground('3hbh2jg3b')
// returns a Promise that resolves to the ProfileSettings objectsettings.removeBackground()
// returns a Promise that resolves to the ProfileSettings objectAvailable functions on Listing objects:
listing.stream()
// returns a Promise that resolves to an AsyncGeneratorFunction that yields items from the current page and all sequential pagesAvailable functions on Pagination objects:
pagination.get()
// returns a Promise that resolves to a Listing object - you can use this to refreshpagination.next()
// returns a Promise that resolves to a Listing objectpagination.prev()
// returns a Promise that resolves to a Listing objectTODO
- Better documentation than just this list
- More testing
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago