Esempio n. 1
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Silanis.ESL.SDK.SessionService"/> class.
		/// </summary>
		/// <param name="apiToken">API token.</param>
		/// <param name="baseUrl">Base URL.</param>
		public SessionService (string apiToken, string baseUrl)
		{
			this.apiToken = apiToken;
			template = new UrlTemplate (baseUrl);
			authenticationService = new AuthenticationTokenService(new RestClient(apiToken), baseUrl);

		}
Esempio n. 2
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Silanis.ESL.SDK.PackageService"/> class.
		/// </summary>
		/// <param name="apiToken">API token.</param>
		/// <param name="baseUrl">Base URL.</param>
		public PackageService (RestClient restClient, string baseUrl)
		{
            this.restClient = restClient;
			template = new UrlTemplate (baseUrl);
			settings = new JsonSerializerSettings ();
			settings.NullValueHandling = NullValueHandling.Ignore;
		}
		public void VerifyResult()
		{
			example = new AttachmentRequirementExample( Props.GetInstance() );
			example.Run();

			// Asserts the attachment requirements for each signer is set correctly.
			DocumentPackage retrievedPackage = example.RetrievedPackage;
			IDictionary<string, AttachmentRequirement> signer1Attachments = retrievedPackage.Signers[example.Email1].Attachments;
			IDictionary<string, AttachmentRequirement> signer2Attachments = retrievedPackage.Signers[example.Email2].Attachments;

			Assert.AreEqual(signer1Attachments.Count, 1);
			AttachmentRequirement signer1Att1 = signer1Attachments[example.NAME1];
			Assert.AreEqual(signer1Att1.Name, example.NAME1);
			Assert.AreEqual(signer1Att1.Description, example.DESCRIPTION1);
			Assert.AreEqual(signer1Att1.Required, true);
			Assert.AreEqual(signer1Att1.Status.ToString(), RequirementStatus.INCOMPLETE.ToString());

			Assert.AreEqual(signer2Attachments.Count, 2);
			AttachmentRequirement signer2Att1 = signer2Attachments[example.NAME2];
			AttachmentRequirement signer2Att2 = signer2Attachments[example.NAME3];
			Assert.AreEqual(signer2Att1.Name, example.NAME2);
			Assert.AreEqual(signer2Att1.Description, example.DESCRIPTION2);
			Assert.AreEqual(signer2Att1.Required, false);
			Assert.AreEqual(signer2Att1.Status.ToString(), RequirementStatus.INCOMPLETE.ToString());
			Assert.AreEqual(signer2Att2.Name, example.NAME3);
			Assert.AreEqual(signer2Att2.Description, example.DESCRIPTION3);
			Assert.AreEqual(signer2Att2.Required, true);
			Assert.AreEqual(signer2Att2.Status.ToString(), RequirementStatus.INCOMPLETE.ToString());

			// Upload attachment for signer1
			string signerAuthenticationToken = example.EslClient.AuthenticationTokenService.CreateSignerAuthenticationToken(example.PackageId, example.SIGNER1ID);
			AuthenticationClient authenticationClient = new AuthenticationClient(Props.GetInstance().Get("webpage.url"));
			String sessionIdForSigner = authenticationClient.GetSessionIdForSignerAuthenticationToken(signerAuthenticationToken);

			client = new RestClient("");
			template = new UrlTemplate(Props.GetInstance().Get("api.url"));

			Stream fileStream1 = File.OpenRead(new FileInfo(Directory.GetCurrentDirectory() + "/src/document.pdf").FullName);
			uploadAttachment(example.PackageId, signer1Att1.Id, "Test Attachment", fileStream1, sessionIdForSigner);

			// Reject signer1's attachment
			example.RejectAttachment();
			signer1Att1 = retrievedPackage.Signers[example.Email1].Attachments[example.NAME1];
			Assert.AreEqual(signer1Att1.Status.ToString(), RequirementStatus.REJECTED.ToString());
			Assert.AreEqual(signer1Att1.SenderComment, example.REJECTION_COMMENT);

			// Accept signer1's attachment
			example.AcceptAttachment();
			Assert.AreEqual(signer1Att1.Status.ToString(), RequirementStatus.COMPLETE.ToString());
			Assert.AreEqual(signer1Att1.SenderComment, "");

			// Download signer1's attachment
			byte[] downloadedAttachment = example.DownloadAttachment();
			System.IO.File.WriteAllBytes("/dev/null", downloadedAttachment);
		}
 public EventNotificationApiClient(RestClient restClient, string apiUrl, JsonSerializerSettings settings)
 {
     this.restClient = restClient;
     template = new UrlTemplate(apiUrl);
     this.settings = settings;
 }
