Skip to content

@nht-pandats/sdk / @nht-pandats/sdk/clients / @nht-pandats/sdk/clients/affiliateApi / AffiliateApiClient

Class: AffiliateApiClient ​

@nht-pandats/sdk/clients.@nht-pandats/sdk/clients/affiliateApi.AffiliateApiClient

A client for interacting with the Affiliate API. Based on the PandaTS Affiliate API Documentation

Map of Functionality ​

HTTP MethodEndpointMethodIntroduced in Version
POST/api/customers/AffiliateApiClient.customers.createv1.20240429.0
GET/api/customers/:emailAffiliateApiClient.customers.readv1.20240429.0
GET/api/customers/AffiliateApiClient.customers.listv1.20240429.0
PUT/api/customers/:emailAffiliateApiClient.customers.updatev1.20240429.0
GET/api/customers/:email/tradingAccountsAffiliateApiClient.tradingAccounts.list or AffiliateApiClient.customers.tradingAccounts.listv1.20240429.0
GET/api/customers/tradingAccountsAffiliateApiClient.tradingAccounts.list or AffiliateApiClient.customers.tradingAccounts.listv1.20240429.0
POST/api/customers/:email/commentsAffiliateApiClient.comments.create or AffiliateApiClient.customers.comments.createv1.20240429.0
GET/api/customers/:email/commentsAffiliateApiClient.comments.list or AffiliateApiClient.customers.comments.listv1.20240429.0
GET/api/customers/commentsAffiliateApiClient.comments.list or AffiliateApiClient.customers.comments.listv1.20240429.0
POST/api/leadsAffiliateApiClient.leads.createv1.20240429.0
GET/api/leadsAffiliateApiClient.leads.listv1.20240429.0
POST/api/system/loginTokenAffiliateApiClient.system.loginTokenv1.20240429.0
GET/api/system/complianceStatusAffiliateApiClient.system.complianceStatusv1.20240429.0
GET/api/system/countryAffiliateApiClient.system.countryv1.20240429.0
GET/api/system/currencyAffiliateApiClient.system.currencyv1.20240429.0
GET/api/system/languageAffiliateApiClient.system.languagev1.20240429.0
GET/api/system/partner/restrictionsAffiliateApiClient.system.partnerRestrictionsv1.20240429.0
GET/api/callbacksAffiliateApiClient.callbacks.listv1.20240429.0
PUT/api/callbacksAffiliateApiClient.callbacks.updatev1.20240429.0
POST/api/decryptor/decryptAffiliateApiClient.decryptor.decryptv1.20240429.0
POST/api/decryptor/mdecryptAffiliateApiClient.decryptor.mdecryptv1.20240429.0
PUT/api/customers/marketing/:emailAffiliateApiClient.marketing.update or AffiliateApiClient.customers.marketing.updatev1.20240429.0

Constructors ​

constructor ​

• new AffiliateApiClient(host, partnerId, partnerSecret, store?): AffiliateApiClient

Create a new Affiliate API client.

Parameters ​

NameTypeDescription
hoststringThe base URL of the Affiliate API to connect to.
partnerIdstringThe PandaTS Affiliate Partner ID to authenticate as.
partnerSecretstringThe PandaTS Affiliate Partner Secret to authenticate with.
store?RedisThe IORedis-compatible store to use for caching the JWT token to prevent unnecessary re-authentication.

Returns ​

AffiliateApiClient

Defined in ​

src/clients/affiliateApi/index.ts:125

Accessors ​

callbacks ​

• get callbacks(): AffiliateApiCallbacksModule

A module for interacting with the callbacks endpoints of the Affiliate API.

Returns ​

AffiliateApiCallbacksModule

Since

v1.20240429.0

Usage

You can access the methods of the AffiliateApiCallbacksModule by calling the callbacks property of the AffiliateApiClient instance.

typescript
import { AffiliateApiClient } from '@nht-pandats/sdk/clients/affiliateApi'
const client = new AffiliateApiClient('...', '...', '...')
const callbacks = await client.callbacks.list({ ... })

See

AffiliateApiCallbacksModule for more information on usage.

Defined in ​

src/clients/affiliateApi/index.ts:517


comments ​

• get comments(): AffiliateApiCommentsModule

A module for interacting with the comments endpoints of the Affiliate API.

Returns ​

AffiliateApiCommentsModule

Since

v1.20240429.0

Usage

You can access the methods of the AffiliateApiCommentsModule by calling the comments property of the AffiliateApiClient instance.

