Skip to content

Commit a5090a0

Browse files
committed
add workflow requests
1 parent 6fbca51 commit a5090a0

File tree

4 files changed

+96
-7
lines changed

4 files changed

+96
-7
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\Automation\Workflows;
6+
7+
use Saloon\Enums\Method;
8+
use Saloon\Http\Request;
9+
10+
class GetWorkflowByIdRequest extends Request
11+
{
12+
protected Method $method = Method::GET;
13+
14+
public function __construct(
15+
protected readonly string $workflowId,
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 '/workflows/'.$this->workflowId;
29+
}
30+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Ziming\LaravelGetResponse\Requests\Automation\Workflows;
6+
7+
use Saloon\Enums\Method;
8+
use Saloon\Http\Request;
9+
10+
class GetWorkflowsRequest extends Request
11+
{
12+
protected Method $method = Method::GET;
13+
14+
public function __construct(
15+
protected readonly array $fields = [],
16+
protected readonly int $perPage = 100,
17+
18+
protected readonly int $page = 1,
19+
) {}
20+
21+
protected function defaultQuery(): array
22+
{
23+
return array_filter([
24+
'fields' => implode(',', $this->fields),
25+
'perPage' => $this->perPage,
26+
'page' => $this->page,
27+
]);
28+
}
29+
30+
public function resolveEndpoint(): string
31+
{
32+
return '/workflows';
33+
}
34+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Ziming\LaravelGetResponse\Requests\Automation\Workflows;
6+
7+
use Saloon\Enums\Method;
8+
use Saloon\Http\Request;
9+
10+
class UpdateWorkflowRequest extends Request
11+
{
12+
protected Method $method = Method::PUT;
13+
14+
public function __construct(
15+
protected readonly string $workflowId,
16+
17+
// 'active', 'inactive', or 'incomplete'
18+
protected readonly string $status,
19+
) {}
20+
21+
protected function defaultBody(): array
22+
{
23+
return [
24+
'status' => $this->status,
25+
];
26+
}
27+
28+
public function resolveEndpoint(): string
29+
{
30+
return '/workflows/'.$this->workflowId;
31+
}
32+
}

tests/AccountsTest.php

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)