Beispiel #1
0
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public string BuildURL(Dictionary <string, string> parameters)
        {
            string url = null;

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", "Type");
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <LegalType>(parameters["Type"]);

            switch (Type)
            {
            case LegalType.Privacy:
                url = BuildPrivacyUrl(parameters);
                break;

            case LegalType.TOS:
                url = BuildTosUrl(parameters);
                break;

            default:
                break;
            }

            return(url);
        }
        /// <summary>
        /// Builds url based on input parameters.
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public Request BuildUrl(Dictionary <string, string> parameters)
        {
            const string TypeParam = "Type";

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", TypeParam);
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <GeoType>(parameters["Type"]);

            switch (Type)
            {
            case GeoType.ID:
                return(BuildIDUrl(parameters));

            case GeoType.Reverse:
                return(BuildReverseUrl(parameters));

            case GeoType.Search:
                return(BuildSearchUrl(parameters));

            case GeoType.SimilarPlaces:
                return(BuildSimilarPlacesUrl(parameters));

            default:
                throw new InvalidOperationException("The default case of BuildUrl should never execute because a Type must be specified.");
            }
        }
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual string BuildURL(Dictionary <string, string> parameters)
        {
            string url = null;

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", "Type");
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <AccountType>(parameters["Type"]);

            switch (Type)
            {
            case AccountType.VerifyCredentials:
                url = BaseUrl + "account/verify_credentials.xml";
                break;

            case AccountType.RateLimitStatus:
                url = BaseUrl + "account/rate_limit_status.xml";
                break;

            default:
                throw new InvalidOperationException("The default case of BuildUrl should never execute because a Type must be specified.");
            }

            return(url);
        }
