Skip to content

Commit

Permalink
add deleteSources function
Browse files Browse the repository at this point in the history
Signed-off-by: Anupam Kumar <kyteinsky@gmail.com>
  • Loading branch information
kyteinsky committed Nov 8, 2023
1 parent 4a7ebb4 commit a13cc60
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion lib/Service/LangRopeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,25 @@ private function getExApp() {
return $exApp;
}

public function indexSources(string $userId, array $sources): void {
public function deleteSources(string $userId, string ...$sourceNames): void {
if (count($sourceNames) === 0) {
return;
}

$params = [
'userId' => $userId,
'sourceNames' => $sourceNames,
];

$exApp = $this->getExApp();
if ($exApp === null) {
return;
}
$this->requestToExApp($userId, $exApp, '/deleteSources', 'POST', $params);
}

// variable number of args to type check array $sources
public function indexSources(string $userId, Source ...$sources): void {
if (count($sources) === 0) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/ScanService.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ public function scanDirectory(string $userId, array $mimeTypeFilter, Folder $dir
}

public function indexSources(string $userId, array $sources): void {
$this->langRopeService->indexSources($userId, $sources);
$this->langRopeService->indexSources($userId, ...$sources);
}
}

0 comments on commit a13cc60

Please sign in to comment.