public Silanis.ESL.SDK.Sender GetSender(string senderId) { Silanis.ESL.API.Sender apiResponse = apiClient.GetSender(senderId); Sender result = new SenderConverter(apiResponse).ToSDKSender(); return(result); }
public Silanis.ESL.API.Sender ToAPISender() { if (sdkAccountMember != null) { Silanis.ESL.API.Sender result = new Silanis.ESL.API.Sender(); result.Address = new AddressConverter(sdkAccountMember.Address).ToAPIAddress(); result.FirstName = sdkAccountMember.FirstName; result.LastName = sdkAccountMember.LastName; result.Title = sdkAccountMember.Title; result.Company = sdkAccountMember.Company; result.Email = sdkAccountMember.Email; result.Phone = sdkAccountMember.PhoneNumber; result.Language = sdkAccountMember.Language; Silanis.ESL.API.SenderStatus?convertedStatus = new SenderStatusConverter(sdkAccountMember.Status).ToAPISenderStatus(); if (convertedStatus.HasValue) { result.Status = convertedStatus.Value; } return(result); } else { return(null); } }
public Silanis.ESL.API.Sender ToAPISender() { if (null != sdkAccountMember) { Silanis.ESL.API.Sender result = new Silanis.ESL.API.Sender(); result.Address = new AddressConverter(sdkAccountMember.Address).ToAPIAddress(); result.FirstName = sdkAccountMember.FirstName; result.LastName = sdkAccountMember.LastName; result.Title = sdkAccountMember.Title; result.Company = sdkAccountMember.Company; result.Email = sdkAccountMember.Email; result.Phone = sdkAccountMember.PhoneNumber; result.Language = sdkAccountMember.Language; string convertedStatus = new SenderStatusConverter(sdkAccountMember.Status).ToAPISenderStatus(); if (!String.IsNullOrEmpty(convertedStatus)) { result.Status = convertedStatus; } return(result); } else { return(null); } }
public Sender InviteUser(AccountMember invitee) { Silanis.ESL.API.Sender apiSender = new AccountMemberConverter(invitee).ToAPISender(); Silanis.ESL.API.Sender apiResponse = apiClient.InviteUser(apiSender); Sender result = new SenderConverter(apiResponse).ToSDKSender(); return(result); }
public void ToSDKFromAPISender() { Silanis.ESL.API.Sender sender = CreateTypicalAPISender(); SenderInfo senderInfo = new SenderConverter(sender).ToSDKSenderInfo(); Assert.IsNotNull(senderInfo); Assert.AreEqual(sender.Email, senderInfo.Email); Assert.AreEqual(sender.FirstName, senderInfo.FirstName); Assert.AreEqual(sender.LastName, senderInfo.LastName); Assert.AreEqual(sender.Company, senderInfo.Company); Assert.AreEqual(sender.Title, senderInfo.Title); }
private Silanis.ESL.API.Sender CreateTypicalAPISender() { Silanis.ESL.API.Sender sender = new Silanis.ESL.API.Sender(); sender.Email = EMAIL; sender.FirstName = FIRST_NAME; sender.LastName = LAST_NAME; sender.Company = COMPANY; sender.Title = TITLE; sender.External = new Silanis.ESL.API.External(); sender.External.Id = EXTERNAL_ID; sender.External.Provider = EXTERNAL_PROVIDER; sender.External.ProviderName = EXTERNAL_PROVIDER_NAME; return(sender); }
public Silanis.ESL.API.Sender InviteUser(Silanis.ESL.API.Sender invitee) { string path = template.UrlFor(UrlTemplate.ACCOUNT_MEMBER_PATH).Build(); try { string json = JsonConvert.SerializeObject(invitee, jsonSettings); string response = restClient.Post(path, json); Silanis.ESL.API.Sender apiResponse = JsonConvert.DeserializeObject <Silanis.ESL.API.Sender> (response, jsonSettings); return(apiResponse); } catch (EslServerException e) { throw new EslServerException("Failed to invite new account member.\t" + " Exception: " + e.Message, e.ServerError, e); } catch (Exception e) { throw new EslException("Failed to invite new account member.\t" + " Exception: " + e.Message, e); } }
public void UpdateSender(Silanis.ESL.API.Sender apiSender, string senderId) { string path = template.UrlFor(UrlTemplate.ACCOUNT_MEMBER_ID_PATH) .Replace("{senderUid}", senderId) .Build(); try { string json = JsonConvert.SerializeObject(apiSender, jsonSettings); apiSender.Id = senderId; restClient.Post(path, json); } catch (EslServerException e) { throw new EslServerException("Could not update sender.\t" + " Exception: " + e.Message, e.ServerError, e); } catch (Exception e) { throw new EslException("Could not update sender.\t" + " Exception: " + e.Message, e); } }
public void ToSDKFromAPISender() { Silanis.ESL.API.Sender sender = new Silanis.ESL.API.Sender(); sender.Email = EMAIL; sender.FirstName = FIRST_NAME; sender.LastName = LAST_NAME; sender.Company = COMPANY; sender.Title = TITLE; SenderInfo senderInfo = new SenderConverter(sender).ToSDKSenderInfo(); Assert.IsNotNull(senderInfo); Assert.AreEqual(sender.Email, senderInfo.Email); Assert.AreEqual(sender.FirstName, senderInfo.FirstName); Assert.AreEqual(sender.LastName, senderInfo.LastName); Assert.AreEqual(sender.Company, senderInfo.Company); Assert.AreEqual(sender.Title, senderInfo.Title); }
public Silanis.ESL.API.Sender GetSender(string senderId) { string path = template.UrlFor(UrlTemplate.ACCOUNT_MEMBER_ID_PATH) .Replace("{senderUid}", senderId) .Build(); try { string response = restClient.Get(path); Silanis.ESL.API.Sender apiResponse = JsonConvert.DeserializeObject <Silanis.ESL.API.Sender> (response, jsonSettings); return(apiResponse); } catch (EslServerException e) { throw new EslServerException("Failed to retrieve Sender from Account.\t" + " Exception: " + e.Message, e.ServerError, e); } catch (Exception e) { throw new EslException("Failed to retrieve Sender from Account.\t" + " Exception: " + e.Message, e); } }
public Silanis.ESL.API.Sender ToAPISender() { if (sdkAccountMember != null ) { Silanis.ESL.API.Sender result = new Silanis.ESL.API.Sender(); result.Address = new AddressConverter(sdkAccountMember.Address).ToAPIAddress(); result.FirstName = sdkAccountMember.FirstName; result.LastName = sdkAccountMember.LastName; result.Title = sdkAccountMember.Title; result.Company = sdkAccountMember.Company; result.Email = sdkAccountMember.Email; result.Phone = sdkAccountMember.PhoneNumber; result.Language = sdkAccountMember.Language; Silanis.ESL.API.SenderStatus? convertedStatus = new SenderStatusConverter(sdkAccountMember.Status).ToAPISenderStatus(); if ( convertedStatus.HasValue ) result.Status = convertedStatus.Value; return result; } else { return null; } }
public void ToSDKSenderFromAPISender() { Silanis.ESL.API.Sender apiSender = CreateTypicalAPISender(); Silanis.ESL.SDK.Sender sdkSender = new SenderConverter(apiSender).ToSDKSender(); Assert.AreEqual(sdkSender.Status.ToString(), apiSender.Status.ToString()); Assert.AreEqual(sdkSender.LastName, apiSender.LastName); Assert.AreEqual(sdkSender.FirstName, apiSender.FirstName); Assert.AreEqual(sdkSender.Company, apiSender.Company); Assert.AreEqual(sdkSender.Created, apiSender.Created); Assert.AreEqual(sdkSender.Email, apiSender.Email); Assert.AreEqual(sdkSender.Language, apiSender.Language); Assert.AreEqual(sdkSender.Phone, apiSender.Phone); Assert.AreEqual(sdkSender.Name, apiSender.Name); Assert.AreEqual(sdkSender.Title, apiSender.Title); Assert.AreEqual(sdkSender.Type.ToString(), apiSender.Type.ToString()); Assert.AreEqual(sdkSender.Updated, apiSender.Updated); Assert.AreEqual(sdkSender.Id, apiSender.Id); Assert.AreEqual(sdkSender.External.Id, apiSender.External.Id); Assert.AreEqual(sdkSender.External.Provider, apiSender.External.Provider); Assert.AreEqual(sdkSender.External.ProviderName, apiSender.External.ProviderName); }
private Silanis.ESL.API.Package CreateTypicalAPIPackage() { Silanis.ESL.API.Package apiPackage = new Silanis.ESL.API.Package(); apiPackage.Id = "1"; apiPackage.Language = "en"; apiPackage.Autocomplete = true; apiPackage.Consent = "Consent"; apiPackage.Completed = new DateTime?(); apiPackage.Description = "API document package description"; apiPackage.Due = new DateTime?(); apiPackage.Name = "API package name"; apiPackage.Status = DocumentPackageStatus.DRAFT.getApiValue(); apiPackage.Created = DateTime.Now; Silanis.ESL.API.Message apiMessage = new Silanis.ESL.API.Message(); apiMessage.Content = "opt-out reason"; apiMessage.Status = Silanis.ESL.SDK.MessageStatus.NEW.getApiValue(); apiMessage.Created = DateTime.Now; User fromUser = new User(); fromUser.FirstName = "John"; fromUser.LastName = "Smith"; fromUser.Email = "*****@*****.**"; apiMessage.From = fromUser; apiPackage.AddMessage(apiMessage); User toUser = new User(); toUser.FirstName = "Patty"; toUser.LastName = "Galant"; toUser.Email = "*****@*****.**"; apiMessage.AddTo(toUser); Silanis.ESL.API.Sender sender = new Silanis.ESL.API.Sender(); sender.Email = "*****@*****.**"; apiPackage.Sender = sender; return(apiPackage); }
public void FromAPINull() { Silanis.ESL.API.Sender sender = null; Assert.Throws <ArgumentNullException>(() => new SenderConverter(sender)); }
public void FromAPINull() { Silanis.ESL.API.Sender sender = null; new SenderConverter(sender); }
private Silanis.ESL.API.Sender CreateTypicalAPISender() { Silanis.ESL.API.Sender sender = new Silanis.ESL.API.Sender(); sender.Email = EMAIL; sender.FirstName = FIRST_NAME; sender.LastName = LAST_NAME; sender.Company = COMPANY; sender.Title = TITLE; sender.External = new Silanis.ESL.API.External(); sender.External.Id = EXTERNAL_ID; sender.External.Provider = EXTERNAL_PROVIDER; sender.External.ProviderName = EXTERNAL_PROVIDER_NAME; return sender; }