-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from airlst/feature/refactor
Use Saloon PHP on top of Core API
- Loading branch information
Showing
28 changed files
with
574 additions
and
352 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,14 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AirLST\SdkPhp\Contracts; | ||
|
||
use Saloon\Http\Response; | ||
|
||
interface EventResourceContract | ||
{ | ||
public function list(): Response; | ||
|
||
public function get(string $eventId): Response; | ||
} |
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,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AirLST\SdkPhp\Contracts; | ||
|
||
use Saloon\Http\Response; | ||
|
||
interface GuestResourceContract | ||
{ | ||
public function validateCode(string $code): Response; | ||
|
||
public function get(string $code): Response; | ||
|
||
/** | ||
* @param array<string, mixed> $data | ||
*/ | ||
public function create(array $data): Response; | ||
|
||
/** | ||
* @param array<string, mixed> $data | ||
*/ | ||
public function update(string $code, array $data): Response; | ||
} |
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 was deleted.
Oops, something went wrong.
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,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AirLST\SdkPhp\Requests\Event; | ||
|
||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
|
||
class GetRequest extends Request | ||
{ | ||
protected Method $method = Method::GET; | ||
|
||
public function __construct(protected string $eventId) {} | ||
|
||
public function resolveEndpoint(): string | ||
{ | ||
return '/events/' . $this->eventId; | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AirLST\SdkPhp\Requests\Event; | ||
|
||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
|
||
class ListRequest extends Request | ||
{ | ||
protected Method $method = Method::GET; | ||
|
||
public function resolveEndpoint(): string | ||
{ | ||
return '/companies/events'; | ||
} | ||
} |
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,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AirLST\SdkPhp\Requests\Guest; | ||
|
||
use Saloon\Contracts\Body\HasBody; | ||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
use Saloon\Traits\Body\HasJsonBody; | ||
|
||
class CreateRequest extends Request implements HasBody | ||
{ | ||
use HasJsonBody; | ||
|
||
protected Method $method = Method::POST; | ||
|
||
/** | ||
* @param array<string, mixed> $data | ||
*/ | ||
public function __construct(protected array $data) {} | ||
|
||
public function resolveEndpoint(): string | ||
{ | ||
return '/'; | ||
} | ||
|
||
/** | ||
* @return array<string, mixed> | ||
*/ | ||
protected function defaultBody(): array | ||
{ | ||
return $this->data; | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AirLST\SdkPhp\Requests\Guest; | ||
|
||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
|
||
class GetRequest extends Request | ||
{ | ||
protected Method $method = Method::GET; | ||
|
||
public function __construct(protected string $code) {} | ||
|
||
public function resolveEndpoint(): string | ||
{ | ||
return '/' . $this->code; | ||
} | ||
} |
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,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AirLST\SdkPhp\Requests\Guest; | ||
|
||
use Saloon\Contracts\Body\HasBody; | ||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
use Saloon\Traits\Body\HasJsonBody; | ||
|
||
class UpdateRequest extends Request implements HasBody | ||
{ | ||
use HasJsonBody; | ||
|
||
protected Method $method = Method::PUT; | ||
|
||
/** | ||
* @param array<string, mixed> $data | ||
*/ | ||
public function __construct(protected string $code, protected array $data) {} | ||
|
||
public function resolveEndpoint(): string | ||
{ | ||
return '/' . $this->code; | ||
} | ||
|
||
/** | ||
* @return array<string, mixed> | ||
*/ | ||
protected function defaultBody(): array | ||
{ | ||
return $this->data; | ||
} | ||
} |
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,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AirLST\SdkPhp\Requests\Guest; | ||
|
||
use Saloon\Contracts\Body\HasBody; | ||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
use Saloon\Traits\Body\HasJsonBody; | ||
|
||
class ValidateCodeRequest extends Request implements HasBody | ||
{ | ||
use HasJsonBody; | ||
|
||
protected Method $method = Method::POST; | ||
|
||
public function __construct(protected string $code) {} | ||
|
||
public function resolveEndpoint(): string | ||
{ | ||
return '/validate-code'; | ||
} | ||
|
||
/** | ||
* @return array<string, string> | ||
*/ | ||
protected function defaultBody(): array | ||
{ | ||
return [ | ||
'code' => $this->code, | ||
]; | ||
} | ||
} |
Oops, something went wrong.