Skip to content

Commit

Permalink
Merge pull request #11 from harshitav-docusign/Flow-367
Browse files Browse the repository at this point in the history
Flow 367: Get Recipient Tabs
  • Loading branch information
harshitav-docusign authored Apr 25, 2023
2 parents 93c1479 + 363b547 commit 950e722
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 5 deletions.
85 changes: 80 additions & 5 deletions certified-connectors/DocuSignDemo/apiDefinition.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@
"deprecated": false,
"x-ms-visibility": "important"
}
},
},
"/accounts/{accountId}/envelopes": {
"post": {
"tags": [
Expand Down Expand Up @@ -817,7 +817,7 @@
"x-ms-summary": "Email body",
"type":"string",
"x-ms-visibility": "advanced"
},
}
],
"responses": {
"201": {
Expand Down Expand Up @@ -1918,7 +1918,7 @@
}
},
"/accounts/{accountId}/envelopes/{envelopeId}/recipients/updateRecipient": {
"put": {
"put": {
"tags": [
"DocuSign"
],
Expand Down Expand Up @@ -2761,7 +2761,7 @@
"deprecated": false,
"x-ms-visibility": "advanced"
}
},
},
"/signers/accounts/{accountId}/templates/{templateId}/recipients": {
"get": {
"tags": [
Expand Down Expand Up @@ -2959,6 +2959,68 @@
"x-ms-visibility": "advanced"
}
},
"/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/recipientTabs": {
"get": {
"tags": [
"DocuSign"
],
"summary": "Get tabs for recipient",
"description": "Returns all the tabs for a given recipient",
"operationId": "GetRecipientTabs",
"consumes": [],
"produces": [
"application/json",
"text/json",
"application/xml",
"text/xml"
],
"parameters": [
{
"name": "accountId",
"in": "path",
"description": "Account id",
"required": true,
"x-ms-summary": "Account",
"x-ms-test-value": "insert account id",
"x-ms-dynamic-values": {
"operationId": "GetLoginAccounts",
"value-collection": "loginAccounts",
"value-path": "accountIdGuid",
"value-title": "name"
},
"type": "string"
},
{
"name": "envelopeId",
"in": "path",
"description": "Envelope id",
"required": true,
"x-ms-summary": "Envelope",
"x-ms-test-value": "insert envelope id",
"type": "string"
},
{
"name": "recipientId",
"in": "path",
"description": "Recipient id",
"required": true,
"x-ms-summary": "Recipient id",
"type": "string"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/RecipientTabsResponse"
}
}
},
"deprecated": false,
"x-ms-no-generic-test": true,
"x-ms-visibility": "advanced"
}
},
"/document_types": {
"get": {
"tags": [
Expand Down Expand Up @@ -4094,6 +4156,19 @@
}
}
},
"RecipientTabsResponse": {
"type": "object",
"properties": {
"recipientTabs": {
"description": "Recipient tab",
"type": "array",
"items": {
"$ref": "#/definitions/Tab"
},
"x-ms-summary": "Recipient Tab:"
}
}
},
"Signer": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -4390,7 +4465,7 @@
"type": "string",
"x-ms-summary": "Value",
"x-ms-visibility": "important"
}
}
}
},
"UpdateEnvelopeCustomFieldResponse": {
Expand Down
35 changes: 35 additions & 0 deletions certified-connectors/DocuSignDemo/script.csx
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,13 @@ public class Script : ScriptBase
this.Context.Request.RequestUri = uriBuilder.Uri;
}

if ("GetRecipientTabs".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
{
var uriBuilder = new UriBuilder(this.Context.Request.RequestUri);
uriBuilder.Path = uriBuilder.Path.Replace("/recipientTabs", "/tabs");
this.Context.Request.RequestUri = uriBuilder.Uri;
}

if ("ListEnvelopeDocuments".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
{
var uriBuilder = new UriBuilder(this.Context.Request.RequestUri);
Expand Down Expand Up @@ -1747,6 +1754,34 @@ public class Script : ScriptBase
response.Content = new StringContent(newBody.ToString(), Encoding.UTF8, "application/json");
}

if ("GetRecipientTabs".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
{
var body = ParseContentAsJObject(await response.Content.ReadAsStringAsync().ConfigureAwait(false), false);
JObject newBody = new JObject();
JArray recipientTabs = new JArray();

foreach(JProperty tabTypes in body.Properties())
{
foreach(var tab in tabTypes.Value)
{
recipientTabs.Add(new JObject()
{
["name"] = tab["name"],
["tabType"] = tab["tabType"],
["value"] = tab["value"],
["tabLabel"] = tab["tabLabel"],
["documentId"] = tab["documentId"],
["tabId"] = tab["tabId"],
["recipientId"] = tab["recipientId"]
});
}
}

newBody["recipientTabs"] = recipientTabs;
response.Content = new StringContent(newBody.ToString(), Encoding.UTF8, "application/json");
}


if ("GetRecipientFields".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
{
var body = ParseContentAsJObject(await response.Content.ReadAsStringAsync().ConfigureAwait(false), false);
Expand Down

0 comments on commit 950e722

Please sign in to comment.