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 #37 from stitch-digital/johntrickett86-priority-re…
…quests-quotes required quote requests
- Loading branch information
Showing
6 changed files
with
189 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,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace StitchDigital\LaravelSimproApi\Requests\Quotes\Attachments; | ||
|
||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
use Saloon\PaginationPlugin\Contracts\Paginatable; | ||
|
||
class GetQuoteAttachments extends Request implements Paginatable | ||
{ | ||
public function __construct(protected readonly int $quoteId, protected readonly int $companyId) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* The HTTP method of the request | ||
*/ | ||
protected Method $method = Method::GET; | ||
|
||
/** | ||
* The endpoint for the request | ||
*/ | ||
public function resolveEndpoint(): string | ||
{ | ||
return '/companies/'.$this->companyId.'/quotes/'.$this->quoteId.'/attachments/files/'; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/Requests/Quotes/Attachments/RetrieveQuoteAttachment.php
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\Quotes\Attachments; | ||
|
||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
|
||
class RetrieveQuoteAttachment extends Request | ||
{ | ||
public function __construct(protected string $attachmentId, protected readonly int $quoteId, 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.'/quotes/'.$this->quoteId.'/attachments/files/'.$this->attachmentId.'/view'; | ||
} else { | ||
return '/companies/'.$this->companyId.'/quotes/'.$this->quoteId.'/attachments/files/'.$this->attachmentId; | ||
} | ||
} | ||
} |
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,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace StitchDigital\LaravelSimproApi\Requests\Quotes; | ||
|
||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
use Saloon\PaginationPlugin\Contracts\Paginatable; | ||
|
||
class GetQuotes extends Request implements Paginatable | ||
{ | ||
public function __construct(protected readonly int $companyId) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* The HTTP method of the request | ||
*/ | ||
protected Method $method = Method::GET; | ||
|
||
/** | ||
* The endpoint for the request | ||
*/ | ||
public function resolveEndpoint(): string | ||
{ | ||
return '/companies/'.$this->companyId.'/quotes/'; | ||
} | ||
} |
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,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace StitchDigital\LaravelSimproApi\Requests\Quotes; | ||
|
||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
|
||
class RetrieveQuote extends Request | ||
{ | ||
public function __construct(protected readonly int $quoteId, protected int $companyId) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* The HTTP method of the request | ||
*/ | ||
protected Method $method = Method::GET; | ||
|
||
/** | ||
* The endpoint for the request | ||
*/ | ||
public function resolveEndpoint(): string | ||
{ | ||
return '/companies/'.$this->companyId.'/quotes/'.$this->quoteId; | ||
} | ||
|
||
protected function defaultQuery(): array | ||
{ | ||
return [ | ||
'display' => 'all', | ||
]; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/Requests/Quotes/Sections/CostCenters/Assets/GetQuoteSectionCostCentreAssets.php
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,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace StitchDigital\LaravelSimproApi\Requests\Quotes\Sections\CostCenters\Assets; | ||
|
||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
use Saloon\PaginationPlugin\Contracts\Paginatable; | ||
|
||
class GetQuoteSectionCostCentreAssets extends Request implements Paginatable | ||
{ | ||
public function __construct(protected readonly int $costCenterId, protected readonly int $sectionId, protected readonly int $quoteId, protected readonly int $companyId) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* The HTTP method of the request | ||
*/ | ||
protected Method $method = Method::GET; | ||
|
||
/** | ||
* The endpoint for the request | ||
*/ | ||
public function resolveEndpoint(): string | ||
{ | ||
return '/companies/'.$this->companyId.'/quotes/'.$this->quoteId.'/sections/'.$this->sectionId.'/costCenters/'.$this->costCenterId.'/assets/'; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/Requests/Quotes/Sections/CostCenters/RetrieveQuoteSectionCostCenter.php
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,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace StitchDigital\LaravelSimproApi\Requests\Quotes\Sections\CostCenters; | ||
|
||
use Saloon\Enums\Method; | ||
use Saloon\Http\Request; | ||
|
||
class RetrieveQuoteSectionCostCenter extends Request | ||
{ | ||
public function __construct(protected readonly int $costCenterId, protected readonly int $sectionId, protected readonly int $quoteId, protected readonly int $companyId) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* The HTTP method of the request | ||
*/ | ||
protected Method $method = Method::GET; | ||
|
||
/** | ||
* The endpoint for the request | ||
*/ | ||
public function resolveEndpoint(): string | ||
{ | ||
return '/companies/'.$this->companyId.'/quotes/'.$this->quoteId.'/sections/'.$this->sectionId.'/costCenters/'.$this->costCenterId; | ||
} | ||
} |