Ejemplo n.º 1
0
        /// <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&lt;IEnumerable&lt;Board&gt;&gt;</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);
        }
Ejemplo n.º 2
0
        /// <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&lt;IEnumerable&lt;Board&gt;&gt;</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);
        }