@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
Constructors
constructor
• new AffiliateApiClient(host, partnerId, partnerSecret, store?): AffiliateApiClient
Create a new Affiliate API client.
Parameters
| Name | Type | Description |
|---|---|---|
host | string | The base URL of the Affiliate API to connect to. |
partnerId | string | The PandaTS Affiliate Partner ID to authenticate as. |
partnerSecret | string | The PandaTS Affiliate Partner Secret to authenticate with. |
store? | Redis | The IORedis-compatible store to use for caching the JWT token to prevent unnecessary re-authentication. |
Returns
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
Since
v1.20240429.0
Usage
You can access the methods of the AffiliateApiCallbacksModule by calling the callbacks property of the AffiliateApiClient instance.
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
Since
v1.20240429.0
Usage
You can access the methods of the AffiliateApiCommentsModule by calling the comments property of the AffiliateApiClient instance.
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
Since
v1.20240429.0
Usage
You can access the methods of the AffiliateApiCustomersModule by calling the customers property of the AffiliateApiClient instance.
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
Since
v1.20240429.0
Usage
You can access the methods of the AffiliateApiDecryptorModule by calling the decryptor property of the AffiliateApiClient instance.
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
Since
v1.20240429.0
Usage
You can access the methods of the AffiliateApiDepositsModule by calling the deposits property of the AffiliateApiClient instance.
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
| Code | Message |
|---|---|
RV001 | errors.missing.field |
RV002 | errors.invalid.field |
RV003 | errors.invalid.currency |
RV004 | errors.invalid.time |
RV005 | errors.invalid.access.key |
RV006 | errors.invalid.country |
RV007 | errors.input.invalid.alphanumeric |
RV008 | errors.unsupported.language |
RV009 | errors.maximum.entries.limit |
RV010 | errors.unauthorized |
RV011 | errors.password.invalid |
FV000 | errors.unsupported.filter |
FV001 | errors.unsupported.filter |
FV002 | errors.invalid.filter.type |
FV003 | errors.invalid.filter.value |
FV004 | errors.fields.not.exists |
FV005 | errors.invalid.sort.invocation |
FV006 | errors.field.does.not.exists |
FV007 | errors.filter.key.required |
FV008 | errors.invalid.group.invocation |
FV009 | errors.field.does.not.exists |
JT000 | errors.unauthorized.token |
JT001 | errors.token.expired |
JT002 | errors.auth.failed |
JT003 | errors.auth.failed |
JT004 | errors.not.allowed |
JT005 | errors.auth.failed |
JT006 | errors.unauthorized.token |
RL000 | errors.request.limit |
AH000 | errors.not.allowed |
AH001 | errors.blocked.country |
AH002 | errors.unsupported.currency |
AH003 | errors.no.change |
AH004 | errors.unsupported.compliance.status |
AH005 | errors.not.authorized |
AH006 | errors.unsupported.country |
AH007 | errors.unsupported.language |
WR000 | errors.system.error |
WR001 | errors.registration.server.failed |
WR002 | errors.read.message.failed |
BL000 | errors.registration.failed |
BL001 | errors.registration.failure |
BL002 | errors.customer.already.exists |
BL003 | errors.failed.to.parse |
BL010 | errors.unsupported.language |
BL033 | errors.unsupported.currency |
CRM00 | errors.update.failed |
CRM01 | errors.update.failed |
CRM03 | errors.update.failed |
CRM04 | errors.lead.convert.failed |
CRM05 | errors.create.lead.failed |
CRM06 | errors.create.lead.failed |
CRM07 | errors.request.failed |
BR000 | errors.limit.restriction |
BR001 | errors.block.restriction |
SY000 | errors.system.error |
SY001 | errors.system.error |
SY002 | errors.system.error |
SY003 | errors.system.error |
SY004 | errors.system.error |
SY404 | errors.resource.not.found |
SY405 | errors.method.not.supported |
STS001 | errors.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
Since
v1.20240429.0
Usage
You can access the methods of the AffiliateApiLeadsModule by calling the leads property of the AffiliateApiClient instance.
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
Since
v1.20240429.0
Usage
You can access the methods of the AffiliateApiMarketingModule by calling the marketing property of the AffiliateApiClient instance.
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
Since
v1.20240429.0
Usage
You can access the methods of the AffiliateApiSystemModule by calling the system property of the AffiliateApiClient instance.
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.
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
| Name | Type |
|---|---|
T | any |
R | AxiosResponse<T, any> |
D | any |
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The 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
| Name | Type |
|---|---|
T | any |
R | AxiosResponse<T, any> |
D | any |
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The 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
▸ head<T, R, D>(url, config?): Promise<R>
Make an HTTP HEAD request to the Affiliate API.
Type parameters
| Name | Type |
|---|---|
T | any |
R | AxiosResponse<T, any> |
D | any |
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The 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
| Name | Type |
|---|---|
T | any |
R | AxiosResponse<T, any> |
D | any |
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The 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
| Name | Type |
|---|---|
T | any |
R | AxiosResponse<T, any> |
D | any |
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The URL to make the request to. Should be relative to the base URL. |
data? | any | The 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
| Name | Type |
|---|---|
T | any |
R | AxiosResponse<T, any> |
D | any |
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The URL to make the request to. Should be relative to the base URL. |
data? | any | The 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
| Name | Type |
|---|---|
T | any |
R | AxiosResponse<T, any> |
D | any |
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The URL to make the request to. Should be relative to the base URL. |
data? | any | The 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
| Name | Type |
|---|---|
T | any |
R | AxiosResponse<T, any> |
D | any |
Parameters
| Name | Type | Description |
|---|---|---|
config | AxiosRequestConfig<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
| Name | Type | Description |
|---|---|---|
date | any | The 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
| Name | Type | Description |
|---|---|---|
date | string | The ISO 8601-compliant string to convert to a DateTime |
Returns
DateTime
a Luxon DateTime representation of this string
Since
v1.20240429.0