Skip to content

Commit 9c9a7db

Browse files
Merge pull request #1086 from appwrite/chore-exclude-assistant
chore: exclude assistant service in cli
2 parents 6d9318a + b5b6804 commit 9c9a7db

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

example.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ function getSSLPage($url) {
188188
->setDefaultHeaders([
189189
'X-Appwrite-Response-Format' => '1.7.0',
190190
])
191+
->setExclude([
192+
'services' => [
193+
['name' => 'assistant'],
194+
],
195+
])
191196
;
192197

193198
$sdk->generate(__DIR__ . '/examples/cli');

src/SDK/SDK.php

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ class SDK
7070
'test' => 'false'
7171
];
7272

73+
/**
74+
* @var array
75+
*/
76+
protected array $excludeRules = [
77+
'services' => [],
78+
'methods' => [],
79+
'definitions' => []
80+
];
81+
7382
/**
7483
* SDK constructor.
7584
*
@@ -654,6 +663,28 @@ public function generate(string $target): void
654663
}
655664
}
656665

666+
/**
667+
* Add additional exclusion rules for services, methods, or definitions.
668+
*
669+
* @param array $rules Array containing exclusion rules with format:
670+
* [
671+
* 'services' => [['name' => 'serviceName'], ['feature' => 'featureName']],
672+
* 'methods' => [['name' => 'methodName'], ['type' => 'methodType']],
673+
* 'definitions' => [['name' => 'definitionName']]
674+
* ]
675+
* @return $this
676+
*/
677+
public function setExclude(array $rules): SDK
678+
{
679+
foreach (['services', 'methods', 'definitions'] as $type) {
680+
if (isset($rules[$type]) && is_array($rules[$type])) {
681+
$this->excludeRules[$type] = array_merge($this->excludeRules[$type], $rules[$type]);
682+
}
683+
}
684+
685+
return $this;
686+
}
687+
657688
/**
658689
* Determine if a file should be excluded from generation.
659690
*
@@ -668,7 +699,7 @@ public function generate(string $target): void
668699
*/
669700
protected function exclude($file, $params): bool
670701
{
671-
$exclude = $file['exclude'] ?? [];
702+
$exclude = array_merge_recursive($file['exclude'] ?? [], $this->excludeRules);
672703

673704
$services = [];
674705
$features = [];

0 commit comments

Comments
 (0)