public static async Task<ObservableCollection<MeetupEvent>> GetMeetupsFor(string uservar, string toggle, OAuthToken token)
        {
            var meetupServiceProvider = new MeetupServiceProvider(MeetupApiKey, MeetupSecretKey);
            var meetup = meetupServiceProvider.GetApi(token.Value, token.Secret);
            string json;
            if (toggle == "Meetup Group")
            {
                json = await meetup.RestOperations.GetForObjectAsync<string>($"https://api.meetup.com/2/events?offset=0&format=json&limited_events=False&group_urlname={uservar}&photo-host=public&page=20&fields=&order=time&desc=false&status=upcoming&sig_id=182757480&sig=52d73860784c45691862aa492856c26332cd67af");
            }
            else
            {
                json = await meetup.RestOperations.GetForObjectAsync<string>($"https://api.meetup.com/2/concierge?zip={uservar}&offset=0&format=json&photo-host=public&page=500&sig_id=182757480&sig=199b985b4335074f44fbe4697f34f1ff7026bf50");
            }
            EventReturn j = JsonConvert.DeserializeObject<EventReturn>(json);
            /*   ObservableCollection<string> MEvents = new ObservableCollection<string>();
               foreach (var i in j.results)
               {
                   MEvents.Add($"\nName: {i.name}\nStatus: {i.status}\nTime: {i.time}");
               }*/
            ObservableCollection<MeetupEvent> MEvents = new ObservableCollection<MeetupEvent>();
            foreach (var i in j.results)
            {
                MEvents.Add(i);
            }

            return MEvents;
        }
        public static async Task<List<MeetUpList>> GetMeetupsFor(string meetupGroupName)
        {

            List<MeetUpList> list = new List<MeetUpList>();

            var token = await aunthenticate();

            var meetupServiceProvider = new MeetupServiceProvider(MeetupApiKey, MeetupSecKey);


            var meetup = meetupServiceProvider.GetApi(token.Value, token.Secret);


            string json = await meetup.RestOperations.GetForObjectAsync<string>($"https://api.meetup.com/2/events?group_urlname={meetupGroupName}");

            var oEvents = JObject.Parse(json)["results"];

            foreach (var oEvent in oEvents)
            {
                var mappedObject = JsonConvert.DeserializeObject<MeetUpList>(oEvent.ToString());

                list.Add(mappedObject);
            }

            return list;

        }
        //want to return task for async methods
        public static async Task<List<MeetupResults>> GetMeetupsFor(string meetupGroupName)
        {
            // creates token using method authenticate() from above
            var token = await authenticate();

            // creates new MeetupServiceProvider
            var meetupServiceProvider = new MeetupServiceProvider(MeetupApiKey, MeetupSecretKey);

            //what is this line doing? -- puts token into MeetupServiceProvider for authorization
            var meetup = meetupServiceProvider.GetApi(token.Value, token.Secret);

            //await makes the program kind of pause until you get the result of the following code before running everything else
            //creates json string
            string json = await meetup.RestOperations.GetForObjectAsync<string>($"https://api.meetup.com/2/events?&sign=true&photo-host=public&group_urlname={meetupGroupName}&page=20");
            //parses json and assigned to variable o
            var o = JObject.Parse(json);
            //assigns "results" layers of JSON to string resultsJson
            string resultsJson = o["results"].ToString();

            //creates List of MeetupResults objects called result and deserializes the resultsJson string and sticks it into the list
            List<MeetupResults> result = JsonConvert.DeserializeObject<List<MeetupResults>>(resultsJson);

            //returns the List and satisfies the Task condition
            return result;
        }
 public static  async Task<List<MeetupInfo>> GetMeetupsFor(string groupName)
 {
     var token =  await authenticate();
     var meetupServiceProvider = new MeetupServiceProvider(MeetupApiKey, MeetupSecretKey);     
     var meetup = meetupServiceProvider.GetApi(token.Value, token.Secret);
     string json = await meetup.RestOperations.GetForObjectAsync<string>($"https://api.meetup.com/2/events?group_urlname={groupName}");
     var oEvents = JObject.Parse(json);
     List<MeetupInfo> meetupEvents = JsonConvert.DeserializeObject<List<MeetupInfo>>(oEvents["results"].ToString());
     return meetupEvents;
 }
