Trolley JavaScript SDK > RecipientGateway
RecipientGateway
⊕ new RecipientGateway(gateway: Gateway): RecipientGateway
Defined in RecipientGateway.ts:40
Parameters:
Param | Type | Description |
---|---|---|
gateway | Gateway | gateway object |
Returns: RecipientGateway
▸ 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(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(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(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(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
>