@nomad-media/full 1.1.28 → 2026.9.2-beta.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 CHANGED
@@ -1,93 +1,74 @@
1
- ## Prerequisites
2
-
3
- - Node package manager (npm).
4
-
5
- > 📘 Note
6
- >
7
- > You can download npm [here](https://nodejs.org/en/download).
8
-
9
- ## Setup
10
-
11
- To use the Nomad SDK, download the @nomad-media npm. There are two versions, the full version which includes all of the Nomad-Media endpoints, and the public version which only includes the media endpoints.
12
-
13
- To install the full version, use the following command:
14
- ```shell
15
- npm install @nomad-media/full
16
- ```
17
-
18
- To install the public version, use the following command:
19
- ```shell
20
- npm install @nomad-media/public
21
- ```
22
-
23
- Then to import it, you can either use the default version, or the debug version. The difference is that the debug version isn't compressed and has more documentation and named parameters. Both full and public have a debug version. Currently the debug version's tooltips don't show up. This is an issue with npm.
24
-
25
- To use the default version use:
26
-
27
- ```javascript
28
- import NomadMediaSDK from "@nomad-media/full";
29
- ```
30
-
31
- To use the debug version user:
32
-
33
- ```javascript
34
- import NomadMediaSDK from "@nomad-media/full/debug";
35
- ```
36
-
37
- To initialize the sdk, call the NomadMediaSDK class as shown below:
38
-
39
- ```javascript
40
- const SDK = NomadMediaSDK(config);
41
- ```
42
-
43
- ## Logging in
44
-
45
- To log in to the sdk, in the config, enter the username/email of your user. Then enter your api key if you are using an api key, or your password.
46
-
47
- ## Configure Environmental Variables
48
-
49
- Follow this format for the config:
50
-
51
- ```
52
- const config = {
53
- "username": "username",
54
- "password": "password",
55
- "apiKey": "apiKey",
56
- "serviceApiUrl": "serverApiUrl",
57
- "apiType": "admin",
58
- "debugMode": true,
59
- "singleton": false
60
- };
61
- ```
62
-
63
- apiType: Specifies whether the function you are trying to run is **admin** or **portal**.
64
-
65
- debugMode: Specifies when running functions, whether of not to print api call information.
66
-
67
- singleton: Whether or not to only create one class instance.
68
-
69
- Place the config in a file called config.js and import it into your project.
70
-
71
- You are now ready to use the SDK in your project.
72
-
73
- > 📘 Contact: Make sure to contact Nomad Media support to get username, password, and url for your enviromnent.
74
-
75
- > 🚧 Make sure to keep your configuration options secret and do not share them publicly.
76
-
77
- ## Upgrading NPM
78
-
79
- To upgrade the npm, use the following command:
80
-
81
- ```shell
82
- npm update @nomad-media/full
83
- ```
84
-
85
- ## Nomad SDK References
86
-
87
- An overview of all of the Nomad SDK methods. Includes prameter details for the methods. Scroll down to the Nomad SDK section.
88
-
89
- [Nomad SDK References](https://developer.nomad-cms.com/reference)
90
-
91
- ## Nomad SDK NPM Samples
92
-
93
- [Nomad SDK NPM Samples](https://github.com/Nomad-Media/samples-js)
1
+ # @nomad-media/full
2
+
3
+ Official JavaScript SDK for the [Nomad Media API](https://docs.nomad.media): admin and portal endpoints.
4
+ For the media-only subset, see [`@nomad-media/public`](https://www.npmjs.com/package/@nomad-media/public).
5
+
6
+ > **Beta.** The 2026.9 line is a pre-release. Install it with the `beta` tag and
7
+ > [report problems](https://github.com/Nomad-Media/sdk-javascript/issues).
8
+
9
+ ## Install
10
+
11
+ ```shell
12
+ npm install @nomad-media/full@beta
13
+ ```
14
+
15
+ Requires Node.js 18 or higher.
16
+
17
+ ## Quick start
18
+
19
+ ```javascript
20
+ import NomadMediaSDK from "@nomad-media/full";
21
+
22
+ const sdk = new NomadMediaSDK({
23
+ serviceApiUrl: "https://your-instance.demos.media",
24
+ username: "you@example.com",
25
+ password: "your-password", // or apiKey
26
+ apiType: "admin" // "admin" or "portal"
27
+ });
28
+
29
+ // The SDK logs in automatically on the first call
30
+ const channels = await sdk.getLiveChannels();
31
+ ```
32
+
33
+ Failed calls throw an `Error` whose `.status` is the HTTP status:
34
+
35
+ ```javascript
36
+ try {
37
+ await sdk.getAsset(assetId);
38
+ } catch (err) {
39
+ console.error(err.status, err.message);
40
+ }
41
+ ```
42
+
43
+ Uploads send the file in parts and return the new asset id:
44
+
45
+ ```javascript
46
+ const assetId = await sdk.uploadAsset(null, null, null, "replace", "./video.mp4", folderId);
47
+ ```
48
+
49
+ For large files, pass `{ maxWorkers, partConfirmation, onProgress }` as the last argument.
50
+
51
+ ## Upgrading from 1.x
52
+
53
+ - **Failed requests throw.** 1.x logged the error and returned `null`. Wrap calls in `try`/`catch`.
54
+ - **Timed-out writes are not retried.** A POST, PUT, PATCH or DELETE that times out throws.
55
+ - **Versions follow the API:** `YYYY.M.patch` (for example `2026.9.2`).
56
+
57
+ The full list of changes is in the [changelog](https://github.com/Nomad-Media/sdk-javascript/blob/main/CHANGELOG.md).
58
+
59
+ ## Configuration
60
+
61
+ | Option | Description |
62
+ |--------|-------------|
63
+ | `serviceApiUrl` | Your API base URL. Required. |
64
+ | `username`, `password` / `apiKey` | Your credentials. Keep them secret. |
65
+ | `apiType` | `"admin"` or `"portal"`. |
66
+ | `debugMode` | Log API call details. |
67
+
68
+ An unminified build with parameter names is available as `@nomad-media/full/debug`.
69
+
70
+ ## More
71
+
72
+ - [Documentation](https://docs.nomad.media)
73
+ - [Samples](https://github.com/Nomad-Media/samples-js)
74
+ - [Issues](https://github.com/Nomad-Media/sdk-javascript/issues)