feat(Freshworks CRM Node): Add Search + Lookup functionality (#3131)

* Add fields and Ops for Lookup Search

* Adds Search (Search + Lookup) operations

* 🔨 credentials update

* 🔨 improvements

*  clean up and linter fixes

*  merged search and query, more hints

*  Improvements

*  Add generic type to authentication method

Co-authored-by: Michael Kret <michael.k@radency.com>
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
Jan Thiel
2022-07-10 10:37:41 +02:00
committed by GitHub
parent af45a07f21
commit dbc02803db
5 changed files with 348 additions and 5 deletions

View File

@@ -31,12 +31,9 @@ export async function freshworksCrmApiRequest(
body: IDataObject = {},
qs: IDataObject = {},
) {
const { apiKey, domain } = await this.getCredentials('freshworksCrmApi') as FreshworksCrmApiCredentials;
const { domain } = await this.getCredentials('freshworksCrmApi') as FreshworksCrmApiCredentials;
const options: OptionsWithUri = {
headers: {
Authorization: `Token token=${apiKey}`,
},
method,
body,
qs,
@@ -52,7 +49,8 @@ export async function freshworksCrmApiRequest(
delete options.qs;
}
try {
return await this.helpers.request!(options);
const credentialsType = 'freshworksCrmApi';
return await this.helpers.requestWithAuthentication.call(this, credentialsType, options);
} catch (error) {
throw new NodeApiError(this.getNode(), error);
}