Example #5
0
		private static void Main(string[] args)
		{
			try
			{
				var meetupServiceProvider = new MeetupServiceProvider(MeetupApiKey, MeetupApiSecret);

				/* OAuth 'dance' */

				// Authentication using Out-of-band/PIN Code Authentication
				Console.Write("Getting request token...");
				var oauthToken = meetupServiceProvider.OAuthOperations.FetchRequestTokenAsync("oob", null).Result;
				Console.WriteLine("Done");

				var authenticateUrl = meetupServiceProvider.OAuthOperations.BuildAuthorizeUrl(oauthToken.Value, null);
				Console.WriteLine("Redirect user for authentication: " + authenticateUrl);
				Process.Start(authenticateUrl);
				Console.WriteLine("Enter PIN Code from Meetup authorization page:");
				var pinCode = Console.ReadLine();

				Console.Write("Getting access token...");
				var requestToken = new AuthorizedRequestToken(oauthToken, pinCode);
				var oauthAccessToken = meetupServiceProvider.OAuthOperations.ExchangeForAccessTokenAsync(requestToken, null).Result;
				Console.WriteLine("Done");

				/* API */

				var meetup = meetupServiceProvider.GetApi(oauthAccessToken.Value, oauthAccessToken.Secret);

				meetup.RestOperations.GetForObjectAsync<string>("https://api.meetup.com/2/members?member_id=" + MemberId)
					.ContinueWith(task => Console.WriteLine("Result: " + task.Result));
			}
			catch (AggregateException ae)
			{
				ae.Handle(ex =>
				{
				    if (ex is MeetupApiException)
				    {
				        Console.WriteLine(ex.Message);
				        return true;
				    }
				    return false;
				});
			}
			catch (Exception ex)
			{
				Console.WriteLine(ex);
			}
			finally
			{
				Console.WriteLine("--- hit <return> to quit ---");
				Console.ReadLine();
			}
		}
Example #6
0
        private static void Main(string[] args)
        {
            try
            {
                var meetupServiceProvider = new MeetupServiceProvider(MeetupApiKey, MeetupApiSecret);

                /* OAuth 'dance' */

                // Authentication using Out-of-band/PIN Code Authentication
                Console.Write("Getting request token...");
                var oauthToken = meetupServiceProvider.OAuthOperations.FetchRequestTokenAsync("oob", null).Result;
                Console.WriteLine("Done");

                var authenticateUrl = meetupServiceProvider.OAuthOperations.BuildAuthorizeUrl(oauthToken.Value, null);
                Console.WriteLine("Redirect user for authentication: " + authenticateUrl);
                Process.Start(authenticateUrl);
                Console.WriteLine("Enter PIN Code from Meetup authorization page:");
                var pinCode = Console.ReadLine();

                Console.Write("Getting access token...");
                var requestToken     = new AuthorizedRequestToken(oauthToken, pinCode);
                var oauthAccessToken = meetupServiceProvider.OAuthOperations.ExchangeForAccessTokenAsync(requestToken, null).Result;
                Console.WriteLine("Done");

                /* API */

                var meetup = meetupServiceProvider.GetApi(oauthAccessToken.Value, oauthAccessToken.Secret);

                meetup.RestOperations.GetForObjectAsync <string>("https://api.meetup.com/2/members?member_id=" + MemberId)
                .ContinueWith(task => Console.WriteLine("Result: " + task.Result));
            }
            catch (AggregateException ae)
            {
                ae.Handle(ex =>
                {
                    if (ex is MeetupApiException)
                    {
                        Console.WriteLine(ex.Message);
                        return(true);
                    }
                    return(false);
                });
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                Console.WriteLine("--- hit <return> to quit ---");
                Console.ReadLine();
            }
        }
        public static async Task<MeetupSearchResult> GetMeetupsFor(string meetupGroupName)
        {
            var token = await authenticate();

            var meetupServiceProvider = new MeetupServiceProvider(MeetupApiKey, MeetupSecretKey);

            var meetup = meetupServiceProvider.GetApi(token.Value, token.Secret);

            string json = await meetup.RestOperations.GetForObjectAsync<string>($"https://api.meetup.com/2/events?group_urlname={meetupGroupName}");

            var oEvents = JsonConvert.DeserializeObject<MeetupSearchResult>(json);

            return oEvents;
        }
        public static async Task<List<string>> GetMeetupsFor(string meetupGroupName)
        {
            var token = await authenticate();
            var meetupServiceProvider = new MeetupServiceProvider(MeetupApiKey, MeetupSecretKey);
            var meetup = meetupServiceProvider.GetApi(token.Value, token.Secret);
            string json = await meetup.RestOperations.GetForObjectAsync<string>($"https://api.meetup.com/2/events?group_urlname={meetupGroupName}");
            var oEvents = JObject.Parse(json)["results"];
            List<string> MEvents = new List<string>();
            foreach (var oEvent in oEvents)
            {
                MEvents.Add(oEvent["name"].ToString());
            }

            return MEvents;
        }
        public async Task GetMeetupsFor(string meetupGroupName)
        {
            var token = await authenicate();
            var meetupServiceProvider = new MeetupServiceProvider(MeetupApiKey, MeetupSecretKey);

            var meetup = meetupServiceProvider.GetApi(token.Value, token.Secret);

            Console.WriteLine("Enter the name of the group you want to see meetups for");
            string groupname = Console.ReadLine();

            string json = await meetup.RestOperations.GetForObjectAsync<string>($"https://api.meetup.com/2/events?group_urlname={groupname}");
            var oEvents = JObject.Parse(json)["results"];

            foreach (var oEvent in oEvents)
            {
                Console.WriteLine("Here's a meetup! - " + oEvent["name"]);
            }
        }
