Skip to content

Latest commit

 

History

History
162 lines (98 loc) · 3.76 KB

recipientgateway.md

File metadata and controls

162 lines (98 loc) · 3.76 KB

Trolley JavaScript SDK > RecipientGateway

Class: RecipientGateway

Hierarchy

RecipientGateway

Index

Constructors

Methods


Constructors

<Private> constructor

new RecipientGateway(gateway: Gateway): RecipientGateway

Defined in RecipientGateway.ts:40

Parameters:

Param Type Description
gateway Gateway gateway object

Returns: RecipientGateway


Methods

create

create(body: RecipientInput): Promise<Recipient>

Defined in RecipientGateway.ts:82

Create a given recipient

const recipient = await client.recipient.create({
  type: "individual",
  firstName: "Tom",
  lastName: "Jones",
  email: "[email protected]",
  address: {
     street1: "123 Main St",
     country: "US",
  }
});

Parameters:

Param Type Description
body RecipientInput The recipient information to create

Returns: Promise<Recipient>


find

find(recipientId: string): Promise<Recipient>

Defined in RecipientGateway.ts:58

Find a specific recipient by their Trolley recipient ID

const recipient = await client.recipient.find('R-1234');

Parameters:

Param Type Description
recipientId string The Trolley recipient ID (e.g. R-xyzzy)

Returns: Promise<Recipient>


remove

remove(recipientId: string): Promise<boolean>

Defined in RecipientGateway.ts:115

Delete the given recipient.

const status = await client.recipient.remove('R-123');

Parameters:

Param Type Description
recipientId string The Trolley recipient ID (e.g. R-xyzzy)

Returns: Promise<boolean>


search

search(page: number, pageSize: number, term: string): Promise<Recipient[]>

Defined in RecipientGateway.ts:123

Parameters:

Param Type
page number
pageSize number
term string

Returns: Promise<Recipient[]>


update

update(recipientId: string, body: RecipientInput): Promise<boolean>

Defined in RecipientGateway.ts:100

Update the given recipient

const recipient = await client.recipient.update('R-1234', {
  firstName: "Carl",
});

Parameters:

Param Type Description
recipientId string The Trolley recipient ID (e.g. R-xyzzy)
body RecipientInput the changes to make to the recipient

Returns: Promise<boolean>