@pageproof/sdk-pr 481.0.1679533095960 → 481.0.1682926860860
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/lib/api/CommentsImport.d.ts +11 -3
- package/lib/api/CommentsImport.js +1 -1
- package/lib/pageproof.js +1 -1
- package/package.json +1 -1
|
@@ -18,18 +18,26 @@ declare class CommentsImport extends API {
|
|
|
18
18
|
* @returns {Promise<CommentImport>}
|
|
19
19
|
*/
|
|
20
20
|
_startTask(id: string, options: any): Promise<CommentImport>;
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Creates a comment import from a file (currently PDF files are the only ones supported).
|
|
23
|
+
*
|
|
24
|
+
* @param {File|Blob|Buffer} file The file/file contents to import comments from.
|
|
25
|
+
* @param {object} options The options for the task.
|
|
26
|
+
* @param {function} [progressCallback] The upload progress callback. The first argument is a number between 0 and 100, correlating to the percentage of the upload.
|
|
27
|
+
* @returns {Promise<CommentImport>
|
|
28
|
+
*/
|
|
29
|
+
fromFile(file: Blob | File | Buffer, options: any, progressCallback?: Function): Promise<CommentImport>;
|
|
22
30
|
/**
|
|
23
31
|
* Gets information about a comment import.
|
|
24
32
|
*
|
|
25
|
-
* @param {string} id
|
|
33
|
+
* @param {string} id The import ID.
|
|
26
34
|
* @returns {Promise<CommentImport>}
|
|
27
35
|
*/
|
|
28
36
|
info(id: string): Promise<CommentImport>;
|
|
29
37
|
/**
|
|
30
38
|
* Cancels a comment import
|
|
31
39
|
*
|
|
32
|
-
* @param {string} id
|
|
40
|
+
* @param {string} id The import ID.
|
|
33
41
|
* @returns {Promise<CommentImport>}
|
|
34
42
|
*/
|
|
35
43
|
cancel(id: string): Promise<CommentImport>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _whatwgURL=require("../util/whatwgURL");var _whatwgURL2=_interopRequireDefault(_whatwgURL);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i]}return target}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var CommentsImport=function(_API){_inherits(CommentsImport,_API);function CommentsImport(){_classCallCheck(this,CommentsImport);return _possibleConstructorReturn(this,_API.apply(this,arguments))}CommentsImport.prototype._createTask=function _createTask(options){return this.client.request("comments.import.create-task",{options:options}).then(function(response){return response.data})};CommentsImport.prototype._startTask=function _startTask(id,options){return this.client.request("comments.import.action-task",{id:id,options:options,action:"start"}).then(function(response){return response.data.task})};CommentsImport.prototype.fromFile=function fromFile(file,options,progressCallback){var _this2=this;var proofId=options.proofId,fileName=options.fileName,startTaskOptions=_objectWithoutProperties(options,["proofId","fileName"]);return this._createTask({type:"pdf",proofId:proofId,fileName:fileName}).then(function(_ref){var task=_ref.task,uploadRequest=_ref.uploadRequest;return _this2.client.rawRequest({url:new _whatwgURL2.default(uploadRequest.url),method:uploadRequest.method,headers:uploadRequest.headers,body:file},{onUploadProgress:progressCallback}).then(function(){return task})}).then(function(task){return _this2._startTask(task.id,startTaskOptions)})};CommentsImport.prototype.info=function info(id){return this.client.request("comments.import.get-task",{id:id}).then(function(response){return response.data.task})};CommentsImport.prototype.cancel=function cancel(id){return this.client.request("comments.import.action-task",{id:id,action:"cancel"}).then(function(response){return response.data})};return CommentsImport}(_API3.default);exports.default=CommentsImport;
|
|
1
|
+
"use strict";exports.__esModule=true;var _API2=require("./API");var _API3=_interopRequireDefault(_API2);var _whatwgURL=require("../util/whatwgURL");var _whatwgURL2=_interopRequireDefault(_whatwgURL);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj){if(keys.indexOf(i)>=0)continue;if(!Object.prototype.hasOwnProperty.call(obj,i))continue;target[i]=obj[i]}return target}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return call&&(typeof call==="object"||typeof call==="function")?call:self}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass)}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass}var CommentsImport=function(_API){_inherits(CommentsImport,_API);function CommentsImport(){_classCallCheck(this,CommentsImport);return _possibleConstructorReturn(this,_API.apply(this,arguments))}CommentsImport.prototype._createTask=function _createTask(options){return this.client.request("comments.import.create-task",{options:options}).then(function(response){return response.data})};CommentsImport.prototype._startTask=function _startTask(id,options){return this.client.request("comments.import.action-task",{id:id,options:options,action:"start"}).then(function(response){return response.data.task})};CommentsImport.prototype.fromFile=function fromFile(file,options,progressCallback){var _this2=this;var proofId=options.proofId,fileName=options.fileName,startTaskOptions=_objectWithoutProperties(options,["proofId","fileName"]);return this._createTask({type:"pdf",proofId:proofId,fileName:fileName}).then(function(_ref){var task=_ref.task,uploadRequest=_ref.uploadRequest;return _this2.client.rawRequest({url:new _whatwgURL2.default(uploadRequest.url),method:uploadRequest.method,headers:uploadRequest.headers,body:file},{onUploadProgress:progressCallback}).then(function(){return task})}).then(function(task){return _this2._startTask(task.id,startTaskOptions)})};CommentsImport.prototype.info=function info(id){return this.client.request("comments.import.get-task",{id:id}).then(function(response){return response.data.task})};CommentsImport.prototype.cancel=function cancel(id){return this.client.request("comments.import.action-task",{id:id,action:"cancel"}).then(function(response){return response.data.task})};return CommentsImport}(_API3.default);exports.default=CommentsImport;
|