File tree Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,10 @@ const https = require('https');
3
3
const {
4
4
responseHandler, errorHandler, buildRequestOptions,
5
5
} = require ( './common' ) ;
6
- const { remove : removeDocument } = require ( './document' ) ;
6
+ const {
7
+ remove : removeDocument ,
8
+ invite : sendDocumentInvite ,
9
+ } = require ( './document' ) ;
7
10
8
11
9
12
/**
@@ -142,6 +145,39 @@ class Template {
142
145
req . end ( ) ;
143
146
}
144
147
148
+ /**
149
+ * Creates an invite to sign a template.
150
+ * You can create a simple free form invite(s) or a role-based invite(s).
151
+ * The method copies a template into document and creates an invite using created document.
152
+ * @param {DocumentInviteParams } data - create document invite payload
153
+ * @param {function(err: ApiErrorResponse, res: DocumentInviteResponse) } [callback] - error first node.js callback
154
+ */
155
+ static invite ( {
156
+ id,
157
+ data,
158
+ options,
159
+ token,
160
+ } , callback ) {
161
+ this . duplicate ( {
162
+ id,
163
+ token,
164
+ } , ( err , res ) => {
165
+ if ( err ) {
166
+ callback ( err ) ;
167
+ return ;
168
+ } else {
169
+ const { id : documentId } = res ;
170
+
171
+ sendDocumentInvite ( {
172
+ id : documentId ,
173
+ data,
174
+ options,
175
+ token,
176
+ } , callback ) ;
177
+ }
178
+ } ) ;
179
+ }
180
+
145
181
}
146
182
147
183
module . exports = Template ;
You can’t perform that action at this time.
0 commit comments