typescript
import { AffiliateApiClient } from '@nht-pandats/sdk/clients/affiliateApi'
const client = new AffiliateApiClient('...', '...', '...')
const comments = await client.comments.list({ ... })

See

AffiliateApiCommentsModule for more information on usage.

Defined in ​

src/clients/affiliateApi/index.ts:457


countries ​

• get countries(): @nht-pandats/sdk/constants/countries

A dictionary of countries supported by the Affiliate API.

Returns ​

@nht-pandats/sdk/constants/countries

Defined in ​

src/clients/affiliateApi/index.ts:564


customers ​

• get customers(): AffiliateApiCustomersModule

A module for interacting with the customers endpoints of the Affiliate API.

Returns ​

AffiliateApiCustomersModule

Since

v1.20240429.0

Usage

You can access the methods of the AffiliateApiCustomersModule by calling the customers property of the AffiliateApiClient instance.

typescript
import { AffiliateApiClient } from '@nht-pandats/sdk/clients/affiliateApi'
const client = new AffiliateApiClient('...', '...', '...')
const customer = await client.customers.create({ ... })

See

AffiliateApiCustomersModule for more information on usage.

Defined in ​

src/clients/affiliateApi/index.ts:397


decryptor ​

• get decryptor(): AffiliateApiDecryptorModule

A module for interacting with the decryptor endpoints of the Affiliate API.

Returns ​

AffiliateApiDecryptorModule

Since

v1.20240429.0

Usage

You can access the methods of the AffiliateApiDecryptorModule by calling the decryptor property of the AffiliateApiClient instance.

typescript
import { AffiliateApiClient } from '@nht-pandats/sdk/clients/affiliateApi'
const client = new AffiliateApiClient('...', '...', '...')
const decrypted = await client.decryptor.decrypt('...')

See

AffiliateApiDecryptorModule for more information on usage.

Defined in ​

src/clients/affiliateApi/index.ts:537


deposits ​

• get deposits(): AffiliateApiDepositsModule

A module for interacting with the deposits endpoints of the Affiliate API.

Returns ​

AffiliateApiDepositsModule

Since

v1.20240429.0

Usage

You can access the methods of the AffiliateApiDepositsModule by calling the deposits property of the AffiliateApiClient instance.

typescript
import { AffiliateApiClient } from '@nht-pandats/sdk/clients/affiliateApi'
const client = new AffiliateApiClient('...', '...', '...')
const deposits = await client.deposits.list({ ... })

See

AffiliateApiDepositsModule for more information on usage.

Defined in ​

src/clients/affiliateApi/index.ts:437


errors ​

• get errors(): Map<string, string>

A map of error codes to error messages which can be easily translated.

Currently Supported Error Codes ​

CodeMessage
RV001errors.missing.field
RV002errors.invalid.field
RV003errors.invalid.currency
RV004errors.invalid.time
RV005errors.invalid.access.key
RV006errors.invalid.country
RV007errors.input.invalid.alphanumeric
RV008errors.unsupported.language
RV009errors.maximum.entries.limit
RV010errors.unauthorized
RV011errors.password.invalid
FV000errors.unsupported.filter
FV001errors.unsupported.filter
FV002errors.invalid.filter.type
FV003errors.invalid.filter.value
FV004errors.fields.not.exists
FV005errors.invalid.sort.invocation
FV006errors.field.does.not.exists
FV007errors.filter.key.required
FV008errors.invalid.group.invocation
FV009errors.field.does.not.exists
JT000errors.unauthorized.token
JT001errors.token.expired
JT002errors.auth.failed
JT003errors.auth.failed
JT004errors.not.allowed
JT005errors.auth.failed
JT006errors.unauthorized.token
RL000errors.request.limit
AH000errors.not.allowed
AH001errors.blocked.country
AH002errors.unsupported.currency
AH003errors.no.change
AH004errors.unsupported.compliance.status
AH005errors.not.authorized
AH006errors.unsupported.country
AH007errors.unsupported.language
WR000errors.system.error
WR001errors.registration.server.failed
WR002errors.read.message.failed
BL000errors.registration.failed
BL001errors.registration.failure
BL002errors.customer.already.exists
BL003errors.failed.to.parse
BL010errors.unsupported.language
BL033errors.unsupported.currency
CRM00errors.update.failed
CRM01errors.update.failed
CRM03errors.update.failed
CRM04errors.lead.convert.failed
CRM05errors.create.lead.failed
CRM06errors.create.lead.failed
CRM07errors.request.failed
BR000errors.limit.restriction
BR001errors.block.restriction
SY000errors.system.error
SY001errors.system.error
SY002errors.system.error
SY003errors.system.error
SY004errors.system.error
SY404errors.resource.not.found
SY405errors.method.not.supported
STS001errors.system.error

