Skip to content

Commit 6508141

Browse files
committed
initial Webinar Requests
1 parent 473b793 commit 6508141

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Ziming\LaravelGetResponse\Requests\Webinars;
6+
7+
use Saloon\Enums\Method;
8+
use Saloon\Http\Request;
9+
10+
class GetAllWebinarsRequest extends Request
11+
{
12+
protected Method $method = Method::GET;
13+
14+
public function __construct(
15+
protected readonly array $queryParameters = [],
16+
protected readonly array $sortParameters = [],
17+
protected readonly array $fields = [],
18+
protected readonly int $page = 1,
19+
protected readonly int $perPage = 100,
20+
) {
21+
}
22+
23+
protected function defaultQuery(): array
24+
{
25+
return array_filter([
26+
'query' => $this->queryParameters,
27+
'sort' => $this->sortParameters,
28+
'fields' => implode(',', $this->fields),
29+
'page' => $this->page,
30+
'perPage' => $this->perPage,
31+
]);
32+
}
33+
34+
public function resolveEndpoint(): string
35+
{
36+
return '/webinars';
37+
}
38+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Ziming\LaravelGetResponse\Requests\Webinars;
6+
7+
use Saloon\Enums\Method;
8+
use Saloon\Http\Request;
9+
10+
class GetWebinarByIdRequest extends Request
11+
{
12+
protected Method $method = Method::GET;
13+
14+
public function __construct(protected readonly string $webinarId, protected readonly array $fields = [])
15+
{
16+
}
17+
18+
protected function defaultQuery(): array
19+
{
20+
return [
21+
'fields' => implode(',', $this->fields),
22+
];
23+
}
24+
25+
public function resolveEndpoint(): string
26+
{
27+
return '/webinars/' . $this->webinarId;
28+
}
29+
}

0 commit comments

Comments
 (0)