1 /* 2 * librest - RESTful web services access 3 * Copyright (c) 2008, 2009, Intel Corporation. 4 * 5 * Authors: Rob Bradford <rob@linux.intel.com> 6 * Ross Burton <ross@linux.intel.com> 7 * 8 * This program is free software; you can redistribute it and/or modify it 9 * under the terms and conditions of the GNU Lesser General Public License, 10 * version 2.1, as published by the Free Software Foundation. 11 * 12 * This program is distributed in the hope it will be useful, but WITHOUT ANY 13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 15 * more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public License 18 * along with this program; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 */ 22 23 #ifndef _FLICKR_PROXY 24 #define _FLICKR_PROXY 25 26 #include <rest/rest-proxy.h> 27 #include <rest/rest-xml-parser.h> 28 29 G_BEGIN_DECLS 30 31 #define FLICKR_TYPE_PROXY flickr_proxy_get_type() 32 33 #define FLICKR_PROXY(obj) \ 34 (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLICKR_TYPE_PROXY, FlickrProxy)) 35 36 #define FLICKR_PROXY_CLASS(klass) \ 37 (G_TYPE_CHECK_CLASS_CAST ((klass), FLICKR_TYPE_PROXY, FlickrProxyClass)) 38 39 #define FLICKR_IS_PROXY(obj) \ 40 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLICKR_TYPE_PROXY)) 41 42 #define FLICKR_IS_PROXY_CLASS(klass) \ 43 (G_TYPE_CHECK_CLASS_TYPE ((klass), FLICKR_TYPE_PROXY)) 44 45 #define FLICKR_PROXY_GET_CLASS(obj) \ 46 (G_TYPE_INSTANCE_GET_CLASS ((obj), FLICKR_TYPE_PROXY, FlickrProxyClass)) 47 48 typedef struct _FlickrProxyPrivate FlickrProxyPrivate; 49 50 /** 51 * FlickrProxy: 52 * 53 * #FlickrProxy has no publicly available members. 54 */ 55 typedef struct { 56 RestProxy parent; 57 FlickrProxyPrivate *priv; 58 } FlickrProxy; 59 60 typedef struct { 61 RestProxyClass parent_class; 62 /*< private >*/ 63 /* padding for future expansion */ 64 gpointer _padding_dummy[8]; 65 } FlickrProxyClass; 66 67 #define FLICKR_PROXY_ERROR flickr_proxy_error_quark() 68 69 GType flickr_proxy_get_type (void); 70 71 RestProxy* flickr_proxy_new (const char *api_key, 72 const char *shared_secret); 73 74 RestProxy* flickr_proxy_new_with_token (const char *api_key, 75 const char *shared_secret, 76 const char *token); 77 78 const char * flickr_proxy_get_api_key (FlickrProxy *proxy); 79 80 const char * flickr_proxy_get_shared_secret (FlickrProxy *proxy); 81 82 const char * flickr_proxy_get_token (FlickrProxy *proxy); 83 84 void flickr_proxy_set_token (FlickrProxy *proxy, const char *token); 85 86 char * flickr_proxy_sign (FlickrProxy *proxy, GHashTable *params); 87 88 char * flickr_proxy_build_login_url (FlickrProxy *proxy, 89 const char *frob, 90 const char *perms); 91 92 gboolean flickr_proxy_is_successful (RestXmlNode *root, GError **error); 93 94 RestProxyCall * flickr_proxy_new_upload (FlickrProxy *proxy); 95 96 RestProxyCall * flickr_proxy_new_upload_for_file (FlickrProxy *proxy, const char *filename, GError **error); 97 98 G_END_DECLS 99 100 #endif /* _FLICKR_PROXY */ 101