generated from spatie/package-skeleton-laravel
-
-
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 #27 from stitch-digital/johntrickett86-site-attach…
…ment Create RetrieveSiteAttachment.php
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace StitchDigital\LaravelSimproApi\Requests\Sites\Attachments; | ||
|
||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
|
||
class RetrieveSiteAttachment extends Request | ||
{ | ||
public function __construct(protected string $attachmentId, protected readonly int $siteId, protected int $companyId, protected bool $view = false) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* The HTTP method of the request | ||
*/ | ||
protected Method $method = Method::GET; | ||
|
||
/** | ||
* The endpoint for the request | ||
*/ | ||
public function resolveEndpoint(): string | ||
{ | ||
// If the view parameter is set to true, the endpoint should be different | ||
if ($this->view) { | ||
return '/companies/'.$this->companyId.'/sites/'.$this->siteId.'/attachments/files/'.$this->attachmentId.'/view'; | ||
} else { | ||
return '/companies/'.$this->companyId.'/sites/'.$this->siteId.'/attachments/files/'.$this->attachmentId; | ||
} | ||
} | ||
} |