Ejemplo n.º 1
0
        private async Task GetStoreQuestionsAsync(Location store, List <Question> questions,
                                                  AccountsResource.LocationsResource.QuestionsResource.ListRequest selectedLocationQuestions)
        {
            ListQuestionsResponse questionResult = await selectedLocationQuestions.ExecuteAsync().ConfigureAwait(false);

            if (questionResult != null)
            {
                if (questionResult.Questions != null)
                {
                    questions.AddRange(questionResult.Questions);

                    while (questionResult.NextPageToken != null)

                    {
                        selectedLocationQuestions.PageToken = questionResult.NextPageToken;

                        questionResult = await selectedLocationQuestions.ExecuteAsync().ConfigureAwait(false);

                        questions.AddRange(questionResult.Questions);
                    }
                }
                else
                {
                    await OutputAsync($"No questions found for {store.StoreCode}");
                }
            }
        }
Ejemplo n.º 2
0
        private async Task <List <Question> > GetStoreQuestionsAsync(MyBusinessService service, Location store)
        {
            List <Question> questions = new List <Question>();

            AccountsResource.LocationsResource.QuestionsResource.ListRequest selectedLocationQuestions =
                service.Accounts.Locations.Questions.List(store.Name);
            try
            {
                try
                {
                    await GetStoreQuestionsAsync(store, questions, selectedLocationQuestions).ConfigureAwait(false);
                }
                catch (TaskCanceledException)
                {
                    await OutputAsync($"Failed to get questions for {store.StoreCode}, retrying");

                    try
                    {
                        await GetStoreQuestionsAsync(store, questions, selectedLocationQuestions).ConfigureAwait(false);
                    }
                    catch (TaskCanceledException ex2)
                    {
                        await AddUserNotificationAsync(
                            $"PERMENANTLY FAILED to get questions for {store.StoreCode} {ex2.Message}");
                    }
                }
            }
            catch (Google.GoogleApiException ex)
            {
                await AddUserNotificationAsync($"Failed to get questions for {store.StoreCode} {ex.Message}");
            }

            return(questions);
        }