コード例 #1
0
ファイル: Subscriber.cs プロジェクト: muratoner/sendloop
        /// <summary>
        /// If you have a lot of email addresses to add into your subscriber list, you can use this bulk subscriber import API call.
        /// [HEADS UP] While we provide a bulk email address import API call, we monitor requests to this API call and in case of unfair usage,
        /// your account may be suspended. Please do not import unauthorized email addresses, third party rented/purchased lists,
        /// harvested email addresses or email addresses which have not given explicit authorization to you. For more details,
        /// please refer to our <see href="http://ma92abd-abd8cf.sendloop.com/page/antispam_policy/">anti-spam policy</see>.
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public async Task <ResultSubscriberImport> ImportAsync(ParamSubscriberImport param)
        {
            var arry = new Dictionary <string, string> {
                { nameof(param.ListID), param.ListID.ToString() }
            };

            for (var i = 0; i < param.Subscribers.Count; i++)
            {
                arry.Add($"Subscribers[{i}][{nameof( Model.Subscriber.Subscriber.EmailAddress )}]", param.Subscribers[i].EmailAddress);
                for (int j = 0; j < param.Subscribers[i].Fields.Count; j++)
                {
                    arry.Add($"Subscribers[{i}][{param.Subscribers[i].Fields.Keys.ElementAt(j)}]", param.Subscribers[i].Fields.Values.ElementAt(j));
                }
            }

            return(await _http.Value.PostAsync <ResultSubscriberImport>(SendloopAddress.SubscriberImport, arry));
        }
コード例 #2
0
ファイル: Subscriber.cs プロジェクト: muratoner/sendloop
 /// <summary>
 /// If you have a lot of email addresses to add into your subscriber list, you can use this bulk subscriber import API call.
 /// [HEADS UP] While we provide a bulk email address import API call, we monitor requests to this API call and in case of unfair usage,
 /// your account may be suspended. Please do not import unauthorized email addresses, third party rented/purchased lists,
 /// harvested email addresses or email addresses which have not given explicit authorization to you. For more details,
 /// please refer to our <see href="http://ma92abd-abd8cf.sendloop.com/page/antispam_policy/">anti-spam policy</see>.
 /// </summary>
 /// <param name="param"></param>
 /// <returns></returns>
 public ResultSubscriberImport Import(ParamSubscriberImport param)
 => ImportAsync(param).GetAwaiter().GetResult();