Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 169 additions & 13 deletions certified-connectors/DocuSignDemo/apiDefinition.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,58 @@
"x-ms-visibility": "advanced"
}
},
"/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/tabs": {
"get": {
"summary": "Get envelope document tabs",
"description": "Get envelope document tabs.",
"operationId": "GetEnvelopeDocumentTabs",
"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": "documentId",
"in": "path",
"description": "Document id",
"required": true,
"x-ms-summary": "Document id",
"x-ms-test-value": "insert document id",
"type": "string"
}
],
"responses": {
"200": {
"description": "default",
"schema": {
"$ref": "#/definitions/ListTabsResponse"
}
}
},
"deprecated": false,
"x-ms-visibility": "advanced"
}
},
"/trigger/accounts/{accountId}/envelopes": {
"get": {
"tags": [
Expand Down Expand Up @@ -589,13 +641,88 @@
"x-ms-visibility": "important"
}
},
"/accounts/{accountId}/envelopes": {
"/accounts/{accountId}/envelopes/createFromTemplateNoRecipients": {
"post": {
"tags": [
"DocuSign"
],
"summary": "Create envelope using template",
"description": "Create a new envelope using a specified template.",
"operationId": "CreateEnvelopeFromTemplateNoRecipients",
"x-ms-no-generic-test": true,
"consumes": [
"application/json",
"text/json",
"application/xml",
"text/xml",
"application/x-www-form-urlencoded"
],
"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": "templateId",
"in": "query",
"description": "Template id",
"required": true,
"x-ms-summary": "Template id",
"x-ms-test-value": "insert template id",
"x-ms-visibility": "important",
"type": "string"
},
{
"name": "status",
"in": "query",
"description": "Envelope status",
"required": true,
"x-ms-summary": "Envelope status",
"x-ms-test-value": "Created",
"x-ms-visibility": "important",
"type": "string",
"enum": [
"Sent",
"Created"
]
}
],
"responses": {
"201": {
"description": "OK",
"schema": {
"$ref": "#/definitions/CreateEnvelopeResponse"
}
}
},
"deprecated": false,
"x-ms-visibility": "important"
}
},
"/accounts/{accountId}/envelopes": {
"post": {
"tags": [
"DocuSign"
],
"summary": "Create envelope using template with recipients",
"description": "Create a new envelope using a specified template and specify recipients.",
"operationId": "SendEnvelope",
"x-ms-no-generic-test": true,
"consumes": [
Expand Down Expand Up @@ -690,7 +817,6 @@
"x-ms-summary": "Email body",
"type":"string",
"x-ms-visibility": "advanced"

},
],
"responses": {
Expand Down Expand Up @@ -3931,23 +4057,40 @@
"Tab": {
"type": "object",
"properties": {
"tabLabel": {
"description": "The label of the tab",
"name": {
"description": "The name of the tab.",
"type": "string",
"x-ms-summary": "Tab label",
"x-ms-visibility": "important"
"x-ms-summary": "Tab Name"
},
"name": {
"description": "The name of the tab",
"tabType": {
"description": "The type of the tab.",
"type": "string",
"x-ms-summary": "Name",
"x-ms-visibility": "important"
"x-ms-summary": "Tab Type"
},
"tabLabel": {
"description": "The label of the tab.",
"type": "string",
"x-ms-summary": "Tab Label"
},
"value": {
"description": "The value of the tab",
"description": "The value of the tab.",
"type": "string",
"x-ms-summary": "Value",
"x-ms-visibility": "important"
"x-ms-summary": "Tab Value"
},
"tabId": {
"description": "The id of the tab.",
"type": "string",
"x-ms-summary": "Tab Id"
},
"documentId": {
"description": "The id of the document.",
"type": "string",
"x-ms-summary": "Document Id"
},
"recipientId": {
"description": "The id of the recipient.",
"type": "string",
"x-ms-summary": "Recipient Id"
}
}
},
Expand Down Expand Up @@ -4071,6 +4214,19 @@
}
}
},
"ListTabsResponse": {
"type": "object",
"properties": {
"tabs": {
"description": "Tabs",
"type": "array",
"items": {
"$ref": "#/definitions/Tab"
},
"x-ms-summary": "Tabs"
}
}
},
"RecipientTypesResponse": {
"type": "object",
"properties": {
Expand Down
56 changes: 56 additions & 0 deletions certified-connectors/DocuSignDemo/script.csx
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,29 @@ public class Script : ScriptBase
return newBody;
}

private JObject CreateEnvelopeFromTemplateNoRecipientsBodyTransformation(JObject body)
{
var templateRoles = new JArray();
var signer = new JObject();
var query = HttpUtility.ParseQueryString(this.Context.Request.RequestUri.Query);

var newBody = new JObject()
{
["templateId"] = query.Get("templateId")
};

if (!string.IsNullOrEmpty(query.Get("status")))
{
newBody["status"] = query.Get("status");
}

var uriBuilder = new UriBuilder(this.Context.Request.RequestUri);
uriBuilder.Path = uriBuilder.Path.Replace("/envelopes/createFromTemplateNoRecipients", "/envelopes");
this.Context.Request.RequestUri = uriBuilder.Uri;

return newBody;
}

private JObject UpdateEnvelopeCustomFieldBodyTransformation(JObject body)
{
var query = HttpUtility.ParseQueryString(this.Context.Request.RequestUri.Query);
Expand Down Expand Up @@ -1472,6 +1495,11 @@ public class Script : ScriptBase
await this.TransformRequestJsonBody(this.CreateEnvelopeFromTemplateV2BodyTransformation).ConfigureAwait(false);
}

if ("CreateEnvelopeFromTemplateNoRecipients".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
{
await this.TransformRequestJsonBody(this.CreateEnvelopeFromTemplateNoRecipientsBodyTransformation).ConfigureAwait(false);
}

if ("AddRecipientToEnvelope".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
{
await this.TransformRequestJsonBody(this.AddRecipientToEnvelopeBodyTransformation).ConfigureAwait(false);
Expand Down Expand Up @@ -1662,6 +1690,34 @@ public class Script : ScriptBase
body["workflowIds"] = workflowsArray;
response.Content = new StringContent(body.ToString(), Encoding.UTF8, "application/json");
}

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

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

newBody["tabs"] = tabs;

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

if ("GetTabInfo".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
{
Expand Down