Skip to content

Commit

Permalink
Merge pull request #37 from stitch-digital/johntrickett86-priority-re…
Browse files Browse the repository at this point in the history
…quests-quotes

required quote requests
  • Loading branch information
johntrickett86 authored Oct 23, 2024
2 parents 6d24635 + b1debcb commit 8abc14c
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/Requests/Quotes/Attachments/GetQuoteAttachments.php
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 src/Requests/Quotes/Attachments/RetrieveQuoteAttachment.php
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;
}
}
}
30 changes: 30 additions & 0 deletions src/Requests/Quotes/GetQuotes.php
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/';
}
}
36 changes: 36 additions & 0 deletions src/Requests/Quotes/RetrieveQuote.php
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',
];
}
}
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/';
}
}
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;
}
}

0 comments on commit 8abc14c

Please sign in to comment.