@wireapp/api-client
TypeScript icon, indicating that this package has built-in type declarations

26.11.4 • Public • Published

Wire

This repository is part of the source code of Wire. You can find more information at wire.com or by contacting opensource@wire.com.

You can find the published source code at github.com/wireapp.

For licensing information, see the attached LICENSE file and the list of third-party licenses at wire.com/legal/licenses/.

API Client

Wire for Web's API client.

Getting Started

yarn
yarn start

Installation

yarn add @wireapp/api-client

Usage

Wire Backend

import {APIClient} from '@wireapp/api-client';
import {LoginData} from '@wireapp/api-client/lib/auth/';
import {ClientType} from '@wireapp/api-client/lib/client';

const credentials: LoginData = {
  clientType: ClientType.TEMPORARY,
  email: 'user@wire.com',
  password: 'top-secret',
};

const apiClient = new APIClient();

apiClient.login(credentials);

Custom Backend

import {APIClient} from '@wireapp/api-client';
import {Config} from '@wireapp/api-client/lib/Config';
import {LoginData} from '@wireapp/api-client/lib/auth/';
import {ClientType} from '@wireapp/api-client/lib/client';

const credentials: LoginData = {
  clientType: ClientType.TEMPORARY,
  email: 'user@wire.com',
  password: 'top-secret',
};

const apiConfig: Config = {
  urls: {
    name: 'My custom backend',
    rest: 'https://backend-rest.domain.com',
    ws: 'wss://backend-websocket.domain.com',
  },
};

const apiClient = new APIClient(apiConfig);

apiClient.login(credentials);

Examples

Browser

Node.js

Execution

Bash

#!/bin/bash

EMAIL="name@email.com"
PASSWORD="password"

node index.js --e="$EMAIL" --p="$PASSWORD"

Node

npm run dist
node index.js --e="name@email.com" --p="password"

Readme

Keywords

none

Package Sidebar

Install

npm i @wireapp/api-client

Weekly Downloads

424

Version

26.11.4

License

GPL-3.0

Unpacked Size

930 kB

Total Files

906

Last publish

Collaborators

  • augustocdias_wire
  • beltram_wire
  • tlebon
  • typfel
  • wireapp-owner
  • wireapp-member