diff --git a/src/QueryBuilder/DirectoryQuery/DirectoryQuery.php b/src/QueryBuilder/DirectoryQuery/DirectoryQuery.php new file mode 100644 index 0000000..5c1d489 --- /dev/null +++ b/src/QueryBuilder/DirectoryQuery/DirectoryQuery.php @@ -0,0 +1,26 @@ +QueryString = $queryString; + } + + public function RunQuery(DeegraphServer $server): DirectoryQueryResponse + { + $response = $server->RunRawRequest( + endpoint: "/api/v1/@query", + method: "POST", + body: $this->QueryString + ); + $temp = json_decode($response, true); + return new DirectoryQueryResponse($temp); + } +} diff --git a/src/QueryBuilder/DirectoryQuery/DirectoryQueryBuilder.php b/src/QueryBuilder/DirectoryQuery/DirectoryQueryBuilder.php new file mode 100644 index 0000000..0184506 --- /dev/null +++ b/src/QueryBuilder/DirectoryQuery/DirectoryQueryBuilder.php @@ -0,0 +1,33 @@ +RelativePath = $relativePath; + return $this; + } + + public function Build(): DirectoryQuery + { + self::ValidateValues(target: $this); + $builder = "DIRECTORY " . $this->RelativePath; + return new DirectoryQuery(queryString: $builder); + } +} \ No newline at end of file diff --git a/src/QueryBuilder/DirectoryQuery/DirectoryQueryResponse.php b/src/QueryBuilder/DirectoryQuery/DirectoryQueryResponse.php new file mode 100644 index 0000000..3aa60bc --- /dev/null +++ b/src/QueryBuilder/DirectoryQuery/DirectoryQueryResponse.php @@ -0,0 +1,13 @@ +Map = $deegraphResponse["@map"]; + } +} \ No newline at end of file diff --git a/src/QueryBuilder/PermissionsQuery/PermissionQuery.php b/src/QueryBuilder/PermissionsQuery/PermissionQuery.php index 471e3b6..d483f68 100644 --- a/src/QueryBuilder/PermissionsQuery/PermissionQuery.php +++ b/src/QueryBuilder/PermissionsQuery/PermissionQuery.php @@ -4,7 +4,7 @@ namespace Darksparrow\DeegraphInteractions\QueryBuilder\PermissionsQuery; use Darksparrow\DeegraphInteractions\Core\DeegraphServer; -class PermissionQuery +final class PermissionQuery { protected string $QueryString; diff --git a/src/QueryBuilder/PermissionsQuery/PermissionQueryBuilder.php b/src/QueryBuilder/PermissionsQuery/PermissionQueryBuilder.php index 61e1764..d10d788 100644 --- a/src/QueryBuilder/PermissionsQuery/PermissionQueryBuilder.php +++ b/src/QueryBuilder/PermissionsQuery/PermissionQueryBuilder.php @@ -7,7 +7,7 @@ use Darksparrow\DeegraphInteractions\Attributes\QueryBuilderRequiredField; use Darksparrow\DeegraphInteractions\QueryBuilder\QueryBuilderTrait; #[QueryBuilderQuery] -class PermissionQueryBuilder +final class PermissionQueryBuilder { use QueryBuilderTrait; @@ -35,6 +35,8 @@ class PermissionQueryBuilder public function Build(): PermissionQuery { + self::ValidateValues(target: $this); + $builder = "PERMISSIONS "; if($this->On != "") $builder .= " ON {". $this->On . "}"; if($this->As != "") $builder .= " AS {". $this->As . "}"; diff --git a/src/QueryBuilder/PermissionsQuery/PermissionQueryBuilderInterface.php b/src/QueryBuilder/PermissionsQuery/PermissionQueryBuilderInterface.php index 1f0b72c..2cd3466 100644 --- a/src/QueryBuilder/PermissionsQuery/PermissionQueryBuilderInterface.php +++ b/src/QueryBuilder/PermissionsQuery/PermissionQueryBuilderInterface.php @@ -5,4 +5,4 @@ namespace Darksparrow\DeegraphInteractions\QueryBuilder\PermissionsQuery; interface PermissionQueryBuilderInterface { public function Build() : PermissionQuery; -} \ No newline at end of file +} diff --git a/src/QueryBuilder/PermissionsQuery/PermissionQueryResponse.php b/src/QueryBuilder/PermissionsQuery/PermissionQueryResponse.php index c1370d3..fb8036c 100644 --- a/src/QueryBuilder/PermissionsQuery/PermissionQueryResponse.php +++ b/src/QueryBuilder/PermissionsQuery/PermissionQueryResponse.php @@ -2,7 +2,7 @@ namespace Darksparrow\DeegraphInteractions\QueryBuilder\PermissionsQuery; -class PermissionQueryResponse +final class PermissionQueryResponse { public bool $CanAct = false; public bool $CanDelete = false;