/// <summary> /// Recommends upcoming meetups for the authorized member in a given location and in thier groups /// </summary> /// <param name="lat">A valid latitude, limits the returned group events to those within radius miles</param> /// <param name="lon">A valid longitude, limits the returned group events to those within radius miles</param> /// <param name="cancellationToken">Cancellation Token</param> /// <returns>Task<OpenEvents>.</returns> /// <exception cref="HttpRequestException"> /// Ops! Something went wrong :S. Please try again, if the error persist contact /// with the developer to fix the issue. /// </exception> public async Task <Events> Concierge([NotNull] string lat, [NotNull] string lon, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(lon)) { throw new ArgumentException("Argument is null or empty", nameof(lon)); } if (string.IsNullOrEmpty(lat)) { throw new ArgumentException("Argument is null or empty", nameof(lat)); } if (string.IsNullOrWhiteSpace(lon)) { throw new ArgumentException("Argument is null or whitespace", nameof(lon)); } if (string.IsNullOrWhiteSpace(lat)) { throw new ArgumentException("Argument is null or whitespace", nameof(lat)); } var queryUrl = new StringBuilder(MeetupBase.BASE_URL); #if DEBUG queryUrl.Append($"/2/concierge?{SecretKeys.ApiKeyUrl}&lat={lat}&lon={lon}"); #else queryUrl.Append($"/2/concierge?&lat={lat}&lon={lon}"); #endif var response = await MeetupBase.ExecuteQueryAsync <Events>(queryUrl, cancellationToken); if (response == null) { throw new HttpRequestException(Resources.ErrorMessage); } return(response); }
/// <summary> /// Fetches a Meetup Event by group urlname and event_id /// </summary> /// <param name="urlName">The urlname path element may be any valid group urlname.</param> /// <param name="id">The id path element must be a valid alphanumeric Meetup Event identifier</param> /// <param name="cancellationToken">Cancellation Token</param> /// <returns>Task<Event>.</returns> /// <exception cref="HttpRequestException"> /// Ops! Something went wrong :S. Please try again, if the error persist contact /// with the developer to fix the issue. /// </exception> public async Task <Event> Event([NotNull] string urlName, [NotNull] string id, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(urlName)) { throw new ArgumentException("Argument is null or empty", nameof(urlName)); } if (string.IsNullOrEmpty(id)) { throw new ArgumentException("Argument is null or empty", nameof(id)); } if (string.IsNullOrWhiteSpace(urlName)) { throw new ArgumentException("Argument is null or whitespace", nameof(urlName)); } if (string.IsNullOrWhiteSpace(id)) { throw new ArgumentException("Argument is null or whitespace", nameof(id)); } var queryUrl = new StringBuilder(MeetupBase.BASE_URL); queryUrl.Append($"/{urlName}/events/{id}?&photo-host=public&fields=photo_album"); var response = await MeetupBase.ExecuteQueryAsync <Event>(queryUrl, cancellationToken); if (response == null) { throw new HttpRequestException(Resources.ErrorMessage); } return(response); }
/// <summary> /// Access Meetup events using a group, member, or event id. Events in private groups are available only to authenticated members of those groups. /// Status can be specified to fetch "cancelled", "draft", "past", "proposed", "suggested", or "upcoming" /// </summary> /// <param name="groupUrl">Path to group from meetup.com, no slashes</param> /// <param name="cancellationToken">Cancellation Token</param> /// <returns>Task<OpenEvents>.</returns> /// <exception cref="HttpRequestException"> /// Ops! Something went wrong :S. Please try again, if the error persist contact /// with the developer to fix the issue. /// </exception> public async Task <Events> Events([NotNull] string groupUrl, [NotNull] string statusList, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(groupUrl)) { throw new ArgumentException("Argument is null or empty", nameof(groupUrl)); } if (string.IsNullOrWhiteSpace(groupUrl)) { throw new ArgumentException("Argument is null or whitespace", nameof(groupUrl)); } var queryUrl = new StringBuilder(MeetupBase.BASE_URL); #if DEBUG queryUrl.Append($"/2/events?{SecretKeys.ApiKeyUrl}&group_urlname={groupUrl}&status={statusList}&fields=description_images"); #else queryUrl.Append($"/2/events?&group_urlname={groupUrl}&status={statusList}&fields=description_images"); #endif var response = await MeetupBase.ExecuteQueryAsync <Events>(queryUrl, cancellationToken); if (response == null) { throw new HttpRequestException(Resources.ErrorMessage); } return(response); }
/// <summary> /// Fetches a Meetup Event by group urlname and event_id /// </summary> /// <param name="urlName">The urlname path element may be any valid group urlname.</param> /// <param name="id">The id path element must be a valid alphanumeric Meetup Event identifier</param> /// <param name="cancellationToken">Cancellation Token</param> /// <returns>Task<Event>.</returns> /// <exception cref="HttpRequestException"> /// Ops! Something went wrong :S. Please try again, if the error persist contact /// with the developer to fix the issue. /// </exception> public async Task <Event> ByIdAsync([NotNull] string urlName, [NotNull] string id, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(urlName)) { throw new ArgumentException("Argument is null or empty", nameof(urlName)); } if (string.IsNullOrEmpty(id)) { throw new ArgumentException("Argument is null or empty", nameof(id)); } if (string.IsNullOrWhiteSpace(urlName)) { throw new ArgumentException("Argument is null or whitespace", nameof(urlName)); } if (string.IsNullOrWhiteSpace(id)) { throw new ArgumentException("Argument is null or whitespace", nameof(id)); } var queryUrl = new StringBuilder(MeetupBase.BASE_URL); queryUrl.Append($"/{urlName}/events/{id}/"); var response = await MeetupBase.ExecuteQueryAsync <Event>(queryUrl, cancellationToken); if (response == null) { throw new HttpRequestException( "Ops! Something went wrong :S. Please try again, if the error persist contact with the developer to fix the issue."); } return(response); }
/// <summary> /// [Authentication required] Listings of Group discussion boards /// </summary> /// <param name="urlName">The urlName path element may be any valid group urlname or domain name.</param> /// <param name="cancellationToken">Cancellation Token</param> /// <returns>Task<IEnumerable<Board>></returns> /// <exception cref="HttpRequestException"> /// Ops! Something went wrong :S. Please try again, if the error persist contact /// with the developer to fix the issue. /// </exception> public async Task <IEnumerable <Board> > All([NotNull] string urlName, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(urlName)) { throw new ArgumentException("Argument is null or empty", nameof(urlName)); } if (string.IsNullOrWhiteSpace(urlName)) { throw new ArgumentException("Argument is null or whitespace", nameof(urlName)); } if (!await MeetupBase.RenewAccessToken()) { throw new HttpRequestException( "MeetupApi is unable to get the listings of group discussion boards, please re-login for renew your access token."); } var queryUrl = new StringBuilder(MeetupBase.BASE_URL); #if DEBUG queryUrl.Append($"/{urlName}/boards?{SecretKeys.ApiKeyUrl}"); #else queryUrl.Append($"/{urlName}/boards"); #endif var response = await MeetupBase.ExecuteQueryAsync <IEnumerable <Board> >(queryUrl, cancellationToken); if (response == null) { throw new HttpRequestException( "Ops! Something went wrong :S. Please try again, if the error persist contact with the developer to fix the issue."); } return(response); }
/// <summary> /// [Authentication required] Listings of Group discussion boards /// </summary> /// <param name="urlName">The urlName path element may be any valid group urlname or domain name.</param> /// <param name="cancellationToken">Cancellation Token</param> /// <returns>Task<IEnumerable<Board>></returns> /// <exception cref="HttpRequestException"> /// Ops! Something went wrong :S. Please try again, if the error persist contact /// with the developer to fix the issue. /// </exception> public async Task <IEnumerable <Board> > All([NotNull] string urlName, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(urlName)) { throw new ArgumentException("Argument is null or empty", nameof(urlName)); } if (string.IsNullOrWhiteSpace(urlName)) { throw new ArgumentException("Argument is null or whitespace", nameof(urlName)); } if (!await MeetupBase.RenewAccessToken()) { throw new HttpRequestException(Resources.ErrorMessage); } var queryUrl = new StringBuilder(MeetupBase.BASE_URL); #if DEBUG queryUrl.Append($"/{urlName}/boards?{SecretKeys.ApiKeyUrl}"); #else queryUrl.Append($"/{urlName}/boards"); #endif var response = await MeetupBase.ExecuteQueryAsync <IEnumerable <Board> >(queryUrl, cancellationToken); if (response == null) { throw new HttpRequestException(Resources.ErrorMessage); } return(response); }
/// <summary> /// Returns the current API service status /// </summary> /// <returns>Task<System.Boolean>.</returns> public static async Task <bool> GetStatus() { var queryUrl = new StringBuilder(MeetupBase.BASE_URL); queryUrl.Append("/status/"); var response = await MeetupBase.ExecuteQueryAsync <StatusInfo>(queryUrl, CancellationToken.None); return(response?.status == "ok"); }
/// <summary> /// Returns Meetup cities. This method supports search by latitude/longitude/radius, by country/state, by query term/zip, or a /// combination of all of these. Location-only searches by lat and lon return all cities within a radius of the provided coordinates. /// Searches with a query return up to 10 cities matching the term, and can be sorted by size or distance to a given coordinate. /// 'smart' ordering can be used to return the match(es) with the highest member_count, unless a smaller size match exists nearby the given /// coordinates. Query searches are supported for country but not country and state /// </summary> /// <param name="country">A valid country code</param> /// <param name="lat">Latitude to search</param> /// <param name="lon">Longitude to search</param> /// <param name="radius">When searching by lat/lon only, specify a radius to search (default 50 miles)</param> /// <returns>Task<IList<Cities>></returns> public static async Task <Cities> Cities(string country, double lat, double lon, int radius) { var queryUrl = new StringBuilder(MeetupBase.BASE_URL); queryUrl.Append($"/2/cities?&country={country}&lon={lon}&radius={radius}&lat={lat}"); var response = await MeetupBase.ExecuteQueryAsync <Cities>(queryUrl, CancellationToken.None); if (response == null) { throw new HttpRequestException(Resources.ErrorMessage); } return(response); }
/// <summary> /// [Authentication required] Returns a list of Meetup group categories /// </summary> /// <returns>Task<IList<Categories>></returns> public static async Task <Categories> Categories() { var queryUrl = new StringBuilder(MeetupBase.BASE_URL); #if DEBUG queryUrl.Append($"/2/categories?{SecretKeys.ApiKeyUrl}"); #else queryUrl.Append("/2/categories"); #endif var response = await MeetupBase.ExecuteQueryAsync <Categories>(queryUrl, CancellationToken.None); if (response == null) { throw new HttpRequestException(Resources.ErrorMessage); } return(response); }
/// <summary> /// [Authentication required] Returns a list of Meetup group categories /// </summary> /// <returns>Task<IList<Categories>></returns> public static async Task <Categories> Categories() { var queryUrl = new StringBuilder(MeetupBase.BASE_URL); #if DEBUG queryUrl.Append($"/2/categories?{SecretKeys.ApiKeyUrl}"); #else queryUrl.Append("/2/categories"); #endif var response = await MeetupBase.ExecuteQueryAsync <Categories>(queryUrl, CancellationToken.None); if (response == null) { throw new HttpRequestException( "Ops! Something went wrong :S. Please try again, if the error persist contact with the developer to fix the issue."); } return(response); }
public async Task <Events> Create([NotNull] string groupUrl, [NotNull] string name, CreateEventModel content, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(groupUrl)) { throw new ArgumentException("Argument is null or empty", nameof(groupUrl)); } if (string.IsNullOrWhiteSpace(groupUrl)) { throw new ArgumentException("Argument is null or whitespace", nameof(groupUrl)); } if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Argument is null or empty", nameof(name)); } if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("Argument is null or whitespace", nameof(name)); } var queryUrl = new StringBuilder(MeetupBase.BASE_URL); var hosts = content.Hosts[0]; for (var i = 1; i < content.Hosts.Length; i++) { hosts += $",{content.Hosts[i]}"; } var htmlContent = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("description", content.Description), new KeyValuePair <string, string>("duration", content.Duration.ToString()), new KeyValuePair <string, string>("guest_limit", content.GuestLimit.ToString()), new KeyValuePair <string, string>("hosts", content.Hosts.ToString()), new KeyValuePair <string, string>("how_to_find_us", content.HowToFindUs), new KeyValuePair <string, string>("publish_status", content.PublishStatus.ToString()), //new KeyValuePair<string, string>("question_1", ), new KeyValuePair <string, string>("rsvp_close", content.RSVPClose.ToString()), new KeyValuePair <string, string>("rsvp_limit", content.RSVPLimit.ToString()), new KeyValuePair <string, string>("rsvp_open", content.RSVPOpen.ToString()), new KeyValuePair <string, string>("simple_html_description", content.SimpleHtmlDescription), new KeyValuePair <string, string>("time", content.Time.ToString()), new KeyValuePair <string, string>("venue_id", content.VenueId), new KeyValuePair <string, string>("venue_visibility", content.VenueVisibility.ToString()), new KeyValuePair <string, string>("waitlisting", content.Waitlisting.ToString()), new KeyValuePair <string, string>("why", content.Why) }); #if DEBUG queryUrl.Append($"/2/event?{SecretKeys.ApiKeyUrl}&group_urlname={groupUrl}"); #else queryUrl.Append($"/2/event?&group_urlname={groupUrl}"); #endif for (int i = 0; i < content.Questions.Length; i++) { queryUrl.Append($"&question{i}={content.Questions[i]}"); } var response = await MeetupBase.ExecuteQueryAsync <Events>(queryUrl, cancellationToken, htmlContent, HttpMethodTypes.POST); if (response == null) { throw new HttpRequestException(Resources.ErrorMessage); } return(response); }