|
| 1 | +/** |
| 2 | + * Shotstack |
| 3 | + * Shotstack is a video, image and audio editing service that allows for the automated generation of videos, images and audio using JSON and a RESTful API. You arrange and configure an edit and POST it to the API which will render your media and provide a file location when complete. For more details visit [shotstack.io](https://shotstack.io) or checkout our [getting started](https://shotstack.gitbook.io/docs/guides/getting-started) documentation. There are two main API's, one for editing and generating assets (Edit API) and one for managing hosted assets (Serve API). The Edit API base URL is: <b>https://api.shotstack.io/{version}</b> The Serve API base URL is: <b>https://api.shotstack.io/serve/{version}</b> |
| 4 | + * |
| 5 | + * The version of the OpenAPI document: v1 |
| 6 | + * |
| 7 | + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 8 | + * https://openapi-generator.tech |
| 9 | + * |
| 10 | + * OpenAPI Generator version: 5.0.0 |
| 11 | + * |
| 12 | + * Do not edit the class manually. |
| 13 | + * |
| 14 | + */ |
| 15 | + |
| 16 | +(function(root, factory) { |
| 17 | + if (typeof define === 'function' && define.amd) { |
| 18 | + // AMD. Register as an anonymous module. |
| 19 | + define(['ApiClient', 'model/AssetRenderResponse', 'model/AssetResponse'], factory); |
| 20 | + } else if (typeof module === 'object' && module.exports) { |
| 21 | + // CommonJS-like environments that support module.exports, like Node. |
| 22 | + module.exports = factory(require('../ApiClient'), require('../model/AssetRenderResponse'), require('../model/AssetResponse')); |
| 23 | + } else { |
| 24 | + // Browser globals (root is window) |
| 25 | + if (!root.ShotstackSdk) { |
| 26 | + root.ShotstackSdk = {}; |
| 27 | + } |
| 28 | + root.ShotstackSdk.ServeApi = factory(root.ShotstackSdk.ApiClient, root.ShotstackSdk.AssetRenderResponse, root.ShotstackSdk.AssetResponse); |
| 29 | + } |
| 30 | +}(this, function(ApiClient, AssetRenderResponse, AssetResponse) { |
| 31 | + 'use strict'; |
| 32 | + |
| 33 | + /** |
| 34 | + * Serve service. |
| 35 | + * @module api/ServeApi |
| 36 | + * @version v1 |
| 37 | + */ |
| 38 | + |
| 39 | + /** |
| 40 | + * Constructs a new ServeApi. |
| 41 | + * @alias module:api/ServeApi |
| 42 | + * @class |
| 43 | + * @param {module:ApiClient} [apiClient] Optional API client implementation to use, |
| 44 | + * default to {@link module:ApiClient#instance} if unspecified. |
| 45 | + */ |
| 46 | + var exports = function(apiClient) { |
| 47 | + this.apiClient = apiClient || ApiClient.instance; |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + /** |
| 52 | + * Delete Asset |
| 53 | + * Delete an asset by its asset id. If a render creates multiple assets, such as thumbnail and poster images, each asset must be deleted individually by the asset id. **base URL:** https://api.shotstack.io/serve/{version} |
| 54 | + * @param {String} id The id of the asset in UUID format |
| 55 | + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response |
| 56 | + */ |
| 57 | + this.deleteAssetWithHttpInfo = function(id) { |
| 58 | + var postBody = null; |
| 59 | + // verify the required parameter 'id' is set |
| 60 | + if (id === undefined || id === null) { |
| 61 | + throw new Error("Missing the required parameter 'id' when calling deleteAsset"); |
| 62 | + } |
| 63 | + |
| 64 | + var pathParams = { |
| 65 | + 'id': id |
| 66 | + }; |
| 67 | + var queryParams = { |
| 68 | + }; |
| 69 | + var collectionQueryParams = { |
| 70 | + }; |
| 71 | + var headerParams = { |
| 72 | + }; |
| 73 | + var formParams = { |
| 74 | + }; |
| 75 | + |
| 76 | + var authNames = ['DeveloperKey']; |
| 77 | + var contentTypes = []; |
| 78 | + var accepts = []; |
| 79 | + var returnType = null; |
| 80 | + return this.apiClient.callApi( |
| 81 | + '/assets/{id}', 'DELETE', |
| 82 | + pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, |
| 83 | + authNames, contentTypes, accepts, returnType, null |
| 84 | + ); |
| 85 | + } |
| 86 | + |
| 87 | + /** |
| 88 | + * Delete Asset |
| 89 | + * Delete an asset by its asset id. If a render creates multiple assets, such as thumbnail and poster images, each asset must be deleted individually by the asset id. **base URL:** https://api.shotstack.io/serve/{version} |
| 90 | + * @param {String} id The id of the asset in UUID format |
| 91 | + * @return {Promise} a {@link https://www.promisejs.org/|Promise} |
| 92 | + */ |
| 93 | + this.deleteAsset = function(id) { |
| 94 | + return this.deleteAssetWithHttpInfo(id) |
| 95 | + .then(function(response_and_data) { |
| 96 | + return response_and_data.data; |
| 97 | + }); |
| 98 | + } |
| 99 | + |
| 100 | + |
| 101 | + /** |
| 102 | + * Get Asset |
| 103 | + * The Serve API is used to interact with, and delete hosted assets including videos, images, audio files, thumbnails and poster images. Use this endpoint to fetch an asset by asset id. Note that an asset id is unique for each asset and different from the render id. **base URL:** https://api.shotstack.io/serve/{version} |
| 104 | + * @param {String} id The id of the asset in UUID format |
| 105 | + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AssetResponse} and HTTP response |
| 106 | + */ |
| 107 | + this.getAssetWithHttpInfo = function(id) { |
| 108 | + var postBody = null; |
| 109 | + // verify the required parameter 'id' is set |
| 110 | + if (id === undefined || id === null) { |
| 111 | + throw new Error("Missing the required parameter 'id' when calling getAsset"); |
| 112 | + } |
| 113 | + |
| 114 | + var pathParams = { |
| 115 | + 'id': id |
| 116 | + }; |
| 117 | + var queryParams = { |
| 118 | + }; |
| 119 | + var collectionQueryParams = { |
| 120 | + }; |
| 121 | + var headerParams = { |
| 122 | + }; |
| 123 | + var formParams = { |
| 124 | + }; |
| 125 | + |
| 126 | + var authNames = ['DeveloperKey']; |
| 127 | + var contentTypes = []; |
| 128 | + var accepts = ['application/json']; |
| 129 | + var returnType = AssetResponse; |
| 130 | + return this.apiClient.callApi( |
| 131 | + '/assets/{id}', 'GET', |
| 132 | + pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, |
| 133 | + authNames, contentTypes, accepts, returnType, null |
| 134 | + ); |
| 135 | + } |
| 136 | + |
| 137 | + /** |
| 138 | + * Get Asset |
| 139 | + * The Serve API is used to interact with, and delete hosted assets including videos, images, audio files, thumbnails and poster images. Use this endpoint to fetch an asset by asset id. Note that an asset id is unique for each asset and different from the render id. **base URL:** https://api.shotstack.io/serve/{version} |
| 140 | + * @param {String} id The id of the asset in UUID format |
| 141 | + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AssetResponse} |
| 142 | + */ |
| 143 | + this.getAsset = function(id) { |
| 144 | + return this.getAssetWithHttpInfo(id) |
| 145 | + .then(function(response_and_data) { |
| 146 | + return response_and_data.data; |
| 147 | + }); |
| 148 | + } |
| 149 | + |
| 150 | + |
| 151 | + /** |
| 152 | + * Get Asset by Render ID |
| 153 | + * A render may generate more than one file, such as a video, thumbnail and poster image. When the assets are created the only known id is the render id returned by the original [render request](#render-video), status request or webhook. This endpoint lets you look up one or more assets by the render id. **base URL:** https://api.shotstack.io/serve/{version} |
| 154 | + * @param {String} id The render id associated with the asset in UUID format |
| 155 | + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AssetRenderResponse} and HTTP response |
| 156 | + */ |
| 157 | + this.getAssetByRenderIdWithHttpInfo = function(id) { |
| 158 | + var postBody = null; |
| 159 | + // verify the required parameter 'id' is set |
| 160 | + if (id === undefined || id === null) { |
| 161 | + throw new Error("Missing the required parameter 'id' when calling getAssetByRenderId"); |
| 162 | + } |
| 163 | + |
| 164 | + var pathParams = { |
| 165 | + 'id': id |
| 166 | + }; |
| 167 | + var queryParams = { |
| 168 | + }; |
| 169 | + var collectionQueryParams = { |
| 170 | + }; |
| 171 | + var headerParams = { |
| 172 | + }; |
| 173 | + var formParams = { |
| 174 | + }; |
| 175 | + |
| 176 | + var authNames = ['DeveloperKey']; |
| 177 | + var contentTypes = []; |
| 178 | + var accepts = ['application/json']; |
| 179 | + var returnType = AssetRenderResponse; |
| 180 | + return this.apiClient.callApi( |
| 181 | + '/assets/render/{id}', 'GET', |
| 182 | + pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody, |
| 183 | + authNames, contentTypes, accepts, returnType, null |
| 184 | + ); |
| 185 | + } |
| 186 | + |
| 187 | + /** |
| 188 | + * Get Asset by Render ID |
| 189 | + * A render may generate more than one file, such as a video, thumbnail and poster image. When the assets are created the only known id is the render id returned by the original [render request](#render-video), status request or webhook. This endpoint lets you look up one or more assets by the render id. **base URL:** https://api.shotstack.io/serve/{version} |
| 190 | + * @param {String} id The render id associated with the asset in UUID format |
| 191 | + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AssetRenderResponse} |
| 192 | + */ |
| 193 | + this.getAssetByRenderId = function(id) { |
| 194 | + return this.getAssetByRenderIdWithHttpInfo(id) |
| 195 | + .then(function(response_and_data) { |
| 196 | + return response_and_data.data; |
| 197 | + }); |
| 198 | + } |
| 199 | + }; |
| 200 | + |
| 201 | + return exports; |
| 202 | +})); |
0 commit comments