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
65 changes: 41 additions & 24 deletions certified-connectors/DocuSignDemo/apiDefinition.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,20 @@
},
"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"
]
},
{
"name": "signers",
"in": "body",
Expand Down Expand Up @@ -1366,13 +1380,10 @@
"allUsers",
"allowEnvelopePublish",
"includeDocumentFields",
"includeEnvelopeVoidReason",
"includeTimeZoneInformation",
"requiresAcknowledgement",
"urlToPublishTo",
"name",
"envelopeEvents",
"includeSenderAccountasCustomField"
"envelopeEvents"
],
"type": "object",
"properties": {
Expand All @@ -1394,18 +1405,6 @@
"x-ms-summary": "includeDocumentFields",
"x-ms-visibility": "internal"
},
"includeEnvelopeVoidReason": {
"default": "true",
"type": "string",
"x-ms-summary": "includeEnvelopeVoidReason",
"x-ms-visibility": "internal"
},
"includeTimeZoneInformation": {
"default": "true",
"type": "string",
"x-ms-summary": "includeTimeZoneInformation",
"x-ms-visibility": "internal"
},
"requiresAcknowledgement": {
"default": "true",
"type": "string",
Expand Down Expand Up @@ -1434,12 +1433,6 @@
"type": "string",
"x-ms-summary": "Envelope event",
"x-ms-visibility": "important"
},
"includeSenderAccountasCustomField": {
"default": "true",
"type": "string",
"x-ms-summary": "includeSenderAccountasCustomField",
"x-ms-visibility": "internal"
}
}
},
Expand All @@ -1450,7 +1443,6 @@
"type": "object",
"properties": {
"envelopeSummary": {
"description": "EnvelopeStatus",
"type": "object",
"properties": {
"customFields": {
Expand Down Expand Up @@ -1488,9 +1480,34 @@
},
"emailSubject": {
"type": "string",
"x-ms-summary": "Subject",
"x-ms-summary": "Email Subject",
"x-ms-visibility": "important"
},
"sender": {
"type": "object",
"properties": {
"userName": {
"type": "string",
"x-ms-summary": "Sender's Name",
"x-ms-visibility": "important"
},
"userId": {
"type": "string",
"x-ms-summary": "Sender's User ID",
"x-ms-visibility": "important"
},
"accountId": {
"type": "string",
"x-ms-summary": "Sender's Account ID",
"x-ms-visibility": "important"
},
"email": {
"type": "string",
"x-ms-summary": "Sender's Email Address",
"x-ms-visibility": "important"
}
}
},
"recipients": {
"type": "object",
"properties": {
Expand Down
28 changes: 28 additions & 0 deletions certified-connectors/DocuSignDemo/script.csx
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,11 @@ public class Script : ScriptBase
["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/createFromTemplate", "/envelopes");
this.Context.Request.RequestUri = uriBuilder.Uri;
Expand Down Expand Up @@ -696,6 +701,15 @@ public class Script : ScriptBase
this.Context.Request.RequestUri = uriBuilder.Uri;
}

if ("GetFolderEnvelopeList".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
{
var uriBuilder = new UriBuilder(this.Context.Request.RequestUri);
var query = HttpUtility.ParseQueryString(this.Context.Request.RequestUri.Query);
query["include_items"] = "true";
uriBuilder.Query = query.ToString();
this.Context.Request.RequestUri = uriBuilder.Uri;
}

// update Accept Header
this.Context.Request.Headers.Accept.Clear();
var acceptHeaderValue = "application/json";
Expand Down Expand Up @@ -803,6 +817,20 @@ public class Script : ScriptBase
response.Headers.RetryAfter = new RetryConditionHeaderValue(TimeSpan.FromSeconds(120));
}

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

foreach (var folder in (body["folders"] as JArray) ?? new JArray())
{
newBody = folder as JObject;
break;
}

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

if (response.Content?.Headers?.ContentType != null)
{
if ("GetDocuments".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
Expand Down