Skip to content

Commit d2ea455

Browse files
Merge branch 'dev' into dev
2 parents ce5392d + a8bbc4f commit d2ea455

File tree

2 files changed

+252
-1
lines changed

2 files changed

+252
-1
lines changed

certified-connectors/DocuSignDemo/apiDefinition.swagger.json

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,154 @@
281281
"x-ms-no-generic-test": true
282282
}
283283
},
284+
"/accounts/{accountId}/envelopes/{envelopeId}/docGenFormFields": {
285+
"get": {
286+
"tags": [
287+
"DocuSign"
288+
],
289+
"summary": "Get envelope docgen form fields",
290+
"description": "Get the docgen fields from envelope documents.",
291+
"operationId": "GetDocgenFormFields",
292+
"consumes": [
293+
"application/json",
294+
"text/json",
295+
"application/xml",
296+
"text/xml",
297+
"application/x-www-form-urlencoded"
298+
],
299+
"produces": [
300+
"application/json",
301+
"text/json",
302+
"application/xml",
303+
"text/xml"
304+
],
305+
"parameters": [
306+
{
307+
"name": "accountId",
308+
"in": "path",
309+
"description": "Account id",
310+
"required": true,
311+
"x-ms-summary": "Account",
312+
"x-ms-test-value": "insert account id",
313+
"x-ms-dynamic-values": {
314+
"operationId": "GetLoginAccounts",
315+
"value-collection": "loginAccounts",
316+
"value-path": "accountIdGuid",
317+
"value-title": "name"
318+
},
319+
"type": "string"
320+
},
321+
{
322+
"name": "envelopeId",
323+
"in": "path",
324+
"description": "Envelope id",
325+
"required": true,
326+
"x-ms-summary": "Envelope",
327+
"x-ms-test-value": "insert envelope id",
328+
"type": "string"
329+
}
330+
],
331+
"responses": {
332+
"200": {
333+
"description": "default",
334+
"schema": {
335+
"$ref": "#/definitions/DocGenFormFieldsResponse"
336+
}
337+
}
338+
},
339+
"deprecated": false,
340+
"x-ms-no-generic-test": true,
341+
"x-ms-visibility": "important"
342+
},
343+
"put": {
344+
"tags": [
345+
"DocuSign"
346+
],
347+
"summary": "Update envelope docgen form fields",
348+
"description": "Update the docgen fields in envelope documents.",
349+
"operationId": "UpdateDocgenFormFields",
350+
"x-ms-no-generic-test": true,
351+
"consumes": [
352+
"application/json",
353+
"text/json",
354+
"application/xml",
355+
"text/xml",
356+
"application/x-www-form-urlencoded"
357+
],
358+
"produces": [
359+
"application/json",
360+
"text/json",
361+
"application/xml",
362+
"text/xml"
363+
],
364+
"parameters": [
365+
{
366+
"name": "accountId",
367+
"in": "path",
368+
"description": "Account id",
369+
"required": true,
370+
"x-ms-summary": "Account",
371+
"x-ms-test-value": "insert account id",
372+
"x-ms-dynamic-values": {
373+
"operationId": "GetLoginAccounts",
374+
"value-collection": "loginAccounts",
375+
"value-path": "accountIdGuid",
376+
"value-title": "name"
377+
},
378+
"type": "string"
379+
},
380+
{
381+
"name": "envelopeId",
382+
"in": "path",
383+
"description": "Envelope id",
384+
"required": true,
385+
"x-ms-summary": "Envelope",
386+
"x-ms-test-value": "insert envelope id",
387+
"type": "string"
388+
},
389+
{
390+
"name": "documentId",
391+
"in": "query",
392+
"description": "Document Id",
393+
"required": true,
394+
"x-ms-summary": "Document Id",
395+
"x-ms-test-value": "insert document id guid",
396+
"type": "string"
397+
},
398+
{
399+
"name": "body",
400+
"in": "body",
401+
"required": true,
402+
"schema": {
403+
"type": "array",
404+
"items": {
405+
"type": "object",
406+
"properties": {
407+
"name": {
408+
"type": "string",
409+
"x-ms-summary": "Name",
410+
"description": "Name"
411+
},
412+
"value": {
413+
"type": "string",
414+
"x-ms-summary": "Value",
415+
"description": "Value"
416+
}
417+
}
418+
},
419+
"x-ms-summary": "Field"
420+
}
421+
}
422+
],
423+
"responses": {
424+
"201": {
425+
"description": "OK"
426+
}
427+
},
428+
"deprecated": false,
429+
"x-ms-visibility": "important"
430+
}
431+
},
284432
"/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}": {
285433
"get": {
286434
"summary": "Get envelope documents",
@@ -4602,6 +4750,49 @@
46024750
}
46034751
}
46044752
},
4753+
"DocGenFormFieldsResponse": {
4754+
"type": "object",
4755+
"properties": {
4756+
"docgenFields": {
4757+
"description": "Docgen Fields",
4758+
"type": "array",
4759+
"items": {
4760+
"$ref": "#/definitions/DocGenFormField"
4761+
},
4762+
"x-ms-summary": "Docgen Fields"
4763+
}
4764+
}
4765+
},
4766+
"DocGenFormField": {
4767+
"type": "object",
4768+
"properties": {
4769+
"documentId": {
4770+
"description": "Document Id.",
4771+
"type": "string",
4772+
"x-ms-summary": "Document Id"
4773+
},
4774+
"label": {
4775+
"description": "Label.",
4776+
"type": "string",
4777+
"x-ms-summary": "Label"
4778+
},
4779+
"type": {
4780+
"description": "Type.",
4781+
"type": "string",
4782+
"x-ms-summary": "Type"
4783+
},
4784+
"name": {
4785+
"description": "Name.",
4786+
"type": "string",
4787+
"x-ms-summary": "Name"
4788+
},
4789+
"value": {
4790+
"description": "Value.",
4791+
"type": "string",
4792+
"x-ms-summary": "Value"
4793+
}
4794+
}
4795+
},
46054796
"RecipientTypesResponse": {
46064797
"type": "object",
46074798
"properties": {

certified-connectors/DocuSignDemo/script.csx

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public class Script : ScriptBase
263263
response["schema"]["properties"]["Build Number"] = new JObject
264264
{
265265
["type"] = "string",
266-
["x-ms-summary"] = "DS1001"
266+
["x-ms-summary"] = "DS1002"
267267
};
268268
}
269269

@@ -1470,6 +1470,37 @@ public class Script : ScriptBase
14701470
return body;
14711471
}
14721472

