diff --git a/ExamplesAPIType.cs b/ExamplesAPIType.cs index 3755493a..ba05e560 100644 --- a/ExamplesAPIType.cs +++ b/ExamplesAPIType.cs @@ -67,6 +67,12 @@ public enum ExamplesApiType /// ")] [Description("mae")] Maestro = 9, + + /// + /// Workflows + /// ")] + [Description("work")] + Workspaces = 10, } public static class ExamplesApiTypeExtensions diff --git a/ExamplesApiTypeExtensions.cs b/ExamplesApiTypeExtensions.cs index b02f497b..8c616c57 100644 --- a/ExamplesApiTypeExtensions.cs +++ b/ExamplesApiTypeExtensions.cs @@ -73,6 +73,12 @@ public enum ExamplesApiType /// ")] [Description("mae")] Maestro = 10, + + /// + /// Workflows + /// ")] + [Description("work")] + Workspaces = 11, } public static class ExamplesApiTypeExtensions diff --git a/JWTAuth.cs b/JWTAuth.cs index f0acbb71..e07ee1fb 100644 --- a/JWTAuth.cs +++ b/JWTAuth.cs @@ -58,6 +58,18 @@ public static OAuthToken AuthenticateWithJwt(string api, string clientId, string }); } + if (apiType == ExamplesApiType.Workspaces) + { + scopes.AddRange(new List + { + "impersonation", + "dtr.company.read", + "dtr.rooms.read", + "dtr.rooms.write", + "dtr.documents.write", + }); + } + if (apiType == ExamplesApiType.Monitor) { scopes.AddRange(new List diff --git a/launcher-csharp/Common/IRequestItemsService.cs b/launcher-csharp/Common/IRequestItemsService.cs index a611c32f..9fb6d162 100644 --- a/launcher-csharp/Common/IRequestItemsService.cs +++ b/launcher-csharp/Common/IRequestItemsService.cs @@ -42,6 +42,10 @@ public interface IRequestItemsService public string WorkflowId { get; set; } + public string WorkspaceId { get; set; } + + public string WorkspaceDocumentId { get; set; } + public bool IsWorkflowPublished { get; set; } public string InstanceId { get; set; } diff --git a/launcher-csharp/Common/RequestItemsService.cs b/launcher-csharp/Common/RequestItemsService.cs index a6867160..68ea2af0 100644 --- a/launcher-csharp/Common/RequestItemsService.cs +++ b/launcher-csharp/Common/RequestItemsService.cs @@ -162,6 +162,18 @@ public string WorkflowId set => this.cache.Set(this.GetKey("WorkflowId"), value); } + public string WorkspaceId + { + get => this.cache.Get(this.GetKey("WorkspaceId")); + set => this.cache.Set(this.GetKey("WorkspaceId"), value); + } + + public string WorkspaceDocumentId + { + get => this.cache.Get(this.GetKey("WorkspaceDocumentId")); + set => this.cache.Set(this.GetKey("WorkspaceDocumentId"), value); + } + public bool IsWorkflowPublished { get => this.cache.Get(this.GetKey("WorkflowPublished")); @@ -309,6 +321,10 @@ public string IdentifyApiOfCodeExample(string eg) { currentApiType = ExamplesApiType.Maestro.ToString(); } + else if (eg.Contains(ExamplesApiType.Workspaces.ToKeywordString())) + { + currentApiType = ExamplesApiType.Workspaces.ToString(); + } else { currentApiType = ExamplesApiType.ESignature.ToString(); diff --git a/launcher-csharp/Maestro/Views/Mae002PauseWorkflow/mae002.cshtml b/launcher-csharp/Maestro/Views/Mae002PauseWorkflow/mae002.cshtml index 5feae78e..3ef3fda0 100644 --- a/launcher-csharp/Maestro/Views/Mae002PauseWorkflow/mae002.cshtml +++ b/launcher-csharp/Maestro/Views/Mae002PauseWorkflow/mae002.cshtml @@ -13,7 +13,7 @@ @Html.Raw( @String.Format( ViewBag.SupportingTexts.ViewSourceFile, - "TriggerWorkflow.cs" + "PauseWorkflow.cs" ) )

