Migration complete
This commit is contained in:
@@ -24,7 +24,7 @@ class XenforoApiService {
|
||||
*/
|
||||
private function get(string $endpoint, ?int $customUserId = null ): mixed
|
||||
{
|
||||
$response = Http::withHeaders([
|
||||
$response = Http::timeout(30)->withHeaders([
|
||||
'XF-Api-Key' => $this->apiKey,
|
||||
'XF-Api-User' => $customUserId ?? $this->superUserId,
|
||||
])->get("{$this->apiUrl}/{$endpoint}");
|
||||
@@ -37,7 +37,7 @@ class XenforoApiService {
|
||||
|
||||
private function post(string $endpoint, ?int $customUserId = null, array $data = [] ): mixed
|
||||
{
|
||||
$response = Http::withHeaders([
|
||||
$response = Http::timeout(30)->withHeaders([
|
||||
'XF-Api-Key' => $this->apiKey,
|
||||
'XF-Api-User' => $customUserId ?? $this->superUserId,
|
||||
])->post("{$this->apiUrl}/{$endpoint}", $data);
|
||||
@@ -50,7 +50,7 @@ class XenforoApiService {
|
||||
|
||||
private function delete(string $endpoint, ?int $customUserId = null, array $data = [] ): mixed
|
||||
{
|
||||
$response = Http::withHeaders([
|
||||
$response = Http::timeout(30)->withHeaders([
|
||||
'XF-Api-Key' => $this->apiKey,
|
||||
'XF-Api-User' => $customUserId ?? $this->superUserId,
|
||||
])->delete("{$this->apiUrl}/{$endpoint}", $data);
|
||||
@@ -75,7 +75,7 @@ class XenforoApiService {
|
||||
public function markAllNotificationsRead(int $userId): void
|
||||
{
|
||||
Cache::forget("xf_alerts_{$userId}");
|
||||
$this->post("alerts/marl-all", $userId );
|
||||
$this->post("alerts/mark-all", $userId );
|
||||
}
|
||||
|
||||
public function getConversations(int $userId): mixed
|
||||
@@ -87,8 +87,9 @@ class XenforoApiService {
|
||||
|
||||
public function createConversation( array $userIdList, string $title, string $message, bool $conversationOpen, bool $openInvite ): bool
|
||||
{
|
||||
$response = $this->post("conversations", data: ['recipient_ids' => $userIdList, 'title' => $title, 'message' => $message, 'open_invite' => $openInvite, 'conversation_open' => $conversationOpen] );
|
||||
|
||||
$response = $this->post("conversations",
|
||||
data: ['recipient_ids' => $userIdList, 'title' => $title, 'message' => $message, 'open_invite' => $openInvite, 'conversation_open' => $conversationOpen]
|
||||
);
|
||||
return $response['success'] ?? false;
|
||||
}
|
||||
|
||||
@@ -152,4 +153,13 @@ class XenforoApiService {
|
||||
return (bool) $this->post("threads/{$threadId}/undelete" );
|
||||
}
|
||||
|
||||
public function _migrateUser(array $data): array
|
||||
{
|
||||
$response = $this->post("migrate/user", data: $data );
|
||||
if( !$response || !$response['success'] )
|
||||
return [false,false];
|
||||
|
||||
return [ $response['user_id'] ?? false, $response['password_set'] ?? false ];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user