Add user resource (#892)

This commit is contained in:
Ricardo Espinoza
2020-08-27 02:53:23 -04:00
committed by GitHub
parent 1727b4626b
commit 74e2bcd1e0
3 changed files with 824 additions and 5 deletions

View File

@@ -23,7 +23,10 @@ export async function zendeskApiRequest(this: IHookFunctions | IExecuteFunctions
body,
//@ts-ignore
uri,
json: true
json: true,
qsStringifyOptions: {
arrayFormat: 'brackets',
},
};
options = Object.assign({}, options, option);
@@ -43,8 +46,6 @@ export async function zendeskApiRequest(this: IHookFunctions | IExecuteFunctions
options.uri = `https://${credentials.subdomain}.zendesk.com/api/v2${resource}.json`;
options.headers!['Authorization'] = `Basic ${base64Key}`;
//console.log(options);
return await this.helpers.request!(options);
} else {
const credentials = this.getCredentials('zendeskOAuth2Api');
@@ -58,6 +59,7 @@ export async function zendeskApiRequest(this: IHookFunctions | IExecuteFunctions
return await this.helpers.requestOAuth2!.call(this, 'zendeskOAuth2Api', options);
}
} catch(err) {
let errorMessage = err.message;
if (err.response && err.response.body && err.response.body.error) {
errorMessage = err.response.body.error;