@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
| Name | Type | Description |
|---|---|---|
config | CRMClientConfig | The configuration object for the CRMClient. |
cookieJar? | any | An optional cookie jar to use for storing cookies. |
Returns
Defined in
Accessors
authenticated
• get authenticated(): boolean
Returns whether or not the client is authenticated.
Returns
boolean
Defined in
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected Axios response type. |
D | any | The request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The 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
apiGet
▸ apiGet<T, R, D>(url, config?): Promise<R>
Makes a GET request to the CRM API (/api/v1 requests).
Type parameters
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected AxiosResponse type. |
D | any | The expected request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The 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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The Axios response object type. |
D | any | The request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The 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
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
| Name | Type | Description |
|---|---|---|
T | any | The type of the response data. |
R | AxiosResponse<T, any> | The type of the AxiosResponse. |
D | any | The type of the request data. |
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The 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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected response type. |
D | any | The expected request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The URL to send the request to. |
data? | any | The 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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The response type. |
D | any | The request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The URL to send the request to. |
data? | any | The 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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The type of the response object. |
D | any | The type of the request data. |
Parameters
| Name | Type | Description |
|---|---|---|
url | string | The URL to send the request to. |
data? | any | The 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
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
| Name | Type |
|---|---|
T | any |
R | AxiosResponse<T, any> |
D | any |
Parameters
| Name | Type | Description |
|---|---|---|
config | AxiosRequestConfig<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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected AxiosResponse type. |
D | any | The expected request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
params | Record<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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected AxiosResponse type. |
D | any | The expected request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
params | Record<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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected response type. |
D | any | The expected request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
params | Record<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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected AxiosResponse type. |
D | any | The expected request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
params | Record<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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected response type. |
D | any | The expected request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
params | Record<string, undefined | null | string | number> | The parameters to be sent with the request. |
data? | any | The 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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected AxiosResponse type. |
D | any | The expected request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
params | Record<string, undefined | null | string | number> | The parameters to be included in the request URL. |
data? | any | The 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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected response type. |
D | any | The expected request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
params | Record<string, undefined | null | string | number> | The parameters to be included in the request URL. |
data? | any | The 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
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
| Name | Type |
|---|---|
T | any |
R | AxiosResponse<T, any> |
D | any |
Parameters
| Name | Type | Description |
|---|---|---|
config | AxiosRequestConfig<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
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
| Name | Type | Description |
|---|---|---|
mfa? | string | The MFA code to use for authentication. (Optional) |
Returns
Promise<void>
Throws
If authentication fails for any reason.
Defined in
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected AxiosResponse type. |
D | any | The expected request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
params | Record<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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected AxiosResponse type. |
D | any | The expected request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
params | Record<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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected response type. |
D | any | The expected request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
params | Record<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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected AxiosResponse type. |
D | any | The expected request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
params | Record<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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected response type. |
D | any | The expected request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
params | Record<string, undefined | null | string | number> | The parameters to be sent with the request. |
data? | any | The 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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected AxiosResponse type. |
D | any | The expected request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
params | Record<string, undefined | null | string | number> | The parameters to be included in the request URL. |
data? | any | The 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
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
| Name | Type | Description |
|---|---|---|
T | any | The expected response data type. |
R | AxiosResponse<T, any> | The expected response type. |
D | any | The expected request data type. |
Parameters
| Name | Type | Description |
|---|---|---|
params | Record<string, undefined | null | string | number> | The parameters to be included in the request URL. |
data? | any | The 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
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
| Name | Type |
|---|---|
T | any |
R | AxiosResponse<T, any> |
D | any |
Parameters
| Name | Type | Description |
|---|---|---|
config | AxiosRequestConfig<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.