fix(ZendeskTrigger Node): Fix deprecated targets, replaced with webhooks (#3025)

* 🔨 fix for deprecated targets

*  Move crendentials injection to the credential file

Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
Michael Kret
2022-04-18 19:43:09 +03:00
committed by GitHub
parent 7fc8c53f8a
commit 794ad7c756
4 changed files with 75 additions and 80 deletions

View File

@@ -76,7 +76,6 @@ export class Zendesk implements INodeType {
],
},
},
testedBy: 'zendeskSoftwareApiTest',
},
{
name: 'zendeskOAuth2Api',
@@ -153,42 +152,6 @@ export class Zendesk implements INodeType {
};
methods = {
credentialTest: {
async zendeskSoftwareApiTest(this: ICredentialTestFunctions, credential: ICredentialsDecrypted): Promise<INodeCredentialTestResult> {
const credentials = credential.data;
const subdomain = credentials!.subdomain;
const email = credentials!.email;
const apiToken = credentials!.apiToken;
const base64Key = Buffer.from(`${email}/token:${apiToken}`).toString('base64');
const options: OptionsWithUri = {
headers: {
'Content-Type': 'application/json',
'Authorization': `Basic ${base64Key}`,
},
method: 'GET',
uri: `https://${subdomain}.zendesk.com/api/v2/ticket_fields.json`,
qs: {
recent: 0,
},
json: true,
timeout: 5000,
};
try {
await this.helpers.request!(options);
} catch (error) {
return {
status: 'Error',
message: `Connection details not valid: ${error.message}`,
};
}
return {
status: 'OK',
message: 'Authentication successful!',
};
},
},
loadOptions: {
// Get all the custom fields to display them to user so that he can
// select them easily