{"id":13904864,"url":"https://github.com/Eyevinn/enigma.io","last_synced_at":"2025-07-18T02:32:05.520Z","repository":{"id":36430058,"uuid":"221708673","full_name":"Eyevinn/enigma.io","owner":"Eyevinn","description":"NPM library for integration with Red Bee Media Managed OTT APIs","archived":false,"fork":false,"pushed_at":"2023-03-15T07:09:05.000Z","size":929,"stargazers_count":1,"open_issues_count":3,"forks_count":2,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-17T23:11:50.055Z","etag":null,"topics":["library"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Eyevinn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-14T13:51:00.000Z","updated_at":"2023-05-03T00:28:53.000Z","dependencies_parsed_at":"2023-01-17T01:24:01.952Z","dependency_job_id":null,"html_url":"https://github.com/Eyevinn/enigma.io","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eyevinn%2Fenigma.io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eyevinn%2Fenigma.io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eyevinn%2Fenigma.io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eyevinn%2Fenigma.io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Eyevinn","download_url":"https://codeload.github.com/Eyevinn/enigma.io/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226336399,"owners_count":17608826,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library"],"created_at":"2024-08-06T23:01:04.990Z","updated_at":"2024-11-25T13:30:40.541Z","avatar_url":"https://github.com/Eyevinn.png","language":"JavaScript","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"An NPM library for integration with Red Bee Media Managed OTT platform.\n\n## Installation\n\n```\nnpm install @eyevinn/enigma.io\n```\n\n## Authentication\n\nProvide API key ID and secret with the environment variables `API_KEY_ID` and `API_KEY_SECRET`. \n\nYour key and secret can also be set when initiating the ManagementApi, like so:\n\n```js\nconst managementApi = new EnigmaIO.ManagementAPI(\"Customer\", \"BusinessUnit\", { \n  API_KEY_ID: \"Your API KEY ID\",\n  API_KEY_SECRET: \"Your API KEY SECRET\"\n});\n```\nIf omitted when created a new class, the managementAPI will look for environment variables.\n\n## Management API\n\n```js\nconst EnigmaIO = require(\"@eyevinn/enigma.io\");\nconst managementApi = new EnigmaIO.ManagementAPI(\"Customer\", \"BusinessUnit\");\n\n// using red bee's stage environment\n\nconst managementApi = new EnigmaIO.ManagementAPI(\"Customer\", \"BusinessUnit\", { environment: \"stage\"});\n```\n\n### Methods\n\n#### Users\n\n- [`getEndUsers`](src/api/mgmt.js#L45) Retrieve a list of end users.\n- [`getEndUser`](src/api/mgmt.js#55) Retrieve a specific end user.\n- [`getEndUserById`](src/api/mgmt.js#l64) Retrieve a specific end user by their account id.\n- [`createUser`](src/api/mgmt.js#73) Create a single end user.\n- [`createUsers`](src/api/mgmt.js#L85) Bulk create users.\n- [`setLabelsForUser`](src/api/mgmt.js#L95) Set labels on an existing user.\n\n#### Products \u0026 Product Offerings\n\n- [`getProductOfferings`](src/api/mgmt.js#L107) Retrieve a list of productOfferings.\n- [`getProductOffering`](src/api/mgmt.js#L120) Retrieve a specific productOffering.\n- [`setLabelsForProductOffering`](src/api/mgmt.js#L129) Set labels on an existing productOffering.\n\n#### Purchases\n\n- [`getPurchases`](src/api/mgmt.js#L139) Retrieve active purchases for an account.\n- [`performPurchase`](src/api/mgmt.js#L148) Performs a purchase of a given productOffering for a given account.\n- [`removePurchase`](src/api/mgmt.js#L158) Remove a purchased productOffering and its access from a given account.\n\n#### Assets\n\n- [`createAsset`](src/api/mgmt.js#L167) Create an asset\n\nWhere the metadata object should be constructed in the following format\n```js\n{\n  \"languages\": [ \"en\" ],\n  \"en\": {\n    \"description\": \"Walt rejects everyone who tries to help him with the cancer. Jesse tries his best to create Walt's meth, with the help of an old friend.\"\n  },\n  \"studio\": \"Sony Pictures Television\",\n  \"productionYear\": \"2019\"\n}\n```\n\n- [`linkAssets`](src/api/mgmt.js#L178) Create a link from srcAssetId to destAssetId.\n- [`ingestVideo`](src/api/mgmt.js#L189) Ingest a video file to an asset. The URL to the video file must be accessible by the platform.\n- [`publishAsset`](src/api/mgmt.js#L200) Add a product publication to an asset.\n- [`unpublishAsset`](src/api/mgmt.js#218) Remove one single publication, or all publications, on an asset.\n- [`createProduct`](src/api/mgmt.js#237) Create a product in the platform\n- [`getProducts`](src/api/mgmt.js#261) Get all products in the platform\n- [`getProduct`](src/api/mgmt.js#270) Get a specific product in the platform\n\n## Exposure API\n\n```js\nconst EnigmaIO = require(\"@eyevinn/enigma.io\");\nconst exposureApi = new EnigmaIO.ExposureAPI(\"Customer\", \"BusinessUnit\");\n\n// using red bee's stage environment\n\nconst exposureApi = new EnigmaIO.ExposureAPI(\"Customer\", \"BusinessUnit\", { environment: \"stage\"});\n```\n\n### Methods\n\n#### Authorization\n\n- [`authenticate`](src/api/exposure.js#L28) Get an authenticated session for an end user\n\n```js\nconst authResponse = await exposureApi.authenticate(username, password);\nconst sessionToken = authResponse.sessionToken;\n```\n\n#### Assets\n\n- [`play`](src/api/exposure.js#L38) Get a medialocator, i.e. a manifest, to play the file\n\n```js\nconst authResponse = await exposureApi.authenticate(username, password);\nconst sessionToken = authResponse.sessionToken;\nconst playResponse = await exposureApi.play(sessionToken, assetId);\nconst hlsFormat = playResponse.formats.find(a =\u003e a.format === \"HLS\");\nif (hlsFormat) {\n  const mediaLocator = hlsFormat.mediaLocator;\n}\n```\n\n- [`getAssets`](src/api/exposure.js#L47) Get all assets of a specific asset type.\n- [`getAsset`](src/api/exposure.js#L59) Get a specific asset by its asset ID.\n- [`resolveSerie`](src/api/exposure.js#67) Get all assets for a serie and structured in a series/seasons/episodes structure.\n\n\n## Run the tests\n\n- create a `.env` file in the root of the project\n- add `API_KEY_ID` and `API_KEY_SECRET` for the Management API\n- add your `USERNAME` and `PASSWORD` to obtain session for the Exposure API\n- run `npm test`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEyevinn%2Fenigma.io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEyevinn%2Fenigma.io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEyevinn%2Fenigma.io/lists"}