Returns ​

Map<string, string>

Defined in ​

src/clients/affiliateApi/index.ts:377


languages ​

• get languages(): @nht-pandats/sdk/constants/languages

A dictionary of languages supported by the Affiliate API.

Returns ​

@nht-pandats/sdk/constants/languages

Defined in ​

src/clients/affiliateApi/index.ts:571


leads ​

• get leads(): AffiliateApiLeadsModule

A module for interacting with the leads endpoints of the Affiliate API.

Returns ​

AffiliateApiLeadsModule

Since

v1.20240429.0

Usage

You can access the methods of the AffiliateApiLeadsModule by calling the leads property of the AffiliateApiClient instance.

typescript
import { AffiliateApiClient } from '@nht-pandats/sdk/clients/affiliateApi'
const client = new AffiliateApiClient('...', '...', '...')
const leads = await client.leads.list({ ... })

See

AffiliateApiLeadsModule for more information on usage.

Defined in ​

src/clients/affiliateApi/index.ts:477


marketing ​

• get marketing(): AffiliateApiMarketingModule

A module for interacting with the customer marketing endpoints of the Affiliate API.

Returns ​

AffiliateApiMarketingModule

Since

v1.20240429.0

Usage

You can access the methods of the AffiliateApiMarketingModule by calling the marketing property of the AffiliateApiClient instance.

typescript
import { AffiliateApiClient } from '@nht-pandats/sdk/clients/affiliateApi'
const client = new AffiliateApiClient('...', '...', '...')
const updated = await client.marketing.update({ ... })

See

AffiliateApiMarketingModule for more information on usage.

Defined in ​

src/clients/affiliateApi/index.ts:557


system ​

• get system(): AffiliateApiSystemModule

A module for interacting with the system endpoints of the Affiliate API.

Returns ​

AffiliateApiSystemModule

Since

v1.20240429.0

Usage

You can access the methods of the AffiliateApiSystemModule by calling the system property of the AffiliateApiClient instance.

typescript
import { AffiliateApiClient } from '@nht-pandats/sdk/clients/affiliateApi'
const client = new AffiliateApiClient('...', '...', '...')
const loginToken = await client.system.loginToken('...')

See

AffiliateApiSystemModule for more information on usage.

Defined in ​

src/clients/affiliateApi/index.ts:497


tradingAccounts ​

• get tradingAccounts(): AffiliateApiTradingAccountsModule

A module for interacting with the trading accounts endpoints of the Affiliate API.

Returns ​

AffiliateApiTradingAccountsModule

Since

v1.20240429.0

Usage

You can access the methods of the AffiliateApiTradingAccountsModule by calling the tradingAccounts property of the AffiliateApiClient instance.

typescript
import { AffiliateApiClient } from '@nht-pandats/sdk/clients/affiliateApi'
const client = new AffiliateApiClient('...', '...', '...')
const tradingAccounts = await client.tradingAccounts.list({ ... })

See

AffiliateApiTradingAccountsModule for more information on usage.

Defined in ​

src/clients/affiliateApi/index.ts:417


countries ​

• get countries(): @nht-pandats/sdk/constants/countries

A dictionary of countries supported by the Affiliate API.

Returns ​

@nht-pandats/sdk/constants/countries

Defined in ​

src/clients/affiliateApi/index.ts:578


languages ​

• get languages(): @nht-pandats/sdk/constants/languages

A dictionary of languages supported by the Affiliate API.

Returns ​

@nht-pandats/sdk/constants/languages

Defined in ​

src/clients/affiliateApi/index.ts:585

Methods ​

delete ​

▸ delete<T, R, D>(url, config?): Promise<R>

Make an HTTP DELETE request to the Affiliate API.

Type parameters ​

NameType
Tany
RAxiosResponse<T, any>
Dany

Parameters ​

NameTypeDescription
urlstringThe URL to make the request to. Should be relative to the base URL.
config?AxiosRequestConfig<D>The request configuration

Returns ​

Promise<R>

a promise that resolves with the response

Defined in ​

src/clients/affiliateApi/index.ts:196


