public bool VerifyCredentials(string username, string password) { const string url = @"https://winchatty.com/v2/verifyCredentials"; const string dataFormat = @"username={0}&password={1}"; using (var client = new ChattyWebClient()) { string data = string.Format(dataFormat, username, password); string result = client.UploadString(url, data); return(result.Contains("\"isValid\":true")); } }
public bool PostComment(string username, string password, int parentId, string text) { const string url = @"https://winchatty.com/v2/postComment"; const string dataFormat = @"username={0}&password={1}&parentId={2}&text={3}"; using (var client = new ChattyWebClient()) { string data = string.Format(dataFormat, username, password, parentId, text); string result = client.UploadString(url, data); const string success = "{\"result\":\"success\"}"; return(result == success); } }
public bool SendMessage(string username, string password, string targetUsername, string subject, string text) { const string url = @"https://winchatty.com/v2/sendMessage"; const string dataFormat = @"username={0}&password={1}&to={2}&subject={3}&body={4}"; using (var client = new ChattyWebClient()) { string data = string.Format(dataFormat, username, password, targetUsername, subject, text); string result = client.UploadString(url, data); const string success = "{\"result\":\"success\"}"; return(result == success); } }