Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@api.video/nodejs-client

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@api.video/nodejs-client

api.video nodejs API client

  • 2.6.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

badge   badge   badge

api.video Node.js client

api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.

Table of contents

Project description

api.video's Java Node.js is a lightweight client built in TypeScript that streamlines the coding process. Chunking files is handled for you, as is pagination and refreshing your tokens.

Getting started

Installation

With npm:

npm install @api.video/nodejs-client --save

...or with yarn:

yarn add @api.video/nodejs-client

Migration

If you're coming from @api.video/nodejs-sdk make sure to read our Migration guide first.

Development

To build and compile the typescript sources to javascript use:

npm install
npm run build

Code sample

const ApiVideoClient = require('@api.video/nodejs-client');
// or: import ApiVideoClient from '@api.video/nodejs-client';

(async () => {
    try {
        const client = new ApiVideoClient({ apiKey: "YOUR_API_KEY" });

        // create a video
        const videoCreationPayload = {
            title: "Maths video", // The title of your new video.
            description: "A video about string theory.", // A brief description of your video.
        };
        const video = await client.videos.create(videoCreationPayload);

        // upload a video file into the video container
        await client.videos.upload(video.videoId, "my-video-file.mp4");
    } catch (e) {
        console.error(e);
    }
})();

Documentation

API Endpoints

AnalyticsApi
MethodDescriptionHTTP request
getAggregatedMetrics()Retrieve aggregated metricsGET /data/metrics/{metric}/{aggregation}
getMetricsBreakdown()Retrieve metrics in a breakdown of dimensionsGET /data/buckets/{metric}/{breakdown}
getMetricsOverTime()Retrieve metrics over timeGET /data/timeseries/{metric}
CaptionsApi
MethodDescriptionHTTP request
upload()Upload a captionPOST /videos/{videoId}/captions/{language}
get()Retrieve a captionGET /videos/{videoId}/captions/{language}
update()Update a captionPATCH /videos/{videoId}/captions/{language}
delete()Delete a captionDELETE /videos/{videoId}/captions/{language}
list()List video captionsGET /videos/{videoId}/captions
ChaptersApi
MethodDescriptionHTTP request
upload()Upload a chapterPOST /videos/{videoId}/chapters/{language}
get()Retrieve a chapterGET /videos/{videoId}/chapters/{language}
delete()Delete a chapterDELETE /videos/{videoId}/chapters/{language}
list()List video chaptersGET /videos/{videoId}/chapters
LiveStreamsApi
MethodDescriptionHTTP request
create()Create live streamPOST /live-streams
get()Retrieve live streamGET /live-streams/{liveStreamId}
update()Update a live streamPATCH /live-streams/{liveStreamId}
delete()Delete a live streamDELETE /live-streams/{liveStreamId}
list()List all live streamsGET /live-streams
uploadThumbnail()Upload a thumbnailPOST /live-streams/{liveStreamId}/thumbnail
deleteThumbnail()Delete a thumbnailDELETE /live-streams/{liveStreamId}/thumbnail
complete()Complete a live streamPUT /live-streams/{liveStreamId}/complete
PlayerThemesApi
MethodDescriptionHTTP request
create()Create a playerPOST /players
get()Retrieve a playerGET /players/{playerId}
update()Update a playerPATCH /players/{playerId}
delete()Delete a playerDELETE /players/{playerId}
list()List all player themesGET /players
uploadLogo()Upload a logoPOST /players/{playerId}/logo
deleteLogo()Delete logoDELETE /players/{playerId}/logo
SummariesApi
MethodDescriptionHTTP request
create()Generate video summaryPOST /summaries
update()Update summary detailsPATCH /summaries/{summaryId}/source
delete()Delete video summaryDELETE /summaries/{summaryId}
list()List summariesGET /summaries
getSummarySource()Get summary detailsGET /summaries/{summaryId}/source
TagsApi
MethodDescriptionHTTP request
list()List all video tagsGET /tags
UploadTokensApi
MethodDescriptionHTTP request
createToken()Generate an upload tokenPOST /upload-tokens
getToken()Retrieve upload tokenGET /upload-tokens/{uploadToken}
deleteToken()Delete an upload tokenDELETE /upload-tokens/{uploadToken}
list()List all active upload tokensGET /upload-tokens
VideosApi
MethodDescriptionHTTP request
create()Create a video objectPOST /videos
upload()Upload a videoPOST /videos/{videoId}/source
uploadWithUploadToken()Upload with an delegated upload tokenPOST /upload
get()Retrieve a video objectGET /videos/{videoId}
update()Update a video objectPATCH /videos/{videoId}
delete()Delete a video objectDELETE /videos/{videoId}
list()List all video objectsGET /videos
uploadThumbnail()Upload a thumbnailPOST /videos/{videoId}/thumbnail
pickThumbnail()Set a thumbnailPATCH /videos/{videoId}/thumbnail
getDiscarded()Retrieve a discarded video objectGET /discarded/videos/{videoId}
getStatus()Retrieve video status and detailsGET /videos/{videoId}/status
listDiscarded()List all discarded video objectsGET /discarded/videos
updateDiscarded()Update a discarded video objectPATCH /discarded/videos/{videoId}
WatermarksApi
MethodDescriptionHTTP request
upload()Upload a watermarkPOST /watermarks
delete()Delete a watermarkDELETE /watermarks/{watermarkId}
list()List all watermarksGET /watermarks
WebhooksApi
MethodDescriptionHTTP request
create()Create WebhookPOST /webhooks
get()Retrieve Webhook detailsGET /webhooks/{webhookId}
delete()Delete a WebhookDELETE /webhooks/{webhookId}
list()List all webhooksGET /webhooks

Models

Rate Limiting

api.video implements rate limiting to ensure fair usage and stability of the service. The API provides the rate limit values in the response headers for any API requests you make. The /auth endpoint is the only route without rate limitation.

In this Node.js client, you can access these headers by using the *WithResponseHeaders() versions of the methods. These methods return both the response body and the headers, allowing you to check the X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Retry-After headers to understand your current rate limit status.

Read more about these response headers in the API reference.

Here is an example of how to use these methods:

const client = new ApiVideoClient({ apiKey: "YOUR_API_KEY" });
const { body: videos, headers } = await client.videos.listWithResponseHeaders();
console.log('Rate Limit:', headers['x-ratelimit-limit']);
console.log('Rate Limit Remaining:', headers['x-ratelimit-remaining']);
console.log('Rate Limit Retry after:', headers['x-ratelimit-retry-after']);

Authorization

API key

Most endpoints required to be authenticated using the API key mechanism described in our documentation. The access token generation mechanism is automatically handled by the client.

All you have to do is provide an API key when instantiating the ApiVideoClient:

const client = new ApiVideoClient({ apiKey: "YOUR_API_KEY" });
Get the access token

If you need to access the access-token value obtained using the API key, you can use the getAccessToken() method of the client:

const client = new ApiVideoClient({ apiKey: "YOUR_API_KEY" });
const accessToken = await client.getAccessToken();
Public endpoints

Some endpoints don't require authentication. These one can be called with an ApiVideoClient instantiated without API key:

const client = new ApiVideoClient();

Have you gotten use from this API client?

Please take a moment to leave a star on the client ⭐

This helps other users to find the clients and also helps us understand which clients are most popular. Thank you!

Contribution

Since this API client is generated from an OpenAPI description, we cannot accept pull requests made directly to the repository. If you want to contribute, you can open a pull request on the repository of our client generator. Otherwise, you can also simply open an issue detailing your need on this repository.

Keywords

FAQs

Package last updated on 08 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc