n8n-nodes-rettiwt
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -18,3 +18,11 @@ "use strict"; | ||
default: '', | ||
required: true, | ||
description: 'The API key for authenticating with the Rettiwt API. You can obtain this from your Rettiwt developer account.', | ||
}, | ||
{ | ||
displayName: 'API Key Instructions', | ||
name: 'apiKeyInstructions', | ||
type: 'notice', | ||
default: 'To obtain your API key, follow these steps:<br>1. Log in to your Rettiwt developer account<br>2. Navigate to the "API Keys" section<br>3. Generate a new API key<br>4. Copy the generated key and paste it here', | ||
}, | ||
]; | ||
@@ -21,0 +29,0 @@ } |
import { IExecuteFunctions, IHookFunctions, ILoadOptionsFunctions, IWebhookFunctions, IDataObject, IHttpRequestMethods } from 'n8n-workflow'; | ||
export declare function rettiwtApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions, method: IHttpRequestMethods, resource: string, body?: IDataObject, query?: IDataObject, uri?: string, option?: IDataObject): Promise<any>; | ||
export declare function handleRettiwtApiError(this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions, error: any): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.rettiwtApiRequest = rettiwtApiRequest; | ||
exports.handleRettiwtApiError = handleRettiwtApiError; | ||
const n8n_workflow_1 = require("n8n-workflow"); | ||
async function rettiwtApiRequest(method, resource, body = {}, query = {}, uri, option = {}) { | ||
@@ -17,2 +19,3 @@ const credentials = await this.getCredentials('rettiwtApi'); | ||
json: true, | ||
timeout: 10000, | ||
}; | ||
@@ -26,11 +29,33 @@ if (!Object.keys(body).length) { | ||
try { | ||
return await this.helpers.request(options); | ||
const response = await this.helpers.request(options); | ||
return response; | ||
} | ||
catch (error) { | ||
if (error.statusCode === 401) { | ||
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { message: 'Invalid API key. Please check your credentials.' }); | ||
} | ||
if (error.statusCode === 403) { | ||
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { message: 'Access forbidden. Please check your API permissions.' }); | ||
} | ||
if (error.statusCode === 404) { | ||
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { message: 'Resource not found. Please check your request parameters.' }); | ||
} | ||
if (error.statusCode === 429) { | ||
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { message: 'Rate limit exceeded. Please try again later.' }); | ||
} | ||
if (error.statusCode >= 500) { | ||
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { message: 'Rettiwt API server error. Please try again later.' }); | ||
} | ||
if (error.response && error.response.body && error.response.body.message) { | ||
throw new Error(`Rettiwt API error response: ${error.response.body.message}`); | ||
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { message: `Rettiwt API error: ${error.response.body.message}` }); | ||
} | ||
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { message: 'An error occurred while making the request to Rettiwt API.' }); | ||
} | ||
} | ||
function handleRettiwtApiError(error) { | ||
if (error instanceof n8n_workflow_1.NodeApiError) { | ||
throw error; | ||
} | ||
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unexpected error: ${error.message}`); | ||
} | ||
//# sourceMappingURL=GenericFunctions.js.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
const n8n_workflow_1 = require("n8n-workflow"); | ||
const GenericFunctions_1 = require("../Rettiwt/GenericFunctions"); | ||
const GenericFunctions_1 = require("./GenericFunctions"); | ||
class Rettiwt { | ||
@@ -15,3 +15,3 @@ constructor() { | ||
version: 1, | ||
description: 'Consume the Rettiwt API', | ||
description: 'Interact with the Rettiwt API to post tweets, like tweets, follow users, and more', | ||
defaults: { | ||
@@ -39,2 +39,3 @@ name: 'Rettiwt', | ||
action: 'Follow a user', | ||
description: 'Follow a user on Rettiwt', | ||
}, | ||
@@ -45,2 +46,3 @@ { | ||
action: 'Retrieve a tweet by ID', | ||
description: 'Get details of a specific tweet', | ||
}, | ||
@@ -51,2 +53,3 @@ { | ||
action: 'Get details of a user', | ||
description: 'Retrieve information about a specific user', | ||
}, | ||
@@ -57,2 +60,3 @@ { | ||
action: 'Get user timeline', | ||
description: 'Retrieve recent tweets from a user\'s timeline', | ||
}, | ||
@@ -63,2 +67,3 @@ { | ||
action: 'Like a tweet', | ||
description: 'Like a specific tweet', | ||
}, | ||
@@ -69,2 +74,3 @@ { | ||
action: 'Post a new tweet', | ||
description: 'Create and post a new tweet', | ||
}, | ||
@@ -75,2 +81,3 @@ { | ||
action: 'Retweet a tweet', | ||
description: 'Retweet an existing tweet', | ||
}, | ||
@@ -81,2 +88,3 @@ { | ||
action: 'Search for tweets', | ||
description: 'Search for tweets based on a query', | ||
}, | ||
@@ -103,2 +111,5 @@ ], | ||
type: 'string', | ||
typeOptions: { | ||
maxLength: 280, | ||
}, | ||
displayOptions: { | ||
@@ -111,3 +122,3 @@ show: { | ||
required: true, | ||
description: 'The text of the tweet to post', | ||
description: 'The text of the tweet to post (max 280 characters)', | ||
}, | ||
@@ -158,2 +169,5 @@ { | ||
const tweetText = this.getNodeParameter('tweetText', i); | ||
if (tweetText.length > 280) { | ||
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Tweet text exceeds 280 characters'); | ||
} | ||
responseData = await GenericFunctions_1.rettiwtApiRequest.call(this, 'POST', '/tweet/post', { text: tweetText }); | ||
@@ -197,3 +211,3 @@ break; | ||
} | ||
throw error; | ||
GenericFunctions_1.handleRettiwtApiError.call(this, error); | ||
} | ||
@@ -200,0 +214,0 @@ } |
{ | ||
"name": "n8n-nodes-rettiwt", | ||
"version": "0.1.0", | ||
"description": "n8n node to interact with the Rettiwt API", | ||
"version": "0.2.0", | ||
"description": "n8n node to interact with the Rettiwt API, enabling tweet posting, liking, retweeting, user following, and more", | ||
"keywords": [ | ||
@@ -9,3 +9,8 @@ "n8n-community-node-package", | ||
"twitter", | ||
"social media" | ||
"social media", | ||
"tweet", | ||
"retweet", | ||
"like", | ||
"follow", | ||
"search" | ||
], | ||
@@ -12,0 +17,0 @@ "license": "MIT", |
{ | ||
"name": "n8n-nodes-rettiwt", | ||
"version": "0.1.0", | ||
"description": "n8n node to interact with the Rettiwt API", | ||
"version": "0.2.0", | ||
"description": "n8n node to interact with the Rettiwt API, enabling tweet posting, liking, retweeting, user following, and more", | ||
"keywords": [ | ||
@@ -9,3 +9,8 @@ "n8n-community-node-package", | ||
"twitter", | ||
"social media" | ||
"social media", | ||
"tweet", | ||
"retweet", | ||
"like", | ||
"follow", | ||
"search" | ||
], | ||
@@ -12,0 +17,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95354
786