Example #1
0
     public Message AddTo(User value)
 {
     if (value == null)
     {
         throw new ArgumentNullException("Argument cannot be null");
     }
     
     _to.Add(value);
     return this;
 }
 public User ToAPIUser() {
     if (apiUser != null)
     {
         return apiUser;
     }
     else if (sdkAccountMember != null ) {
         User result = new User();
         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;
         return result;
     }
     else {
         return null;
     }
 }
 public AccountMemberConverter( User apiUser )
 {
     this.apiUser = apiUser;
 }
        private Silanis.ESL.API.Message CreateTypicalAPIMessage()
        {
            Silanis.ESL.API.Message apiMessage = new Silanis.ESL.API.Message();
            apiMessage.Content = "Opt-out reason";
            apiMessage.Status = Silanis.ESL.API.MessageStatus.READ;
            apiMessage.Created = DateTime.Now;

            User fromUser = new User();
            fromUser.FirstName = "John";
            fromUser.LastName = "Smith";
            fromUser.Id = "user1";
            fromUser.Email = "*****@*****.**";
            apiMessage.From = fromUser;

            User toUser = new User();
            toUser.FirstName = "Patty";
            toUser.LastName = "Galant";
            toUser.Id = "user2";
            toUser.Email = "*****@*****.**";
            apiMessage.AddTo(toUser);

            return apiMessage;
        }
		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 = Silanis.ESL.API.PackageStatus.DRAFT;

            Silanis.ESL.API.Message apiMessage = new Silanis.ESL.API.Message();
            apiMessage.Content = "opt-out reason";
            apiMessage.Status = Silanis.ESL.API.MessageStatus.NEW;
            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);

			return apiPackage;
		}