Skip to content

Commit

Permalink
Merge pull request #27 from stitch-digital/johntrickett86-site-attach…
Browse files Browse the repository at this point in the history
…ment

Create RetrieveSiteAttachment.php
  • Loading branch information
johntrickett86 authored Oct 15, 2024
2 parents 4a17ab7 + 05e89fc commit c087e86
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/Requests/Sites/Attachments/RetrieveSiteAttachment.php
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;
}
}
}

0 comments on commit c087e86

Please sign in to comment.