|
@ -5,6 +5,7 @@ namespace Darksparrow\DeegraphInteractions\Core; |
|
|
use Auxilium\Exceptions\DatabaseConnectionException; |
|
|
use Auxilium\Exceptions\DatabaseConnectionException; |
|
|
use Auxilium\Exceptions\DeegraphException; |
|
|
use Auxilium\Exceptions\DeegraphException; |
|
|
use Darksparrow\DeegraphInteractions\DataStructures\DeegraphNodeDetails; |
|
|
use Darksparrow\DeegraphInteractions\DataStructures\DeegraphNodeDetails; |
|
|
|
|
|
use Darksparrow\DeegraphInteractions\DataStructures\NewNodeDetails; |
|
|
use Darksparrow\DeegraphInteractions\DataStructures\ServerInfo; |
|
|
use Darksparrow\DeegraphInteractions\DataStructures\ServerInfo; |
|
|
use Darksparrow\DeegraphInteractions\DataStructures\UUID; |
|
|
use Darksparrow\DeegraphInteractions\DataStructures\UUID; |
|
|
use Exception; |
|
|
use Exception; |
|
@ -174,4 +175,27 @@ class DeegraphServer |
|
|
); |
|
|
); |
|
|
return new ServerInfo(response: $response); |
|
|
return new ServerInfo(response: $response); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function CreatedNewNode( |
|
|
|
|
|
UUID $actorID, |
|
|
|
|
|
string $dataURL, |
|
|
|
|
|
?string $schema = null, |
|
|
|
|
|
?UUID $creator = null |
|
|
|
|
|
): NewNodeDetails |
|
|
|
|
|
{ |
|
|
|
|
|
$body = [ |
|
|
|
|
|
"@data" => $dataURL, |
|
|
|
|
|
]; |
|
|
|
|
|
if($schema != null) |
|
|
|
|
|
$body["@schema"] = $schema; |
|
|
|
|
|
|
|
|
|
|
|
$response = $this->RunRawRequest( |
|
|
|
|
|
actorID: $actorID, |
|
|
|
|
|
endpoint: "/api/v1/@new", |
|
|
|
|
|
method: "PUT", |
|
|
|
|
|
body: json_encode($body), |
|
|
|
|
|
); |
|
|
|
|
|
return new NewNodeDetails(serverResponse: $response); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|