Beispiel #4
0
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual Request BuildUrl(Dictionary <string, string> parameters)
        {
            if (parameters == null || !parameters.ContainsKey(nameof(Type)))
            {
                throw new ArgumentException($"You must set {nameof(Type)}.", nameof(Type));
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <WelcomeMessageType>(parameters[nameof(Type)]);

            switch (Type)
            {
            case WelcomeMessageType.ListMessages:
                return(BuildListMessagesUrl(parameters));

            case WelcomeMessageType.ListRules:
                return(BuildListRulesUrl(parameters));

            case WelcomeMessageType.ShowMessage:
                return(BuildShowMessagesUrl(parameters));

            case WelcomeMessageType.ShowRule:
                return(BuildShowRuleUrl(parameters));

            default:
                throw new InvalidOperationException(
                          $"Didn't recognize '{Type}' for {nameof(Type)} parameter in WelcomeMessageRequestProcessor.BuildUrl.");
            }
        }
Beispiel #5
0
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public string BuildURL(Dictionary <string, string> parameters)
        {
            string url = null;

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", "Type");
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <UserStreamType>(parameters["Type"]);

            switch (Type)
            {
            case UserStreamType.User:
                url = BuildUserUrl(parameters);
                break;

            case UserStreamType.Site:
                url = BuildSiteUrl(parameters);
                break;

            default:
                throw new ArgumentException("Invalid UserStreamType", "UserStreamType");
            }

            return(url);
        }
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public string BuildURL(Dictionary <string, string> parameters)
        {
            string url = null;

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", "Type");
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <SocialGraphType>(parameters["Type"]);

            switch (Type)
            {
            case SocialGraphType.Followers:
                url = BuildSocialGraphFollowersUrl(parameters);
                break;

            case SocialGraphType.Friends:
                url = BuildSocialGraphFriendsUrl(parameters);
                break;

            default:
                throw new InvalidOperationException("The default case of BuildUrl should never execute because a Type must be specified.");
            }

            return(url);
        }
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public Request BuildUrl(Dictionary <string, string> parameters)
        {
            const string TypeParam = "Type";

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", TypeParam);
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <StreamingType>(parameters["Type"]);

            switch (Type)
            {
            case StreamingType.Filter:
                return(BuildFilterUrl(parameters));

            case StreamingType.Firehose:
                return(BuildFirehoseUrl(parameters));

            case StreamingType.Links:
                return(BuildLinksUrl(parameters));

            case StreamingType.Retweet:
                return(BuildRetweetUrl(parameters));

            case StreamingType.Sample:
                return(BuildSampleUrl(parameters));

            default:
                break;
            }

            return(null);
        }
        public Request BuildUrl(Dictionary <string, string> parameters)
        {
            const string TypeParam = "Type";

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", TypeParam);
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <HelpType>(parameters["Type"]);

            switch (Type)
            {
            case HelpType.Configuration:
                return(new Request(BaseUrl + "help/configuration.json"));

            case HelpType.Languages:
                return(new Request(BaseUrl + "help/languages.json"));

            case HelpType.Privacy:
                return(new Request(BaseUrl + "help/privacy.json"));

            case HelpType.RateLimits:
                return(BuildRateLimitsUrl(parameters));

            case HelpType.Tos:
                return(new Request(BaseUrl + "help/tos.json"));

            default:
                throw new InvalidOperationException("The default case of BuildUrl should never execute because a Type must be specified.");
            }
        }
Beispiel #9
0
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual string BuildURL(Dictionary <string, string> parameters)
        {
            string url = null;

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", "Type");
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <DirectMessageType>(parameters["Type"]);

            switch (Type)
            {
            case DirectMessageType.SentBy:
                url = BuildSentByUrl(parameters);
                break;

            case DirectMessageType.SentTo:
                url = BuildSentToUrl(parameters);
                break;

            case DirectMessageType.Show:
                url = BuildShowUrl(parameters);
                break;

            default:
                throw new InvalidOperationException("The default case of BuildUrl should never execute because a Type must be specified.");
            }

            return(url);
        }
Beispiel #10
0
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual Request BuildUrl(Dictionary <string, string> parameters)
        {
            const string TypeParam = "Type";

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", TypeParam);
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <TrendType>(parameters["Type"]);

            switch (Type)
            {
            case TrendType.Available:
                return(BuildAvailableTrendsUrl());

            case TrendType.Closest:
                return(BuildClosestTrendsUrl(parameters));

            case TrendType.Place:
                return(BuildPlaceTrendsUrl(parameters));

            default:
                throw new InvalidOperationException("The default case of BuildUrl should never execute because a Type must be specified.");
            }
        }
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public string BuildURL(Dictionary <string, string> parameters)
        {
            string url = null;

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", "Type");
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <GeoType>(parameters["Type"]);

            switch (Type)
            {
            case GeoType.ID:
                url = BuildIDUrl(parameters);
                break;

            case GeoType.Reverse:
                url = BuildReverseUrl(parameters);
                break;

            case GeoType.Nearby:
                url = BuildNearbyPlacesUrl(parameters);
                break;

            default:
                throw new InvalidOperationException("The default case of BuildUrl should never execute because a Type must be specified.");
            }

            return(url);
        }
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual string BuildURL(Dictionary <string, string> parameters)
        {
            string url = null;

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", "Type");
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <BlockingType>(parameters["Type"]);

            switch (Type)
            {
            case BlockingType.Blocking:
                url = BuildBlockingUrl(parameters);
                break;

            case BlockingType.Exists:
                url = BuildBlockingExistsUrl(parameters);
                break;

            case BlockingType.IDS:
                url = BuildBlockingIDsUrl(parameters);
                break;

            default:
                throw new InvalidOperationException("The default case of BuildUrl should never execute because a Type must be specified.");
            }

            return(url);
        }
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual string BuildURL(Dictionary <string, string> parameters)
        {
            string url = null;

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", "Type");
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <StatusType>(parameters["Type"]);

            switch (Type)
            {
            case StatusType.Friends:
                url = BuildFriendUrl(parameters);
                break;

            case StatusType.Home:
                url = BuildHomeUrl(parameters);
                break;

            case StatusType.Mentions:
                url = BuildMentionsUrl(parameters);
                break;

            case StatusType.Public:
                url = BuildPublicUrl();
                break;

            case StatusType.Retweets:
                url = BuildRetweetsUrl(parameters);
                break;

            case StatusType.RetweetedByMe:
                url = BuildRetweetedByMeUrl(parameters);
                break;

            case StatusType.RetweetedToMe:
                url = BuildRetweetedToMeUrl(parameters);
                break;

            case StatusType.RetweetsOfMe:
                url = BuildRetweetsOfMeUrl(parameters);
                break;

            case StatusType.Show:
                url = BuildShowUrl(parameters);
                break;

            case StatusType.User:
                url = BuildUserUrl(parameters);
                break;

            default:
                throw new InvalidOperationException("The default case of BuildUrl should never execute because a Type must be specified.");
            }

            return(url);
        }
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public Request BuildUrl(Dictionary <string, string> parameters)
        {
            if (parameters.ContainsKey("Type"))
            {
                Type = RequestProcessorHelper.ParseQueryEnumType <SearchType>(parameters["Type"]);
            }
            else
            {
                throw new ArgumentException("Type is required", "Type");
            }

            return(BuildSearchUrlParameters(parameters, "search/tweets.json"));
        }
Beispiel #15
0
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual string BuildURL(Dictionary <string, string> parameters)
        {
            string url = null;

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", "Type");
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <UserType>(parameters["Type"]);

            switch (Type)
            {
            case UserType.Followers:
                url = BuildFollowersUrl(parameters);
                break;

            case UserType.Friends:
                url = BuildFriendsUrl(parameters);
                break;

            case UserType.Show:
                url = BuildShowUrl(parameters);
                break;

            case UserType.Categories:
                url = BuildCategoriesUrl(parameters);
                break;

            case UserType.Category:
                url = BuildUsersInCategoryUrl(parameters);
                break;

            case UserType.CategoryStatus:
                url = BuildCategoryStatusUrl(parameters);
                break;

            case UserType.Lookup:
                url = BuildLookupUrl(parameters);
                break;

            case UserType.Search:
                url = BuildSearchUrl(parameters);
                break;

            default:
                throw new InvalidOperationException("The default case of BuildUrl should never execute because a Type must be specified.");
            }

            return(url);
        }
Beispiel #16
0
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public string BuildURL(Dictionary <string, string> parameters)
        {
            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", "Type");
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <SearchType>(parameters["Type"]);

            var url = BaseUrl + "search.atom";

            url = BuildSearchUrlParameters(parameters, url);

            return(url);
        }
Beispiel #17
0
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual string BuildURL(Dictionary <string, string> parameters)
        {
            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", "Type");
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <FavoritesType>(parameters["Type"]);

            var url = BaseUrl + "favorites.xml";

            url = BuildFavoritesUrlParameters(parameters, url);

            return(url);
        }
Beispiel #18
0
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual Request BuildUrl(Dictionary <string, string> parameters)
        {
            const string TypeParam = "Type";

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", TypeParam);
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <StatusType>(parameters["Type"]);

            switch (Type)
            {
            case StatusType.Conversation:
                return(BuildConversationUrl(parameters));

            case StatusType.Home:
                return(BuildHomeUrl(parameters));

            case StatusType.Lookup:
                return(BuildLookupUrl(parameters));

            case StatusType.Mentions:
                return(BuildMentionsUrl(parameters));

            case StatusType.Oembed:
                return(BuildOembedUrl(parameters));

            case StatusType.RetweetsOfMe:
                return(BuildRetweetsOfMeUrl(parameters));

            case StatusType.Retweets:
                return(BuildRetweets(parameters));

            case StatusType.Show:
                return(BuildShowUrl(parameters));

            case StatusType.User:
                return(BuildUserUrl(parameters));

            case StatusType.Retweeters:
                return(BuildRetweetersUrl(parameters));

            default:
                throw new InvalidOperationException("The default case of BuildUrl should never execute because a Type must be specified.");
            }
        }
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual Request BuildUrl(Dictionary <string, string> parameters)
        {
            if (parameters == null || !parameters.ContainsKey(TypeParam))
            {
                throw new ArgumentException("You must set Type.", TypeParam);
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <ListType>(parameters[TypeParam]);

            switch (Type)
            {
            case ListType.Lists:
                return(BuildListsUrl(parameters));

            case ListType.Show:
                return(BuildShowUrl(parameters));

            case ListType.Statuses:
                return(BuildStatusesUrl(parameters));

            case ListType.Memberships:
                return(BuildMembershipsUrl(parameters));

            case ListType.Subscriptions:
                return(BuildSubscriptionsUrl(parameters));

            case ListType.Members:
                return(BuildMembersUrl(parameters));

            case ListType.IsMember:
                return(BuildIsMemberUrl(parameters));

            case ListType.Subscribers:
                return(BuildSubscribersUrl(parameters));

            case ListType.IsSubscribed:
                return(BuildIsSubcribedUrl(parameters));

            case ListType.Ownerships:
                return(BuildOwnershipsUrl(parameters));

            default:
                throw new ArgumentException("Invalid ListType", TypeParam);
            }
        }
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual Request BuildUrl(Dictionary <string, string> parameters)
        {
            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", "Type");
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <RelatedResultsType>(parameters["Type"]);

            switch (Type)
            {
            case RelatedResultsType.Show:
                return(BuildShowUrl(parameters));

            default:
                throw new InvalidOperationException("The default case of BuildUrl should never execute because a Type must be specified.");
            }
        }
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public Request BuildUrl(Dictionary <string, string> parameters)
        {
            const string TypeParam = "Type";

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", TypeParam);
            }

            // Joe: Why force a Type when there is only one Type?
            //
            // Answer: This is a LINQ to Twitter idiom and is necessary for extensibility.
            // If we add another member to the enum in the future and this wasn't here,
            // then adding this later would break a lot of code - Joe
            Type = RequestProcessorHelper.ParseQueryEnumType <SearchType>(parameters["Type"]);

            return(BuildSearchUrlParameters(parameters, "tweets.json"));
        }
Beispiel #22
0
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual Request BuildUrl(Dictionary <string, string> parameters)
        {
            const string TypeParam = "Type";

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", TypeParam);
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <UserType>(parameters["Type"]);

            switch (Type)
            {
            case UserType.Show:
                return(BuildShowUrl(parameters));

            case UserType.Categories:
                return(BuildCategoriesUrl(parameters));

            case UserType.Category:
                return(BuildUsersInCategoryUrl(parameters));

            case UserType.CategoryStatus:
                return(BuildCategoryStatusUrl(parameters));

            case UserType.Lookup:
                return(BuildLookupUrl(parameters));

            case UserType.Search:
                return(BuildSearchUrl(parameters));

            case UserType.Contributees:
                return(BuildContributeesUrl(parameters));

            case UserType.Contributors:
                return(BuildContributorsUrl(parameters));

            case UserType.BannerSizes:
                return(BuildBannerSizesUrl(parameters));

            default:
                throw new InvalidOperationException("The default case of BuildUrl should never execute because a Type must be specified.");
            }
        }
Beispiel #23
0
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual Request BuildUrl(Dictionary <string, string> parameters)
        {
            const string TypeParam = "Type";

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", TypeParam);
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <FriendshipType>(parameters["Type"]);

            switch (Type)
            {
            case FriendshipType.Incoming:
                return(BuildFriendshipIncomingUrl(parameters));

            case FriendshipType.Lookup:
                return(BuildLookupUrl(parameters));

            case FriendshipType.Outgoing:
                return(BuildFriendshipOutgoingUrl(parameters));

            case FriendshipType.Show:
                return(BuildFriendshipShowUrl(parameters));

            case FriendshipType.NoRetweetIDs:
                return(BuildFriendshipNoRetweetIDsUrl());

            case FriendshipType.FollowersList:
                return(BuildFollowersListUrl(parameters));

            case FriendshipType.FriendsList:
                return(BuildFriendsListUrl(parameters));

            case FriendshipType.FollowerIDs:
                return(BuildFollowerIDsUrl(parameters));

            case FriendshipType.FriendIDs:
                return(BuildFriendIDsUrl(parameters));

            default:
                throw new ArgumentException("Invalid FriendshipType", "Type");
            }
        }
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual Request BuildUrl(Dictionary <string, string> parameters)
        {
            const string TypeParam   = "Type";
            const string ParamsParam = "parameters";

            if (parameters == null)
            {
                throw new ArgumentException("You must pass a \"parameters\" Dictionary<string, string> parameter.", ParamsParam);
            }

            if (!parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", TypeParam);
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <FavoritesType>(parameters["Type"]);

            return(BuildFavoritesUrlParameters(parameters));
        }
Beispiel #25
0
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual string BuildURL(Dictionary <string, string> parameters)
        {
            string url = null;

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", "Type");
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <TrendType>(parameters["Type"]);

            switch (Type)
            {
            case TrendType.Current:
                url = BuildCurrentTrendsUrl(parameters);
                break;

            case TrendType.Daily:
                url = BuildDailyTrendsUrl(parameters);
                break;

            case TrendType.Trend:
                url = BuildTrendsUrl(parameters);
                break;

            case TrendType.Weekly:
                url = BuildWeeklyTrendsUrl(parameters);
                break;

            case TrendType.Available:
                url = BuildAvailableTrendsUrl(parameters);
                break;

            case TrendType.Location:
                url = BuildLocationTrendsUrl(parameters);
                break;

            default:
                throw new InvalidOperationException("The default case of BuildUrl should never execute because a Type must be specified.");
            }

            return(url);
        }
Beispiel #26
0
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual Request BuildUrl(Dictionary <string, string> parameters)
        {
            if (parameters == null || !parameters.ContainsKey(nameof(Type)))
            {
                throw new ArgumentException($"You must set {nameof(Type)}.", nameof(Type));
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <AccountActivityType>(parameters[nameof(Type)]);

            switch (Type)
            {
            case AccountActivityType.Subscriptions:
                return(BuildSubscriptionsUrl(parameters));

            case AccountActivityType.Webhooks:
                return(BuildWebhooksUrl(parameters));

            default:
                throw new InvalidOperationException(
                          $"Didn't recognize '{Type}' for {nameof(Type)} parameter in AccountActivityRequestProcessor.BuildUrl.");
            }
        }
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public string BuildURL(Dictionary <string, string> parameters)
        {
            string url = null;

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", "Type");
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <StreamingType>(parameters["Type"]);

            switch (Type)
            {
            case StreamingType.Filter:
                url = BuildFilterUrl(parameters);
                break;

            case StreamingType.Firehose:
                url = BuildFirehoseUrl(parameters);
                break;

            case StreamingType.Links:
                url = BuildLinksUrl(parameters);
                break;

            case StreamingType.Retweet:
                url = BuildRetweetUrl(parameters);
                break;

            case StreamingType.Sample:
                url = BuildSampleUrl(parameters);
                break;

            default:
                break;
            }

            return(url);
        }
Beispiel #28
0
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual Request BuildUrl(Dictionary <string, string> parameters)
        {
            const string TypeParam = "Type";

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", TypeParam);
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <ControlStreamType>(parameters["Type"]);

            switch (Type)
            {
            case ControlStreamType.Followers:
                return(BuildFollowersUrl(parameters));

            case ControlStreamType.Info:
                return(BuildInfoUrl(parameters));

            default:
                throw new InvalidOperationException("The default case of BuildUrl should never execute because a Type must be specified.");
            }
        }
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public virtual Request BuildUrl(Dictionary <string, string> parameters)
        {
            const string TypeParam = "Type";

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", TypeParam);
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <AccountType>(parameters[TypeParam]);

            switch (Type)
            {
            case AccountType.VerifyCredentials:
                return(BuildVerifyCredentialsUrl(parameters));

            case AccountType.Settings:
                return(new Request(BaseUrl + "account/settings.json"));

            default:
                throw new InvalidOperationException("The default case of BuildUrl should never execute because a Type must be specified.");
            }
        }
Beispiel #30
0
        /// <summary>
        /// builds url based on input parameters
        /// </summary>
        /// <param name="parameters">criteria for url segments and parameters</param>
        /// <returns>URL conforming to Twitter API</returns>
        public Request BuildUrl(Dictionary <string, string> parameters)
        {
            const string TypeParam = "Type";

            if (parameters == null || !parameters.ContainsKey("Type"))
            {
                throw new ArgumentException("You must set Type.", TypeParam);
            }

            Type = RequestProcessorHelper.ParseQueryEnumType <UserStreamType>(parameters["Type"]);

            switch (Type)
            {
            case UserStreamType.User:
                return(BuildUserUrl(parameters));

            case UserStreamType.Site:
                return(BuildSiteUrl(parameters));

            default:
                throw new ArgumentException("Invalid UserStreamType", "UserStreamType");
            }
        }