Esempio n. 5
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Silanis.ESL.SDK.AuditService"/> class.
		/// </summary>
		/// <param name="apiToken">API token.</param>
		/// <param name="baseUrl">Base URL.</param>
		public AuditService (string apiToken, string baseUrl)
		{
			this.apiToken = apiToken;
			template = new UrlTemplate (baseUrl);
		}
Esempio n. 6
0
 internal TemplateApiClient(RestClient restClient, string baseUrl, JsonSerializerSettings settings)
 {
     this.restClient = restClient;
     urls = new UrlTemplate (baseUrl);
     this.settings = settings;
 }
 public CustomFieldApiClient(RestClient client, string baseUrl, JsonSerializerSettings settings)
 {
     template = new UrlTemplate(baseUrl);
     this.client = client;
     this.settings = settings;
 }
Esempio n. 8
0
 public CustomFieldService(RestClient client, string baseUrl) {
     template = new UrlTemplate( baseUrl );
     this.client = client;
     settings = new JsonSerializerSettings ();
 }
		public AuthenticationTokenService (RestClient restClient, string baseUrl)
		{
			this.restClient = restClient;
			template = new UrlTemplate (baseUrl);
		}
Esempio n. 10
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Silanis.ESL.SDK.PackageService"/> class.
		/// </summary>
		/// <param name="apiToken">API token.</param>
		/// <param name="baseUrl">Base URL.</param>
		public PackageService (RestClient restClient, string baseUrl, JsonSerializerSettings settings)
		{
            this.restClient = restClient;
			template = new UrlTemplate (baseUrl);
            this.settings = settings;
        }
Esempio n. 11
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Silanis.ESL.SDK.FieldSummaryService"/> class.
		/// </summary>
		/// <param name="apiToken">API token.</param>
		/// <param name="baseUrl">Base URL.</param>
		public FieldSummaryService (string apiToken, string baseUrl)
		{
			this.apiToken = apiToken;
			template = new UrlTemplate (baseUrl);
		}
  public FieldSummaryApiClient (string apiToken, string baseUrl)
 {
     this.apiToken = apiToken;
     template = new UrlTemplate (baseUrl);                                                                   
 }
 public AuthenticationService(string webpageUrl)
 {
     client = new UnauthenticatedRestClient();
     authenticationTemplate = new UrlTemplate(webpageUrl + UrlTemplate.ESL_AUTHENTICATION_PATH);
     webpageTemplate = new UrlTemplate(webpageUrl);
 }
Esempio n. 14
0
 public GroupApiClient(RestClient restClient, string baseUrl, JsonSerializerSettings settings)
 {
     this.restClient = restClient;
     template = new UrlTemplate (baseUrl);
     this.settings = settings;
 }
 public AttachmentRequirementApiClient(RestClient restClient, string apiUrl, JsonSerializerSettings jsonSettings)
 {
     this.restClient = restClient;
     template = new UrlTemplate (apiUrl);            
     this.jsonSettings = jsonSettings;
 }
 public EventNotificationService( RestClient restClient, string apiUrl )
 {
     this.restClient = restClient;
     template = new UrlTemplate(apiUrl);
     settings = new JsonSerializerSettings ();
 }
Esempio n. 17
0
 public ApprovalApiClient(RestClient restClient, string baseUrl, JsonSerializerSettings jsonSettings)
 {
     this.restClient = restClient;
     template = new UrlTemplate (baseUrl);
     this.jsonSettings = jsonSettings;
 }