1 //-----------------------------------------------------------------------
2 // <copyright file="TwitterTrend.cs" company="Patrick 'Ricky' Smith">
3 //  This file is part of the Twitterizer library (http://www.twitterizer.net/)
4 //
5 //  Copyright (c) 2010, Patrick "Ricky" Smith (ricky@digitally-born.com)
6 //  All rights reserved.
7 //
8 //  Redistribution and use in source and binary forms, with or without modification, are
9 //  permitted provided that the following conditions are met:
10 //
11 //  - Redistributions of source code must retain the above copyright notice, this list
12 //    of conditions and the following disclaimer.
13 //  - Redistributions in binary form must reproduce the above copyright notice, this list
14 //    of conditions and the following disclaimer in the documentation and/or other
15 //    materials provided with the distribution.
16 //  - Neither the name of the Twitterizer nor the names of its contributors may be
17 //    used to endorse or promote products derived from this software without specific
18 //    prior written permission.
19 //
20 //  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 //  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 //  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 //  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 //  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 //  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 //  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 //  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 //  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 //  POSSIBILITY OF SUCH DAMAGE.
30 // </copyright>
31 // <author>Ricky Smith</author>
32 // <summary>The Twitter Trend class</summary>
33 //-----------------------------------------------------------------------
34 
35 namespace Twitterizer
36 {
37     using System;
38     using System.Runtime.Serialization;
39     using Twitterizer.Core;
40 
41     /// <summary>
42     /// The TwitterTrend class.
43     /// </summary>
44 #if !SILVERLIGHT
45     [Serializable]
46 #endif
47     [DataContract]
48     public class TwitterTrend : TwitterObject
49     {
50         /// <summary>
51         /// Gets or sets the name.
52         /// </summary>
53         /// <value>The name of the trend.</value>
54         [DataMember]
55         public string Name { get; set; }
56 
57         /// <summary>
58         /// Gets or sets the address.
59         /// </summary>
60         /// <value>The address.</value>
61         [DataMember]
62         public string Address { get; set; }
63 
64         /// <summary>
65         /// Gets or sets the search query.
66         /// </summary>
67         /// <value>The search query.</value>
68         [DataMember]
69         public string SearchQuery { get; set; }
70 
71         /// <summary>
72         /// Gets or sets the promoted content value.
73         /// </summary>
74         /// <value>Promoted Content.</value>
75         [DataMember]
76         public string PromotedContent { get; set; }
77 
78         /// <summary>
79         /// Gets or sets the events.
80         /// </summary>
81         /// <value>The events.</value>
82         [DataMember]
83         public string Events { get; set; }
84 
85         /// <summary>
86         /// Gets the trends with the specified WOEID.
87         /// </summary>
88         /// <param name="tokens">The request tokens.</param>
89         /// <param name="WoeID">The WOEID.</param>
90         /// <param name="options">The options.</param>
91         /// <returns>
92         /// A collection of <see cref="Twitterizer.TwitterTrend"/> objects.
93         /// </returns>
Trends(OAuthTokens tokens, int WoeID, LocalTrendsOptions options)94         public static TwitterResponse<TwitterTrendCollection> Trends(OAuthTokens tokens, int WoeID, LocalTrendsOptions options)
95         {
96             Commands.TrendsCommand command = new Twitterizer.Commands.TrendsCommand(tokens, WoeID, options);
97 
98             return Core.CommandPerformer.PerformAction(command);
99         }
100 
101         /// <summary>
102         /// Gets the current trends.
103         /// </summary>
104         /// <param name="tokens">The request tokens.</param>
105         /// <param name="WoeID">The WOEID.</param>
106         /// <returns>
107         /// A collection of <see cref="Twitterizer.TwitterTrend"/> objects.
108         /// </returns>
Trends(OAuthTokens tokens, int WoeID)109         public static TwitterResponse<TwitterTrendCollection> Trends(OAuthTokens tokens, int WoeID)
110         {
111             return Trends(tokens, WoeID, null);
112         }
113 
114         /// <summary>
115         /// Gets the trends with the specified WOEID.
116         /// </summary>
117         /// <param name="WoeID">The WOEID.</param>
118         /// <param name="options">The options.</param>
119         /// <returns>
120         /// A collection of <see cref="Twitterizer.TwitterTrend"/> objects.
121         /// </returns>
Trends(int WoeID, LocalTrendsOptions options)122         public static TwitterResponse<TwitterTrendCollection> Trends(int WoeID, LocalTrendsOptions options)
123         {
124             return Trends(null, WoeID, options);
125         }
126 
127         /// <summary>
128         /// Gets the current trends.
129         /// </summary>
130         /// <param name="WoeID">The WOEID.</param>
131         /// <returns>
132         /// A collection of <see cref="Twitterizer.TwitterTrend"/> objects.
133         /// </returns>
Trends(int WoeID)134         public static TwitterResponse<TwitterTrendCollection> Trends(int WoeID)
135         {
136             return Trends(null, WoeID, null);
137         }
138 
139         /// <summary>
140         /// Gets the locations where trends are available.
141         /// </summary>
142         /// <param name="tokens">The request tokens.</param>
143         /// <param name="options">The options.</param>
144         /// <returns>
145         /// A collection of <see cref="Twitterizer.TwitterTrendLocation"/> objects.
146         /// </returns>
Available(OAuthTokens tokens, AvailableTrendsOptions options)147         public static TwitterResponse<TwitterTrendLocationCollection> Available(OAuthTokens tokens, AvailableTrendsOptions options)
148         {
149             Commands.AvailableTrendsCommand command = new Twitterizer.Commands.AvailableTrendsCommand(tokens, options);
150 
151             return Core.CommandPerformer.PerformAction(command);
152         }
153 
154         /// <summary>
155         /// Gets the locations where trends are available.
156         /// </summary>
157         /// <param name="options">The options.</param>
158         /// <returns>
159         /// A collection of <see cref="Twitterizer.TwitterTrendLocation"/> objects.
160         /// </returns>
Available(AvailableTrendsOptions options)161         public static TwitterResponse<TwitterTrendLocationCollection> Available(AvailableTrendsOptions options)
162         {
163             return Available(null, options);
164         }
165 
166         /// <summary>
167         /// Gets the locations where trends are available.
168         /// </summary>
169         /// <returns>
170         /// A collection of <see cref="Twitterizer.TwitterTrendLocation"/> objects.
171         /// </returns>
Available()172         public static TwitterResponse<TwitterTrendLocationCollection> Available()
173         {
174             return Available(null, null);
175         }
176 
177 
178         /// <summary>
179         /// Gets the daily global trends
180         /// </summary>
181         /// <param name="tokens">The request tokens.</param>
182         /// <param name="options">The options.</param>
Daily(OAuthTokens tokens, TrendsOptions options)183         public static TwitterResponse<TwitterTrendDictionary> Daily(OAuthTokens tokens, TrendsOptions options)
184         {
185             Commands.DailyTrendsCommand command = new Twitterizer.Commands.DailyTrendsCommand(tokens, options);
186 
187             return Core.CommandPerformer.PerformAction(command);
188         }
189 
190         /// <summary>
191         /// Gets the daily global trends
192         /// </summary>
193         /// <param name="options">The options.</param>
Daily(TrendsOptions options)194         public static TwitterResponse<TwitterTrendDictionary> Daily(TrendsOptions options)
195         {
196             return Daily(null, options);
197         }
198 
199         /// <summary>
200         /// Gets the daily global trends
201         /// </summary>
Daily()202         public static TwitterResponse<TwitterTrendDictionary> Daily()
203         {
204             return Daily(null, null);
205         }
206 
207         /// <summary>
208         /// Gets the weekly global trends
209         /// </summary>
210         /// <param name="tokens">The request tokens.</param>
211         /// <param name="options">The options.</param>
Weekly(OAuthTokens tokens, TrendsOptions options)212         public static TwitterResponse<TwitterTrendDictionary> Weekly(OAuthTokens tokens, TrendsOptions options)
213         {
214             Commands.WeeklyTrendsCommand command = new Twitterizer.Commands.WeeklyTrendsCommand(tokens, options);
215 
216             return Core.CommandPerformer.PerformAction(command);
217         }
218 
219         /// <summary>
220         /// Gets the weekly global trends
221         /// </summary>
222         /// <param name="options">The options.</param>
Weekly(TrendsOptions options)223         public static TwitterResponse<TwitterTrendDictionary> Weekly(TrendsOptions options)
224         {
225             return Weekly(null, options);
226         }
227 
228         /// <summary>
229         /// Gets the weekly global trends
230         /// </summary>
Weekly()231         public static TwitterResponse<TwitterTrendDictionary> Weekly()
232         {
233             return Weekly(null, null);
234         }
235     }
236 }
237