---
title: IFCApi
summary: PHP SDK: the IFC - Industry Foundation Classes operations, 21 methods, each with its parameters, result and a complete example.
order: 14
languages: [php]
sdk-package: PHP SDK · BIMworks
link-terms: true
---

# IFCApi

[[page:reference/sdk/php|PHP SDK]] · `BIMworks\Api` · class · 21 methods

IFC related calls, for example queries and model checks

Construct it with the client of [[page:reference/sdk/php#connect|the connect step]]: `new IFCApi(config: $client)`. Each method is one operation of the [[page:api|API part]], where it runs on its page.

<table class="dense">
<thead><tr><th>Method</th><th>Operation</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>[[page:reference/sdk/php/ifcapi#check|check]]</code></td><td>[[openapi:Check]]</td><td>Check one or more models</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#committransaction|commitTransaction]]</code></td><td>[[openapi:CommitTransaction]]</td><td>Commit a BUL transaction against the head Version of a Node, producing a new Version</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#comparemodels|compareModels]]</code></td><td>[[openapi:CompareModels]]</td><td>Compare two models with a BCOL definition</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#compareobjects|compareObjects]]</code></td><td>[[openapi:CompareObjects]]</td><td>Compare two chosen objects</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#deletecomparepairoverride|deleteComparePairOverride]]</code></td><td>[[openapi:DeleteComparePairOverride]]</td><td>Take a pair fixed by hand away again</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#exportcompareresult|exportCompareResult]]</code></td><td>[[openapi:ExportCompareResult]]</td><td>Download a stored compare result (deprecated, use GetCompareResult with a format)</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#getcomparebul|getCompareBul]]</code></td><td>[[openapi:GetCompareBul]]</td><td>The changes between two Versions as BUL</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#getcompareresult|getCompareResult]]</code></td><td>[[openapi:GetCompareResult]]</td><td>Read a stored compare result</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#getmatchcandidates|getMatchCandidates]]</code></td><td>[[openapi:GetMatchCandidates]]</td><td>The added objects that could be a removed object</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#getobjecthistory|getObjectHistory]]</code></td><td>[[openapi:GetObjectHistory]]</td><td>The change history of one object</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#getversionchanges|getVersionChanges]]</code></td><td>[[openapi:GetVersionChanges]]</td><td>What changed in Versions since the Versions before them</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#listbuildingstoreys|listBuildingStoreys]]</code></td><td>[[openapi:ListBuildingStoreys]]</td><td>The building storeys of one or more models</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#listcomparepairoverrides|listComparePairOverrides]]</code></td><td>[[openapi:ListComparePairOverrides]]</td><td>The pairs fixed by hand for two Versions</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#mapqids|mapQids]]</code></td><td>[[openapi:MapQids]]</td><td>Map objects of one Version to their counterparts in another</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#parsequery|parseQuery]]</code></td><td>[[openapi:ParseQuery]]</td><td>Parse a BQL query into its syntax tree</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#query|query]]</code></td><td>[[openapi:Query]]</td><td>Query one or more IFC models</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#recorduploadastransaction|recordUploadAsTransaction]]</code></td><td>[[openapi:RecordUploadAsTransaction]]</td><td>Replace an upload by a transaction with the same changes</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#resolvebvl|resolveBvl]]</code></td><td>[[openapi:ResolveBvl]]</td><td>Resolve a BVL script to what it shows, hides, selects and colours</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#setcomparepairoverride|setComparePairOverride]]</code></td><td>[[openapi:SetComparePairOverride]]</td><td>Fix a pair by hand for two Versions</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#textsearch|textSearch]]</code></td><td>[[openapi:TextSearch]]</td><td>Free-text search in models</td></tr>
<tr><td><code>[[page:reference/sdk/php/ifcapi#upgradesyntax|upgradeSyntax]]</code></td><td>[[openapi:UpgradeSyntax]]</td><td>Rewrite BQL, BVL and BCL written for 2.x in the 3.0 syntax</td></tr>
</tbody>
</table>

## `check` {#check}

```php
public function check(CheckRequest $check_request): CheckResultsResponse
```

Check one or more models. Checks one or more models against an IDS definition (XML), a BCL definition (BIM.works Checking Language) or a stored check action. Pass exactly one of `ids`, `bcl` and `action_uuid`. A stored action is an IDS or a BCL (CHECK3) action; running it needs read rights on it, not actions:read.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:Check]] · <code>POST /openapi/ifc/Check</code></td></tr>
<tr><th>Scope</th><td>[[scope:checks:run]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>check_request</code></td><td><code>[[page:reference/sdk/php/models#CheckRequest|CheckRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:Check]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#CheckResultsResponse|CheckResultsResponse]]</code> — The check results in the requested format

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\CheckRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "models": [
    {
      "type": "VersionModelIdentifier",
      "uuid": "BIM_WORKS_FIRST_MODEL"
    }
  ],
  "ids": "<ids xmlns=\"http://standards.buildingsmart.org/IDS\">…</ids>"
}
JSON, CheckRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->check($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `commitTransaction` {#committransaction}

```php
public function commitTransaction(CommitTransactionRequest $commit_transaction_request): CommitTransactionResult
```

Commit a BUL transaction against the head Version of a Node, producing a new Version. Applies one or more BUL (BIM.works Update Language) statements to the given Version and creates a new Version on the same Node. The given Version must be the head (latest) Version of its Node: history is linear, and committing against an older Version fails with 409. The commit is atomic (either the complete new Version is created, or nothing is) and synchronous: the new Version is ready when the call returns.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:CommitTransaction]] · <code>POST /openapi/ifc/CommitTransaction</code></td></tr>
<tr><th>Scope</th><td>[[scope:model:write]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>commit_transaction_request</code></td><td><code>[[page:reference/sdk/php/models#CommitTransactionRequest|CommitTransactionRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:CommitTransaction]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#CommitTransactionResult|CommitTransactionResult]]</code> — The transaction result. For a commit: <code>transaction</code> and <code>node</code>. For a dry run: <code>updates</code>, <code>is_head</code> and (only when the Version is not the head) <code>head_version</code>

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\CommitTransactionRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "version_uuid": "BIM_WORKS_FIRST_MODEL",
  "bul": [
    "SET attribute.Name = \"Standard door\" WHERE type = IFCDOOR"
  ],
  "comment": "Normalize door names"
}
JSON, CommitTransactionRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->commitTransaction($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `compareModels` {#comparemodels}

```php
public function compareModels(CompareModelsRequest $compare_models_request): CompareResult
```

Compare two models with a BCOL definition. Compares two models (usually two Versions of one Node, left the older one) and returns what was added, removed, changed and unchanged, by the categories of a BCOL (BIM.works Compare Language) definition: the built-in Default, another built-in definition, a stored compare action, or BCOL text.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:CompareModels]] · <code>POST /openapi/ifc/CompareModels</code></td></tr>
<tr><th>Scope</th><td>[[scope:query:run]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>compare_models_request</code></td><td><code>[[page:reference/sdk/php/models#CompareModelsRequest|CompareModelsRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:CompareModels]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#CompareResult|CompareResult]]</code> — The compare result, at the requested detail level

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\CompareModelsRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "left": {
    "models": [
      {
        "type": "VersionModelIdentifier",
        "uuid": "BIM_WORKS_FIRST_MODEL"
      }
    ]
  },
  "right": {
    "models": [
      {
        "type": "VersionModelIdentifier",
        "uuid": "BIM_WORKS_FIRST_MODEL"
      }
    ]
  }
}
JSON, CompareModelsRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->compareModels($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `compareObjects` {#compareobjects}

```php
public function compareObjects(CompareObjectsRequest $compare_objects_request): CompareObjectsResult
```

Compare two chosen objects. Compares two objects as one pair, whatever matching would say: of one model or of two. By default with the built-in `everything` definition. The answer says what differs (`changed_features` and `changes`, in the shape of a compare record) and what the definition watches.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:CompareObjects]] · <code>POST /openapi/ifc/CompareObjects</code></td></tr>
<tr><th>Scope</th><td>[[scope:query:run]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>compare_objects_request</code></td><td><code>[[page:reference/sdk/php/models#CompareObjectsRequest|CompareObjectsRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:CompareObjects]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#CompareObjectsResult|CompareObjectsResult]]</code> — What differs between the two objects

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\CompareObjectsRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "left": "",
  "right": "",
  "bcol": "",
  "definition": "everything"
}
JSON, CompareObjectsRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->compareObjects($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `deleteComparePairOverride` {#deletecomparepairoverride}

```php
public function deleteComparePairOverride(DeleteComparePairOverrideRequest $delete_compare_pair_override_request): ComparePairOverrides
```

Take a pair fixed by hand away again. Needs read rights on both Versions and write rights on the right one.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:DeleteComparePairOverride]] · <code>POST /openapi/ifc/DeleteComparePairOverride</code></td></tr>
<tr><th>Scope</th><td>[[scope:model:write]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>delete_compare_pair_override_request</code></td><td><code>[[page:reference/sdk/php/models#DeleteComparePairOverrideRequest|DeleteComparePairOverrideRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:DeleteComparePairOverride]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#ComparePairOverrides|ComparePairOverrides]]</code> — What the two Versions still have

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\DeleteComparePairOverrideRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "uuid": "BIM_WORKS_FIRST_MODEL"
}
JSON, DeleteComparePairOverrideRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->deleteComparePairOverride($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `exportCompareResult` {#exportcompareresult}

```php
public function exportCompareResult(ExportCompareResultRequest $export_compare_result_request): \SplFileObject
```

Download a stored compare result (deprecated, use GetCompareResult with a format). Deprecated: GetCompareResult with `format` (`document` for this operation's `json`) answers the same files, and a 202 with the status while the result is computed. This operation will be removed in a later release.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:ExportCompareResult]] · <code>POST /openapi/ifc/ExportCompareResult</code></td></tr>
<tr><th>Scope</th><td>[[scope:query:run]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>export_compare_result_request</code></td><td><code>[[page:reference/sdk/php/models#ExportCompareResultRequest|ExportCompareResultRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:ExportCompareResult]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>\SplFileObject</code> — The file

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\ExportCompareResultRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "result_uuid": "00000000-0000-0000-0000-000000000000",
  "format": "xlsx",
  "categories": [
    ""
  ]
}
JSON, ExportCompareResultRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->exportCompareResult($request);

// 4. The result
copy($result->getPathname(), 'export-compare-result.bin');
```

## `getCompareBul` {#getcomparebul}

```php
public function getCompareBul(GetCompareBulRequest $get_compare_bul_request): CompareBul
```

The changes between two Versions as BUL. The changes of a compare of two Versions written as BUL statements on the left Version, verified by a dry run of that Version, and the changes BUL cannot write, each with the reason. Values carry their IFC type (`IFCPOSITIVELENGTHMEASURE(1200 mm)`), moves and rotations become TRANSFORM statements, removed objects DELETE OBJECT; added objects, materials, relations and changed shapes are never BUL. The compare compares every value exactly and is stored like any other; the BUL is made once per compare result and kept with it. `record` says whether the right Version, an upload, can be replaced by a transaction with these changes (RecordUploadAsTransaction).

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:GetCompareBul]] · <code>POST /openapi/ifc/GetCompareBul</code></td></tr>
<tr><th>Scope</th><td>[[scope:query:run]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>get_compare_bul_request</code></td><td><code>[[page:reference/sdk/php/models#GetCompareBulRequest|GetCompareBulRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:GetCompareBul]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#CompareBul|CompareBul]]</code> — The statements, the residual, the coverage and whether the upload can be recorded

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\GetCompareBulRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "left_version_uuid": "00000000-0000-0000-0000-000000000000",
  "right_version_uuid": "00000000-0000-0000-0000-000000000000"
}
JSON, GetCompareBulRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->getCompareBul($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `getCompareResult` {#getcompareresult}

```php
public function getCompareResult(GetCompareResultRequest $get_compare_result_request): CompareResult
```

Read a stored compare result. Reads a result of CompareModels by its `result_uuid`, at a detail level and a page of its records, or its status while it is computed. Requires read access to both sides, and the same feature visibility as the caller that computed it (otherwise compare the models again).

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:GetCompareResult]] · <code>POST /openapi/ifc/GetCompareResult</code></td></tr>
<tr><th>Scope</th><td>[[scope:query:run]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>get_compare_result_request</code></td><td><code>[[page:reference/sdk/php/models#GetCompareResultRequest|GetCompareResultRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:GetCompareResult]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#CompareResult|CompareResult]]</code> — The result in the requested format, or for format json its status while it is computed

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\GetCompareResultRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "result_uuid": "4d1f2a3b-5c6d-4e7f-8a9b-0c1d2e3f4a5b",
  "details": "changes",
  "limit": 100
}
JSON, GetCompareResultRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->getCompareResult($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `getMatchCandidates` {#getmatchcandidates}

```php
public function getMatchCandidates(GetMatchCandidatesRequest $get_match_candidates_request): MatchCandidates
```

The added objects that could be a removed object. For the review of a stored compare's unmatched objects. Per removed object the added objects that could be it, best first by the geometric matcher's cost (the distance between the box centres, the size, the type, the name). Objects a user confirmed are listed apart.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:GetMatchCandidates]] · <code>POST /openapi/ifc/GetMatchCandidates</code></td></tr>
<tr><th>Scope</th><td>[[scope:query:run]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>get_match_candidates_request</code></td><td><code>[[page:reference/sdk/php/models#GetMatchCandidatesRequest|GetMatchCandidatesRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:GetMatchCandidates]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#MatchCandidates|MatchCandidates]]</code> — The removed objects with their candidates, the added objects, and what was confirmed

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\GetMatchCandidatesRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "result_uuid": "00000000-0000-0000-0000-000000000000",
  "left_oids": [
    0
  ],
  "left_qids": [
    ""
  ],
  "limit": 5,
  "radius_mm": 10000
}
JSON, GetMatchCandidatesRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->getMatchCandidates($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `getObjectHistory` {#getobjecthistory}

```php
public function getObjectHistory(GetObjectHistoryRequest $get_object_history_request): array<string,mixed>
```

The change history of one object. Every transaction that changed the object (by its oid) in the Node's line of Versions, newest first (as ListTransactions), with what it changed, and the Version the object first appeared in. `feature` limits it to one feature (`property.Pset_WallCommon.IsExternal`); `features_only` answers only the features that ever changed.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:GetObjectHistory]] · <code>POST /openapi/ifc/GetObjectHistory</code></td></tr>
<tr><th>Scope</th><td>[[scope:model:read]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>get_object_history_request</code></td><td><code>[[page:reference/sdk/php/models#GetObjectHistoryRequest|GetObjectHistoryRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:GetObjectHistory]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>array&lt;string,mixed&gt;</code> — The history

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\GetObjectHistoryRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "model": {
    "type": "UrlModelIdentifier"
  },
  "oid": 0,
  "feature": "",
  "features_only": false
}
JSON, GetObjectHistoryRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->getObjectHistory($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `getVersionChanges` {#getversionchanges}

```php
public function getVersionChanges(GetVersionChangesRequest $get_version_changes_request): VersionChangesResult
```

What changed in Versions since the Versions before them. The counts of the built-in Default compare of each Version with the Version before it on its Node (the highest version number below it among the Node's live, processed IFC Versions): added, removed, changed, unchanged and ignored objects. New uploads are compared automatically when the server has `compare.auto_on_upload` on. A Version nothing compared yet is compared now, in the background (`pending`), unless `only_stored` asks for stored results only. Read the full result with GetCompareResult or map objects with MapQids.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:GetVersionChanges]] · <code>POST /openapi/ifc/GetVersionChanges</code></td></tr>
<tr><th>Scope</th><td>[[scope:query:run]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>get_version_changes_request</code></td><td><code>[[page:reference/sdk/php/models#GetVersionChangesRequest|GetVersionChangesRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:GetVersionChanges]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#VersionChangesResult|VersionChangesResult]]</code> — Per Version its changes; for a single version_uuid the fields of that Version are also at the top level

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\GetVersionChangesRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "version_uuid": "BIM_WORKS_FIRST_MODEL",
  "version_uuids": [
    "BIM_WORKS_FIRST_MODEL"
  ],
  "only_stored": false
}
JSON, GetVersionChangesRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->getVersionChanges($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `listBuildingStoreys` {#listbuildingstoreys}

```php
public function listBuildingStoreys(ListBuildingStoreysRequest $list_building_storeys_request): BuildingStoreys
```

The building storeys of one or more models. The storeys of the models merged by name, highest first, each with the objects on it; the objects without a storey come last, under "[No BS]". What a storey picker or a walk mode needs in one call.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:ListBuildingStoreys]] · <code>POST /openapi/ifc/ListBuildingStoreys</code></td></tr>
<tr><th>Scope</th><td>[[scope:query:run]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>list_building_storeys_request</code></td><td><code>[[page:reference/sdk/php/models#ListBuildingStoreysRequest|ListBuildingStoreysRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:ListBuildingStoreys]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#BuildingStoreys|BuildingStoreys]]</code> — The storeys

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\ListBuildingStoreysRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "models": [
    {
      "type": "UrlModelIdentifier"
    }
  ]
}
JSON, ListBuildingStoreysRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->listBuildingStoreys($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `listComparePairOverrides` {#listcomparepairoverrides}

```php
public function listComparePairOverrides(ListComparePairOverridesRequest $list_compare_pair_overrides_request): ComparePairOverrides
```

The pairs fixed by hand for two Versions. The objects a user linked as one object, and the objects a user confirmed as really removed or added. Every compare of the two Versions uses them. Needs read rights on both Versions.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:ListComparePairOverrides]] · <code>POST /openapi/ifc/ListComparePairOverrides</code></td></tr>
<tr><th>Scope</th><td>[[scope:query:run]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>list_compare_pair_overrides_request</code></td><td><code>[[page:reference/sdk/php/models#ListComparePairOverridesRequest|ListComparePairOverridesRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:ListComparePairOverrides]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#ComparePairOverrides|ComparePairOverrides]]</code> — The overrides, oldest first

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\ListComparePairOverridesRequest;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "left_version_uuid": "00000000-0000-0000-0000-000000000000",
  "right_version_uuid": "00000000-0000-0000-0000-000000000000"
}
JSON, ListComparePairOverridesRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->listComparePairOverrides($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `mapQids` {#mapqids}

```php
public function mapQids(MapQidsRequest $map_qids_request): MapQidsResult
```

Map objects of one Version to their counterparts in another. The correspondence of a compare, for re-pointing stored object references after a new Version: every asked object of `from_version` with its counterpart in `to_version`, and the asked objects without one (added, removed, or outside the compare). Without `via` the built-in Default compare of the two Versions is used: a stored one in either direction (the automatic compare of an upload is one), else a new one.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:MapQids]] · <code>POST /openapi/ifc/MapQids</code></td></tr>
<tr><th>Scope</th><td>[[scope:query:run]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>map_qids_request</code></td><td><code>[[page:reference/sdk/php/models#MapQidsRequest|MapQidsRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:MapQids]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#MapQidsResult|MapQidsResult]]</code> — The pairs, aligned, and the unmatched objects

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\Model\MapQidsRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "from_version": "00000000-0000-0000-0000-000000000000",
  "to_version": "00000000-0000-0000-0000-000000000000",
  "qids": [
    ""
  ],
  "oids": [
    0
  ],
  "all": false,
  "via": "00000000-0000-0000-0000-000000000000"
}
JSON, MapQidsRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->mapQids($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `parseQuery` {#parsequery}

```php
public function parseQuery(ParseQueryRequest $parse_query_request): array<string,mixed>
```

Parse a BQL query into its syntax tree. The BQL query as its JSON syntax tree (the BQL JSON serialization, each node with a `__type`), with the `parameters` bound when given. A query that does not parse answers SYNTAX_ERROR with the line and column. No model is read.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:ParseQuery]] · <code>POST /openapi/ifc/ParseQuery</code></td></tr>
<tr><th>Scope</th><td>any login</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>parse_query_request</code></td><td><code>[[page:reference/sdk/php/models#ParseQueryRequest|ParseQueryRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:ParseQuery]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>array&lt;string,mixed&gt;</code> — The syntax tree

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\Model\ParseQueryRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "query": "",
  "parameters": {}
}
JSON, ParseQueryRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->parseQuery($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `query` {#query}

```php
public function query(QueryRequest $query_request): mixed
```

Query one or more IFC models. Queries one or more models with BQL (BIM.works Query Language): the `query` text, or a stored query action by `action_uuid`. Running a stored query needs read rights on it, not actions:read.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:Query]] · <code>POST /openapi/ifc/Query</code></td></tr>
<tr><th>Scope</th><td>[[scope:query:run]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>query_request</code></td><td><code>[[page:reference/sdk/php/models#QueryRequest|QueryRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:Query]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>mixed</code> — Query results in the requested format

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\Model\QueryRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "models": [
    {
      "type": "VersionModelIdentifier",
      "name": "My model name",
      "uuid": "BIM_WORKS_FIRST_MODEL"
    }
  ],
  "query": "GET attribute.GlobalId, attribute.Name WHERE type = IFCWALL AND property.*.IsExternal = true"
}
JSON, QueryRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->query($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `recordUploadAsTransaction` {#recorduploadastransaction}

```php
public function recordUploadAsTransaction(RecordUploadAsTransactionRequest $record_upload_as_transaction_request): RecordUploadAsTransactionResult
```

Replace an upload by a transaction with the same changes. Records an uploaded Version as a transaction on the Version before it: the BUL of GetCompareBul is committed on the previous Version, and the upload is deleted the way deleting the last Version does (a soft delete: its data stays). The new Version takes the upload's place and number, keeps the previous Version's object ids, and so keeps the history of every object and what refers to it. Only for the last Version of its Node, made by an upload, with a previous Version, when every change of the two is in the BUL (`record.possible` of GetCompareBul). Needs write rights on the Node and the user feature BUL (Model editing); without the feature the call answers 403 USER_FEATURE_REQUIRED.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:RecordUploadAsTransaction]] · <code>POST /openapi/ifc/RecordUploadAsTransaction</code></td></tr>
<tr><th>Scope</th><td>[[scope:model:write]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>record_upload_as_transaction_request</code></td><td><code>[[page:reference/sdk/php/models#RecordUploadAsTransactionRequest|RecordUploadAsTransactionRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:RecordUploadAsTransaction]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#RecordUploadAsTransactionResult|RecordUploadAsTransactionResult]]</code> — The committed transaction, the Node with its new Version, and the replaced upload

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\Model\RecordUploadAsTransactionRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "version_uuid": "BIM_WORKS_FIRST_MODEL",
  "comment": ""
}
JSON, RecordUploadAsTransactionRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->recordUploadAsTransaction($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `resolveBvl` {#resolvebvl}

```php
public function resolveBvl(ResolveBvlRequest $resolve_bvl_request): ResolvedActions
```

Resolve a BVL script to what it shows, hides, selects and colours. Runs a BVL (BIM.works Visualisation Language) script against one or more models and returns its effect, ready for a viewer: the objects to show, hide, select and fit, the colour per object, the labels and the annotations. The server evaluates every condition of the script (each one is a BQL expression); the client only applies the answer, in the JavaScript SDK with `new BvlHelper(objectStateManager, viewer).processResults([answer])` of `@bimworks/viewercommon`.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:ResolveBvl]] · <code>POST /openapi/ifc/ResolveBvl</code></td></tr>
<tr><th>Scope</th><td>[[scope:actions:read]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>resolve_bvl_request</code></td><td><code>[[page:reference/sdk/php/models#ResolveBvlRequest|ResolveBvlRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:ResolveBvl]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#ResolvedActions|ResolvedActions]]</code> — The resolved actions

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\Model\ResolveBvlRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "models": [
    {
      "type": "VersionModelIdentifier",
      "uuid": "BIM_WORKS_FIRST_MODEL"
    }
  ],
  "bvl": "if (type = IFCWALL AND property.*.IsExternal = true) { COLOR \"red\" VIEWFIT; }"
}
JSON, ResolveBvlRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->resolveBvl($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `setComparePairOverride` {#setcomparepairoverride}

```php
public function setComparePairOverride(SetComparePairOverrideRequest $set_compare_pair_override_request): ComparePairOverrideSet
```

Fix a pair by hand for two Versions. Links two objects as one object (the manual matcher pairs them before every other matcher), or confirms that an object really was removed or added (no matcher pairs it). Every compare of the two Versions uses it from then on; a stored result made before is computed again. An earlier override of either object is replaced. Needs read rights on both Versions and write rights on the right one.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:SetComparePairOverride]] · <code>POST /openapi/ifc/SetComparePairOverride</code></td></tr>
<tr><th>Scope</th><td>[[scope:model:write]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>set_compare_pair_override_request</code></td><td><code>[[page:reference/sdk/php/models#SetComparePairOverrideRequest|SetComparePairOverrideRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:SetComparePairOverride]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#ComparePairOverrideSet|ComparePairOverrideSet]]</code> — The new override and every override of the two Versions

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\Model\SetComparePairOverrideRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "left_version_uuid": "00000000-0000-0000-0000-000000000000",
  "right_version_uuid": "00000000-0000-0000-0000-000000000000",
  "kind": "pair",
  "left_oid": 0,
  "right_oid": 0,
  "note": ""
}
JSON, SetComparePairOverrideRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->setComparePairOverride($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `textSearch` {#textsearch}

```php
public function textSearch(TextSearchRequest $text_search_request): TextSearchResult
```

Free-text search in models. Searches the text of the models (names and values of attributes, properties, quantities, classifications, materials, layers) for words, not with BQL. Each group says where the text matched, how many objects match there and which (at most `max_qids_per_group`). A query that is a GlobalId (22 characters, or a UUID) also finds that object exactly, as a value match on the attribute GlobalId. Needs text indexing on the instance (features.text_indexing). Not available in a workspace whose filter limits the objects.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:TextSearch]] · <code>POST /openapi/ifc/TextSearch</code></td></tr>
<tr><th>Scope</th><td>[[scope:query:run]]</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>text_search_request</code></td><td><code>[[page:reference/sdk/php/models#TextSearchRequest|TextSearchRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:TextSearch]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#TextSearchResult|TextSearchResult]]</code> — The matches

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\Model\TextSearchRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "models": [
    {
      "type": "UrlModelIdentifier"
    }
  ],
  "query": "",
  "fuzzy": true,
  "max_edits": 0,
  "prefix": true,
  "search_values": true,
  "search_names": true,
  "kind": "attribute",
  "set": "",
  "name": "",
  "type": "",
  "max_qids_per_group": 100
}
JSON, TextSearchRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->textSearch($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```

## `upgradeSyntax` {#upgradesyntax}

```php
public function upgradeSyntax(UpgradeSyntaxRequest $upgrade_syntax_request): UpgradeSyntaxResponse
```

Rewrite BQL, BVL and BCL written for 2.x in the 3.0 syntax. For BQL, BVL and BCL texts that a client keeps itself, written for BIM.works 2.x: each text that no longer parses in 3.0 because of a known syntax change comes back in the 3.0 syntax, with the changes made. The known changes are the unit clause (`IN mm` is `UNIT mm`), `CS LENGTH` (is `LENGTH`) and names that 3.0 reserves as keywords (quoted: `property.Dimensions."length"`, `AS "status"`). A text that parses already comes back as it is (`UNCHANGED`); a text with any other error comes back as it is too, with the 3.0 parser's message (`NOT_REWRITTEN`), also when it has known changes as well. Strings and comments are never changed. Up to 1000 texts per request, answered in the order they were sent. No model is read. A stored action needs no call: the instance rewrites its stored actions once, as new versions.

<table class="dense">
<tbody>
<tr><th>Operation</th><td>[[openapi:UpgradeSyntax]] · <code>POST /openapi/ifc/UpgradeSyntax</code></td></tr>
<tr><th>Scope</th><td>any login</td></tr>
</tbody>
</table>

### Parameters

<table class="dense">
<thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code>upgrade_syntax_request</code></td><td><code>[[page:reference/sdk/php/models#UpgradeSyntaxRequest|UpgradeSyntaxRequest]]</code><span class="req">required</span></td><td>The request: its properties are those of the model, its JSON that of [[openapi:UpgradeSyntax]]'s request body.</td></tr>
</tbody>
</table>

### Returns

<code>[[page:reference/sdk/php/models#UpgradeSyntaxResponse|UpgradeSyntaxResponse]]</code> — One result per input, in the order of the inputs

### Example

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use BIMworks\Api\AuthApi;
use BIMworks\Api\IFCApi;
use BIMworks\Configuration;
use BIMworks\Model\LoginWithApiTokenRequest;
use BIMworks\Model\UpgradeSyntaxRequest;
use BIMworks\ObjectSerializer;

// 1. Connect to BIM.works and log in with your API token
$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');
$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));
$client->setAccessToken($auth->getBase64());

// 2. The request
$request = ObjectSerializer::deserialize(<<<'JSON'
{
  "inputs": [
    {
      "id": "wall-heights",
      "language": "BQL",
      "text": "GET qid, quantity.Qto_WallBaseQuantities.Height IN mm WHERE type = IFCWALL"
    },
    {
      "id": "lengths",
      "language": "BCL",
      "text": "select (type = IFCWALL) { require property.Dimensions.length > 0; }"
    }
  ]
}
JSON, UpgradeSyntaxRequest::class);

// 3. The call
$result = (new IFCApi(config: $client))->upgradeSyntax($request);

// 4. The result
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;
```