diff --git a/launcher-csharp/Maestro/Views/Mae003ResumeWorkflow/mae003.cshtml b/launcher-csharp/Maestro/Views/Mae003ResumeWorkflow/mae003.cshtml index beabca88..eb162007 100644 --- a/launcher-csharp/Maestro/Views/Mae003ResumeWorkflow/mae003.cshtml +++ b/launcher-csharp/Maestro/Views/Mae003ResumeWorkflow/mae003.cshtml @@ -13,7 +13,7 @@ @Html.Raw( @String.Format( ViewBag.SupportingTexts.ViewSourceFile, - "TriggerWorkflow.cs" + "ResumeWorkflow.cs" ) )

diff --git a/launcher-csharp/Maestro/Views/Mae004CancelWorkflowInstance/mae004.cshtml b/launcher-csharp/Maestro/Views/Mae004CancelWorkflowInstance/mae004.cshtml index beabca88..0c8d61da 100644 --- a/launcher-csharp/Maestro/Views/Mae004CancelWorkflowInstance/mae004.cshtml +++ b/launcher-csharp/Maestro/Views/Mae004CancelWorkflowInstance/mae004.cshtml @@ -13,7 +13,7 @@ @Html.Raw( @String.Format( ViewBag.SupportingTexts.ViewSourceFile, - "TriggerWorkflow.cs" + "CancelWorkflowInstance.cs" ) )