1473+
private async Task UpdateDocgenFormFieldsBodyTransformation()
1474+
{
1475+
var body = ParseContentAsJArray(await this.Context.Request.Content.ReadAsStringAsync().ConfigureAwait(false), true);
1476+
var query = HttpUtility.ParseQueryString(this.Context.Request.RequestUri.Query);
1477+
var fieldList = new JArray();
1478+
var documentId = query.Get("documentId");
1479+
1480+
foreach (var field in body)
1481+
{
1482+
fieldList.Add(new JObject
1483+
{
1484+
["name"] = field["name"],
1485+
["value"] = field["value"]
1486+
});
1487+
}
1488+
1489+
var docGenFormFields = new JArray
1490+
{
1491+
new JObject
1492+
{
1493+
["documentId"] = documentId,
1494+
["docGenFormFieldList"] = fieldList
1495+
},
1496+
};
1497+
1498+
var newBody = new JObject();
1499+
newBody["docGenFormFields"] = docGenFormFields;
1500+
1501+
this.Context.Request.Content = CreateJsonContent(newBody.ToString());
1502+
}
1503+
14731504
private async Task UpdateApiEndpoint()
14741505
{
14751506
string content = string.Empty;
@@ -1641,6 +1672,11 @@ public class Script : ScriptBase
16411672
await this.UpdateEnvelopePrefillTabsBodyTransformation().ConfigureAwait(false);
16421673
}
16431674

1675+
if ("UpdateDocgenFormFields".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
1676+
{
1677+
await this.UpdateDocgenFormFieldsBodyTransformation().ConfigureAwait(false);
1678+
}
1679+
16441680
if ("RemoveRecipientFromEnvelope".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
16451681
{
16461682
var newBody = new JObject();
@@ -1936,6 +1972,30 @@ public class Script : ScriptBase
19361972
response.Content = new StringContent(newBody.ToString(), Encoding.UTF8, "application/json");
19371973
}
19381974

1975+
if ("GetDocgenFormFields".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
1976+
{
1977+
var body = ParseContentAsJObject(await response.Content.ReadAsStringAsync().ConfigureAwait(false), false);
1978+
JObject newBody = new JObject();
1979+
JArray formFields = new JArray();
1980+
1981+
foreach (var doc in (body["docGenFormFields"] as JArray) ?? new JArray())
1982+
{
1983+
foreach(var field in (doc["docGenFormFieldList"] as JArray) ?? new JArray())
1984+
{
1985+
formFields.Add(new JObject()
1986+
{
1987+
["name"] = field["name"],
1988+
["type"] = field["type"],
1989+
["value"] = field["value"],
1990+
["label"] = field["label"],
1991+
["documentId"] = doc["documentId"]
1992+
});
1993+
}
1994+
}
1995+
1996+
newBody["docgenFields"] = formFields;
1997+
response.Content = new StringContent(newBody.ToString(), Encoding.UTF8, "application/json");
1998+
}
19391999

19402000
if ("GetRecipientFields".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
19412001
{

0 commit comments

Comments
 (0)