public static void Subscribe(Action done) { const string section = "PTestNewsletter.Subscribe"; Debug.Log(section); PNewsletterOptions options = new PNewsletterOptions { email = "invalid @email.com" }; Playtomic.Newsletter.Subscribe(options, r => { AssertFalse(section + "#1", "Request failed", r.success); AssertEquals(section + "#1", "Mailchimp API error", r.errorcode, 602); options["email"] = "*****@*****.**"; options["fields"] = new Dictionary <string, object> { { "STRINGVALUE", "this is a string" } }; Playtomic.Newsletter.Subscribe(options, r2 => { AssertTrue(section, "Request succeeded", r2.success); AssertEquals(section, "No errorcode", r2.errorcode, 0); done(); }); }); }
public static void Subscribe(Action done) { const string section = "PTestNewsletter.Subscribe"; Debug.Log (section); PNewsletterOptions options = new PNewsletterOptions { email = "invalid @email.com" }; Playtomic.Newsletter.Subscribe (options, r => { AssertFalse(section + "#1", "Request failed", r.success); AssertEquals(section + "#1", "Mailchimp API error", r.errorcode, 602); options["email"] = "*****@*****.**"; options["fields"] = new Dictionary<string,object> { {"STRINGVALUE", "this is a string"} }; Playtomic.Newsletter.Subscribe (options, r2 => { AssertTrue(section, "Request succeeded", r2.success); AssertEquals(section, "No errorcode", r2.errorcode, 0); done(); }); }); }
private IEnumerator SendRequest(string section, string action, Action<PResponse> callback, PNewsletterOptions options) { var www = PRequest.Prepare (section, action, options); yield return www; var response = PRequest.Process(www); callback(response); }
/** * Subscribes a person to your newsletter * @param options Dictionary<string,object> The email and other information * @param callback Action<PResponse> Your callback function */ public void Subscribe(PNewsletterOptions options, Action<PResponse> callback) { Playtomic.API.StartCoroutine(SendRequest(SECTION, SUBSCRIBE, callback, options)); }
private IEnumerator SendRequest(string section, string action, Action <PResponse> callback, PNewsletterOptions options) { var www = PRequest.Prepare(section, action, options); yield return(www); var response = PRequest.Process(www); callback(response); }
/** * Subscribes a person to your newsletter * @param options Dictionary<string,object> The email and other information * @param callback Action<PResponse> Your callback function */ public void Subscribe(PNewsletterOptions options, Action <PResponse> callback) { Playtomic.API.StartCoroutine(SendRequest(SECTION, SUBSCRIBE, callback, options)); }