Skip to content

Commit c3c02c3

Browse files
Merge pull request #19 from harshitav-docusign/Flow-386
Flow 386: Update envelope recipient tabs
2 parents f541c0a + 781ba7e commit c3c02c3

File tree

2 files changed

+120
-1
lines changed

2 files changed

+120
-1
lines changed

certified-connectors/DocuSignDemo/apiDefinition.swagger.json

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@
476476
}
477477
}
478478
},
479-
"x-ms-summary": "Tab"
479+
"x-ms-summary": "Tab"
480480
}
481481
}
482482
],
@@ -3154,6 +3154,91 @@
31543154
"deprecated": false,
31553155
"x-ms-no-generic-test": true,
31563156
"x-ms-visibility": "advanced"
3157+
},
3158+
"put": {
3159+
"tags": [
3160+
"DocuSign"
3161+
],
3162+
"summary": "Update envelope recipient tabs values",
3163+
"description": "Updates one or more tabs for a recipient in a draft envelope.",
3164+
"operationId": "UpdateRecipientTabsValues",
3165+
"parameters": [
3166+
{
3167+
"name": "accountId",
3168+
"in": "path",
3169+
"description": "Account id",
3170+
"required": true,
3171+
"x-ms-summary": "Account",
3172+
"x-ms-test-value": "insert account id",
3173+
"x-ms-dynamic-values": {
3174+
"operationId": "GetLoginAccounts",
3175+
"value-collection": "loginAccounts",
3176+
"value-path": "accountIdGuid",
3177+
"value-title": "name"
3178+
},
3179+
"type": "string"
3180+
},
3181+
{
3182+
"name": "envelopeId",
3183+
"in": "path",
3184+
"required": true,
3185+
"type": "string",
3186+
"description": "Envelope id",
3187+
"x-ms-summary": "Envelope",
3188+
"x-ms-test-value": "insert envelope id"
3189+
},
3190+
{
3191+
"name": "recipientId",
3192+
"in": "path",
3193+
"required": true,
3194+
"type": "string",
3195+
"description": "Recipient id",
3196+
"x-ms-summary": "Recipient",
3197+
"x-ms-test-value": "insert recipient id"
3198+
},
3199+
{
3200+
"name": "body",
3201+
"in": "body",
3202+
"required": true,
3203+
"schema": {
3204+
"type": "array",
3205+
"items": {
3206+
"type": "object",
3207+
"properties": {
3208+
"tabType": {
3209+
"enum": [
3210+
"Text",
3211+
"Note"
3212+
],
3213+
"type": "string",
3214+
"description": "Tab type",
3215+
"x-ms-summary": "Type",
3216+
"x-ms-test-value": "select tab type"
3217+
},
3218+
"tabId": {
3219+
"type": "string",
3220+
"x-ms-summary": "Id",
3221+
"description": "Id"
3222+
},
3223+
"value": {
3224+
"type": "string",
3225+
"x-ms-summary": "Value",
3226+
"description": "Value"
3227+
}
3228+
}
3229+
},
3230+
"x-ms-summary": "Tab"
3231+
}
3232+
}
3233+
],
3234+
"responses": {
3235+
"200": {
3236+
"description": "OK"
3237+
}
3238+
},
3239+
"deprecated": false,
3240+
"x-ms-visibility": "important",
3241+
"x-ms-no-generic-test": true
31573242
}
31583243
},
31593244
"/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/recipientTabs": {

certified-connectors/DocuSignDemo/script.csx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,35 @@ public class Script : ScriptBase
14171417

14181418
body["documents"] = documents;
14191419
return body;
1420+
}
1421+
1422+
private async Task UpdateRecipientTabsValuesBodyTransformation()
1423+
{
1424+
var body = ParseContentAsJArray(await this.Context.Request.Content.ReadAsStringAsync().ConfigureAwait(false), true);
1425+
var tabs = new JObject();
1426+
1427+
var tabsMap = new Dictionary<string, string>() {
1428+
{ "Text", "textTabs" },
1429+
{ "Note", "noteTabs" },
1430+
};
1431+
1432+
foreach (var tab in body)
1433+
{
1434+
var tabType = tab["tabType"].ToString();
1435+
tabType = tabsMap.ContainsKey(tabType) ? tabsMap[tabType] : tabType;
1436+
var tabsForType = tabs[tabType] as JArray ?? new JArray();
1437+
1438+
tabsForType.Add(new JObject
1439+
{
1440+
["tabId"] = tab["tabId"],
1441+
["value"] = tab["value"]
1442+
});
1443+
1444+
tabs[tabType] = tabsForType;
1445+
}
1446+
1447+
var newBody = tabs;
1448+
this.Context.Request.Content = CreateJsonContent(newBody.ToString());
14201449
}
14211450

14221451
private JObject AddRecipientTabsBodyTransformation(JObject body)
@@ -1602,6 +1631,11 @@ public class Script : ScriptBase
16021631
await this.TransformRequestJsonBody(this.AddRecipientTabsBodyTransformation).ConfigureAwait(false);
16031632
}
16041633

1634+
if ("UpdateRecipientTabsValues".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
1635+
{
1636+
await this.UpdateRecipientTabsValuesBodyTransformation().ConfigureAwait(false);
1637+
}
1638+
16051639
if ("UpdateEnvelopePrefillTabs".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
16061640
{
16071641
await this.UpdateEnvelopePrefillTabsBodyTransformation().ConfigureAwait(false);

0 commit comments

Comments
 (0)