Skip to content

@nht-pandats/sdk / @nht-pandats/sdk/clients / @nht-pandats/sdk/clients/crm / CRMClient

Class: CRMClient

@nht-pandats/sdk/clients.@nht-pandats/sdk/clients/crm.CRMClient

A client for interacting with the CRM API's reverse engineered from the CRM's web interface. This client is intended for use in NodeJS

Constructors

constructor

new CRMClient(config, cookieJar?): CRMClient

Constructs a new instance of the CRMClient class.

Parameters

NameTypeDescription
configCRMClientConfigThe configuration object for the CRMClient.
cookieJar?anyAn optional cookie jar to use for storing cookies.

Returns

CRMClient

Defined in

src/clients/crm.ts:86

Accessors

authenticated

get authenticated(): boolean

Returns whether or not the client is authenticated.

Returns

boolean

Defined in

src/clients/crm.ts:353

Methods

apiDelete

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

Sends a DELETE request to the the CRM API (/api/v1 requests) using the configured Axios instance.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected Axios response type.
DanyThe request data type.

Parameters

NameTypeDescription
urlstringThe URL to send the request to.
config?AxiosRequestConfig<D>Optional Axios request configuration.

Returns

Promise<R>

A Promise that resolves with the Axios response object.

Defined in

src/clients/crm.ts:706


apiGet

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

Makes a GET request to the CRM API (/api/v1 requests).

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected AxiosResponse type.
DanyThe expected request data type.

Parameters

NameTypeDescription
urlstringThe URL to make the request to.
config?AxiosRequestConfig<D>The Axios request configuration.

Returns

Promise<R>

  • A Promise that resolves with the AxiosResponse.

Defined in

src/clients/crm.ts:689


apiHead

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

Sends a HEAD request to the CRM API (/api/v1 requests) using the configured Axios instance.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The Axios response object type.
DanyThe request data type.

Parameters

NameTypeDescription
urlstringThe URL to send the request to.
config?AxiosRequestConfig<D>Optional Axios request configuration.

Returns

Promise<R>

A Promise that resolves with the Axios response object.

Defined in

src/clients/crm.ts:722


apiOptions

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

Sends an HTTP OPTIONS request to the CRM API (/api/v1 requests) using the provided AxiosRequestConfig.

Type parameters

NameTypeDescription
TanyThe type of the response data.
RAxiosResponse<T, any>The type of the AxiosResponse.
DanyThe type of the request data.

Parameters

NameTypeDescription
urlstringThe URL to send the request to.
config?AxiosRequestConfig<D>The AxiosRequestConfig to use for the request.

Returns

Promise<R>

A Promise that resolves with the AxiosResponse for the request.

Defined in

src/clients/crm.ts:738


apiPatch

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

Sends a PATCH request to the CRM API (/api/v1 requests) using the provided data and configuration.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected response type.
DanyThe expected request data type.

Parameters

NameTypeDescription
urlstringThe URL to send the request to.
data?anyThe data to send with the request.
config?AxiosRequestConfig<D>The configuration options for the request.

Returns

Promise<R>

A Promise that resolves with the AxiosResponse object.

Defined in

src/clients/crm.ts:794


apiPost

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

Sends a POST request to the CRM API (/api/v1 requests) using the Axios library.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The response type.
DanyThe request data type.

Parameters

NameTypeDescription
urlstringThe URL to send the request to.
data?anyThe data to send with the request.
config?AxiosRequestConfig<D>The Axios request configuration.

Returns

Promise<R>

  • A promise that resolves with the response data.

Defined in

src/clients/crm.ts:758


apiPut

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

Sends a PUT request to the CRM API (/api/v1 requests) using the provided data and configuration.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The type of the response object.
DanyThe type of the request data.

Parameters

NameTypeDescription
urlstringThe URL to send the request to.
data?anyThe data to send with the request.
config?AxiosRequestConfig<D>The configuration options for the request.

Returns

Promise<R>

A promise that resolves with the response data.

Defined in

src/clients/crm.ts:776


apiRequest

apiRequest<T, R, D>(config): Promise<R>

Sends a request to the CRM API (/api/v1 requests) using the provided Axios request configuration and returns the response.

Type parameters

NameType
Tany
RAxiosResponse<T, any>
Dany

Parameters

NameTypeDescription
configAxiosRequestConfig<D>The Axios request configuration.

Returns

Promise<R>

A Promise that resolves with the Axios response object.

Typeparam

T The type of the response data.

Typeparam

R The type of the Axios response object.

Typeparam

D The type of the request data.

Defined in

src/clients/crm.ts:674


appDelete

