n8n-nodes-sudomock 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +527 -0
- package/dist/credentials/SudoMockApi.credentials.d.ts +9 -0
- package/dist/credentials/SudoMockApi.credentials.js +39 -0
- package/dist/nodes/SudoMock/SudoMock.node.d.ts +5 -0
- package/dist/nodes/SudoMock/SudoMock.node.js +809 -0
- package/dist/nodes/SudoMock/sudomock.svg +1 -0
- package/package.json +64 -0
package/README.md
ADDED
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
# n8n-nodes-sudomock
|
|
2
|
+
|
|
3
|
+
n8n community node for the SudoMock API. Integrate mockup rendering into your n8n workflows for Print-on-Demand automation.
|
|
4
|
+
|
|
5
|
+
[SudoMock](https://sudomock.com) | [Documentation](https://sudomock.com/docs) | [API Reference](https://sudomock.com/docs/api)
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
### Account Operations
|
|
10
|
+
- **Get Account Info**: Retrieve account details, subscription plan, and usage statistics
|
|
11
|
+
|
|
12
|
+
### Mockup Management
|
|
13
|
+
- **Upload PSD**: Upload PSD templates from a URL
|
|
14
|
+
- **List Mockups**: List all your uploaded mockup templates with filtering and pagination
|
|
15
|
+
- **Get Mockup**: Get detailed information about a specific mockup template
|
|
16
|
+
- **Update Mockup**: Update the name of a mockup template
|
|
17
|
+
- **Delete Mockup**: Delete a specific mockup template
|
|
18
|
+
- **Delete All Mockups**: Delete all your mockup templates at once
|
|
19
|
+
|
|
20
|
+
### Rendering
|
|
21
|
+
- **Render Mockup**: Generate mockups by combining templates with your designs
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
### Via n8n UI
|
|
26
|
+
|
|
27
|
+
In n8n, go to **Settings → Community Nodes → Install** and enter:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
n8n-nodes-sudomock
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Manual Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cd ~/.n8n/nodes
|
|
37
|
+
npm install n8n-nodes-sudomock
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Restart n8n after installation.
|
|
41
|
+
|
|
42
|
+
## Setup
|
|
43
|
+
|
|
44
|
+
### 1. Get Your API Key
|
|
45
|
+
|
|
46
|
+
1. Sign up at [SudoMock](https://sudomock.com)
|
|
47
|
+
2. Go to Dashboard → API Keys
|
|
48
|
+
3. Create a new API key (starts with `sm_`)
|
|
49
|
+
|
|
50
|
+
### 2. Add Credentials in n8n
|
|
51
|
+
|
|
52
|
+
1. Create a new SudoMock node
|
|
53
|
+
2. Click on **Credentials → Create New**
|
|
54
|
+
3. Enter your SudoMock API Key
|
|
55
|
+
4. Save and test the connection
|
|
56
|
+
|
|
57
|
+
## Operations
|
|
58
|
+
|
|
59
|
+
### Get Account Info
|
|
60
|
+
|
|
61
|
+
Retrieve your account information, subscription details, and credit usage.
|
|
62
|
+
|
|
63
|
+
**Output:**
|
|
64
|
+
- Account: UUID, email, name, created date
|
|
65
|
+
- Subscription: Plan name, status, billing period
|
|
66
|
+
- Usage: Credits used/remaining, billing dates
|
|
67
|
+
- API Key: Name, creation date, last used, total requests
|
|
68
|
+
|
|
69
|
+
**Example Output:**
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"success": true,
|
|
73
|
+
"data": {
|
|
74
|
+
"account": {
|
|
75
|
+
"uuid": "user-123",
|
|
76
|
+
"email": "user@example.com",
|
|
77
|
+
"name": "John Doe"
|
|
78
|
+
},
|
|
79
|
+
"subscription": {
|
|
80
|
+
"plan": { "name": "Pro", "tier": "pro" },
|
|
81
|
+
"status": "active"
|
|
82
|
+
},
|
|
83
|
+
"usage": {
|
|
84
|
+
"credits_used_this_month": 250,
|
|
85
|
+
"credits_limit": 1000,
|
|
86
|
+
"credits_remaining": 750
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### Upload PSD
|
|
95
|
+
|
|
96
|
+
Upload a PSD template from a public URL.
|
|
97
|
+
|
|
98
|
+
**Parameters:**
|
|
99
|
+
- **PSD File URL** (required): Public URL to your PSD file (max 300MB)
|
|
100
|
+
- **Template Name** (optional): Custom name for the template (auto-generated if not provided)
|
|
101
|
+
|
|
102
|
+
**Example:**
|
|
103
|
+
```
|
|
104
|
+
PSD URL: https://storage.example.com/mockup.psd
|
|
105
|
+
Name: T-Shirt Mockup Front
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Output:**
|
|
109
|
+
- Mockup UUID (use for rendering)
|
|
110
|
+
- Smart object UUIDs and details
|
|
111
|
+
- Thumbnail URLs
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### List Mockups
|
|
116
|
+
|
|
117
|
+
List all your uploaded mockup templates with optional filtering and pagination.
|
|
118
|
+
|
|
119
|
+
**Parameters:**
|
|
120
|
+
- **Return All**: Fetch all mockups or limit results
|
|
121
|
+
- **Limit**: Number of results (1-100, default: 20)
|
|
122
|
+
- **Additional Options**:
|
|
123
|
+
- Filter by Name: Exact name match
|
|
124
|
+
- Created After: Date filter
|
|
125
|
+
- Created Before: Date filter
|
|
126
|
+
- Sort By: `created_at`, `updated_at`, `name`
|
|
127
|
+
- Sort Order: `asc` or `desc`
|
|
128
|
+
|
|
129
|
+
**Example:**
|
|
130
|
+
```
|
|
131
|
+
Limit: 20
|
|
132
|
+
Sort By: Created At
|
|
133
|
+
Sort Order: Descending
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Output:**
|
|
137
|
+
Each mockup as a separate item with full details (UUID, name, smart objects, thumbnails, etc.)
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
### Get Mockup
|
|
142
|
+
|
|
143
|
+
Retrieve detailed information about a specific mockup template.
|
|
144
|
+
|
|
145
|
+
**Parameters:**
|
|
146
|
+
- **Mockup UUID** (required): UUID of the mockup to retrieve
|
|
147
|
+
|
|
148
|
+
**Example:**
|
|
149
|
+
```
|
|
150
|
+
Mockup UUID: c315f78f-d2c7-4541-b240-a9372842de94
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Output:**
|
|
154
|
+
Complete mockup details including all smart objects, thumbnails, and metadata.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
### Update Mockup
|
|
159
|
+
|
|
160
|
+
Update the name of a mockup template.
|
|
161
|
+
|
|
162
|
+
**Parameters:**
|
|
163
|
+
- **Mockup UUID** (required): UUID of the mockup to update
|
|
164
|
+
- **New Name** (required): New name for the template
|
|
165
|
+
|
|
166
|
+
**Example:**
|
|
167
|
+
```
|
|
168
|
+
Mockup UUID: c315f78f-d2c7-4541-b240-a9372842de94
|
|
169
|
+
New Name: Updated T-Shirt Mockup
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Output:**
|
|
173
|
+
Updated mockup details with the new name.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
### Render Mockup
|
|
178
|
+
|
|
179
|
+
Generate a mockup by filling smart objects with your designs.
|
|
180
|
+
|
|
181
|
+
**Parameters:**
|
|
182
|
+
- **Mockup UUID** (required): UUID from Upload PSD response
|
|
183
|
+
- **Smart Objects** (required): One or more smart objects to fill
|
|
184
|
+
- Smart Object UUID
|
|
185
|
+
- Design URL (PNG, JPG, WebP)
|
|
186
|
+
- Fit Mode: `fill`, `contain`, or `cover` (recommended)
|
|
187
|
+
- **Additional Options** (optional):
|
|
188
|
+
- Rotation: -360 to 360 degrees
|
|
189
|
+
- Color Overlay: Hex color code
|
|
190
|
+
- Color Blend Mode: Various blend modes
|
|
191
|
+
- Brightness: -150 to 150
|
|
192
|
+
- Contrast: -100 to 100
|
|
193
|
+
- Opacity: 0-100
|
|
194
|
+
|
|
195
|
+
- **Export Options** (optional):
|
|
196
|
+
- Image Format: WebP (recommended), PNG, or JPEG
|
|
197
|
+
- Image Size: Width in pixels (100-8000)
|
|
198
|
+
- Quality: 1-100 for JPG/WebP
|
|
199
|
+
- Export Label: Custom label for file naming
|
|
200
|
+
|
|
201
|
+
**Example:**
|
|
202
|
+
```
|
|
203
|
+
Mockup UUID: abc123-def456
|
|
204
|
+
Smart Object 1:
|
|
205
|
+
- UUID: so-uuid-001
|
|
206
|
+
- Design URL: https://cdn.example.com/design.png
|
|
207
|
+
- Fit Mode: Cover
|
|
208
|
+
- Brightness: 10
|
|
209
|
+
- Contrast: 5
|
|
210
|
+
|
|
211
|
+
Export Options:
|
|
212
|
+
- Format: WebP
|
|
213
|
+
- Size: 1920
|
|
214
|
+
- Quality: 95
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Output:**
|
|
218
|
+
```json
|
|
219
|
+
{
|
|
220
|
+
"success": true,
|
|
221
|
+
"renderedImageUrl": "https://cdn.sudomock.com/renders/abc123.webp",
|
|
222
|
+
"allRenderedUrls": [
|
|
223
|
+
"https://cdn.sudomock.com/renders/abc123.webp"
|
|
224
|
+
],
|
|
225
|
+
"data": {
|
|
226
|
+
"print_files": [...]
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
### Delete Mockup
|
|
234
|
+
|
|
235
|
+
Delete a specific mockup template.
|
|
236
|
+
|
|
237
|
+
**Parameters:**
|
|
238
|
+
- **Mockup UUID** (required): UUID of the mockup to delete
|
|
239
|
+
|
|
240
|
+
**Example:**
|
|
241
|
+
```
|
|
242
|
+
Mockup UUID: c315f78f-d2c7-4541-b240-a9372842de94
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Output:**
|
|
246
|
+
Deletion confirmation
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
### Delete All Mockups
|
|
251
|
+
|
|
252
|
+
Delete all your mockup templates at once.
|
|
253
|
+
|
|
254
|
+
**Parameters:** None
|
|
255
|
+
|
|
256
|
+
**Output:**
|
|
257
|
+
```json
|
|
258
|
+
{
|
|
259
|
+
"deleted_count": 15
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Example Workflows
|
|
266
|
+
|
|
267
|
+
Ready-to-use n8n workflows are available in the [`examples/`](./examples) folder:
|
|
268
|
+
|
|
269
|
+
### 1. Complete API Test Workflow
|
|
270
|
+
**File**: [`examples/complete-test-workflow.json`](./examples/complete-test-workflow.json)
|
|
271
|
+
|
|
272
|
+
Tests all 8 operations in sequence:
|
|
273
|
+
- Get Account Info → Upload PSD → Get Mockup → List Mockups
|
|
274
|
+
- Render Mockup → Update Name → Verify Update → Delete Mockup
|
|
275
|
+
|
|
276
|
+
Perfect for verifying your setup and understanding the complete workflow.
|
|
277
|
+
|
|
278
|
+
[View Details →](./examples/README.md#1-complete-api-test-complete-test-workflowjson)
|
|
279
|
+
|
|
280
|
+
### 2. Rate Limit Handling Workflow
|
|
281
|
+
**File**: [`examples/rate-limit-test-workflow.json`](./examples/rate-limit-test-workflow.json)
|
|
282
|
+
|
|
283
|
+
Demonstrates proper rate limit error handling with automatic retry logic:
|
|
284
|
+
- Detects 429 errors
|
|
285
|
+
- Extracts retry-after value
|
|
286
|
+
- Waits and automatically retries
|
|
287
|
+
- Shows detailed error information
|
|
288
|
+
|
|
289
|
+
[View Details →](./examples/README.md#2-rate-limit-error-handling-test-rate-limit-test-workflowjson)
|
|
290
|
+
|
|
291
|
+
### Quick Start with Examples
|
|
292
|
+
|
|
293
|
+
1. Import a workflow:
|
|
294
|
+
```
|
|
295
|
+
n8n UI → Workflows → Import from File → Select workflow JSON
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
2. Configure credentials:
|
|
299
|
+
```
|
|
300
|
+
Click any SudoMock node → Credentials → Select your API key
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
3. Execute:
|
|
304
|
+
```
|
|
305
|
+
Click "Execute Workflow" button
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
See [`examples/README.md`](./examples/README.md) for detailed instructions, customization options, and troubleshooting.
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Usage Examples
|
|
313
|
+
|
|
314
|
+
### Example 1: Complete Mockup Workflow
|
|
315
|
+
|
|
316
|
+
```
|
|
317
|
+
1. [HTTP Request]
|
|
318
|
+
→ Download PSD from URL
|
|
319
|
+
|
|
320
|
+
2. [SudoMock: Upload PSD]
|
|
321
|
+
→ Upload template
|
|
322
|
+
→ Extract: mockupUuid, smartObjectUuid
|
|
323
|
+
|
|
324
|
+
3. [SudoMock: Render Mockup]
|
|
325
|
+
→ Use extracted UUIDs
|
|
326
|
+
→ Add design URL
|
|
327
|
+
→ Get: renderedImageUrl
|
|
328
|
+
|
|
329
|
+
4. [Etsy/Shopify Node]
|
|
330
|
+
→ Create product listing
|
|
331
|
+
→ Use rendered mockup image
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Example 2: Batch Process Designs
|
|
335
|
+
|
|
336
|
+
```
|
|
337
|
+
1. [Airtable Trigger]
|
|
338
|
+
→ Get list of designs to process
|
|
339
|
+
|
|
340
|
+
2. [SudoMock: List Mockups]
|
|
341
|
+
→ Get available templates
|
|
342
|
+
|
|
343
|
+
3. [Loop Over Designs]
|
|
344
|
+
→ [SudoMock: Render Mockup]
|
|
345
|
+
→ Generate mockup for each design
|
|
346
|
+
|
|
347
|
+
4. [Store Results]
|
|
348
|
+
→ Save rendered URLs to database
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Example 3: Account Monitoring
|
|
352
|
+
|
|
353
|
+
```
|
|
354
|
+
1. [Schedule Trigger]
|
|
355
|
+
→ Run daily at 9 AM
|
|
356
|
+
|
|
357
|
+
2. [SudoMock: Get Account Info]
|
|
358
|
+
→ Check credit usage
|
|
359
|
+
|
|
360
|
+
3. [IF Node]
|
|
361
|
+
→ If credits < 100
|
|
362
|
+
|
|
363
|
+
4. [Send Email/Slack]
|
|
364
|
+
→ Alert about low credits
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## Rate Limits
|
|
368
|
+
|
|
369
|
+
### Request Rate Limits
|
|
370
|
+
|
|
371
|
+
All authenticated users have a base rate limit of **1000 requests per minute** with burst capacity of 1500 requests.
|
|
372
|
+
|
|
373
|
+
Unauthenticated requests (IP-based): **30 requests per minute**
|
|
374
|
+
|
|
375
|
+
### Concurrent Request Limits (Plan-Based)
|
|
376
|
+
|
|
377
|
+
| Plan | Concurrent Renders | Concurrent Uploads |
|
|
378
|
+
|------|-------------------|--------------------|
|
|
379
|
+
| Free | 1 | 1 |
|
|
380
|
+
| Starter | 3 | 2 |
|
|
381
|
+
| Pro | 10 | 5 |
|
|
382
|
+
| Scale | 25 | 10 |
|
|
383
|
+
|
|
384
|
+
### Rate Limit Error Handling
|
|
385
|
+
|
|
386
|
+
The node automatically detects and handles two types of rate limit errors:
|
|
387
|
+
|
|
388
|
+
#### 1. Request Rate Limit Exceeded (1000 RPM)
|
|
389
|
+
|
|
390
|
+
**Error Output:**
|
|
391
|
+
```json
|
|
392
|
+
{
|
|
393
|
+
"error": "Rate limit exceeded (1000 requests/minute). Please retry after 42 seconds.",
|
|
394
|
+
"operation": "render",
|
|
395
|
+
"statusCode": 429,
|
|
396
|
+
"retryAfter": 42,
|
|
397
|
+
"errorType": "rate_limit_exceeded",
|
|
398
|
+
"errorDetails": {
|
|
399
|
+
"type": "rate_limit_exceeded",
|
|
400
|
+
"limit": 1000,
|
|
401
|
+
"remaining": 0
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
#### 2. Concurrent Limit Exceeded (Plan-Based)
|
|
407
|
+
|
|
408
|
+
**Error Output:**
|
|
409
|
+
```json
|
|
410
|
+
{
|
|
411
|
+
"error": "Concurrent render limit reached (11/10). Please wait 5 seconds and try again.",
|
|
412
|
+
"operation": "render",
|
|
413
|
+
"statusCode": 429,
|
|
414
|
+
"retryAfter": 5,
|
|
415
|
+
"errorType": "concurrent_limit_exceeded",
|
|
416
|
+
"errorDetails": {
|
|
417
|
+
"type": "concurrent_limit_exceeded",
|
|
418
|
+
"resource": "concurrent-render",
|
|
419
|
+
"limit": 10,
|
|
420
|
+
"current": 11
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### Best Practices
|
|
426
|
+
|
|
427
|
+
1. **Enable "Continue On Fail"** in n8n node settings to capture rate limit errors without stopping the workflow
|
|
428
|
+
2. **Implement retry logic** using the `retryAfter` value from error output
|
|
429
|
+
3. **Monitor `errorType`** to distinguish between request rate limits and concurrent limits
|
|
430
|
+
4. **Use n8n's "Wait" node** with `{{$json.retryAfter}}` seconds before retrying
|
|
431
|
+
|
|
432
|
+
### Example: Retry Logic Workflow
|
|
433
|
+
|
|
434
|
+
```
|
|
435
|
+
[SudoMock Render] (Continue On Fail: ON)
|
|
436
|
+
→ [IF: Check statusCode]
|
|
437
|
+
→ If 429: [Wait: {{$json.retryAfter}} seconds]
|
|
438
|
+
→ [SudoMock Render Again]
|
|
439
|
+
→ Else: Continue
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
## Error Handling
|
|
443
|
+
|
|
444
|
+
All operations support the **Continue On Fail** option in n8n. When enabled:
|
|
445
|
+
- Errors are captured as output items
|
|
446
|
+
- Workflow continues to next item
|
|
447
|
+
- Error details included in output
|
|
448
|
+
|
|
449
|
+
**Example Error Output:**
|
|
450
|
+
```json
|
|
451
|
+
{
|
|
452
|
+
"error": "Rate limit exceeded. Retry after 42 seconds.",
|
|
453
|
+
"operation": "render"
|
|
454
|
+
}
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
## Development
|
|
458
|
+
|
|
459
|
+
### Setup
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
# Clone repository
|
|
463
|
+
git clone https://github.com/sudomock/n8n-nodes-sudomock.git
|
|
464
|
+
cd n8n-nodes-sudomock
|
|
465
|
+
|
|
466
|
+
# Install dependencies
|
|
467
|
+
pnpm install
|
|
468
|
+
|
|
469
|
+
# Build
|
|
470
|
+
pnpm build
|
|
471
|
+
|
|
472
|
+
# Development (watch mode)
|
|
473
|
+
pnpm dev
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### Testing Locally
|
|
477
|
+
|
|
478
|
+
```bash
|
|
479
|
+
# Link package globally
|
|
480
|
+
npm link
|
|
481
|
+
|
|
482
|
+
# Link in n8n's custom nodes
|
|
483
|
+
cd ~/.n8n/custom
|
|
484
|
+
npm link n8n-nodes-sudomock
|
|
485
|
+
|
|
486
|
+
# Start n8n
|
|
487
|
+
n8n start
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
Access n8n at `http://localhost:5678` and search for "SudoMock" in the nodes panel.
|
|
491
|
+
|
|
492
|
+
### Build Commands
|
|
493
|
+
|
|
494
|
+
```bash
|
|
495
|
+
# Build TypeScript and icons
|
|
496
|
+
pnpm build
|
|
497
|
+
|
|
498
|
+
# Format code
|
|
499
|
+
pnpm format
|
|
500
|
+
|
|
501
|
+
# Lint code
|
|
502
|
+
pnpm lint
|
|
503
|
+
|
|
504
|
+
# Fix linting issues
|
|
505
|
+
pnpm lintfix
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
## Resources
|
|
509
|
+
|
|
510
|
+
- [SudoMock Website](https://sudomock.com)
|
|
511
|
+
- [API Documentation](https://sudomock.com/docs/api)
|
|
512
|
+
- [n8n Documentation](https://docs.n8n.io)
|
|
513
|
+
- [Report Issues](https://github.com/sudomock/n8n-nodes-sudomock/issues)
|
|
514
|
+
|
|
515
|
+
## License
|
|
516
|
+
|
|
517
|
+
MIT
|
|
518
|
+
|
|
519
|
+
## Support
|
|
520
|
+
|
|
521
|
+
- Email: hello@sudomock.com
|
|
522
|
+
- Documentation: https://sudomock.com/docs
|
|
523
|
+
- Community: https://community.n8n.io
|
|
524
|
+
|
|
525
|
+
---
|
|
526
|
+
|
|
527
|
+
**Made with ❤️ for the n8n community**
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class SudoMockApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: IAuthenticateGeneric;
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SudoMockApi = void 0;
|
|
4
|
+
class SudoMockApi {
|
|
5
|
+
name = 'sudoMockApi';
|
|
6
|
+
displayName = 'SudoMock API';
|
|
7
|
+
documentationUrl = 'https://sudomock.com/docs/authentication';
|
|
8
|
+
properties = [
|
|
9
|
+
{
|
|
10
|
+
displayName: 'API Key',
|
|
11
|
+
name: 'apiKey',
|
|
12
|
+
type: 'string',
|
|
13
|
+
typeOptions: {
|
|
14
|
+
password: true,
|
|
15
|
+
},
|
|
16
|
+
default: '',
|
|
17
|
+
required: true,
|
|
18
|
+
description: 'Your SudoMock API key (starts with sm_). Get it from your <a href="https://sudomock.com/dashboard/api-keys" target="_blank">Dashboard</a>.',
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
// API key is automatically added to X-API-KEY header
|
|
22
|
+
authenticate = {
|
|
23
|
+
type: 'generic',
|
|
24
|
+
properties: {
|
|
25
|
+
headers: {
|
|
26
|
+
'X-API-KEY': '={{$credentials.apiKey}}',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
// Credential test - make request to a simple endpoint
|
|
31
|
+
test = {
|
|
32
|
+
request: {
|
|
33
|
+
baseURL: 'https://api.sudomock.com',
|
|
34
|
+
url: '/api/v1/me',
|
|
35
|
+
method: 'GET',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
exports.SudoMockApi = SudoMockApi;
|