Blame gfbgraph/gfbgraph-common.c

Packit 87b8d1
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*-  */
Packit 87b8d1
/*
Packit 87b8d1
 * libgfbgraph - GObject library for Facebook Graph API
Packit 87b8d1
 * Copyright (C) 2013-2015 Álvaro Peña <alvaropg@gmail.com>
Packit 87b8d1
 *
Packit 87b8d1
 * GFBGraph is free software; you can redistribute it and/or
Packit 87b8d1
 * modify it under the terms of the GNU Lesser General Public
Packit 87b8d1
 * License as published by the Free Software Foundation; either
Packit 87b8d1
 * version 2.1 of the License, or (at your option) any later version.
Packit 87b8d1
 *
Packit 87b8d1
 * GFBGraph is distributed in the hope that it will be useful,
Packit 87b8d1
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 87b8d1
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 87b8d1
 * Lesser General Public License for more details.
Packit 87b8d1
 *
Packit 87b8d1
 * You should have received a copy of the GNU Lesser General Public
Packit 87b8d1
 * License along with GFBGraph.  If not, see <http://www.gnu.org/licenses/>.
Packit 87b8d1
 */
Packit 87b8d1
Packit 87b8d1
#include "gfbgraph-common.h"
Packit 87b8d1
Packit 87b8d1
#include <rest/rest-proxy.h>
Packit 87b8d1
Packit 87b8d1
#define FACEBOOK_ENDPOINT "https://graph.facebook.com/v2.3"
Packit 87b8d1
Packit 87b8d1
/**
Packit 87b8d1
 * gfbgraph_new_rest_call:
Packit 87b8d1
 * @authorizer: a #GFBGraphAuthorizer.
Packit 87b8d1
 *
Packit 87b8d1
 * Create a new #RestProxyCall pointing to the Facebook Graph API url (https://graph.facebook.com)
Packit 87b8d1
 * and processed by the authorizer to allow queries.
Packit 87b8d1
 *
Packit 87b8d1
 * Returns: (transfer full): a new #RestProxyCall or %NULL in case of error.
Packit 87b8d1
 **/
Packit 87b8d1
RestProxyCall*
Packit 87b8d1
gfbgraph_new_rest_call (GFBGraphAuthorizer *authorizer)
Packit 87b8d1
{
Packit 87b8d1
        RestProxy *proxy;
Packit 87b8d1
        RestProxyCall *rest_call;
Packit 87b8d1
Packit 87b8d1
        g_return_val_if_fail (GFBGRAPH_IS_AUTHORIZER (authorizer), NULL);
Packit 87b8d1
Packit 87b8d1
        proxy = rest_proxy_new (FACEBOOK_ENDPOINT, FALSE);
Packit 87b8d1
        rest_call = rest_proxy_new_call (proxy);
Packit 87b8d1
Packit 87b8d1
        gfbgraph_authorizer_process_call (authorizer, rest_call);
Packit 87b8d1
Packit 87b8d1
        g_object_unref (proxy);
Packit 87b8d1
Packit 87b8d1
        return rest_call;
Packit 87b8d1
}