@types/strophejs-plugin-roster
TypeScript icon, indicating that this package has built-in type declarations

1.1.5 • Public • Published

Installation

npm install --save @types/strophejs-plugin-roster

Summary

This package contains type definitions for strophejs-plugin-roster (https://github.com/strophe/strophejs-plugin-roster#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/strophejs-plugin-roster.

index.d.ts

import { Strophe } from "strophe.js";

export {};

export type IqCallback = (stanza: Element) => any;
export type IqID = string;
export type RosterSubscriptionState = "none" | "to" | "from" | "both" | "remove";
export type PresenceSubscriptionType = "subscribe" | "unsubscribe" | "subscribed" | "unsubscribed";

export interface RosterResource {
    priority: string;
    show: string;
    status: string;
}

export interface RosterItem {
    name: string;
    jid: string;
    subscription: RosterSubscriptionState;
    ask: string;
    groups: string[];
    resources: { [resourceId: string]: RosterResource };
}

export type RosterUpdateCallback = (items: RosterItem[], item: RosterItem, previousItem: RosterItem) => any;
export type PresenceRequestCallback = (from: string) => any;

interface StropheRosterPlugin {
    supportVersioning(): boolean;

    get(userCallback: IqCallback, ver?: string, items?: string[]): IqID;

    registerCallback(callback: RosterUpdateCallback): void;

    registerRequestCallback(callback: PresenceRequestCallback): void;

    findItem(jid: string): RosterItem | false;

    removeItem(jid: string): boolean;

    subscribe(jid: string, message?: string, nick?: string): void;

    unsubscribe(jid: string, message?: string): void;

    authorize(jid: string, message?: string): void;

    unauthorize(jid: string, message?: string): void;

    add(jid: string, name: string, groups: string[], call_back?: IqCallback): IqID;

    update(jid: string, name?: string, groups?: string[], call_back?: IqCallback): IqID;

    remove(jid: string, call_back?: IqCallback): void;
}

/*~ Here, declare the same module as the one you imported above */
declare module "strophe.js" {
    namespace Strophe {
        interface Connection {
            roster: StropheRosterPlugin;
        }
    }
}

declare global {
    namespace Strophe {
        interface Connection {
            roster: StropheRosterPlugin;
        }
    }
}

Additional Details

Credits

These definitions were written by LeartS.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/strophejs-plugin-roster

Weekly Downloads

108

Version

1.1.5

License

MIT

Unpacked Size

6.65 kB

Total Files

5

Last publish

Collaborators

  • types