Exemplo n.º 1
0
        internal Placeholder AddPlaceholder(PackageId templateId, Placeholder placeholder)
        {
            string path = urls.UrlFor(UrlTemplate.ROLE_PATH)
                          .Replace("{packageId}", templateId.Id)
                          .Build();
            Role apiPayload = new Role();

            apiPayload.Id   = placeholder.Id;
            apiPayload.Name = placeholder.Name;

            try
            {
                string json     = JsonConvert.SerializeObject(apiPayload, settings);
                string response = restClient.Post(path, json);
                Silanis.ESL.API.Role apiRole = JsonConvert.DeserializeObject <Silanis.ESL.API.Role>(response);
                return(new Placeholder(apiRole.Id));
            }
            catch (EslServerException e)
            {
                throw new EslServerException("Could not add placeholder." + " Exception: " + e.Message, e.ServerError, e);
            }
            catch (Exception e)
            {
                throw new EslException("Could not add placeholder." + " Exception: " + e.Message, e);
            }
        }
 public void RejectAttachment(string packageId, Role role)
 {
     string path = template.UrlFor(UrlTemplate.UPDATE_SIGNER_PATH)
         .Replace("{packageId}", packageId)
         .Replace("{roleId}", role.Id)
         .Build();
         
     try {
         string json = JsonConvert.SerializeObject(role, jsonSettings);
         restClient.Put(path, json);              
     } 
     catch (EslServerException e) {
         throw new EslServerException("Could not reject attachment for signer." + " Exception: " + e.Message, e.ServerError, e);
     }
     catch (Exception e) {
         throw new EslException("Could not reject attachment for signer." + " Exception: " + e.Message,e);
     }
 }
Exemplo n.º 3
0
        public Signer GetSigner(PackageId packageId, string signerId)
        {
            string path = template.UrlFor(UrlTemplate.GET_SIGNER_PATH)
                          .Replace("{packageId}", packageId.Id)
                          .Replace("{roleId}", signerId)
                          .Build();

            try {
                string response = restClient.Get(path);
                Silanis.ESL.API.Role apiRole = JsonConvert.DeserializeObject <Silanis.ESL.API.Role> (response, settings);
                return(new SignerConverter(apiRole).ToSDKSigner());
            }
            catch (EslServerException e) {
                throw new EslServerException("Could not retrieve signer." + " Exception: " + e.Message, e.ServerError, e);
            }
            catch (Exception e) {
                throw new EslException("Could not retrieve signer." + " Exception: " + e.Message, e);
            }
        }
Exemplo n.º 4
0
     public Layout AddRole(Role value)
 {
     if (value == null)
     {
         throw new ArgumentNullException("Argument cannot be null");
     }
     
     _roles.Add(value);
     return this;
 }
Exemplo n.º 5
0
 private static bool isPlaceHolder( Role role ) {
     return role.Signers.Count == 0;
 }