forked from cloudflare/node-cloudflare
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): support Cloudflare Stream
Adds support for the Cloudflare Stream api. Signed-off-by: Terin Stock <terinjokes@gmail.com>
- Loading branch information
1 parent
9072fda
commit 2079b45
Showing
2 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* Copyright (C) 2014-present Cloudflare, Inc. | ||
* This software may be modified and distributed under the terms | ||
* of the MIT license. See the LICENSE file for details. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const prototypal = require('es-class'); | ||
const auto = require('autocreate'); | ||
|
||
const Resource = require('../Resource'); | ||
const method = require('../method'); | ||
|
||
/** | ||
* Stream represents the /accout/:id/stream API endpoint. | ||
* | ||
* @class Stream | ||
* @hideconstructor | ||
* @extends Resource | ||
*/ | ||
module.exports = auto( | ||
prototypal({ | ||
extends: Resource, | ||
path: 'accounts/:accountId/stream', | ||
hasBrokenPatch: true, | ||
|
||
includeBasic: ['browse', 'read', 'edit', 'add', 'del'], | ||
|
||
/** | ||
* ListVideos retrieves all of a account's videos. | ||
* | ||
* @function listVideos | ||
* @memberof Stream | ||
* @instance | ||
* @async | ||
* @param {string} accountId - The account ID | ||
* @returns {Promise<Object>} The response object | ||
*/ | ||
listVideos: method({ | ||
method: 'GET', | ||
}), | ||
|
||
/** | ||
* VideoDetails retrieves details of a account's single video. | ||
* | ||
* @function videoDetails | ||
* @memberof Stream | ||
* @instance | ||
* @async | ||
* @param {string} accountId - The account ID | ||
* @param {string} id - The video ID | ||
* @returns {Promise<Object>} The response object | ||
*/ | ||
videoDetails: method({ | ||
method: 'GET', | ||
path: ':id', | ||
}), | ||
|
||
/** | ||
* UploadVideoFromUrl uploads a video from specific URL | ||
* | ||
* @function uploadVideoFromUrl | ||
* @instance | ||
* @async | ||
* @param {string} accountId - The account ID | ||
* @param {Object} video - The upload video info | ||
* @returns {Promise<Object>} The response object | ||
*/ | ||
uploadVideoFromUrl: method({ | ||
method: 'POST', | ||
path: 'copy', | ||
}), | ||
|
||
/** | ||
* DeleteVideo deletes a account's single video. | ||
* | ||
* @function deleteVideo | ||
* @memberof Stream | ||
* @instance | ||
* @async | ||
* @param {string} accountId - The account ID | ||
* @param {string} id - The video ID | ||
* @returns {Promise<Object>} The response object | ||
*/ | ||
deleteVideo: method({ | ||
method: 'DELETE', | ||
path: ':id', | ||
}), | ||
}) | ||
); |