<commit_before><?php require('test-inc.php');

define('API_KEY', file_get_contents('./../.apikey'));

$autoload = require('../GraphCommons/Autoload.php');
$autoload->register();

use GraphCommons\GraphCommons;
use GraphCommons\Graph\Graph;
use GraphCommons\Graph\Signal;
use GraphCommons\Graph\SignalCollection;

$gc = new GraphCommons(API_KEY, ['debug' => true]);
// pre($gc);

// check status
// $data = $gc->api->status();

// get graph
// $graph = $gc->api->getGraph('8f8c794a-a498-4c3e-a73b-95a460db6e3a');
// pre($graph->id);
// pre($graph->image->path);
// pre($graph->license->type);
// pre($graph->layout->springLength);
// foreach ($graph->users as $user) {
//     print $user->id ."\n";
// }

// add graph
// $graph = $gc->api->addGraph((function() {
//     $graph = new Graph();
//     $graph->setName('Person Graph');
//     $graph->setDescription('The Person Graph!');
//     $graph->setStatus(Graph::STATUS_DRAFT);
//     $graph->setSignals(SignalCollection::fromArray(array(
//         array(
//             'action'        => Signal::NODE_CREATE,
//             'parameters'    => array(
//                 'name'      => 'Ahmet',
//                 'type'      => 'Person',
//             ),
//         ),
//         array(
//             'action'        => Signal::EDGE_CREATE,
//             'parameters'    => array(
//                 'from_name' => 'Ahmet',
//                 'from_type' => 'Person',
//                 'to_name'   => 'Burak',
//                 'to_type'   => 'Person',
//                 'name'      => 'COLLABORATED',
//                 'weight'    => 2,
//             ),
//         ),
//     )));
//     return $graph;
// })());

// add graph signal
// $data = $gc->api->addGraphSignal(
//     '29d02ccc-fcd5-4b9c-aa74-bd1033b6d3bd', SignalCollection::fromArray(array(
//         array(
//             'action'        => Signal::EDGE_CREATE,
//             'parameters'    => array(
//                 'from_name' => 'Ahmet',
//                 'from_type' => 'Person',
//                 'to_name'   => 'Fatih',
//                 'to_type'   => 'Person',
//                 'name'      => 'COLLABORATED',
//                 'weight'    => 2,
//             ),
//         ),
// )));

// get node
// $data = $gc->api->getNode('255905e9-c82f-4468-a659-7139dd66d810');

// get nodes
// $data = $gc->api->getNodes(array(
//     'query' => 'kerem',
//     'limit' => 1,
// ));

// error!
try {
    $data = $gc->api->getGraph('nö!');
} catch (\Throwable $e) {
    // 404
    print $e->getCode() ."\n";
    // API error: code(404) message(Graph not found)
    print $e->getMessage() ."\n";

    // print original response status
    print $gc->client->response->getStatus() ."\n";
    // print original response body
    print $gc->client->response->getBody() ."\n";
}







// pre(SignalCollection::fromArray(array(
//     array(
//         'action' => Signal::NODE_CREATE,
//         'parameters' => array(
//             'name' => 'The foo',<commit_msg>test: update use's.<commit_after><?php require('test-inc.php');

define('API_KEY', file_get_contents('./../.apikey'));

$autoload = require('../GraphCommons/Autoload.php');
$autoload->register();

use GraphCommons\GraphCommons;
use GraphCommons\Graph\Graph;
use GraphCommons\Graph\Signal;
use GraphCommons\Graph\SignalCollection;

$gc = new GraphCommons(API_KEY, ['debug' => true]);
// pre($gc);

// check status
$data = $gc->api->status();
// pre($data,1);

// get graph
// $graph = $gc->api->getGraph('8f8c794a-a498-4c3e-a73b-95a460db6e3a');

// pre($graph->image->path);
// pre($graph->license->type);
// pre($graph->layout->springLength);
// foreach ($graph->users as $user) {
//     print $user->id ."\n";
// }

// add graph
// $graph = $gc->api->addGraph((function() {
//     $graph = new Graph();
//     $graph->setName('Person Graph');
//     $graph->setDescription('The Person Graph!');
//     $graph->setStatus(Graph::STATUS_DRAFT);
//     $graph->setSignals(SignalCollection::fromArray(array(
//         array(
//             'action'        => Signal::NODE_CREATE,
//             'parameters'    => array(
//                 'name'      => 'Ahmet',
//                 'type'      => 'Person',
//             ),
//         ),
//         array(
//             'action'        => Signal::EDGE_CREATE,
//             'parameters'    => array(
//                 'from_name' => 'Ahmet',
//                 'from_type' => 'Person',
//                 'to_name'   => 'Burak',
//                 'to_type'   => 'Person',
//                 'name'      => 'COLLABORATED',
//                 'weight'    => 2,
//             ),
//         ),
//     )));
//     return $graph;
// })());

// add graph signal
// $data = $gc->api->addGraphSignal(
//     '29d02ccc-fcd5-4b9c-aa74-bd1033b6d3bd', SignalCollection::fromArray(array(
//         array(
//             'action'        => Signal::EDGE_CREATE,
//             'parameters'    => array(
//                 'from_name' => 'Ahmet',
//                 'from_type' => 'Person',
//                 'to_name'   => 'Fatih',
//                 'to_type'   => 'Person',
//                 'name'      => 'COLLABORATED',
//                 'weight'    => 2,
//             ),
//         ),
// )));

// get node
// $data = $gc->api->getNode('255905e9-c82f-4468-a659-7139dd66d810');

// get nodes
// $data = $gc->api->getNodes(array(
//     'query' => 'kerem',
//     'limit' => 1,
// ));

// error!
// try {
//     $gc->api->getGraph('nö!');
// } catch (\Throwable $e) {
//     // 404
//     print $e->getCode() ."\n";
//     // API error: code(404) message(Graph not found)
//     print $e->getMessage() ."\n";

//     // print original response status
//     print $gc->client->response->getStatus() ."\n";
//     // print original response body
//     print $gc->client->response->getBody() ."\n";
// }







// pre(SignalCollection::fromArray(array(
//     array(
//         'action' => Signal::NODE_CREATE,
//         'parameters' => array(
//             'name' => 'The foo',
{'fraction_non_alphanumeric': 0.2224804914494438, 'fraction_numerical': 0.022746139797443134, 'mean_word_length': 1.736937755565652, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 126, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2302449', 'n_tokens_mistral': 2081, 'n_tokens_neox': 1988, 'n_words': 322}