Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/BwtApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace AlwaysOpen\BwtApi;

class BwtApi {
class BwtApi
{
public const BWT_AMAZON_ENGINE = 'bwt_amazon_product';
}
}
8 changes: 4 additions & 4 deletions src/BwtApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function getAuthHeader(): array
{
return [
'Authorization' => 'Bearer '.$this->apiKey,
];
];
}

/**
Expand Down Expand Up @@ -68,7 +68,7 @@ public function getAmazonSessionStatus(
try {
$response = $this->makeRequest(
'get',
$this->baseUrl .= "/$id",
$this->baseUrl."/$id",
null,
3,
);
Expand All @@ -85,13 +85,13 @@ public function getAmazonSessionStatus(

public function getAmazonResults(
string $id,
int $limit = 1,
int $limit = 1000,
int $offset = 0,
): AmazonResults {
try {
$response = $this->makeRequest(
'get',
$this->baseUrl .= "/$id/results?limit=$limit&offset=$offset",
$this->baseUrl."/$id/results?limit=$limit&offset=$offset",
null,
3,
);
Expand Down
7 changes: 3 additions & 4 deletions src/DTOs/Amazon/AmazonSessionStatusResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace AlwaysOpen\BwtApi\DTOs\Amazon;

use Carbon\Carbon;
use Spatie\LaravelData\Attributes\DataCollectionOf;
use Spatie\LaravelData\Attributes\WithCast;
use Spatie\LaravelData\Casts\DateTimeInterfaceCast;
use Spatie\LaravelData\Data;
Expand All @@ -13,9 +12,9 @@ class AmazonSessionStatusResponse extends Data
public function __construct(
public readonly int $status,
public readonly string $message,
#[WithCast(DateTimeInterfaceCast::class, format: ['Y-m-d H:i:s', 'Y-m-d\TH:i:s\+H:i', 'Y-m-d H:i:s.u'])]
#[WithCast(DateTimeInterfaceCast::class, format: ['Y-m-d H:i:s', 'Y-m-d\TH:i:s\+H:i', 'Y-m-d H:i:s.u', 'Y-m-d\TH:i:s'])]
public readonly ?Carbon $created_at,
#[WithCast(DateTimeInterfaceCast::class, format: ['Y-m-d H:i:s', 'Y-m-d\TH:i:s\+H:i', 'Y-m-d H:i:s.u'])]
#[WithCast(DateTimeInterfaceCast::class, format: ['Y-m-d H:i:s', 'Y-m-d\TH:i:s\+H:i', 'Y-m-d H:i:s.u', 'Y-m-d\TH:i:s'])]
public readonly ?Carbon $finished_at,
) {}
}
}
2 changes: 1 addition & 1 deletion src/DTOs/Amazon/ProductRequestItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace AlwaysOpen\BwtApi\DTOs\Amazon;

use Spatie\LaravelData\Data;
use AlwaysOpen\BwtApi\Enums\ScrapingModes;
use Spatie\LaravelData\Data;

class ProductRequestItem extends Data
{
Expand Down
Loading