A lot of things.
This commit is contained in:
@@ -48,6 +48,19 @@ class XenforoApiService {
|
||||
return $response->json();
|
||||
}
|
||||
|
||||
private function delete(string $endpoint, ?int $customUserId = null, array $data = [] ): mixed
|
||||
{
|
||||
$response = Http::withHeaders([
|
||||
'XF-Api-Key' => $this->apiKey,
|
||||
'XF-Api-User' => $customUserId ?? $this->superUserId,
|
||||
])->delete("{$this->apiUrl}/{$endpoint}", $data);
|
||||
|
||||
if( !$response->ok() )
|
||||
return null;
|
||||
|
||||
return $response->json();
|
||||
}
|
||||
|
||||
public function getUserAlerts(int $userId): mixed
|
||||
{
|
||||
if( app(XenforoService::class)->getXfUser($userId)?->alerts_unviewed > 0 ) {
|
||||
@@ -121,4 +134,14 @@ class XenforoApiService {
|
||||
return $response['success'] ?? false;
|
||||
}
|
||||
|
||||
public function deleteThreadWithEntry(int $threadId): bool
|
||||
{
|
||||
return (bool) $this->delete( "threads/{$threadId}", data: ['reason' => "Deletion with entry." ] );
|
||||
}
|
||||
|
||||
public function restoreThreadWithEntry(int $threadId): bool
|
||||
{
|
||||
return (bool) $this->post("threads/{$threadId}/undelete" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user