|
3 | 3 | // |
4 | 4 | // env TRANSLOADIT_KEY=xxx TRANSLOADIT_SECRET=yyy node template_api.js |
5 | 5 | // |
6 | | -// You'll likely just want to `require('transloadit')`, but we're requiring the local |
7 | | -// variant here for easier testing: |
8 | | -const Transloadit = require('../src/Transloadit') |
| 6 | +// You may need to build the project first using: |
| 7 | +// |
| 8 | +// yarn prepack |
| 9 | +// |
| 10 | +const { Transloadit } = require('transloadit') |
9 | 11 |
|
10 | 12 | const transloadit = new Transloadit({ |
11 | | - authKey: process.env.TRANSLOADIT_KEY, |
12 | | - authSecret: process.env.TRANSLOADIT_SECRET, |
13 | | - // authKey : process.env.API2_SYSTEMTEST_AUTH_KEY, |
14 | | - // authSecret: process.env.API2_SYSTEMTEST_SECRET_KEY, |
15 | | - // endpoint : 'https://api2-vbox.transloadit.com', |
| 13 | + authKey: /** @type {string} */ (process.env.TRANSLOADIT_KEY), |
| 14 | + authSecret: /** @type {string} */ (process.env.TRANSLOADIT_SECRET), |
| 15 | + // authKey: /** @type {string} */ (process.env.API2_SYSTEMTEST_AUTH_KEY), |
| 16 | + // authSecret: /** @type {string} */ (process.env.API2_SYSTEMTEST_SECRET_KEY), |
| 17 | + // endpoint: /** @type {string} */ ('https://api2-vbox.transloadit.com'), |
16 | 18 | }) |
17 | 19 |
|
18 | 20 | const firstName = 'myProductionS3' |
@@ -51,9 +53,8 @@ const credentialParams = { |
51 | 53 | } |
52 | 54 |
|
53 | 55 | console.log(`==> createTemplateCredential`) |
54 | | - const createTemplateCredentialResult = await transloadit.createTemplateCredential( |
55 | | - credentialParams |
56 | | - ) |
| 56 | + const createTemplateCredentialResult = |
| 57 | + await transloadit.createTemplateCredential(credentialParams) |
57 | 58 | console.log('TemplateCredential created successfully:', createTemplateCredentialResult) |
58 | 59 | // ^-- with Templates, there is `ok`, `message`, `id`, `content`, `name`, `require_signature_auth`. Same is true for: created, updated, fetched |
59 | 60 | // with Credentials, there is `ok`, `message`, `credentials` <-- and a single object nested directly under it, which is unexpected with that plural imho. Same is true for created, updated, fetched |
|
0 commit comments