generated from spatie/package-skeleton-php
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e38c0d2
commit 9b70e92
Showing
15 changed files
with
250 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace HeyJorgeDev\QStash\Contracts; | ||
|
||
use HeyJorgeDev\QStash\Contracts\Resources\MessageInterface; | ||
use HeyJorgeDev\QStash\Contracts\Resources\QueueInterface; | ||
use HeyJorgeDev\QStash\Contracts\Resources\ScheduleInterface; | ||
|
||
interface ClientInterface | ||
{ | ||
public function queues(): QueueInterface; | ||
|
||
public function schedules(): ScheduleInterface; | ||
|
||
public function messages(): MessageInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace HeyJorgeDev\QStash\Contracts; | ||
|
||
interface ReceiverInterface | ||
{ | ||
public function verify(): bool; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace HeyJorgeDev\QStash\Contracts\Resources; | ||
|
||
interface MessageInterface | ||
{ | ||
public function publish(); | ||
|
||
public function enqueue(); | ||
|
||
public function batch(); | ||
|
||
public function get(string $messageId); | ||
|
||
public function cancel(string $messageId); | ||
|
||
/** | ||
* @param array<string> $messageIds | ||
*/ | ||
public function bulkCancel(array $messageIds); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace HeyJorgeDev\QStash\Contracts\Resources; | ||
|
||
interface QueueInterface | ||
{ | ||
public function list(); | ||
|
||
public function get(string $queueName); | ||
|
||
public function delete(string $queueName); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace HeyJorgeDev\QStash\Contracts\Resources; | ||
|
||
interface ScheduleInterface | ||
{ | ||
public function list(); | ||
|
||
public function get(string $scheduleName); | ||
|
||
public function delete(string $scheduleName); | ||
|
||
// public function create(string $scheduleName, string $scheduleTime); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
namespace HeyJorgeDev\QStash\Contracts; | ||
|
||
interface TransporterInterface {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace HeyJorgeDev\QStash; | ||
|
||
use HeyJorgeDev\QStash\Transporters\HttpTransporter; | ||
use Psr\Http\Client\ClientInterface as HttpClientInterface; | ||
|
||
class Factory | ||
{ | ||
private ?string $apiKey = null; | ||
|
||
private ?HttpClientInterface $httpClient = null; | ||
|
||
public function withApiKey(string $apiKey): Factory | ||
{ | ||
$this->apiKey = $apiKey; | ||
|
||
return $this; | ||
} | ||
|
||
public function make(): Client | ||
{ | ||
return new Client(new HttpTransporter()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace HeyJorgeDev\QStash; | ||
|
||
use HeyJorgeDev\QStash\Contracts\ReceiverInterface; | ||
|
||
class Receiver implements ReceiverInterface | ||
{ | ||
public function verify(): bool | ||
{ | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace HeyJorgeDev\QStash\Resources; | ||
|
||
use HeyJorgeDev\QStash\Contracts\Resources\MessageInterface; | ||
use HeyJorgeDev\QStash\Contracts\TransporterInterface; | ||
|
||
class MessageResource implements MessageInterface | ||
{ | ||
public function __construct(private readonly TransporterInterface $transporter) {} | ||
|
||
public function publish() | ||
{ | ||
// TODO: Implement publish() method. | ||
} | ||
|
||
public function enqueue() | ||
{ | ||
// TODO: Implement enqueue() method. | ||
} | ||
|
||
public function batch() | ||
{ | ||
// TODO: Implement batch() method. | ||
} | ||
|
||
public function get(string $messageId) | ||
{ | ||
// TODO: Implement get() method. | ||
} | ||
|
||
public function cancel(string $messageId) | ||
{ | ||
// TODO: Implement cancel() method. | ||
} | ||
|
||
public function bulkCancel(array $messageIds) | ||
{ | ||
// TODO: Implement bulkCancel() method. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace HeyJorgeDev\QStash\Resources; | ||
|
||
use HeyJorgeDev\QStash\Contracts\Resources\QueueInterface; | ||
use HeyJorgeDev\QStash\Contracts\TransporterInterface; | ||
|
||
class QueueResource implements QueueInterface | ||
{ | ||
public function __construct(private readonly TransporterInterface $transporter) {} | ||
|
||
public function list() | ||
{ | ||
// TODO: Implement list() method. | ||
} | ||
|
||
public function get(string $queueName) | ||
{ | ||
// TODO: Implement get() method. | ||
} | ||
|
||
public function delete(string $queueName) | ||
{ | ||
// TODO: Implement delete() method. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace HeyJorgeDev\QStash\Resources; | ||
|
||
use HeyJorgeDev\QStash\Contracts\Resources\ScheduleInterface; | ||
use HeyJorgeDev\QStash\Contracts\TransporterInterface; | ||
|
||
class ScheduleResource implements ScheduleInterface | ||
{ | ||
public function __construct(private readonly TransporterInterface $transporter) {} | ||
|
||
public function list() | ||
{ | ||
// TODO: Implement list() method. | ||
} | ||
|
||
public function get(string $scheduleName) | ||
{ | ||
// TODO: Implement get() method. | ||
} | ||
|
||
public function delete(string $scheduleName) | ||
{ | ||
// TODO: Implement delete() method. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace HeyJorgeDev\QStash\Transporters; | ||
|
||
use HeyJorgeDev\QStash\Contracts\TransporterInterface; | ||
|
||
class HttpTransporter implements TransporterInterface {} |