Skip to content

Commit 13b2b5b

Browse files
committed
Add SMS requests
1 parent fc21ae1 commit 13b2b5b

File tree

5 files changed

+151
-0
lines changed

5 files changed

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

tests/SmsTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
it('can get sms messages', function (): void {
6+
expect(true)->toBeTrue();
7+
});
8+
9+
it('can create sms message', function (): void {
10+
expect(true)->toBeTrue();
11+
});
12+
13+
it('can get sms message by id', function (): void {
14+
expect(true)->toBeTrue();
15+
});
16+
17+

0 commit comments

Comments
 (0)