diff --git a/dotnet/console/Console/Console.csproj b/dotnet/console/Console/Console.csproj
index 5d46594..b6b8ee3 100644
--- a/dotnet/console/Console/Console.csproj
+++ b/dotnet/console/Console/Console.csproj
@@ -67,6 +67,7 @@
+
diff --git a/dotnet/console/Console/Scenarios/AddSignerToExistingDocumentScenario.cs b/dotnet/console/Console/Scenarios/AddSignerToExistingDocumentScenario.cs
new file mode 100644
index 0000000..5100b0e
--- /dev/null
+++ b/dotnet/console/Console/Scenarios/AddSignerToExistingDocumentScenario.cs
@@ -0,0 +1,67 @@
+using Lacuna.Signer.Api.Documents;
+using Lacuna.Signer.Api.FlowActions;
+using Lacuna.Signer.Api.Users;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Console.Scenarios {
+ internal class AddSignerToExistingDocumentScenario : Scenario {
+ public override async Task RunAsync() {
+ // 0. You need a document id
+ var result = await CreateDocumentAsync();
+ var docId = result.DocumentId;
+
+ // 1.Get the document details
+ var details = await SignerClient.GetDocumentDetailsAsync(docId);
+
+ // 2. Input the ongoing flowActionId to be able to change previously defined FlowActions
+ var flowActions = details.FlowActions;
+
+ // 3. For each participant on the new flow, create one instance of ParticipantUserModel
+ var user = new ParticipantUserModel() {
+ Name = "Anakin Skywalker",
+ Email = "anakin.skywalker@mailnator.com",
+ Identifier = "75502846369"
+ };
+
+ // 4. Create a FlowActionCreateModel instance for each action (signature or approval) in the flow.
+ // This object is responsible for defining the personal data of the participant and the type of
+ // action that he will perform on the flow
+ var flowActionCreateModel = new FlowActionCreateModel() {
+ Type = Lacuna.Signer.Api.FlowActionType.Signer,
+ User = user,
+ };
+
+ // 5. The new flow action step must be greater or equal to the current pending step
+ flowActionCreateModel.Step = flowActions.Count() + 1;
+
+ // 5.5 Create list for flowAction
+ var flowActionList = new List { flowActionCreateModel };
+
+ // 6. Prepare the request
+ var documentEditFlowRequest = new DocumentFlowEditRequest() {
+ AddedFlowActions = flowActionList
+ };
+
+ // 7. Pass the parameters to the editflow function to perform the request
+ await SignerClient.EditDocumentFlowAsync(docId, documentEditFlowRequest);
+
+ // 8. Send a reminder to the new participants of the document flow
+ await RemindFlowUsersWithPendingActions(docId);
+
+ }
+
+ private async Task RemindFlowUsersWithPendingActions(Guid docId) {
+ var details = await SignerClient.GetDocumentDetailsAsync(docId);
+ foreach (var flowAction in details.FlowActions) {
+ if (flowAction.Status == Lacuna.Signer.Api.ActionStatus.Pending) {
+ await SignerClient.SendFlowActionReminderAsync(docId, flowAction.Id);
+ }
+ }
+ }
+ }
+}
diff --git a/java/console/build.gradle b/java/console/build.gradle
index 789ca44..b7062ae 100644
--- a/java/console/build.gradle
+++ b/java/console/build.gradle
@@ -19,7 +19,7 @@ repositories {
}
dependencies {
- implementation 'com.lacunasoftware.signer:signer-client:2.7.0'
+ implementation 'com.lacunasoftware.signer:signer-client:2.8.1'
implementation 'com.google.code.gson:gson:2.8.1'
}
diff --git a/java/console/src/main/java/com/lacunasoftware/signer/sample/scenarios/AddSignerToExistingDocumentScenario.java b/java/console/src/main/java/com/lacunasoftware/signer/sample/scenarios/AddSignerToExistingDocumentScenario.java
new file mode 100644
index 0000000..332f47c
--- /dev/null
+++ b/java/console/src/main/java/com/lacunasoftware/signer/sample/scenarios/AddSignerToExistingDocumentScenario.java
@@ -0,0 +1,82 @@
+package com.lacunasoftware.signer.sample.scenarios;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import com.lacunasoftware.signer.ActionStatus;
+import com.lacunasoftware.signer.FlowActionType;
+import com.lacunasoftware.signer.documents.CreateDocumentResult;
+import com.lacunasoftware.signer.documents.DocumentFlowEditRequest;
+import com.lacunasoftware.signer.documents.DocumentModel;
+import com.lacunasoftware.signer.flowactions.FlowActionCreateModel;
+import com.lacunasoftware.signer.flowactions.FlowActionModel;
+import com.lacunasoftware.signer.javaclient.exceptions.RestException;
+import com.lacunasoftware.signer.users.ParticipantUserModel;
+
+public class AddSignerToExistingDocumentScenario extends Scenario {
+
+ @Override
+ public void Run() throws IOException, RestException, Exception {
+ // 0. Create the Document
+ CreateDocumentResult document = createDocument();
+
+ // 1. Get the document details
+ DocumentModel details = signerClient.getDocumentDetails(document.getDocumentId());
+
+ // 2. Input the ongoing flowActionId to be able to change previously defined
+ // FlowActions
+ List flowActionArray = details.getFlowActions();
+
+ // 3. For each participant on the new flow, create one instance of
+ // ParticipantUserModel
+ ParticipantUserModel user = new ParticipantUserModel();
+ user.setName("Anakin Skywalker");
+ user.setEmail("anakin.skywalker@mailnator.com");
+ user.setIdentifier("75502846369");
+
+ // 4. Create a FlowActionCreateModel instance for each action (signature or approval) in the flow.
+ // This object is responsible for defining the personal data of the participant
+ // and the type of action that he will perform on the flow
+ FlowActionCreateModel flowActionCreateModel = new FlowActionCreateModel();
+ flowActionCreateModel.setType(FlowActionType.SIGNER);
+ flowActionCreateModel.setUser(user);
+
+ // 5. The new flow action step must be greater or equal to the current pending step
+ flowActionCreateModel.setStep(flowActionArray.size() + 1);
+
+ // 6. Prepare the request
+ DocumentFlowEditRequest documentFlowEditRequest = new DocumentFlowEditRequest();
+ List flowActionCreateModelList = new ArrayList();
+ flowActionCreateModelList.add(flowActionCreateModel);
+ documentFlowEditRequest.setAddedFlowActions(flowActionCreateModelList);
+
+ // 7. Pass the parameters to the editflow function to perform the request
+ signerClient.updateDocumentFlow(document.getDocumentId(), documentFlowEditRequest);
+
+ // 8. Send a reminder to the new participants of the document flow
+ remindFlowUsersWithPendingFlowActions(document.getDocumentId());
+ }
+
+ /**
+ * Sends a reminder to all users with pending actions in the document flow.
+ *
+ * This function retrieves the current flow actions associated with a document,
+ * checks for any actions that have a status of 'Pending', and sends a reminder
+ * to the corresponding participants to prompt them to complete their actions.
+ *
+ * @param string documentId The ID of the document for which to send reminders.
+ */
+ private void remindFlowUsersWithPendingFlowActions(UUID documentId) throws RestException {
+ DocumentModel details = signerClient.getDocumentDetails(documentId);
+ for (FlowActionModel flowAction : details.getFlowActions()) {
+ if(flowAction.getStatus() == ActionStatus.PENDING){
+ signerClient.sendFlowActionReminder(documentId, flowAction.getId());
+ }
+ }
+ }
+
+}
+
+
diff --git a/nodejs/scenarios/addSignerToExistingDocumentScenario.ts b/nodejs/scenarios/addSignerToExistingDocumentScenario.ts
new file mode 100644
index 0000000..a1f76b9
--- /dev/null
+++ b/nodejs/scenarios/addSignerToExistingDocumentScenario.ts
@@ -0,0 +1,101 @@
+import {
+ FlowActionType,
+ DocumentsApi,
+ FlowActionsFlowActionCreateModel,
+ DocumentsDocumentFlowEditRequest,
+ DocumentsDocumentModel,
+ ActionStatus,
+ NotificationsApi,
+ NotificationsCreateFlowActionReminderRequest,
+ FlowActionsFlowActionModel,
+} from "signer-node-client";
+import { CreateDocument, config } from "./scenario";
+
+/**
+ * This scenario demonstrates the creation of a document into an existing folder.
+ */
+const documentsApi = new DocumentsApi(config);
+const notificationsApi = new NotificationsApi(config);
+const fileName = "sample.pdf";
+
+
+// 1. The file's bytes must be read by the application and uploaded
+CreateDocument().then(async(res) => {
+ //1. You need a document id
+ const docId = res.documentId;
+ // 2. Define the name of the document which will be visible in the application
+ const fileUploadModel = {
+ displayName: "Add signer to existing document scenario sample",
+ id: docId,
+ contentType: "application/pdf",
+ name: fileName,
+ };
+ // 3. For each participant on the flow, create one instance of ParticipantUserModel
+ const participant = {
+ name: "Anakin Skywalker",
+ email: "anakin.skywalker@mailnator.com",
+ identifier: "75502846369",
+ };
+
+ // 4. Create a FlowActionCreateModel instance for each action (signature or approval) in the flow.
+ // This object is responsible for defining the personal data of the participant and the type of
+ // action that he will perform on the flow
+ let flowAction: FlowActionsFlowActionCreateModel = {
+ type: FlowActionType.Signer,
+ user: participant,
+ };
+ const files = [fileUploadModel];
+ let flowActions: FlowActionsFlowActionCreateModel[] = [flowAction];
+
+ // 5. The new flow action step must be greater or equal to the current pending step
+ flowAction.step = flowActions.length + 1;
+
+ // 6. Prepare the request
+ let documentFlowEditRequest: DocumentsDocumentFlowEditRequest = {
+ addedFlowActions: flowActions,
+ };
+
+ // 7. Pass the parameters to the editflow function to perform the request
+ documentsApi.apiDocumentsIdFlowPost(
+ docId,
+ documentFlowEditRequest
+ ).then(async () => {
+ // 8. Send a reminder to the new participants of the document flow
+ await remindFlowUsersWithPendingActions(docId);
+ })
+ .catch((ex) => {
+ console.error(ex);
+ })
+
+ });
+/**
+ * Sends a reminder to all users with pending actions in the document flow.
+ *
+ * This function retrieves the current flow actions associated with a document,
+ * checks for any actions that have a status of 'Pending', and sends a reminder
+ * to the corresponding participants to prompt them to complete their actions.
+ *
+ * @param string documentId The ID of the document for which to send reminders.
+ */
+async function remindFlowUsersWithPendingActions(documentId: string) {
+ documentsApi.apiDocumentsIdGet(documentId).then((res: DocumentsDocumentModel|any) => {
+ let details = res.data as DocumentsDocumentModel; // type assertion
+ const flowActions = details.flowActions;
+
+ flowActions.forEach((flowAction: FlowActionsFlowActionModel) => {
+ if (flowAction.status == ActionStatus.Pending) {
+ let notificationsCreateFlowActionReminderRequest: NotificationsCreateFlowActionReminderRequest =
+ {
+ documentId: documentId,
+ flowActionId: flowAction.id,
+ };
+
+ notificationsApi.apiNotificationsFlowActionReminderPost(
+ notificationsCreateFlowActionReminderRequest
+ ).then((res) => {
+ console.log(res.status);
+ });
+ }
+ });
+ });
+}
diff --git a/nodejs/scenarios/dist/addSignerToExistingDocumentScenario.js b/nodejs/scenarios/dist/addSignerToExistingDocumentScenario.js
new file mode 100644
index 0000000..57b0e8c
--- /dev/null
+++ b/nodejs/scenarios/dist/addSignerToExistingDocumentScenario.js
@@ -0,0 +1,88 @@
+"use strict";
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const signer_node_client_1 = require("signer-node-client");
+const scenario_1 = require("./scenario");
+/**
+ * This scenario demonstrates the creation of a document into an existing folder.
+ */
+const documentsApi = new signer_node_client_1.DocumentsApi(scenario_1.config);
+const notificationsApi = new signer_node_client_1.NotificationsApi(scenario_1.config);
+const fileName = "sample.pdf";
+// 1. The file's bytes must be read by the application and uploaded
+(0, scenario_1.CreateDocument)().then((res) => __awaiter(void 0, void 0, void 0, function* () {
+ //1. You need a document id
+ const docId = res.documentId;
+ // 2. Define the name of the document which will be visible in the application
+ const fileUploadModel = {
+ displayName: "Add signer to existing document scenario sample",
+ id: docId,
+ contentType: "application/pdf",
+ name: fileName,
+ };
+ // 3. For each participant on the flow, create one instance of ParticipantUserModel
+ const participant = {
+ name: "Anakin Skywalker",
+ email: "anakin.skywalker@mailnator.com",
+ identifier: "75502846369",
+ };
+ // 4. Create a FlowActionCreateModel instance for each action (signature or approval) in the flow.
+ // This object is responsible for defining the personal data of the participant and the type of
+ // action that he will perform on the flow
+ let flowAction = {
+ type: signer_node_client_1.FlowActionType.Signer,
+ user: participant,
+ };
+ const files = [fileUploadModel];
+ let flowActions = [flowAction];
+ // 5. The new flow action step must be greater or equal to the current pending step
+ flowAction.step = flowActions.length + 1;
+ // 6. Prepare the request
+ let documentFlowEditRequest = {
+ addedFlowActions: flowActions,
+ };
+ // 7. Pass the parameters to the editflow function to perform the request
+ documentsApi.apiDocumentsIdFlowPost(docId, documentFlowEditRequest).then(() => __awaiter(void 0, void 0, void 0, function* () {
+ // 8. Send a reminder to the new participants of the document flow
+ yield remindFlowUsersWithPendingActions(docId);
+ }))
+ .catch((ex) => {
+ console.error(ex);
+ });
+}));
+/**
+ * Sends a reminder to all users with pending actions in the document flow.
+ *
+ * This function retrieves the current flow actions associated with a document,
+ * checks for any actions that have a status of 'Pending', and sends a reminder
+ * to the corresponding participants to prompt them to complete their actions.
+ *
+ * @param string documentId The ID of the document for which to send reminders.
+ */
+function remindFlowUsersWithPendingActions(documentId) {
+ return __awaiter(this, void 0, void 0, function* () {
+ documentsApi.apiDocumentsIdGet(documentId).then((res) => {
+ let details = res.data; // type assertion
+ const flowActions = details.flowActions;
+ flowActions.forEach((flowAction) => {
+ if (flowAction.status == signer_node_client_1.ActionStatus.Pending) {
+ let notificationsCreateFlowActionReminderRequest = {
+ documentId: documentId,
+ flowActionId: flowAction.id,
+ };
+ notificationsApi.apiNotificationsFlowActionReminderPost(notificationsCreateFlowActionReminderRequest).then((res) => {
+ console.log(res.status);
+ });
+ }
+ });
+ });
+ });
+}
diff --git a/nodejs/scenarios/dist/scenario.js b/nodejs/scenarios/dist/scenario.js
index 8637b3a..e4d5b56 100644
--- a/nodejs/scenarios/dist/scenario.js
+++ b/nodejs/scenarios/dist/scenario.js
@@ -9,7 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", { value: true });
-exports.CreateDocument = exports.config = void 0;
+exports.config = void 0;
+exports.CreateDocument = CreateDocument;
const signer_node_client_1 = require("signer-node-client");
exports.config = {
apiKey: "API Sample App|43fc0da834e48b4b840fd6e8c37196cf29f919e5daedba0f1a5ec17406c13a99",
@@ -48,4 +49,3 @@ function CreateDocument() {
return result.data[0];
});
}
-exports.CreateDocument = CreateDocument;