1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /*
3  * GData Client
4  * Copyright (C) Philip Withnall 2009, 2015 <philip@tecnocode.co.uk>
5  *
6  * GData Client is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * GData Client is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with GData Client.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef GDATA_YOUTUBE_QUERY_H
21 #define GDATA_YOUTUBE_QUERY_H
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 
26 #include <gdata/gdata-query.h>
27 #include <gdata/gdata-types.h>
28 #include <gdata/services/youtube/gdata-youtube-enums.h>
29 #include <gdata/services/youtube/gdata-youtube-content.h>
30 
31 G_BEGIN_DECLS
32 
33 /**
34  * GDataYouTubeSafeSearch:
35  * @GDATA_YOUTUBE_SAFE_SEARCH_NONE: YouTube will not perform any filtering on the search result set
36  * @GDATA_YOUTUBE_SAFE_SEARCH_MODERATE: YouTube will filter some content from search results and, at the least,
37  * will filter content that is restricted in your locale
38  * @GDATA_YOUTUBE_SAFE_SEARCH_STRICT: YouTube will try to exclude all restricted content from the search result set
39  *
40  * Safe search levels for removing restricted entries from query results. For more information, see the
41  * <ulink type="http" url="https://developers.google.com/youtube/v3/docs/search/list#safeSearch">online documentation</ulink>.
42  *
43  * Since: 0.3.0
44  */
45 typedef enum {
46 	GDATA_YOUTUBE_SAFE_SEARCH_NONE = 0,
47 	GDATA_YOUTUBE_SAFE_SEARCH_MODERATE,
48 	GDATA_YOUTUBE_SAFE_SEARCH_STRICT
49 } GDataYouTubeSafeSearch;
50 
51 #ifndef LIBGDATA_DISABLE_DEPRECATED
52 /**
53  * GDataYouTubeSortOrder:
54  * @GDATA_YOUTUBE_SORT_NONE: do not explicitly sort in any sense
55  * @GDATA_YOUTUBE_SORT_ASCENDING: sort results in ascending order of the order field
56  * @GDATA_YOUTUBE_SORT_DESCENDING: sort results in descending order of the order field
57  *
58  * Sort orders for the search results from queries. They specify the order of the designated order field.
59  *
60  * Since: 0.3.0
61  * Deprecated: 0.17.0: No longer supported by Google. There is no
62  *   replacement.
63  */
64 typedef enum {
65 	GDATA_YOUTUBE_SORT_NONE = 0,
66 	GDATA_YOUTUBE_SORT_ASCENDING,
67 	GDATA_YOUTUBE_SORT_DESCENDING
68 } GDataYouTubeSortOrder;
69 #endif /* !LIBGDATA_DISABLE_DEPRECATED */
70 
71 /**
72  * GDataYouTubeAge:
73  * @GDATA_YOUTUBE_AGE_ALL_TIME: retrieve all videos, regardless of the date they were uploaded
74  * @GDATA_YOUTUBE_AGE_TODAY: retrieve only videos uploaded in the past day
75  * @GDATA_YOUTUBE_AGE_THIS_WEEK: retrieve only videos uploaded in the past week
76  * @GDATA_YOUTUBE_AGE_THIS_MONTH: retrieve only videos uploaded in the past month
77  *
78  * Video ages, allowing queries to be limited to videos uploaded in a recent time period.
79  *
80  * Since: 0.3.0
81  */
82 typedef enum {
83 	GDATA_YOUTUBE_AGE_ALL_TIME = 0,
84 	GDATA_YOUTUBE_AGE_TODAY,
85 	GDATA_YOUTUBE_AGE_THIS_WEEK,
86 	GDATA_YOUTUBE_AGE_THIS_MONTH
87 } GDataYouTubeAge;
88 
89 #ifndef LIBGDATA_DISABLE_DEPRECATED
90 /**
91  * GDataYouTubeUploader:
92  * @GDATA_YOUTUBE_UPLOADER_ALL: retrieve all videos, regardless of who uploaded them
93  * @GDATA_YOUTUBE_UPLOADER_PARTNER: retrieve only videos uploaded by YouTube partners
94  *
95  * Video uploaders, allowing queries to be limited to returning videos uploaded by YouTube partners.
96  *
97  * Since: 0.3.0
98  * Deprecated: 0.17.0: No longer supported by Google. There is no
99  *   replacement.
100  */
101 typedef enum {
102 	GDATA_YOUTUBE_UPLOADER_ALL = 0,
103 	GDATA_YOUTUBE_UPLOADER_PARTNER
104 } GDataYouTubeUploader;
105 #endif /* !LIBGDATA_DISABLE_DEPRECATED */
106 
107 /**
108  * GDATA_YOUTUBE_LICENSE_CC:
109  *
110  * Value for #GDataYouTubeQuery:license to restrict search results to only videos which are Creative Commons licensed. Specifically, the license
111  * is the Creative Commons Attribution 3.0 Unported license; see the
112  * <ulink type="http" url="http://www.google.com/support/youtube/bin/answer.py?hl=en&answer=1284989">YouTube Help</ulink> for more information.
113  *
114  * Since: 0.11.0
115  */
116 #define GDATA_YOUTUBE_LICENSE_CC "cc"
117 
118 /**
119  * GDATA_YOUTUBE_LICENSE_STANDARD:
120  *
121  * Value for #GDataYouTubeQuery:license to restrict search results to only videos which are under the standard YouTube license.
122  *
123  * Since: 0.11.0
124  */
125 #define GDATA_YOUTUBE_LICENSE_STANDARD "youtube"
126 
127 #define GDATA_TYPE_YOUTUBE_QUERY		(gdata_youtube_query_get_type ())
128 #define GDATA_YOUTUBE_QUERY(o)			(G_TYPE_CHECK_INSTANCE_CAST ((o), GDATA_TYPE_YOUTUBE_QUERY, GDataYouTubeQuery))
129 #define GDATA_YOUTUBE_QUERY_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), GDATA_TYPE_YOUTUBE_QUERY, GDataYouTubeQueryClass))
130 #define GDATA_IS_YOUTUBE_QUERY(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GDATA_TYPE_YOUTUBE_QUERY))
131 #define GDATA_IS_YOUTUBE_QUERY_CLASS(k)		(G_TYPE_CHECK_CLASS_TYPE ((k), GDATA_TYPE_YOUTUBE_QUERY))
132 #define GDATA_YOUTUBE_QUERY_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GDATA_TYPE_YOUTUBE_QUERY, GDataYouTubeQueryClass))
133 
134 typedef struct _GDataYouTubeQueryPrivate	GDataYouTubeQueryPrivate;
135 
136 /**
137  * GDataYouTubeQuery:
138  *
139  * All the fields in the #GDataYouTubeQuery structure are private and should never be accessed directly.
140  *
141  * Since: 0.3.0
142  */
143 typedef struct {
144 	GDataQuery parent;
145 	GDataYouTubeQueryPrivate *priv;
146 } GDataYouTubeQuery;
147 
148 /**
149  * GDataYouTubeQueryClass:
150  *
151  * All the fields in the #GDataYouTubeQueryClass structure are private and should never be accessed directly.
152  *
153  * Since: 0.3.0
154  */
155 typedef struct {
156 	/*< private >*/
157 	GDataQueryClass parent;
158 
159 	/*< private >*/
160 	/* Padding for future expansion */
161 	void (*_g_reserved0) (void);
162 	void (*_g_reserved1) (void);
163 } GDataYouTubeQueryClass;
164 
165 GType gdata_youtube_query_get_type (void) G_GNUC_CONST;
166 
167 GDataYouTubeQuery *gdata_youtube_query_new (const gchar *q) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
168 
169 void gdata_youtube_query_get_location (GDataYouTubeQuery *self, gdouble *latitude, gdouble *longitude, gdouble *radius, gboolean *has_location);
170 void gdata_youtube_query_set_location (GDataYouTubeQuery *self, gdouble latitude, gdouble longitude, gdouble radius, gboolean has_location);
171 const gchar *gdata_youtube_query_get_order_by (GDataYouTubeQuery *self) G_GNUC_PURE;
172 void gdata_youtube_query_set_order_by (GDataYouTubeQuery *self, const gchar *order_by);
173 const gchar *gdata_youtube_query_get_restriction (GDataYouTubeQuery *self) G_GNUC_PURE;
174 void gdata_youtube_query_set_restriction (GDataYouTubeQuery *self, const gchar *restriction);
175 GDataYouTubeSafeSearch gdata_youtube_query_get_safe_search (GDataYouTubeQuery *self) G_GNUC_PURE;
176 void gdata_youtube_query_set_safe_search (GDataYouTubeQuery *self, GDataYouTubeSafeSearch safe_search);
177 GDataYouTubeAge gdata_youtube_query_get_age (GDataYouTubeQuery *self) G_GNUC_PURE;
178 void gdata_youtube_query_set_age (GDataYouTubeQuery *self, GDataYouTubeAge age);
179 const gchar *gdata_youtube_query_get_license (GDataYouTubeQuery *self) G_GNUC_PURE;
180 void gdata_youtube_query_set_license (GDataYouTubeQuery *self, const gchar *license);
181 
182 #ifndef LIBGDATA_DISABLE_DEPRECATED
183 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
184 GDataYouTubeFormat gdata_youtube_query_get_format (GDataYouTubeQuery *self) G_GNUC_PURE G_GNUC_DEPRECATED;
185 void gdata_youtube_query_set_format (GDataYouTubeQuery *self, GDataYouTubeFormat format) G_GNUC_DEPRECATED;
186 const gchar *gdata_youtube_query_get_language (GDataYouTubeQuery *self) G_GNUC_PURE G_GNUC_DEPRECATED;
187 void gdata_youtube_query_set_language (GDataYouTubeQuery *self, const gchar *language) G_GNUC_DEPRECATED;
188 GDataYouTubeSortOrder gdata_youtube_query_get_sort_order (GDataYouTubeQuery *self) G_GNUC_PURE G_GNUC_DEPRECATED;
189 void gdata_youtube_query_set_sort_order (GDataYouTubeQuery *self, GDataYouTubeSortOrder sort_order) G_GNUC_DEPRECATED;
190 GDataYouTubeUploader gdata_youtube_query_get_uploader (GDataYouTubeQuery *self) G_GNUC_PURE G_GNUC_DEPRECATED;
191 void gdata_youtube_query_set_uploader (GDataYouTubeQuery *self, GDataYouTubeUploader uploader) G_GNUC_DEPRECATED;
192 G_GNUC_END_IGNORE_DEPRECATIONS
193 #endif /* !LIBGDATA_DISABLE_DEPRECATED */
194 
195 G_END_DECLS
196 
197 #endif /* !GDATA_YOUTUBE_QUERY_H */
198