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

backpacktf-oauth

v1.0.1

Published

A wrapper for https://www.backpack.tf OAuth API.

Downloads

8

Readme

BACKPACKTF

A wrapper for https://www.backpack.tf OAuth API.

Create an app if you don't have one already: https://backpack.tf/developer/apps.

Breaking changes may occur Until v1

Constructor

import backpacktf from 'backpacktf-oauth';
//or
const backpacktf = require('backpacktf-oauth');

const bp = new backpacktf('***client_id***', '***client_secret***');

bp.once('ready', () => {
    //You can use the module however you want now
});

Method

// Checks current users status. Returns BackpackTF.StatusResponse
bp.getStatus();

⚠️ All Methods Return their shown values wrapped by a Promise. ⚠️

Classes

Classifieds

I'm too lazy to type them here just use typecript

Agent

Methods

// Activates User Agent returns Agent.PulseResponse
await bp.Agent.pulse();

// Stops User Agent returns Agent.OnlyStatus (Probably "inactive")
await bp.Agent.stop();

// Checks current User Agent status returns Agent.PulseResponse
await bp.Agent.status();

Types

namespace Agent {
    export interface PulseResponse extends OnlyStatus {
        current_time?: number;
        expire_at?: number;
        client?: string;
    }
    export interface OnlyStatus {
        status: 'active' | 'inactive';
    }
}

Alerts

Methods

    // Get an alert by alertid (string) returns Alerts.Alert
    await bp.Alerts.getAlert(id)

    // This endpoint currently doesn't work due to serverside issues.
    // Delete an alert by alertid(string) returns UNKNOWN
    await bp.Alerts.deleteAlert(id)

    // Get alerts returns Alerts.Response.
    // skip and limit variables are Optional.
    await bp.Alerts.getAlerts(skip?, limit?)

    // Create an Alert by alert (Alerts.Create)  returns Alerts.Alert
    await bp.Alerts.createAlert(alert)

Types

namespace Alerts {
    export interface Response {
        results: Alert[];
        cursor: {
            skip: number;
            limit: number;
            total: number;
        };
    }

    export interface Alert {
        id: string;
        item_name: string;
        intent: 'sell' | 'buy';
        appid: number;
        steamid: string;
        price: {
            currency: 'metal' | 'key';
            min: number;
            max: number;
        };
    }
    export interface Create {
        item_name: string;
        intent: 'sell' | 'buy';
        currency: 'metal' | 'key';
        min: number;
        max: number;
        blanket: string;
    }
}

Notifications

Methods

    // Get a notification by notificationid (string) returns Notifications.Notification
    await bp.Notifications.getNotification(id)

    // This endpoint currently doesn't work due to serverside issues.
    // Delete a notification by notificationid (string) returns UNKNOWN
    await bp.Notifications.deleteNotification(id)

    // Get notifications returns Notifications.Response.
    // skip, limit and unread variables are Optional.
    await bp.Notifications.getNotifications(skip?, limit?, unread?)

    // Unread all notifications returns Notifications.Notification[] (returns all unread Notifications and marks them as read)
    await bp.Notifications.unreadNotifications(alert)

    // Mark Notifications returns Notifications.MarkResponse
    await bp.Notifications.markNotifications(alert)

Types

namespace Notifications {
    export interface Notification {
        id: string;
        steamid: string;
        lastMoved: number;
        elementId: string;
        userId: string;
        type: number;
        bunde: {
            listing?: BackpackTF.classifiedItemBuy | BackpackTF.classifiedItemSell;
        };
        contents: {
            subject: string;
            message: string;
            url: string;
        };
    }
    export interface Response {
        results: Notification[];
        cursor: {
            skip: number;
            limit: number;
            total: number;
        };
    }
    export interface MarkResponse {
        modified: number;
    }
}

WebAPIUsers

Methods

    // Gets UserInfos by steamids (string[]) returns WebAPIUsers.UserResponse
    await bp.WebApiUsers.getUsers(steamids)

    // Gets Impersonated users returns WebAPIUsers.ImpersonatedResponse
    // skip and limit variables are Optional.
    await bp.WebApiUsers.getImpersonatedUsers(skip?, limit?)

Types

namespace WebAPIUsers {
    export interface UserResponse {
        response: {
            success: 1 | 0;
            current_time: number;
            players: {
                [steamid64: string]: {
                    steamid: string;
                    success: 1 | 0;
                    backpack_value: {
                        [appid: string]: number;
                    };
                    backpack_update: {
                        [appid: string]: number;
                    };
                    name: string;
                    backpack_tf_trust: {
                        for: number;
                        against: number;
                    };
                };
            };
        };
    }
    export interface ImpersonatedResponse {
        results: {
            steamid: string;
            personaname: string;
            avatar: string;
        }[];
        total: number;
    }
}

Inventory

Methods

// Gets inventory value of a user by steamid (string) returns Inventory.Values
await bp.Inventory.getValue(steamid);

// Gets status of a user by steamid (string) returns Inventory.Status
await bp.Inventory.getStatus();

// Refreshes Status of a user by steamid (string) returns Inventory.Status
await bp.Inventory.refresh();

Types

namespace Inventory {
    export interface Values {
        market_value: number;
        value: number;
    }
    export interface Status {
        current_time: number;
        last_update: number;
        timestamp: number;
        next_update: number;
        refresh_interval: number;
    }
}