gfbgraph Reference Manual: GFBGraphConnectable

## GFBGraphConnectable GFBGraphConnectable — Connectable interface for nodes |

## Functions

GHashTable * | gfbgraph_connectable_get_connection_post_params ()
GList * | gfbgraph_connectable_parse_connected_data ()
gboolean | gfbgraph_connectable_is_connectable_to ()
const gchar * | gfbgraph_connectable_get_connection_path ()
GList * | gfbgraph_connectable_default_parse_connected_data ()

## Types and Values

struct | GFBGraphConnectableInterface

## Object Hierarchy

## Includes

    #include <gfbgraph/gfbgraph.h>

## Description

GFBGraphConnectable interface allow the connection between nodes. You can see the posible (not necesary implemented) connections in the section "Connections" in any node object in the

Facebook Graph API documentation

## Functions

### gfbgraph_connectable_get_connection_post_params ()

    GHashTable *
    gfbgraph_connectable_get_connection_post_params
                                   (GFBGraphConnectable *self,
                                    GType node_type);

Get the params to be inserted in a request to the Facebook Graph API in order to append the node `self` to a node of type `node_type` .

#### Parameters

self | a GFBGraphConnectable. |
node_type | a GType, required a GFBGRAPH_TYPE_NODE or children. |

#### Returns

A string based GHashTable with the params and his values or `NULL`.

[transfer full]

### gfbgraph_connectable_parse_connected_data ()

    GList *
    gfbgraph_connectable_parse_connected_data
                                   (GFBGraphConnectable *self,
                                    const gchar *payload,
                                    GError **error);

Parse the response contained in `payload` when a `gfbgraph_node_get_connection_nodes()` was executed.

#### Parameters

self | a GFBGraphConnectable. |
payload | a const gchar with the response string from the Facebook Graph API. |
error | a GError. | [allow-none]

#### Returns

a newly-allocated GList of GFBGraphNode created from the `payload` or `NULL`.

[element-type GFBGraphNode][transfer full]

### gfbgraph_connectable_is_connectable_to ()

    gboolean
    gfbgraph_connectable_is_connectable_to
                                   (GFBGraphConnectable *self,
                                    GType node_type);

Check if `self` object, normally a GFBGraphNode implementing the GFBGraphConnectable interface, has the possibility to be connected to another node of type `node_type` .

#### Parameters

self | a GFBGraphConnectable. |
node_type | a GType, required a GFBGRAPH_TYPE_NODE or children. |

#### Returns

`TRUE` in case that the `self` object can be connected to a node of type `node_type` , `FALSE` otherwise.

### gfbgraph_connectable_get_connection_path ()

    const gchar *
    gfbgraph_connectable_get_connection_path
                                   (GFBGraphConnectable *self,
                                    GType node_type);

Get the Facebook Graph API function path to retrieve the nodes connected with `node_type` managed by the GFBGraphConnectable object.

#### Parameters

self | a GFBGraphConnectable. |
node_type | a GType, required a GFBGRAPH_TYPE_NODE or children. |

#### Returns

a const gchar with the function path or `NULL`.

[transfer none]

### gfbgraph_connectable_default_parse_connected_data ()

    GList *
    gfbgraph_connectable_default_parse_connected_data
                                   (GFBGraphConnectable *self,
                                    const gchar *payload,
                                    GError **error);

In most cases, GFBGraphConnectable implementers can use this function in order to parse the response when a `gfbgraph_node_get_connection_nodes()` is executed and the `gfbgraph_connectable_parse_connected_data()` was called.

Normally, Facebook Graph API returns the connections in the same way, using JSON objects, with a root object called "data".

#### Parameters

self | a GFBGraphConnectable. |
payload | a const gchar with the response string from the Facebook Graph API. |
error | a GError or `NULL`. | [allow-none]

#### Returns

a newly-allocated GList of GFBGraphNode with the same GType as `self` .

[element-type GFBGraphNode][transfer full]

## Types and Values

### struct GFBGraphConnectableInterface

    struct GFBGraphConnectableInterface {
            GTypeInterface parent;

            GHashTable *connections;

            GHashTable   *(*get_connection_post_params) (GFBGraphConnectable *self, GType node_type);
            GList        *(*parse_connected_data) (GFBGraphConnectable *self, const gchar *payload, GError **error);
    };