get ​

▸ get<T, R, D>(url, config?): Promise<R>

Make an HTTP GET request to the Affiliate API.

Type parameters ​

NameType
Tany
RAxiosResponse<T, any>
Dany

Parameters ​

NameTypeDescription
urlstringThe URL to make the request to. Should be relative to the base URL.
config?AxiosRequestConfig<D>The request configuration

Returns ​

Promise<R>

a promise that resolves with the response

Defined in ​

src/clients/affiliateApi/index.ts:183


▸ head<T, R, D>(url, config?): Promise<R>

Make an HTTP HEAD request to the Affiliate API.

Type parameters ​

NameType
Tany
RAxiosResponse<T, any>
Dany

Parameters ​

NameTypeDescription
urlstringThe URL to make the request to. Should be relative to the base URL.
config?AxiosRequestConfig<D>The request configuration

Returns ​

Promise<R>

a promise that resolves with the response

Note

This method is not used by the Affiliate API, but is included for completeness.

Defined in ​

src/clients/affiliateApi/index.ts:211


options ​

▸ options<T, R, D>(url, config?): Promise<R>

Make an HTTP OPTIONS request to the Affiliate API.

Type parameters ​

NameType
Tany
RAxiosResponse<T, any>
Dany

Parameters ​

NameTypeDescription
urlstringThe URL to make the request to. Should be relative to the base URL.
config?AxiosRequestConfig<D>The request configuration

Returns ​

Promise<R>

a promise that resolves with the response

Note

This method is not used by the Affiliate API, but is included for completeness.

Defined in ​

src/clients/affiliateApi/index.ts:226


patch ​

▸ patch<T, R, D>(url, data?, config?): Promise<R>

Make an HTTP PATCH request to the Affiliate API.

Type parameters ​

NameType
Tany
RAxiosResponse<T, any>
Dany

Parameters ​

NameTypeDescription
urlstringThe URL to make the request to. Should be relative to the base URL.
data?anyThe payload to send with the request.
config?AxiosRequestConfig<D>The request configuration

Returns ​

Promise<R>

a promise that resolves with the response

Defined in ​

src/clients/affiliateApi/index.ts:270


post ​

▸ post<T, R, D>(url, data?, config?): Promise<R>

Make an HTTP POST request to the Affiliate API.

Type parameters ​

NameType
Tany
RAxiosResponse<T, any>
Dany

Parameters ​

NameTypeDescription
urlstringThe URL to make the request to. Should be relative to the base URL.
data?anyThe payload to send with the request.
config?AxiosRequestConfig<D>The request configuration

Returns ​

Promise<R>

a promise that resolves with the response

Defined in ​

src/clients/affiliateApi/index.ts:240


put ​

▸ put<T, R, D>(url, data?, config?): Promise<R>

Make an HTTP PUT request to the Affiliate API.

Type parameters ​

NameType
Tany
RAxiosResponse<T, any>
Dany

Parameters ​

NameTypeDescription
urlstringThe URL to make the request to. Should be relative to the base URL.
data?anyThe payload to send with the request.
config?AxiosRequestConfig<D>The request configuration

Returns ​

Promise<R>

a promise that resolves with the response

Defined in ​

src/clients/affiliateApi/index.ts:255


request ​

▸ request<T, R, D>(config): Promise<R>

Make a request to the Affiliate API.

Type parameters ​

NameType
Tany
RAxiosResponse<T, any>
Dany

Parameters ​

NameTypeDescription
configAxiosRequestConfig<D>The request configuration

Returns ​

Promise<R>

a promise that resolves with the response

Defined in ​

src/clients/affiliateApi/index.ts:171


dateToString ​

▸ dateToString(date): string

Convert a JS Date or Luxon DateTime to an ISO 8601-compliant string.

Parameters ​

NameTypeDescription
dateanyThe JS Date or Luxon DateTime to convert to a string

Returns ​

string

an ISO 8601-compliant string representation of this DateTime

Since

v1.20240429.0

Defined in ​

src/clients/affiliateApi/index.ts:595


stringToDate ​

▸ stringToDate(date): DateTime

Convert an ISO 8601-compliant string to a Luxon DateTime.

Parameters ​

NameTypeDescription
datestringThe ISO 8601-compliant string to convert to a DateTime

Returns ​

DateTime

a Luxon DateTime representation of this string

Since

v1.20240429.0

Defined in ​

src/clients/affiliateApi/index.ts:611