appDelete<T, R, D>(params, config?): Promise<R>

Sends a DELETE request to the app API (index.php requests) with the specified parameters.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected AxiosResponse type.
DanyThe expected request data type.

Parameters

NameTypeDescription
paramsRecord<string, undefined | null | string | number>An object containing the parameters to be sent with the request.
config?AxiosRequestConfig<D>Optional Axios request configuration.

Returns

Promise<R>

A Promise that resolves with the AxiosResponse object containing the response data.

Defined in

src/clients/crm.ts:564


appGet

appGet<T, R, D>(params, config?): Promise<R>

Sends a GET request to the app API (index.php requests) with the given parameters.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected AxiosResponse type.
DanyThe expected request data type.

Parameters

NameTypeDescription
paramsRecord<string, undefined | null | string | number>The query parameters to include in the request URL.
config?AxiosRequestConfig<D>The Axios request configuration object.

Returns

Promise<R>

  • A Promise that resolves with the AxiosResponse object.

Defined in

src/clients/crm.ts:547


appHead

appHead<T, R, D>(params, config?): Promise<R>

Sends a HEAD request to the app API (index.php requests) with the given parameters and configuration.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected response type.
DanyThe expected request data type.

Parameters

NameTypeDescription
paramsRecord<string, undefined | null | string | number>The parameters to be included in the request URL.
config?AxiosRequestConfig<D>The configuration options for the request.

Returns

Promise<R>

A Promise that resolves with the AxiosResponse object.

Defined in

src/clients/crm.ts:581


appOptions

appOptions<T, R, D>(params, config?): Promise<R>

Sends an HTTP OPTIONS request to the app API (index.php requests) with the given parameters and configuration.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected AxiosResponse type.
DanyThe expected request data type.

Parameters

NameTypeDescription
paramsRecord<string, undefined | null | string | number>The parameters to be included in the request URL.
config?AxiosRequestConfig<D>The configuration options for the request.

Returns

Promise<R>

A promise that resolves with the response data from the server.

Defined in

src/clients/crm.ts:598


appPatch

appPatch<T, R, D>(params, data?, config?): Promise<R>

Sends a PATCH request to the app API (index.php requests) with the given parameters and data.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected response type.
DanyThe expected request data type.

Parameters

NameTypeDescription
paramsRecord<string, undefined | null | string | number>The parameters to be sent with the request.
data?anyThe data to be sent with the request.
config?AxiosRequestConfig<D>The configuration options for the request.

Returns

Promise<R>

A Promise that resolves with the AxiosResponse.

Defined in

src/clients/crm.ts:656


appPost

appPost<T, R, D>(params, data?, config?): Promise<R>

Sends a POST request to the app API (index.php requests) with the given parameters and data.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected AxiosResponse type.
DanyThe expected request data type.

Parameters

NameTypeDescription
paramsRecord<string, undefined | null | string | number>The parameters to be included in the request URL.
data?anyThe data to be included in the request body.
config?AxiosRequestConfig<D>The AxiosRequestConfig to be used for the request.

Returns

Promise<R>

A Promise that resolves with the AxiosResponse of type T.

Defined in

src/clients/crm.ts:616


appPut

appPut<T, R, D>(params, data?, config?): Promise<R>

Sends a PUT request to the app API (index.php requests) with the given parameters and data.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected response type.
DanyThe expected request data type.

Parameters

NameTypeDescription
paramsRecord<string, undefined | null | string | number>The parameters to be included in the request URL.
data?anyThe data to be included in the request body.
config?AxiosRequestConfig<D>The configuration options for the request.

Returns

Promise<R>

A Promise that resolves with the AxiosResponse.

Defined in

src/clients/crm.ts:636


appRequest

appRequest<T, R, D>(config): Promise<R>

Sends a request to the app API (index.php requests) using the provided Axios request configuration.

Type parameters

NameType
Tany
RAxiosResponse<T, any>
Dany

Parameters

NameTypeDescription
configAxiosRequestConfig<D>The Axios request configuration object.

Returns

Promise<R>

A promise that resolves with the Axios response object.

Typeparam

T The type of the response data.

Typeparam

R The type of the Axios response object.

Typeparam

D The type of the request body data.

Defined in

src/clients/crm.ts:532


authenticate

authenticate(mfa?): Promise<void>

Authenticates the user with the CRM webservices and stores relevant cookies and headers to allow for further requests to be made.

Parameters

NameTypeDescription
mfa?stringThe MFA code to use for authentication. (Optional)

Returns

Promise<void>

Throws

If authentication fails for any reason.

Defined in

src/clients/crm.ts:378


proxyDelete

