Skip to content

ascariandrea/revolut-sdk

Repository files navigation

Revolut SDK

Build Status npm version

A typesafe SDK for revolut API.

Install

$ yarn add revolut-sdk

# or if you have time to spare

$ npm install revolut-sdk

Usage

import { RevolutClient } from 'revolut-sdk';
const revolut = RevolutClient.run({
  sandbox: true,
  apiKey: 'your-api-key'
});

The SDK uses Either and Option to model the result returned from API.

Accounts

revolut
  .accounts
  .get(accountId: string): TaskEither<AxiosError, Option<Account>>>;

revolut
  .accounts
  .getAll(): TaskEither<AxiosError, Option<Account[]>>>;

Counterparties

revolut
  .counterparties
  .add(counterparty: Counterparty): TaskEither<AxiosError, Option<Counterparty>>>;

revolut
  .counterparties
  .getAll(): TaskEither<AxiosError, Option<Counterparty[]>>>;

revolut
  .counterparties
  .get(counterpartyId: string): TaskEither<AxiosError, Option<Counterparty>>>;

revolut
  .counterparties
  .del(counterpartyId: string): TaskEither<AxiosError, Option<any>>>;

Payments

revolut
  .payments
  .transfer(transfer: TransferData): TaskEither<AxiosError, Option<Transaction>>>;

revolut
  .payments
  .pay(payment: PaymentData): TaskEither<AxiosError, Option<Transaction>>>;

revolut
  .payments
  .transactionById(transactionId: string): TaskEither<AxiosError, Option<Transaction>>>;

revolut
  .payments
  .transactionByRequestId(transactionRequestId: string): TaskEither<AxiosError, Option<Transaction>>>;

revolut
  .payments
  .cancel(paymentId: string): TaskEither<AxiosError, Option<any>>>;

revolut
  .payments
  .transactions(transactionsParams?: TransactionParams): TaskEither<AxiosError, Option<Transaction[]>>>;

Test

$ yarn test