Example #10
0
        public static async Task<List<string>> GetMeetupsFor(string uservar, string toggle)
        {
            var token = await authenticate();
            var meetupServiceProvider = new MeetupServiceProvider(MeetupApiKey, MeetupSecretKey);
            var meetup = meetupServiceProvider.GetApi(token.Value, token.Secret);
            string json;
            if (toggle == "meetup")
            {
                json = await meetup.RestOperations.GetForObjectAsync<string>($"https://api.meetup.com/2/events?offset=0&format=json&limited_events=False&group_urlname={uservar}&photo-host=public&page=20&fields=&order=time&desc=false&status=upcoming&sig_id=182757480&sig=52d73860784c45691862aa492856c26332cd67af");
            }
            else
            {
                json = await meetup.RestOperations.GetForObjectAsync<string>($"https://api.meetup.com/2/concierge?zip={uservar}&offset=0&format=json&photo-host=public&page=500&sig_id=182757480&sig=199b985b4335074f44fbe4697f34f1ff7026bf50");
            }
            var oEvents = JObject.Parse(json)["results"];
            List<string> MEvents = new List<string>();
            foreach (var oEvent in oEvents)
            {
                MEvents.Add(oEvent["name"].ToString());
            }

            return MEvents;
        }
        public static async Task<List<MeetupInfo>> GetmeetupsFor(string groupname)
        {
            var token = await authenticate();
            var meetupServiceProvider = new MeetupServiceProvider(MeetupApiKey, MeetupApiSecret);
            var meetup = meetupServiceProvider.GetApi(token.Value, token.Secret);
            var group = groupname;
            string json = await meetup.RestOperations.GetForObjectAsync<string>($"https://api.meetup.com/2/events?group_urlname={group}");

            var o = JObject.Parse(json);

            List<MeetupInfo> meetupEvents = JsonConvert.DeserializeObject<List<MeetupInfo>>(o["results"].ToString());

            //var oEvents = JObject.Parse(json)["results"];

            //foreach (var oEvent in oEvents)
            //{

            //    var result = JsonConvert.DeserializeObject<List<MeetupInfo>>(json);
            //    Console.WriteLine(result);

            //}

            return meetupEvents;
        }