proxyDelete<T, R, D>(params, config?): Promise<R>

Sends a DELETE request to the panda proxy (/panda/proxy.php requests) with the specified parameters.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected AxiosResponse type.
DanyThe expected request data type.

Parameters

NameTypeDescription
paramsRecord<string, undefined | null | string | number>An object containing the parameters to be sent with the request.
config?AxiosRequestConfig<D>Optional Axios request configuration.

Returns

Promise<R>

A Promise that resolves with the AxiosResponse object containing the response data.

Defined in

src/clients/crm.ts:842


proxyGet

proxyGet<T, R, D>(params, config?): Promise<R>

Sends a GET request to the panda proxy (/panda/proxy.php requests) with the given parameters.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected AxiosResponse type.
DanyThe expected request data type.

Parameters

NameTypeDescription
paramsRecord<string, undefined | null | string | number>The query parameters to include in the request URL.
config?AxiosRequestConfig<D>The Axios request configuration object.

Returns

Promise<R>

  • A Promise that resolves with the AxiosResponse object.

Defined in

src/clients/crm.ts:825


proxyHead

proxyHead<T, R, D>(params, config?): Promise<R>

Sends a HEAD request to the panda proxy (/panda/proxy.php requests) with the given parameters and configuration.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected response type.
DanyThe expected request data type.

Parameters

NameTypeDescription
paramsRecord<string, undefined | null | string | number>The parameters to be included in the request URL.
config?AxiosRequestConfig<D>The configuration options for the request.

Returns

Promise<R>

A Promise that resolves with the AxiosResponse object.

Defined in

src/clients/crm.ts:859


proxyOptions

proxyOptions<T, R, D>(params, config?): Promise<R>

Sends an HTTP OPTIONS request to the panda proxy (/panda/proxy.php requests) with the given parameters and configuration.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected AxiosResponse type.
DanyThe expected request data type.

Parameters

NameTypeDescription
paramsRecord<string, undefined | null | string | number>The parameters to be included in the request URL.
config?AxiosRequestConfig<D>The configuration options for the request.

Returns

Promise<R>

A promise that resolves with the response data from the server.

Defined in

src/clients/crm.ts:876


proxyPatch

proxyPatch<T, R, D>(params, data?, config?): Promise<R>

Sends a PATCH request to the panda proxy (/panda/proxy.php requests) with the given parameters and data.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected response type.
DanyThe expected request data type.

Parameters

NameTypeDescription
paramsRecord<string, undefined | null | string | number>The parameters to be sent with the request.
data?anyThe data to be sent with the request.
config?AxiosRequestConfig<D>The configuration options for the request.

Returns

Promise<R>

A Promise that resolves with the AxiosResponse.

Defined in

src/clients/crm.ts:932


proxyPost

proxyPost<T, R, D>(params, data?, config?): Promise<R>

Sends a POST request to the panda proxy (/panda/proxy.php requests) with the given parameters and data.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected AxiosResponse type.
DanyThe expected request data type.

Parameters

NameTypeDescription
paramsRecord<string, undefined | null | string | number>The parameters to be included in the request URL.
data?anyThe data to be included in the request body.
config?AxiosRequestConfig<D>The AxiosRequestConfig to be used for the request.

Returns

Promise<R>

A Promise that resolves with the AxiosResponse of type T.

Defined in

src/clients/crm.ts:894


proxyPut

proxyPut<T, R, D>(params, data?, config?): Promise<R>

Sends a PUT request to the panda proxy (/panda/proxy.php requests) with the given parameters and data.

Type parameters

NameTypeDescription
TanyThe expected response data type.
RAxiosResponse<T, any>The expected response type.
DanyThe expected request data type.

Parameters

NameTypeDescription
paramsRecord<string, undefined | null | string | number>The parameters to be included in the request URL.
data?anyThe data to be included in the request body.
config?AxiosRequestConfig<D>The configuration options for the request.

Returns

Promise<R>

A Promise that resolves with the AxiosResponse.

Defined in

src/clients/crm.ts:913


proxyRequest

proxyRequest<T, R, D>(config): Promise<R>

Sends a request to the panda proxy (/panda/proxy.php requests) using the provided Axios request configuration.

Type parameters

NameType
Tany
RAxiosResponse<T, any>
Dany

Parameters

NameTypeDescription
configAxiosRequestConfig<D>The Axios request configuration object.

Returns

Promise<R>

A promise that resolves with the Axios response object.

Typeparam

T The type of the response data.

Typeparam

R The type of the Axios response object.

Typeparam

D The type of the request body data.

Defined in

src/clients/crm.ts:810