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

funpay-js-api

v1.0.9

Published

This is a Node.js API project designed to interact with the Funpay.com website. The API allows for seamless integration and communication with Funpay's services, making it easier to develop applications that rely on Funpay's features.

Downloads

33

Readme

Funpay.com API Project

This is a Node.js API project designed to interact with the Funpay.com website. The API allows for seamless integration and communication with Funpay's services, making it easier to develop applications that rely on Funpay's features.

Installation

To install the necessary dependencies, run the following command:

npm i funpay-js-api

Example Usage

import { Api, Runner, Chat } from "funpay-js-api";
const goldenkey = 'YOUR GOLDEN KEY FROM COOKIES';
class app {
    constructor(){
        Api.setConfig(goldenkey);
        this.test()
    }
    async test(){
        Runner.on('orders_counters', (data)=>{
            console.log('updated order counter', data);
        })
        Runner.on('chat_counter', (data)=>{
            console.log('updated chat counter', data);
        })

        let neworders = await Api.getNewOrders();
        console.log('neworders', neworders);

        
        let chat = new Chat(11936609, 1);
        chat.on('message', (msg)=>{
            console.log(msg);
        });
    }
}
new app();

API

The Api class provides methods for interacting with the Funpay API.

Methods

  • setConfig(key: string): Promise<void>

    • Set the API key and initialize the instance.
  • getUserLastMessage(id: number): Promise<string>

    • Retrieve the last message ID for a given user.
  • getOffers(id?: number): Promise<any>

    • Retrieve offers for a specific user or for the current user.
  • getLots(node: string): Promise<any>

    • Retrieve lots for a specific offer node.
  • getOfferPage(node: string, offer: string): Promise<any>

    • Get the page for a specific offer.
  • updateOfferPage(offerPage: any): Promise<any>

    • Update the offer page with new data.
  • updatePrice(node: string, offer: string, price: number): Promise<void>

    • Update the price of a specific offer.
  • getUserLangById(id: number): Promise<string>

    • Get the language preference of a user.
  • getUserByDialogId(dialogId: string): Promise<{ userId: string, lang: string }>

    • Retrieve user information by dialog ID.
  • getDialogs(): Promise<any[]>

    • Retrieve a list of dialogs for the current user.
  • getLastOrders(): Promise<any[]>

    • Retrieve last 100 orders for the current user.
  • getNewOrders(): Promise<any[]>

    • Retrieve new orders for the current user.
  • refund(orderId: string): Promise<any>

    • Refund an order by ID.
  • svgtopng(base64Svg: string): Promise<Buffer>

    • Convert a base64 SVG image to PNG format.
  • uploadFileFromBuffer(imageBuffer: Buffer, contentType: string): Promise<any>

    • Upload a file from a buffer.
  • uploadFileFromUrl(src: string): Promise<any>

    • Upload a file from a URL or base64 encoded string.

Runner

The Runner class handles chat interactions and emits events.

Event Handling

  • on(event: 'orders_counters', listener: (data: any) => void): void

    • Listen for the orders_counters event.
  • on(event: 'chat_counter', listener: (data: any) => void): void

    • Listen for the chat_counter event.
  • off(event: 'orders_counters', listener: (data: any) => void): void

    • Stop listening for the orders_counters event.
  • off(event: 'chat_counter', listener: (data: any) => void): void

    • Stop listening for the chat_counter event.

Chat Class

The Chat class manages individual chat instances, allowing you to send messages, send files, and handle chat-specific events.

Constructor

  • constructor(id: number, lastMessage?: number)
    • Parameters:
      • id (number): The ID of the chat.
      • lastMessage (optional, number): The ID of the last message (if available).

Methods

  • sendMessage(message: string): Promise<void>

    • Send a text message to the chat.
    • Parameters:
      • message (string): The message text to send.
  • sendFile(fileid: string): Promise<void>

    • Send a file to the chat.
    • Parameters:
      • fileid (string): The ID of the file to send.
  • remove(): Promise<void>

    • Delete a chat instance. This method can be used to exit a chat.

Event Handling

  • on(event: 'message', listener: (message: object) => void): void

    • Register an event listener for incoming messages.
    • Parameters:
      • event (string): The event type ('message').
      • listener (function): The callback function to handle incoming messages. The function receives a message object as an argument.
  • off(event: 'message', listener: (message: object) => void): void

    • Unregister an event listener for incoming messages.
    • Parameters:
      • event (string): The event type ('message').
      • listener (function): The callback function to remove.

Author

This project was created by Aleksandr Iurov for https://buynstars.com.