diff --git a/launcher-csharp/Startup.cs b/launcher-csharp/Startup.cs index cb08143f..d4ec8a3c 100644 --- a/launcher-csharp/Startup.cs +++ b/launcher-csharp/Startup.cs @@ -58,6 +58,15 @@ public Startup(IConfiguration configuration) this.apiTypes.Add(ExamplesApiType.Maestro, new List { "signature", "aow_manage" }); + this.apiTypes.Add(ExamplesApiType.Workspaces, new List + { + "signature", + "dtr.company.read", + "dtr.rooms.read", + "dtr.rooms.write", + "dtr.documents.write", + }); + this.apiTypes.Add(ExamplesApiType.Click, new List { "click.manage", diff --git a/launcher-csharp/Terms_of_service.pdf b/launcher-csharp/Terms_of_service.pdf index 8113d33d..d8b3e1dc 100644 Binary files a/launcher-csharp/Terms_of_service.pdf and b/launcher-csharp/Terms_of_service.pdf differ diff --git a/launcher-csharp/Views/Home/Index.cshtml b/launcher-csharp/Views/Home/Index.cshtml index 07b45094..07d86b81 100644 --- a/launcher-csharp/Views/Home/Index.cshtml +++ b/launcher-csharp/Views/Home/Index.cshtml @@ -46,6 +46,7 @@ : ((ApIs) api).Name.ToLower() == ExamplesApiType.Notary.ToString().ToLower() ? ExamplesApiType.Notary.ToKeywordString() : ((ApIs) api).Name.ToLower() == ExamplesApiType.ConnectedFields.ToString().ToLower() ? ExamplesApiType.ConnectedFields.ToKeywordString() : ((ApIs) api).Name.ToLower() == ExamplesApiType.Navigator.ToString().ToLower() ? ExamplesApiType.Navigator.ToKeywordString() + : ((ApIs) api).Name.ToLower() == ExamplesApiType.Workspaces.ToString().ToLower() ? ExamplesApiType.Workspaces.ToKeywordString() : ExamplesApiType.Admin.ToKeywordString(); @foreach(var exampleGroup in api.Groups) diff --git a/launcher-csharp/Workspaces/Controllers/Work001CreateWorkspace.cs b/launcher-csharp/Workspaces/Controllers/Work001CreateWorkspace.cs new file mode 100644 index 00000000..54bb875d --- /dev/null +++ b/launcher-csharp/Workspaces/Controllers/Work001CreateWorkspace.cs @@ -0,0 +1,57 @@ +// +// Copyright (c) Docusign. All rights reserved. +// + +namespace DocuSign.CodeExamples.Controllers +{ + using DocuSign.CodeExamples.Common; + using DocuSign.CodeExamples.Examples; + using DocuSign.CodeExamples.Models; + using Microsoft.AspNetCore.Mvc; + using Newtonsoft.Json; + + [Area("Workspaces")] + [Route("work001")] + public class Work001CreateWorkspace : EgController + { + public Work001CreateWorkspace(DsConfiguration dsConfig, + LauncherTexts launcherTexts, + IRequestItemsService requestItemsService) + : base(dsConfig, launcherTexts, requestItemsService) + { + this.CodeExampleText = this.GetExampleText(this.EgName, ExamplesApiType.Workspaces); + this.ViewBag.title = this.CodeExampleText.ExampleName; + } + + public override string EgName => "work001"; + + [HttpPost] + [SetViewBag] + public IActionResult Create(string workspaceName) + { + bool tokenOk = this.CheckToken(3); + if (!tokenOk) + { + this.RequestItemsService.EgName = this.EgName; + return this.Redirect("/ds/mustAuthenticate"); + } + + var accessToken = this.RequestItemsService.User.AccessToken; + var accountId = this.RequestItemsService.Session.AccountId; + + var createWorkspaceResponse = CreateWorkspace.CreateWorkspaceAsync( + accessToken, + accountId, + workspaceName); + + this.RequestItemsService.WorkspaceId = createWorkspaceResponse.Result.WorkspaceId; + + this.ViewBag.h1 = this.CodeExampleText.ExampleName; + this.ViewBag.message = string.Format( + this.CodeExampleText.ResultsPageText, + createWorkspaceResponse.Result.WorkspaceId); + this.ViewBag.Locals.Json = JsonConvert.SerializeObject(createWorkspaceResponse.Result, Formatting.Indented); + return this.View("example_done"); + } + } +} diff --git a/launcher-csharp/Workspaces/Controllers/Work002AddDocumentToWorkspace.cs b/launcher-csharp/Workspaces/Controllers/Work002AddDocumentToWorkspace.cs new file mode 100644 index 00000000..09ce94a5 --- /dev/null +++ b/launcher-csharp/Workspaces/Controllers/Work002AddDocumentToWorkspace.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Docusign. All rights reserved. +// + +namespace DocuSign.CodeExamples.Controllers +{ + using DocuSign.CodeExamples.Common; + using DocuSign.CodeExamples.Examples; + using DocuSign.CodeExamples.Models; + using Microsoft.AspNetCore.Mvc; + using Newtonsoft.Json; + + [Area("Workspaces")] + [Route("work002")] + public class Work002AddDocumentToWorkspace : EgController + { + public Work002AddDocumentToWorkspace(DsConfiguration dsConfig, + LauncherTexts launcherTexts, + IRequestItemsService requestItemsService) + : base(dsConfig, launcherTexts, requestItemsService) + { + this.CodeExampleText = this.GetExampleText(this.EgName, ExamplesApiType.Workspaces); + this.ViewBag.title = this.CodeExampleText.ExampleName; + } + + public override string EgName => "work002"; + + [MustAuthenticate] + [HttpGet] + public override IActionResult Get() + { + IActionResult actionResult = base.Get(); + if (this.RequestItemsService.EgName == this.EgName) + { + return actionResult; + } + + this.ViewBag.WorkspaceIdOk = this.RequestItemsService.WorkspaceId != null; + + return this.View("work002", this); + } + + [HttpPost] + [SetViewBag] + public IActionResult Create(string documentName, string documentPath) + { + bool tokenOk = this.CheckToken(3); + if (!tokenOk) + { + this.RequestItemsService.EgName = this.EgName; + return this.Redirect("/ds/mustAuthenticate"); + } + + var accessToken = this.RequestItemsService.User.AccessToken; + var accountId = this.RequestItemsService.Session.AccountId; + var workspaceId = this.RequestItemsService.WorkspaceId; + + var documentResponse = AddDocumentToWorkspaces.AddDocumentToWorkspaceAsync( + accessToken, + accountId, + workspaceId, + documentName, + documentPath); + + this.RequestItemsService.WorkspaceDocumentId = documentResponse.Result.DocumentId; + + this.ViewBag.h1 = this.CodeExampleText.ExampleName; + this.ViewBag.message = string.Format( + this.CodeExampleText.ResultsPageText, + documentResponse.Result.DocumentId); + this.ViewBag.Locals.Json = JsonConvert.SerializeObject(documentResponse.Result, Formatting.Indented); + return this.View("example_done"); + } + } +} diff --git a/launcher-csharp/Workspaces/Controllers/Work003SendEnvelopeWithRecipientInfo.cs b/launcher-csharp/Workspaces/Controllers/Work003SendEnvelopeWithRecipientInfo.cs new file mode 100644 index 00000000..927f04ee --- /dev/null +++ b/launcher-csharp/Workspaces/Controllers/Work003SendEnvelopeWithRecipientInfo.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Docusign. All rights reserved. +// + +namespace DocuSign.CodeExamples.Controllers +{ + using DocuSign.CodeExamples.Common; + using DocuSign.CodeExamples.Examples; + using DocuSign.CodeExamples.Models; + using Microsoft.AspNetCore.Mvc; + using Newtonsoft.Json; + + [Area("Workspaces")] + [Route("work003")] + public class Work003SendEnvelopeWithRecipientInfo : EgController + { + public Work003SendEnvelopeWithRecipientInfo(DsConfiguration dsConfig, + LauncherTexts launcherTexts, + IRequestItemsService requestItemsService) + : base(dsConfig, launcherTexts, requestItemsService) + { + this.CodeExampleText = this.GetExampleText(this.EgName, ExamplesApiType.Workspaces); + this.ViewBag.title = this.CodeExampleText.ExampleName; + } + + public override string EgName => "work003"; + + [MustAuthenticate] + [HttpGet] + public override IActionResult Get() + { + IActionResult actionResult = base.Get(); + if (this.RequestItemsService.EgName == this.EgName) + { + return actionResult; + } + + this.ViewBag.WorkspaceIdOk = this.RequestItemsService.WorkspaceId != null; + this.ViewBag.DocumentIdOk = this.RequestItemsService.WorkspaceDocumentId != null; + + return this.View("work003", this); + } + + [HttpPost] + [SetViewBag] + public IActionResult Create(string signerEmail, string signerName) + { + bool tokenOk = this.CheckToken(3); + if (!tokenOk) + { + this.RequestItemsService.EgName = this.EgName; + return this.Redirect("/ds/mustAuthenticate"); + } + + var accessToken = this.RequestItemsService.User.AccessToken; + var basePath = this.RequestItemsService.Session.BasePath + "/restapi"; + var accountId = this.RequestItemsService.Session.AccountId; + var documentId = this.RequestItemsService.WorkspaceDocumentId; + var workspaceId = this.RequestItemsService.WorkspaceId; + + var workspaceEnvelope = SendEnvelopeWithRecipientInfo.CreateEnvelopeAsync( + accessToken, + accountId, + documentId, + workspaceId); + var envelopeId = workspaceEnvelope.Result.EnvelopeId; + + var results = SendEnvelopeWithRecipientInfo.SendEnvelopeAsync( + basePath, + accessToken, + accountId, + envelopeId, + signerEmail, + signerName); + + this.ViewBag.h1 = this.CodeExampleText.ExampleName; + this.ViewBag.message = string.Format(this.CodeExampleText.ResultsPageText, envelopeId); + return this.View("example_done"); + } + } +} diff --git a/launcher-csharp/Workspaces/Examples/AddDocumentToWorkspaces.cs b/launcher-csharp/Workspaces/Examples/AddDocumentToWorkspaces.cs new file mode 100644 index 00000000..2a13e98f --- /dev/null +++ b/launcher-csharp/Workspaces/Examples/AddDocumentToWorkspaces.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Docusign. All rights reserved. +// + +namespace DocuSign.CodeExamples.Examples +{ + using System.IO; + using System.Threading.Tasks; + using Docusign.IAM.SDK; + using Docusign.IAM.SDK.Models.Components; + + public static class AddDocumentToWorkspaces + { + public static async Task AddDocumentToWorkspaceAsync( + string accessToken, + string accountId, + string workspaceId, + string documentName, + string documentPath) + { + //ds-snippet-start:Workspaces2Step2 + var client = CreateAuthenticatedClient(accessToken); + //ds-snippet-end:Workspaces2Step2 + + byte[] fileBytes = File.ReadAllBytes(documentPath); + + //ds-snippet-start:Workspaces2Step3 + var addWorkspaceDocumentRequest = new AddWorkspaceDocumentRequest + { + File = new AddWorkspaceDocumentRequestFile + { + FileName = documentName, + Content = fileBytes, + }, + }; + //ds-snippet-end:Workspaces2Step3 + + //ds-snippet-start:Workspaces2Step4 + return await client.Workspaces.WorkspaceDocuments.AddWorkspaceDocumentAsync( + accountId, + workspaceId, + addWorkspaceDocumentRequest); + //ds-snippet-end:Workspaces2Step4 + } + + private static IamClient CreateAuthenticatedClient(string accessToken) + { + return IamClient.Builder() + .WithAccessToken(accessToken) + .Build(); + } + } +} diff --git a/launcher-csharp/Workspaces/Examples/CreateWorkspace.cs b/launcher-csharp/Workspaces/Examples/CreateWorkspace.cs new file mode 100644 index 00000000..1ae8d5e8 --- /dev/null +++ b/launcher-csharp/Workspaces/Examples/CreateWorkspace.cs @@ -0,0 +1,40 @@ +// +// Copyright (c) Docusign. All rights reserved. +// + +namespace DocuSign.CodeExamples.Examples +{ + using System.Threading.Tasks; + using Docusign.IAM.SDK; + using Docusign.IAM.SDK.Models.Components; + + public static class CreateWorkspace + { + public static async Task CreateWorkspaceAsync( + string accessToken, + string accountId, + string workspaceName) + { + //ds-snippet-start:Workspaces1Step2 + var client = CreateAuthenticatedClient(accessToken); + //ds-snippet-end:Workspaces1Step2 + + //ds-snippet-start:Workspaces1Step3 + var createWorkspaceBody = new CreateWorkspaceBody + { + Name = workspaceName, + }; + //ds-snippet-end:Workspaces1Step3 + //ds-snippet-start:Workspaces1Step4 + return await client.Workspaces.Workspaces.CreateWorkspaceAsync(accountId, createWorkspaceBody); + //ds-snippet-end:Workspaces1Step4 + } + + private static IamClient CreateAuthenticatedClient(string accessToken) + { + return IamClient.Builder() + .WithAccessToken(accessToken) + .Build(); + } + } +} diff --git a/launcher-csharp/Workspaces/Examples/SendEnvelopeWithRecipientInfo.cs b/launcher-csharp/Workspaces/Examples/SendEnvelopeWithRecipientInfo.cs new file mode 100644 index 00000000..34bf0487 --- /dev/null +++ b/launcher-csharp/Workspaces/Examples/SendEnvelopeWithRecipientInfo.cs @@ -0,0 +1,118 @@ +// +// Copyright (c) Docusign. All rights reserved. +// + +namespace DocuSign.CodeExamples.Examples +{ + using System.Collections.Generic; + using System.Threading.Tasks; + using DocuSign.eSign.Api; + using DocuSign.eSign.Model; + using Docusign.IAM.SDK; + using Docusign.IAM.SDK.Models.Components; + + public static class SendEnvelopeWithRecipientInfo + { + public static async Task CreateEnvelopeAsync( + string accessToken, + string accountId, + string documentId, + string workspaceId) + { + //ds-snippet-start:Workspaces3Step2 + var client = CreateAuthenticatedClient(accessToken); + //ds-snippet-end:Workspaces3Step2 + + //ds-snippet-start:Workspaces3Step3 + var workspaceEnvelopeForCreate = new WorkspaceEnvelopeForCreate + { + EnvelopeName = "Example Workspace Envelope", + DocumentIds = new List { documentId }, + }; + //ds-snippet-end:Workspaces3Step3 + + //ds-snippet-start:Workspaces3Step4 + return await client.Workspaces.Workspaces.CreateWorkspaceEnvelopeAsync( + accountId, + workspaceId, + workspaceEnvelopeForCreate); + //ds-snippet-end:Workspaces3Step4 + } + + //ds-snippet-start:Workspaces3Step6 + public static async Task SendEnvelopeAsync( + string basePath, + string accessToken, + string accountId, + string envelopeId, + string signerEmail, + string signerName) + { + var apiClient = new eSign.Client.DocuSignClient(basePath); + apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken); + + var envelopesApi = new EnvelopesApi(apiClient); + var envelope = MakeEnvelope(signerEmail, signerName); + + return await envelopesApi.UpdateAsync( + accountId, + envelopeId, + new Envelope + { + EnvelopeId = envelopeId, + Status = envelope.Status, + Recipients = envelope.Recipients, + }); + } + + //ds-snippet-end:Workspaces3Step6 + + //ds-snippet-start:Workspaces3Step5 + private static EnvelopeDefinition MakeEnvelope(string signerEmail, string signerName) + { + var signHere = new SignHere + { + AnchorString = "/sn1/", + AnchorUnits = "pixels", + AnchorXOffset = "20", + AnchorYOffset = "10", + }; + + var tabs = new Tabs + { + SignHereTabs = new List { signHere }, + }; + + var signer = new Signer + { + Email = signerEmail, + Name = signerName, + RecipientId = "1", + RoutingOrder = "1", + Tabs = tabs, + }; + + var recipients = new Recipients + { + Signers = new List { signer }, + }; + + var envelopeDefinition = new EnvelopeDefinition + { + EmailSubject = "Please sign this document", + Recipients = recipients, + Status = "sent", + }; + + return envelopeDefinition; + } + + //ds-snippet-end:Workspaces3Step5 + private static IamClient CreateAuthenticatedClient(string accessToken) + { + return IamClient.Builder() + .WithAccessToken(accessToken) + .Build(); + } + } +} diff --git a/launcher-csharp/Workspaces/Views/Work001CreateWorkspace/work001.cshtml b/launcher-csharp/Workspaces/Views/Work001CreateWorkspace/work001.cshtml new file mode 100644 index 00000000..4629290b --- /dev/null +++ b/launcher-csharp/Workspaces/Views/Work001CreateWorkspace/work001.cshtml @@ -0,0 +1,38 @@ +@{ + int formNumber = 0; + int workspaceNameInputNumber = 0; +} + +

@Html.Raw(ViewBag.CodeExampleText.ExampleName)

+

+ @Html.Raw(ViewBag.CodeExampleText.ExampleDescription) +

+ +@if (ViewBag.showDoc == true) +{ +

Documentation about this example

+} + + + +

+ @Html.Raw(@String.Format(ViewBag.SupportingTexts.ViewSourceFile, "CreateWorkspace.cs")) +

+ +
+
+ + +
+ + + +
diff --git a/launcher-csharp/Workspaces/Views/Work002AddDocumentToWorkspace/work002.cshtml b/launcher-csharp/Workspaces/Views/Work002AddDocumentToWorkspace/work002.cshtml new file mode 100644 index 00000000..6cf2646a --- /dev/null +++ b/launcher-csharp/Workspaces/Views/Work002AddDocumentToWorkspace/work002.cshtml @@ -0,0 +1,98 @@ +@{ + int formNumber = 0; + int documentNameInputNumber = 0; + int documentPathInputNumber = 1; + + string redirectToCodeExample = string.Format( + ViewBag.CodeExampleText.RedirectsToOtherCodeExamples[0].RedirectText, + string.Format("href=\"work00{0}\"", ViewBag.CodeExampleText.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo) + ); + string helperText = string.Format( + ViewBag.SupportingTexts.HelpingTexts.SelectPDFFileFromFolder, + "code-examples-csharp/launcher-csharp/" + ); +} + +

@Html.Raw(ViewBag.CodeExampleText.ExampleName)

+

+ @Html.Raw(ViewBag.CodeExampleText.ExampleDescription) +

+ +@if (ViewBag.showDoc == true) +{ +

Documentation about this example

+} + + + +

+ @Html.Raw(@String.Format(ViewBag.SupportingTexts.ViewSourceFile, "AddDocumentToWorkspace.cs")) +

+ +@if (ViewBag.WorkspaceIdOk) +{ +
+
+ + + + @Html.Raw(ViewBag.SupportingTexts.HelpingTexts.SpecifyNameWithExtension) +
+ +
+ + + + @helperText +
+ + + + +
+ + +} +else +{ + @Html.Raw( + redirectToCodeExample + ) + +
+ +
+} \ No newline at end of file diff --git a/launcher-csharp/Workspaces/Views/Work003SendEnvelopeWithRecipientInfo/work003.cshtml b/launcher-csharp/Workspaces/Views/Work003SendEnvelopeWithRecipientInfo/work003.cshtml new file mode 100644 index 00000000..aeea5119 --- /dev/null +++ b/launcher-csharp/Workspaces/Views/Work003SendEnvelopeWithRecipientInfo/work003.cshtml @@ -0,0 +1,85 @@ +@{ + int formNumber = 0; + int signerEmailInputNumber = 0; + int signerNameInputNumber = 1; + + string redirectToCodeExample = string.Format( + ViewBag.CodeExampleText.RedirectsToOtherCodeExamples[0].RedirectText, + string.Format("href=\"work00{0}\"", ViewBag.CodeExampleText.RedirectsToOtherCodeExamples[0].CodeExampleToRedirectTo) + ); + + string redirectToSecondCodeExample = string.Format( + ViewBag.CodeExampleText.RedirectsToOtherCodeExamples[1].RedirectText, + string.Format("href=\"work00{0}\"", ViewBag.CodeExampleText.RedirectsToOtherCodeExamples[1].CodeExampleToRedirectTo) + ); +} + +

@Html.Raw(ViewBag.CodeExampleText.ExampleName)

+

+ @Html.Raw(ViewBag.CodeExampleText.ExampleDescription) +

+ +@if (ViewBag.showDoc == true) +{ +

Documentation about this example

+} + + + +

+ @Html.Raw(@String.Format(ViewBag.SupportingTexts.ViewSourceFile, "SendEnvelopeWithRecipientInfo.cs")) +

+ +@if (ViewBag.WorkspaceIdOk == false) +{ + @Html.Raw( + redirectToCodeExample + ) + +
+ +
+} +else if (ViewBag.DocumentIdOk == false) +{ + @Html.Raw( + redirectToSecondCodeExample + ) + +
+ +
+} +else +{ +
+
+ + + @Html.Raw(ViewBag.SupportingTexts.HelpingTexts.EmailWontBeShared) +
+
+ + +
+ + +
+} diff --git a/launcher-csharp/World_Wide_Corp_Web_Form.pdf b/launcher-csharp/World_Wide_Corp_Web_Form.pdf index d6b95276..b6af1fa0 100644 Binary files a/launcher-csharp/World_Wide_Corp_Web_Form.pdf and b/launcher-csharp/World_Wide_Corp_Web_Form.pdf differ diff --git a/launcher-csharp/eSignature/Controllers/AccountController.cs b/launcher-csharp/eSignature/Controllers/AccountController.cs index d87b9c93..5e1fe726 100644 --- a/launcher-csharp/eSignature/Controllers/AccountController.cs +++ b/launcher-csharp/eSignature/Controllers/AccountController.cs @@ -134,6 +134,10 @@ private string BuildConsentUrl() { scopes += " adm_store_unified_repo_read"; } + else if (apiType == ExamplesApiType.Workspaces) + { + scopes += " impersonation dtr.company.read dtr.rooms.read dtr.rooms.write dtr.documents.write"; + } return this.Configuration["DocuSign:AuthorizationEndpoint"] + "?response_type=code" + "&scope=" + scopes + diff --git a/launcher-csharp/eSignature/Models/ModelsToReadManifest/HelpingTexts.cs b/launcher-csharp/eSignature/Models/ModelsToReadManifest/HelpingTexts.cs index e8c4b97c..3ef3e0ba 100644 --- a/launcher-csharp/eSignature/Models/ModelsToReadManifest/HelpingTexts.cs +++ b/launcher-csharp/eSignature/Models/ModelsToReadManifest/HelpingTexts.cs @@ -64,5 +64,11 @@ public class HelpingTexts [JsonProperty("UserIDOfUserToDelete")] public string UserIDOfUserToDelete { get; set; } + + [JsonProperty("SelectPDFFileFromFolder")] + public string SelectPDFFileFromFolder { get; set; } + + [JsonProperty("SpecifyNameWithExtension")] + public string SpecifyNameWithExtension { get; set; } } } \ No newline at end of file diff --git a/launcher-csharp/launcher-csharp.csproj b/launcher-csharp/launcher-csharp.csproj index 5aab707d..98201836 100644 --- a/launcher-csharp/launcher-csharp.csproj +++ b/launcher-csharp/launcher-csharp.csproj @@ -42,7 +42,7 @@ - + diff --git a/launcher-csharp/wwwroot/css/css.css b/launcher-csharp/wwwroot/css/css.css index 763c81e7..2b30dacd 100644 --- a/launcher-csharp/wwwroot/css/css.css +++ b/launcher-csharp/wwwroot/css/css.css @@ -17,6 +17,10 @@ pointer-events: none; } +form .form-group .validation-error { + color: red !important; +} + .jumbotron { background: #000 !important; padding-top: 0 !important; diff --git a/launcher-csharp/wwwroot/js/search.js b/launcher-csharp/wwwroot/js/search.js index c9780097..652b2e05 100644 --- a/launcher-csharp/wwwroot/js/search.js +++ b/launcher-csharp/wwwroot/js/search.js @@ -11,6 +11,7 @@ MAESTRO: 'maestro', CONNECTEDFIELDS: 'connectedfields', NAVIGATOR: 'navigator', + WORKSPACES: 'workspaces', }; let processJSONData = function () { @@ -140,6 +141,8 @@ return "cf"; case API_TYPES.NAVIGATOR: return "nav"; + case API_TYPES.WORKSPACES: + return "work"; } } diff --git a/manifest/CodeExamplesManifest.json b/manifest/CodeExamplesManifest.json index 8b782613..da1605fb 100644 --- a/manifest/CodeExamplesManifest.json +++ b/manifest/CodeExamplesManifest.json @@ -43,7 +43,9 @@ "SubmitButtonDeleteText": "Delete", "SubmitButtonRestoreText": "Restore", "DefaultEnvelopeId": "If example 2 was executed, the envelope ID saved after it will be used by default. Alternatively, a different ID can be specified.", - "EnvelopeWillBeRestored": "Envelope {0} will be restored." + "EnvelopeWillBeRestored": "Envelope {0} will be restored.", + "SpecifyNameWithExtension": "Note: Specify the document name with .pdf extension", + "SelectPDFFileFromFolder": "Note: Select a PDF file from the following folder {0}" } }, "APIs": [ @@ -3031,6 +3033,105 @@ ] } ] + }, + { + "Name": "Workspaces", + "Groups": [ + { + "Name": "Workspaces", + "Examples": [ + { + "ExampleNumber": 1, + "ExampleName": "Create a workspace", + "ExampleDescription": "Creates a workspace", + "LinksToAPIMethod": [ + { + "Path": "https://developers.docusign.com/docs/workspaces-api/reference/workspaces/workspaces/createworkspace/", + "PathName": "Workspaces:createWorkspace" + } + ], + "Forms": [ + { + "Inputs": [ + { + "InputName": "Workspace name" + } + ] + } + ], + "ResultsPageText": "Workspace created. ID: {0}" + }, + { + "ExampleNumber": 2, + "ExampleName": "Add a document to a Workspace", + "ExampleDescription": "Adds a document to a Workspace", + "LinksToAPIMethod": [ + { + "Path": "https://developers.docusign.com/docs/workspaces-api/reference/workspaces/workspacedocuments/addworkspacedocument/", + "PathName": "WorkspaceDocuments:addWorkspaceDocument" + } + ], + "RedirectsToOtherCodeExamples": [ + { + "CodeExampleToRedirectTo": 1, + "RedirectText": "

Prerequisite: Please create a workspace before running this example using Create a workspace.

" + } + ], + "Forms": [ + { + "Inputs": [ + { + "InputName": "Document name" + }, + { + "InputName": "Document path" + } + ] + } + ], + "ResultsPageText": "Document added! ID: {0}" + }, + { + "ExampleNumber": 3, + "ExampleName": "Send a Workspace Envelope with Recipient Info", + "ExampleDescription": "Sends a Workspace Envelope with Recipient Info", + "LinksToAPIMethod": [ + { + "Path": "https://developers.docusign.com/docs/workspaces-api/reference/workspaces/workspaces/createworkspaceenvelope/", + "PathName": "Workspaces:createWorkspaceEnvelope" + }, + { + "Path": "https://developers.docusign.com/docs/esign-rest-api/reference/envelopes/envelopes/update/", + "PathName": "Envelopes:update" + } + ], + "RedirectsToOtherCodeExamples": [ + { + "CodeExampleToRedirectTo": 1, + "RedirectText": "

Prerequisite: Please create a workspace before running this example using Create a workspace.

" + }, + { + "CodeExampleToRedirectTo": 2, + "RedirectText": "

Prerequisite: Please create a document in the workspace before running this example using Add a document to a Workspace.

" + } + ], + "Forms": [ + { + "Inputs": [ + { + "InputName": "Signer email" + }, + { + "InputName": "Signer name" + } + ] + } + ], + "ResultsPageText": "The workspace envelope has been created and sent!
Envelope ID {0}." + } + ] + } + ] } ] } \ No newline at end of file