private void processCallAddTag_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBoxTagName.Text)) { MessageBox.Show("You must set a name for the new Tag"); return; } status.Text = ""; outputAddTag.Clear(); Protocol p = (Protocol)protocol.SelectedItem; try { EgoiApi api = EgoiApiFactory.getApi(p); EgoiMap arguments = new EgoiMap(); arguments.Add("apikey", apiKey.Text); arguments.Add("name", textBoxTagName.Text); if (!string.IsNullOrEmpty(setTagColor.Text)) { arguments.Add("color", setTagColor.Text); } EgoiMap result = api.addTag(arguments); outputAddTag.Text = result.ToString(); } catch (EgoiException ex) { status.Text = ex.Message; } }
private void buttonAddSubscriber_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBoxAddSubscriberListID.Text)) { MessageBox.Show("You must set the list id first..."); return; } status.Text = ""; outputAddSubscriber.Clear(); Protocol p = (Protocol)protocol.SelectedItem; try { EgoiApi api = EgoiApiFactory.getApi(p); EgoiMap arguments = new EgoiMap(); arguments.Add("apikey", apiKey.Text); arguments.Add("listID", textBoxAddSubscriberListID.Text); arguments.Add("subscriber", textBoxAddSubscriberSubscriber.Text); arguments.Add("status", comboBoxAddSubscriberStatus.Text); arguments.Add("from", textBoxAddSubscriberFrom.Text); arguments.Add("lang", comboBoxAddSubscriberLang.Text); arguments.Add("email", textBoxAddSubscriberEmail.Text); arguments.Add("validate_phone", comboBoxAddSubscriberValidatePhone.Text); arguments.Add("cellphone", textBoxAddSubscriberCellphone.Text); arguments.Add("telephone", textBoxAddSubscriberTelephone.Text); arguments.Add("fax", textBoxAddSubscriberFax.Text); arguments.Add("first_name", textBoxAddSubscriberFirstName.Text); arguments.Add("last_name", textBoxAddSubscriberLastName.Text); arguments.Add("birth_date", dateTimePickerAddSubscriberBirthDate.Text); //example on how to use extra fields //arguments.Add("extra_1", "value for extra_1"); //arguments.Add("extra_2", "value for extra_2"); //arguments.Add("extra_3", "value for extra_3"); //and so on... EgoiMap em = new EgoiMap(); foreach (var tag in new System.Collections.ArrayList(listBoxAddSubscriberTagId.Items)) { em.Add("id", tag); } arguments.Add("tags", em); arguments.Add("formID", textBoxAddSubscriberFormId.Text); EgoiMap result = api.addSubscriber(arguments); outputAddSubscriber.Text = result.ToString(); } catch (EgoiException ex) { status.Text = ex.Message; } }
private void processCallAttachTag_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBoxAttachTagTagNumber.Text)) { MessageBox.Show("You must set the tag number first..."); return; } if (listBoxAttachTagTarget.Items.Count < 1) { MessageBox.Show("You must set at least a target..."); return; } if (string.IsNullOrEmpty(textBoxAttachTagListId.Text)) { MessageBox.Show("You must set the list id..."); return; } status.Text = ""; outputAttachTag.Clear(); Protocol p = (Protocol)protocol.SelectedItem; try { EgoiApi api = EgoiApiFactory.getApi(p); EgoiMap arguments = new EgoiMap(); arguments.Add("apikey", apiKey.Text); arguments.Add("tag", textBoxAttachTagTagNumber.Text); EgoiMap em = new EgoiMap(); foreach (var subscriber in new System.Collections.ArrayList(listBoxAttachTagTarget.Items)) { em.Add("subscriber", subscriber); } arguments.Add("target", em); arguments.Add("type", "subscriber"); //for now is the only one. Meanwhile, we have to put it here. It's required. arguments.Add("listID", textBoxAttachTagListId.Text); EgoiMap result = api.attachTag(arguments); outputAttachTag.Text = result.ToString(); } catch (EgoiException ex) { status.Text = ex.Message; } }
private void processCall_Click(object sender, EventArgs e) { status.Text = ""; outputGetUserData.Clear(); Protocol p = (Protocol)protocol.SelectedItem; try { EgoiApi api = EgoiApiFactory.getApi(p); EgoiMap arguments = new EgoiMap(); arguments.Add("apikey", apiKey.Text); EgoiMap result = api.getUserData(arguments); outputGetUserData.Text = result.ToString(); } catch (EgoiException ex) { status.Text = ex.Message; } }
/// <summary> /// envia a mensagem /// </summary> /// <returns>string retorno da api</returns> public virtual string Enviar() { string result = ""; if (string.IsNullOrWhiteSpace(this.TelefoneDestinatario)) { return("Telefone em branco"); } if (string.IsNullOrWhiteSpace(this.Corpo)) { return("Mensagem em branco"); } Protocol p = Protocol.Default; try { string numero = "55-" + TelefoneDestinatario .Replace(" ", "") .Replace("-", "") .Replace("(", "") .Replace(")", ""); EgoiApi api = EgoiApiFactory.getApi(p); EgoiMap arguments = new EgoiMap(); arguments.Add("apikey", ApiKey); arguments.Add("subject", Assunto); arguments.Add("cellphone", numero); arguments.Add("message", Corpo); arguments.Add("listID", this._listId); arguments.Add("fromID", this._fromId); EgoiMap resultadoEgoy = api.sendSMS(arguments); result += resultadoEgoy.ToString(); } catch (Exception err) { result = err.ToString(); } return(result); }
public static void Main(string[] args) { EgoiApi api = EgoiApiFactory.getApi(Protocol.Rest); EgoiMap arguments = new EgoiMap(); arguments.Add("apikey", "e20272f0238fa96e52fdddebef8a0062c57f207b"); //arguments.Add("apikey", "a049d48858962f0252b9f707269d16d94c6e25c2"); arguments.Add("listID", "1"); arguments.Add("subscriber", "ppinto%2B96_2%40e-goi.com"); try { EgoiMap result = api.removeSubscriber(arguments); Console.WriteLine(result.ToString()); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine("DONE!"); }