notte-sdk 0.0.18 → 0.0.20

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 CHANGED
@@ -426,10 +426,38 @@ if (metadata.status === 'closed') {
426
426
  }
427
427
  ```
428
428
 
429
+ #### Downloading the function code
430
+
431
+ ```typescript
432
+ const fn = notte.NotteFunction({ function_id: 'your-function-id' });
433
+
434
+ // Get the python source of the function
435
+ const code = await fn.download();
436
+
437
+ // Or write it straight to a file (the path must end with .py)
438
+ await fn.download({ path: './my-function.py' });
439
+
440
+ // A specific version, and the presigned url on its own
441
+ const url = await fn.getUrl({ version: 'v1.0.0' });
442
+ ```
443
+
444
+ Notte managed functions return an encrypted url. Pass the key on the function, or
445
+ per call, and it is decrypted for you:
446
+
447
+ ```typescript
448
+ const fn = notte.NotteFunction({
449
+ function_id: 'your-function-id',
450
+ decryption_key: 'your-decryption-key',
451
+ });
452
+ const code = await fn.download();
453
+ ```
454
+
429
455
  #### Function Methods
430
456
 
431
457
  - `run(variables?)` - Start a function run with optional input variables
432
458
  - `retrieve(functionRunId)` - Get metadata/result for a specific run
459
+ - `download(options?)` - Download the function code, optionally writing it to `options.path`
460
+ - `getUrl(options?)` - Get the (decrypted) download url of the function code
433
461
  - `getFunctionId()` - Get the function ID
434
462
  - `functionId` - The function ID (read-only property)
435
463
  - `decryptionKey` - The decryption key, if provided (read-only property)