/// <summary> /// Takes an enum and returns the description of the enum /// </summary> /// <param name="value">BaseURL enum to get URL from</param> /// <returns>Description of the enum</returns> public static string ToDescriptionString(this BaseURL value) { return (value.GetType() .GetMember(value.ToString()) .FirstOrDefault() ?.GetCustomAttribute <DescriptionAttribute>() ?.Description ?? value.ToString()); }
/// <summary> /// List the Poppulo Accounts /// </summary> /// <returns></returns> public string ListAccount() { string MyReturn = string.Empty; // https://api.newsweaver.com/v2/ return(MakeHttpWebRequest(BaseURL.ToString(), HttpVerb.GET)); }
private async Task <Uri> RenderUriAsync(string uri, object queryString = null, bool websocket = false) { if (queryString != null) { var keyValueContent = ToKeyValue(queryString); var formUrlEncodedContent = new FormUrlEncodedContent(keyValueContent); var urlEncodedString = await formUrlEncodedContent.ReadAsStringAsync(); uri += "?" + urlEncodedString; } return(new Uri( websocket ? new Uri(BaseURL.ToString() // there's got to be a cleaner way to do this... .Replace("http://", "ws://") .Replace("https://", "wss://")) : BaseURL, uri )); }
/// <summary> /// List the Poppulo Accounts /// </summary> /// <param name="pageSize">Page Size</param> /// <returns></returns> public Task <List <XmlNode> > ListAccountsAsync(int?pageSize = null) { // Documentation: https://developer.poppulo.com/api-calls/api-list-accounts.html return(GetListEntitiesAsync(BaseURL.ToString(), PoppuloListType.Accounts, pageSize)); }