feat(Linear Node): Add support for OAuth2 (#7201)

This commit is contained in:
Jon
2023-09-20 10:19:12 +01:00
committed by GitHub
parent 6b582d155c
commit 12a3168367
5 changed files with 140 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ export async function linearApiRequest(
option: IDataObject = {},
): Promise<any> {
const endpoint = 'https://api.linear.app/graphql';
const authenticationMethod = this.getNodeParameter('authentication', 0, 'apiToken') as string;
let options: OptionsWithUri = {
headers: {
@@ -35,7 +36,11 @@ export async function linearApiRequest(
};
options = Object.assign({}, options, option);
try {
return await this.helpers.requestWithAuthentication.call(this, 'linearApi', options);
return await this.helpers.requestWithAuthentication.call(
this,
authenticationMethod === 'apiToken' ? 'linearApi' : 'linearOAuth2Api',
options,
);
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}