repo stringlengths 7 63 | file_url stringlengths 81 284 | file_path stringlengths 5 200 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:02:33 2026-01-05 05:24:06 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
generationtux/jwt-artisan | https://github.com/generationtux/jwt-artisan/blob/7f7a4863fb38d5b822b8a5dca6d836e3d3076ed4/src/Support/ServiceProvider.php | src/Support/ServiceProvider.php | <?php
namespace GenTux\Jwt\Support;
use GenTux\Jwt\Drivers\FirebaseDriver;
use GenTux\Jwt\Drivers\JwtDriverInterface;
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
abstract class ServiceProvider extends BaseServiceProvider
{
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->bind(JwtDriverInterface::class, function($app) {
return $app->make(FirebaseDriver::class);
});
}
/**
* Boot services for JWT
*/
public function boot()
{
$this->registerMiddleware();
}
/**
* Register middlewares that can be used for routes
*/
abstract protected function registerMiddleware();
} | php | MIT | 7f7a4863fb38d5b822b8a5dca6d836e3d3076ed4 | 2026-01-05T04:43:14.261135Z | false |
generationtux/jwt-artisan | https://github.com/generationtux/jwt-artisan/blob/7f7a4863fb38d5b822b8a5dca6d836e3d3076ed4/src/Support/LaravelServiceProvider.php | src/Support/LaravelServiceProvider.php | <?php
namespace GenTux\Jwt\Support;
use GenTux\Jwt\Http\JwtMiddleware;
class LaravelServiceProvider extends ServiceProvider
{
/**
* Register middlewares for JWT that can be used in routes file
*/
protected function registerMiddleware()
{
$router = $this->app['router'];
$router->middleware('jwt', JwtMiddleware::class);
}
} | php | MIT | 7f7a4863fb38d5b822b8a5dca6d836e3d3076ed4 | 2026-01-05T04:43:14.261135Z | false |
generationtux/jwt-artisan | https://github.com/generationtux/jwt-artisan/blob/7f7a4863fb38d5b822b8a5dca6d836e3d3076ed4/spec/JwtTokenSpec.php | spec/JwtTokenSpec.php | <?php
namespace spec\GenTux\Jwt;
use Exception;
use Prophecy\Argument;
use GenTux\Jwt\JwtToken;
use PhpSpec\ObjectBehavior;
use GenTux\Jwt\JwtPayloadInterface;
use GenTux\Jwt\Drivers\FirebaseDriver;
use GenTux\Jwt\Drivers\JwtDriverInterface;
use GenTux\Jwt\Exceptions\NoTokenException;
use PhpSpec\Exception\Example\FailureException;
use GenTux\Jwt\Exceptions\InvalidTokenException;
class JwtTokenSpec extends ObjectBehavior
{
public function let(JwtDriverInterface $jwt)
{
$this->beConstructedWith($jwt);
putenv('JWT_SECRET=secret_123');
}
public function it_gets_and_sets_the_current_jwt_token()
{
$this->shouldThrow(NoTokenException::class)->during('token');
$this->setToken('foo_token')->shouldReturn($this);
$this->token()->shouldReturn('foo_token');
}
public function it_gets_and_sets_the_jwt_secret()
{
$this->secret()->shouldReturn('secret_123'); # from env
$this->setSecret('another_secret')->shouldReturn($this); # overwrites env
$this->secret()->shouldReturn('another_secret');
}
public function it_gets_and_sets_the_jwt_algorithm_to_use()
{
$this->algorithm()->shouldReturn('HS256'); # default
putenv('JWT_ALGO=foo');
$this->algorithm()->shouldReturn('foo'); # from env
$this->setAlgorithm('custom')->shouldReturn($this); # overwrites env
$this->algorithm()->shouldReturn('custom');
# clear env
putenv('JWT_ALGO=');
}
public function it_returns_true_on_validation_if_the_token_is_valid(JwtDriverInterface $jwt)
{
$jwt->validateToken('token_123', 'secret_123', 'HS256')->willReturn(true);
$this->setToken('token_123');
$this->validate()->shouldReturn(true);
}
public function it_returns_false_on_validation_if_the_token_is_invalid(JwtDriverInterface $jwt)
{
$jwt->validateToken('invalid_token', 'secret_123', 'HS256')->willReturn(false);
$this->setToken('invalid_token');
$this->validate()->shouldReturn(false);
}
public function it_throws_an_exception_on_validate_or_fail_if_the_token_is_invalid(JwtDriverInterface $jwt)
{
$jwt->validateToken('invalid_token', 'secret_123', 'HS256')->willReturn(false);
$this->setToken('invalid_token');
$this->shouldThrow(InvalidTokenException::class)->during('validateOrFail');
}
public function it_creates_new_tokens_from_the_provided_payload(JwtDriverInterface $jwt)
{
$jwt->createToken(['exp' => '123'], 'secret_123', 'HS256')->willReturn('newtoken_123');
$result = $this->createToken(['exp' => '123']);
$result->shouldHaveType(JwtToken::class);
if($result->getWrappedObject()->token() !== 'newtoken_123') throw new \Exception('New token was not set correctly.');
}
public function it_creates_new_tokens_from_a_jwt_payload_interface_object(JwtPayloadInterface $payload, JwtDriverInterface $jwt)
{
$jwt->createToken(['foo' => 'bar'], 'secret_123', 'HS256')->willReturn('newtoken_123');
$payload->getPayload()->willReturn(['foo' => 'bar']);
$result = $this->createToken($payload);
$result->shouldHaveType(JwtToken::class);
if($result->getWrappedObject()->token() !== 'newtoken_123') throw new \Exception('New token was not set correctly.');
}
public function it_gets_the_payload_from_the_current_token(JwtDriverInterface $jwt)
{
$jwt->decodeToken('token_123', 'secret_123', 'HS256')->willReturn(['foo' => ['baz' => 'bar']]);
$this->setToken('token_123');
$this->payload()->shouldReturn(['foo' => ['baz' => 'bar']]);
}
public function it_gets_the_payload_data_from_the_provided_dot_path(JwtDriverInterface $jwt)
{
$jwt->decodeToken('token_123', 'secret_123', 'HS256')->willReturn(['foo' => 'bar', 'context' => ['some' => 'data']]);
$this->setToken('token_123');
$this->payload('foo')->shouldReturn('bar');
$this->payload('context')->shouldReturn(['some' => 'data']);
$this->payload('context.some')->shouldReturn('data');
}
public function it_encodes_to_json_as_a_string_representation_of_the_token(JwtDriverInterface $jwt)
{
$driver = new FirebaseDriver();
$jwt = new JwtToken($driver);
$token = $jwt->createToken(['exp' => time() + 100], 'secret');
$serialized = json_encode(['token' => $token]);
$decoded = json_decode($serialized);
if( ! is_string($decoded->token) || strlen($decoded->token) < 1) {
throw new FailureException('Token was not json encoded.');
}
}
}
| php | MIT | 7f7a4863fb38d5b822b8a5dca6d836e3d3076ed4 | 2026-01-05T04:43:14.261135Z | false |
generationtux/jwt-artisan | https://github.com/generationtux/jwt-artisan/blob/7f7a4863fb38d5b822b8a5dca6d836e3d3076ed4/spec/Http/JwtMiddlewareSpec.php | spec/Http/JwtMiddlewareSpec.php | <?php
namespace spec\GenTux\Jwt\Http;
use Prophecy\Argument;
use GenTux\Jwt\JwtToken;
use PhpSpec\ObjectBehavior;
use Illuminate\Http\Request;
use GenTux\Jwt\Exceptions\NoTokenException;
use GenTux\Jwt\Exceptions\InvalidTokenException;
class JwtMiddlewareSpec extends ObjectBehavior
{
public function let(JwtToken $token)
{
$this->beConstructedWith($token);
}
public function it_validates_the_token_and_passes_onto_the_next_middleware(JwtToken $token, Request $request)
{
$request->header('Authorization')->willReturn('Bearer foo_token');
$token->setToken('foo_token')->willReturn($token);
$token->validateOrFail()->shouldBeCalled()->willReturn(true);
$next = function() { return 'hello world'; };
$this->handle($request, $next)->shouldReturn('hello world');
}
public function it_validates_the_token_with_custom_header_key_and_passes_onto_the_next_middleware(JwtToken $token, Request $request)
{
$customHeader = 'X-Test-AuthHeader';
putenv("JWT_HEADER=$customHeader");
$request->header($customHeader)->willReturn('Bearer foo_token');
$token->setToken('foo_token')->willReturn($token);
$token->validateOrFail()->shouldBeCalled()->willReturn(true);
$next = function() { return 'hello world'; };
$this->handle($request, $next)->shouldReturn('hello world');
putenv('JWT_HEADER=');
}
public function it_throws_an_exception_if_the_token_is_invalid(JwtToken $token, Request $request)
{
$request->header('Authorization')->willReturn(null);
$request->input('token')->willReturn('invalid_token');
$token->setToken('invalid_token')->willReturn($token);
$token->validateOrFail()->willThrow(InvalidTokenException::class);
$next = function() {};
$this->shouldThrow(InvalidTokenException::class)->during('handle', [$request, $next]);
}
public function it_throws_an_exception_if_no_token_is_provided_with_the_request(Request $request)
{
$request->header('Authorization')->willReturn(null);
$request->input('token')->willReturn(null);
$next = function() {};
$this->shouldThrow(NoTokenException::class)->during('handle', [$request, $next]);
}
}
| php | MIT | 7f7a4863fb38d5b822b8a5dca6d836e3d3076ed4 | 2026-01-05T04:43:14.261135Z | false |
generationtux/jwt-artisan | https://github.com/generationtux/jwt-artisan/blob/7f7a4863fb38d5b822b8a5dca6d836e3d3076ed4/spec/Drivers/FirebaseDriverSpec.php | spec/Drivers/FirebaseDriverSpec.php | <?php
namespace spec\GenTux\Jwt\Drivers;
use Exception;
use Firebase\JWT\JWT;
use Prophecy\Argument;
use PhpSpec\ObjectBehavior;
use GenTux\Jwt\Drivers\FirebaseDriver;
use GenTux\Jwt\Drivers\JwtDriverInterface;
class FirebaseDriverSpec extends ObjectBehavior
{
public function it_implements_the_driver_interface()
{
$this->shouldHaveType(JwtDriverInterface::class);
}
public function it_creates_new_tokens()
{
$payload = ['foo' => 'bar'];
$secret = 'secret123';
$driver = new FirebaseDriver();
$result = $driver->createToken($payload, $secret);
$expect = JWT::encode($payload, $secret);
if($result !== $expect) {
throw new Exception('Expected '.$expect.' to match '.$result);
}
}
public function it_validates_tokens()
{
$token = JWT::encode([
'exp' => time() + 30,
'iat' => time(),
'nbf' => time(),
], $secret = 'secret_123');
$driver = new FirebaseDriver();
$result = $driver->validateToken($token, $secret);
if(! $result) throw new Exception('Unable to validate token '.$token);
}
public function it_decodes_tokens()
{
$token = JWT::encode(
$payload = [
'exp' => time() + 30,
'iat' => time(),
'nbf' => time(),
'context' => ['foo' => 'bar'],
], $secret = 'secret_123');
$driver = new FirebaseDriver();
$result = $driver->decodeToken($token, $secret);
if(
$result['exp'] !== $payload['exp']
|| $result['iat'] !== $payload['iat']
|| $result['nbf'] !== $payload['nbf']
|| $result['context']['foo'] !== $payload['context']['foo']
) {
throw new \Exception('Decoded payload did not match the encoded tokens payload. '.$token);
}
}
}
| php | MIT | 7f7a4863fb38d5b822b8a5dca6d836e3d3076ed4 | 2026-01-05T04:43:14.261135Z | false |
grasmash/expander | https://github.com/grasmash/expander/blob/eea11b9afb0c32483b18b9009f4ca07b770e39f4/src/StringifierInterface.php | src/StringifierInterface.php | <?php
namespace Grasmash\Expander;
interface StringifierInterface
{
/**
* Converts array to string.
*
* @param array $array
* The array to convert.
*
* @return string
* The resultant string.
*/
public static function stringifyArray(array $array): string;
}
| php | MIT | eea11b9afb0c32483b18b9009f4ca07b770e39f4 | 2026-01-05T04:43:26.774640Z | false |
grasmash/expander | https://github.com/grasmash/expander/blob/eea11b9afb0c32483b18b9009f4ca07b770e39f4/src/Stringifier.php | src/Stringifier.php | <?php
namespace Grasmash\Expander;
/**
* Class Stringifier
* @package Grasmash\Expander
*/
class Stringifier implements StringifierInterface
{
/**
* Converts array to string.
*
* @param array $array
* The array to convert.
*
* @return string
* The resultant string.
*/
public static function stringifyArray(array $array): string
{
return implode(',', $array);
}
}
| php | MIT | eea11b9afb0c32483b18b9009f4ca07b770e39f4 | 2026-01-05T04:43:26.774640Z | false |
grasmash/expander | https://github.com/grasmash/expander/blob/eea11b9afb0c32483b18b9009f4ca07b770e39f4/src/Expander.php | src/Expander.php | <?php
namespace Grasmash\Expander;
use Dflydev\DotAccessData\Data;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
/**
* Class Expander
* @package Grasmash\Expander
*/
class Expander implements LoggerAwareInterface
{
/**
* @var \Grasmash\Expander\StringifierInterface
*/
protected StringifierInterface $stringifier;
/**
* @var \Psr\Log\LoggerInterface
*/
protected LoggerInterface $logger;
public function __construct()
{
$this->setLogger(new NullLogger());
$this->setStringifier(new Stringifier());
}
/**
* @return \Grasmash\Expander\StringifierInterface
*/
public function getStringifier(): StringifierInterface
{
return $this->stringifier;
}
/**
* @param \Grasmash\Expander\StringifierInterface $stringifier
*/
public function setStringifier(StringifierInterface $stringifier)
{
$this->stringifier = $stringifier;
}
/**
* @return \Psr\Log\LoggerInterface
*/
public function getLogger(): LoggerInterface
{
return $this->logger;
}
/**
* @param \Psr\Log\LoggerInterface $logger
*/
public function setLogger(LoggerInterface $logger): void
{
$this->logger = $logger;
}
/**
* Expands property placeholders in an array.
*
* Placeholders should be formatted as ${parent.child}.
*
* @param array $array
* An array containing properties to expand.
*
* @return array
* The modified array in which placeholders have been replaced with
* values.
*/
public function expandArrayProperties(array $array, $reference_array = []): array
{
$data = new Data($array);
if ($reference_array) {
$reference_data = new Data($reference_array);
$this->doExpandArrayProperties($data, $array, '', $reference_data);
} else {
$this->doExpandArrayProperties($data, $array);
}
return $data->export();
}
/**
* Performs the actual property expansion.
*
* @param Data $data
* A data object, containing the $array.
* @param array $array
* The original, unmodified array.
* @param string $parent_keys
* The parent keys of the current key in dot notation. This is used to
* track the absolute path to the current key in recursive cases.
* @param Data|null $reference_data
* A reference data object. This is not operated upon but is used as a
* reference to provide supplemental values for property expansion.
*/
protected function doExpandArrayProperties(
Data $data,
array $array,
string $parent_keys = '',
?Data $reference_data = null
) {
foreach ($array as $key => $value) {
// Boundary condition(s).
if ($value === null || is_bool($value)) {
continue;
}
// Recursive case.
if (is_array($value)) {
$this->doExpandArrayProperties($data, $value, $parent_keys . "$key.", $reference_data);
} else {
// Base case.
$this->expandStringProperties($data, $parent_keys, $reference_data, $value, $key);
}
}
}
/**
* Expand a single property.
*
* @param Data $data
* A data object, containing the $array.
* @param string $parent_keys
* The parent keys of the current key in dot notation. This is used to
* track the absolute path to the current key in recursive cases.
* @param Data|null $reference_data
* A reference data object. This is not operated upon but is used as a
* reference to provide supplemental values for property expansion.
* @param string $value
* The unexpanded property value.
* @param string $key
* The immediate key of the property.
*
* @return mixed
*/
protected function expandStringProperties(
Data $data,
string $parent_keys,
?Data $reference_data,
string $value,
string $key
): mixed {
$pattern = '/\$\{([^\$}]+)\}/';
// We loop through all placeholders in a given string.
// E.g., '${placeholder1} ${placeholder2}' requires two replacements.
while (str_contains((string) $value, '${')) {
$original_value = $value;
$value = preg_replace_callback(
$pattern,
function ($matches) use ($data, $reference_data) {
return $this->expandStringPropertiesCallback($matches, $data, $reference_data);
},
$value,
-1,
$count
);
// If the value was just a _single_ property reference, we have the opportunity to preserve the data type.
if ($count === 1) {
preg_match($pattern, $original_value, $matches);
if ($matches[0] === $original_value) {
$value = $this->expandStringPropertiesCallback($matches, $data, $reference_data);
}
}
// If no replacement occurred at all, break to prevent
// infinite loop.
if ($original_value === $value) {
break;
}
// Set value on $data object.
if ($parent_keys) {
$full_key = $parent_keys . "$key";
} else {
$full_key = $key;
}
$data->set($full_key, $value);
}
return $value;
}
/**
* Expansion callback used by preg_replace_callback() in expandProperty().
*
* @param array $matches
* An array of matches created by preg_replace_callback().
* @param Data $data
* A data object containing the complete array being operated upon.
* @param Data|null $reference_data
* A reference data object. This is not operated upon but is used as a
* reference to provide supplemental values for property expansion.
*
* @return mixed
*/
public function expandStringPropertiesCallback(
array $matches,
Data $data,
?Data $reference_data = null
): mixed {
$property_name = $matches[1];
$unexpanded_value = $matches[0];
// Use only values within the subject array's data.
if (!$reference_data) {
return $this->expandProperty($property_name, $unexpanded_value, $data);
} else {
// Search both the subject array's data and the reference data for a value.
return $this->expandPropertyWithReferenceData(
$property_name,
$unexpanded_value,
$data,
$reference_data
);
}
}
/**
* Searches both the subject data and the reference data for value.
*
* @param string $property_name
* The name of the value for which to search.
* @param string $unexpanded_value
* The original, unexpanded value, containing the placeholder.
* @param Data $data
* A data object containing the complete array being operated upon.
* @param Data|null $reference_data
* A reference data object. This is not operated upon but is used as a
* reference to provide supplemental values for property expansion.
*
* @return string|null The expanded string.
* The expanded string.
*/
public function expandPropertyWithReferenceData(
string $property_name,
string $unexpanded_value,
Data $data,
?Data $reference_data
): ?string {
$expanded_value = $this->expandProperty(
$property_name,
$unexpanded_value,
$data
);
// If the string was not changed using the subject data, try using
// the reference data.
if ($expanded_value === $unexpanded_value) {
$expanded_value = $this->expandProperty(
$property_name,
$unexpanded_value,
$reference_data
);
}
return $expanded_value;
}
/**
* Searches a data object for a value.
*
* @param string $property_name
* The name of the value for which to search.
* @param string $unexpanded_value
* The original, unexpanded value, containing the placeholder.
* @param Data $data
* A data object containing possible replacement values.
*
* @return mixed
*/
public function expandProperty(string $property_name, string $unexpanded_value, Data $data): mixed
{
if (str_starts_with($property_name, "env.") &&
!$data->has($property_name)) {
$env_key = substr($property_name, 4);
if (isset($_SERVER[$env_key])) {
$data->set($property_name, $_SERVER[$env_key]);
} elseif (getenv($env_key)) {
$data->set($property_name, getenv($env_key));
}
}
if (!$data->has($property_name)) {
$this->log("Property \${'$property_name'} could not be expanded.");
return $unexpanded_value;
} else {
$expanded_value = $data->get($property_name);
if (is_array($expanded_value)) {
return $this->getStringifier()->stringifyArray($expanded_value);
}
$this->log("Expanding property \${'$property_name'} => $expanded_value.");
return $expanded_value;
}
}
/**
* Logs a message using the logger.
*
* @param string $message
* The message to log.
*/
public function log(string $message)
{
$this->getLogger()?->debug($message);
}
}
| php | MIT | eea11b9afb0c32483b18b9009f4ca07b770e39f4 | 2026-01-05T04:43:26.774640Z | false |
grasmash/expander | https://github.com/grasmash/expander/blob/eea11b9afb0c32483b18b9009f4ca07b770e39f4/tests/src/ExpanderTest.php | tests/src/ExpanderTest.php | <?php
namespace Grasmash\Expander\Tests;
use Dflydev\DotAccessData\Data;
use Grasmash\Expander\Expander;
use Grasmash\Expander\Stringifier;
use PHPUnit\Framework\TestCase;
class ExpanderTest extends TestCase
{
/**
* Tests Expander::expandArrayProperties().
*
* @param array $array
* @param array $reference_array
*
* @dataProvider providerSourceData
*/
public function testExpandArrayProperties(array $array, array $reference_array)
{
$expander = new Expander();
$this->setEnvVarFixture('test', 'gomjabbar');
$expanded = $expander->expandArrayProperties($array);
$this->assertEquals('gomjabbar', $expanded['env-test']);
$this->assertEquals('Frank Herbert 1965', $expanded['book']['copyright']);
$this->assertEquals('Paul Atreides', $expanded['book']['protaganist']);
$this->assertEquals('Dune by Frank Herbert', $expanded['summary']);
$this->assertEquals('${book.media.1}, hardcover', $expanded['available-products']);
$this->assertEquals('Dune', $expanded['product-name']);
$this->assertEquals(Stringifier::stringifyArray($array['inline-array']), $expanded['expand-array']);
$this->assertEquals(true, $expanded['boolean-value']);
$this->assertIsBool($expanded['boolean-value']);
$this->assertEquals(true, $expanded['expand-boolean']);
$this->assertIsBool($expanded['expand-boolean']);
$expanded = $expander->expandArrayProperties($array, $reference_array);
$this->assertEquals('Dune Messiah, and others.', $expanded['sequels']);
$this->assertEquals('Dune Messiah', $expanded['book']['nested-reference']);
}
/**
* @return array
* An array of values to test.
*/
public function providerSourceData(): array
{
return [
[
[
'type' => 'book',
'book' => [
'title' => 'Dune',
'author' => 'Frank Herbert',
'copyright' => '${book.author} 1965',
'protaganist' => '${characters.0.name}',
'media' => [
0 => 'hardcover',
],
'nested-reference' => '${book.sequel}',
],
'characters' => [
0 => [
'name' => 'Paul Atreides',
'occupation' => 'Kwisatz Haderach',
'aliases' => [
0 => 'Usul',
1 => "Muad'Dib",
2 => 'The Preacher',
],
],
1 => [
'name' => 'Duncan Idaho',
'occupation' => 'Swordmaster',
],
],
'summary' => '${book.title} by ${book.author}',
'publisher' => '${not.real.property}',
'sequels' => '${book.sequel}, and others.',
'available-products' => '${book.media.1}, ${book.media.0}',
'product-name' => '${${type}.title}',
'boolean-value' => true,
'expand-boolean' => '${boolean-value}',
'null-value' => null,
'inline-array' => [
0 => 'one',
1 => 'two',
2 => 'three',
],
'expand-array' => '${inline-array}',
'env-test' => '${env.test}',
'test_expanded_to_null' => '${book.expanded_to_null}'
],
[
'book' => [
'sequel' => 'Dune Messiah',
'expanded_to_null' => null,
]
]
],
];
}
/**
* Tests Expander::expandProperty().
*
* @dataProvider providerTestExpandProperty
*/
public function testExpandProperty(array $array, $property_name, $unexpanded_string, $expected)
{
$data = new Data($array);
$expander = new Expander();
$expanded_value = $expander->expandProperty($property_name, $unexpanded_string, $data);
$this->assertEquals($expected, $expanded_value);
}
/**
* @return array
*/
public function providerTestExpandProperty(): array
{
return [
[ ['author' => 'Frank Herbert'], 'author', '${author}', 'Frank Herbert' ],
[ ['book' => ['author' => 'Frank Herbert' ]], 'book.author', '${book.author}', 'Frank Herbert' ],
];
}
/**
* @param $key
* @param $value
*/
protected function setEnvVarFixture($key, $value)
{
putenv("$key=$value");
$_SERVER[$key] = $value;
}
}
| php | MIT | eea11b9afb0c32483b18b9009f4ca07b770e39f4 | 2026-01-05T04:43:26.774640Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/src/GitLabServiceProvider.php | src/GitLabServiceProvider.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\GitLab;
use Gitlab\Client;
use GrahamCampbell\GitLab\Auth\AuthenticatorFactory;
use GrahamCampbell\GitLab\Cache\ConnectionFactory;
use GrahamCampbell\GitLab\HttpClient\BuilderFactory;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Psr7\HttpFactory as GuzzlePsrFactory;
use Illuminate\Contracts\Container\Container;
use Illuminate\Foundation\Application as LaravelApplication;
use Illuminate\Support\ServiceProvider;
use Laravel\Lumen\Application as LumenApplication;
/**
* This is the gitlab service provider class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class GitLabServiceProvider extends ServiceProvider
{
/**
* Boot the service provider.
*
* @return void
*/
public function boot(): void
{
$this->setupConfig();
}
/**
* Setup the config.
*
* @return void
*/
private function setupConfig(): void
{
$source = realpath($raw = __DIR__.'/../config/gitlab.php') ?: $raw;
if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
$this->publishes([$source => config_path('gitlab.php')]);
} elseif ($this->app instanceof LumenApplication) {
$this->app->configure('gitlab');
}
$this->mergeConfigFrom($source, 'gitlab');
}
/**
* Register the service provider.
*
* @return void
*/
public function register(): void
{
$this->registerHttpClientFactory();
$this->registerAuthFactory();
$this->registerCacheFactory();
$this->registerGitLabFactory();
$this->registerManager();
$this->registerBindings();
}
/**
* Register the http client factory class.
*
* @return void
*/
private function registerHttpClientFactory(): void
{
$this->app->singleton('gitlab.httpclientfactory', function (): BuilderFactory {
$psrFactory = new GuzzlePsrFactory();
return new BuilderFactory(
new GuzzleClient(['connect_timeout' => 10, 'timeout' => 30]),
$psrFactory,
$psrFactory,
$psrFactory,
);
});
$this->app->alias('gitlab.httpclientfactory', BuilderFactory::class);
}
/**
* Register the auth factory class.
*
* @return void
*/
private function registerAuthFactory(): void
{
$this->app->singleton('gitlab.authfactory', function (): AuthenticatorFactory {
return new AuthenticatorFactory();
});
$this->app->alias('gitlab.authfactory', AuthenticatorFactory::class);
}
/**
* Register the cache factory class.
*
* @return void
*/
private function registerCacheFactory(): void
{
$this->app->singleton('gitlab.cachefactory', function (Container $app): ConnectionFactory {
$cache = $app->bound('cache') ? $app->make('cache') : null;
return new ConnectionFactory($cache);
});
$this->app->alias('gitlab.cachefactory', ConnectionFactory::class);
}
/**
* Register the gitlab factory class.
*
* @return void
*/
private function registerGitLabFactory(): void
{
$this->app->singleton('gitlab.factory', function (Container $app): GitLabFactory {
$builder = $app['gitlab.httpclientfactory'];
$auth = $app['gitlab.authfactory'];
$cache = $app['gitlab.cachefactory'];
return new GitLabFactory($builder, $auth, $cache);
});
$this->app->alias('gitlab.factory', GitLabFactory::class);
}
/**
* Register the manager class.
*
* @return void
*/
private function registerManager(): void
{
$this->app->singleton('gitlab', function (Container $app): GitLabManager {
$config = $app['config'];
$factory = $app['gitlab.factory'];
return new GitLabManager($config, $factory);
});
$this->app->alias('gitlab', GitLabManager::class);
}
/**
* Register the bindings.
*
* @return void
*/
private function registerBindings(): void
{
$this->app->bind('gitlab.connection', function (Container $app): Client {
$manager = $app['gitlab'];
return $manager->connection();
});
$this->app->alias('gitlab.connection', Client::class);
}
/**
* Get the services provided by the provider.
*
* @return string[]
*/
public function provides(): array
{
return [
'gitlab.httpclientfactory',
'gitlab.authfactory',
'gitlab.cachefactory',
'gitlab.factory',
'gitlab',
'gitlab.connection',
];
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/src/GitLabFactory.php | src/GitLabFactory.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\GitLab;
use Gitlab\Client;
use Gitlab\HttpClient\Builder;
use GrahamCampbell\GitLab\Auth\Authenticator\AuthenticatorInterface;
use GrahamCampbell\GitLab\Auth\AuthenticatorFactory;
use GrahamCampbell\GitLab\Cache\ConnectionFactory;
use GrahamCampbell\GitLab\HttpClient\BuilderFactory;
use Http\Client\Common\Plugin\RetryPlugin;
use Illuminate\Support\Arr;
use InvalidArgumentException;
use Symfony\Component\Cache\Adapter\Psr16Adapter;
/**
* This is the gitlab factory class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class GitLabFactory
{
/**
* Create a new gitlab factory instance.
*
* @param \GrahamCampbell\GitLab\HttpClient\BuilderFactory $builder
* @param \GrahamCampbell\GitLab\Auth\AuthenticatorFactory $auth
* @param \GrahamCampbell\GitLab\Cache\ConnectionFactory $cache
*
* @return void
*/
public function __construct(
private readonly BuilderFactory $builder,
private readonly AuthenticatorFactory $auth,
private readonly ConnectionFactory $cache,
) {
}
/**
* Make a new gitlab client.
*
* @param string[] $config
*
* @throws \InvalidArgumentException
*
* @return \Gitlab\Client
*/
public function make(array $config): Client
{
$client = new Client($this->getBuilder($config));
if (!array_key_exists('method', $config)) {
throw new InvalidArgumentException('The gitlab factory requires an auth method.');
}
if ($url = Arr::get($config, 'url')) {
$client->setUrl($url);
}
if ($config['method'] === 'none') {
return $client;
}
return $this->getAuthenticator($config['method'])->with($client)->authenticate($config);
}
/**
* Get the http client builder.
*
* @param string[] $config
*
* @return \Gitlab\HttpClient\Builder
*/
protected function getBuilder(array $config): Builder
{
$builder = $this->builder->make();
if ($backoff = Arr::get($config, 'backoff')) {
$builder->addPlugin(new RetryPlugin(['retries' => $backoff === true ? 2 : $backoff]));
}
if (is_array($cache = Arr::get($config, 'cache', false))) {
$boundedCache = $this->cache->make($cache);
$builder->addCache(
new Psr16Adapter($boundedCache),
['cache_lifetime' => $boundedCache->getMaximumLifetime()]
);
}
return $builder;
}
/**
* Get the authenticator.
*
* @throws \InvalidArgumentException
*
* @return \GrahamCampbell\GitLab\Auth\Authenticator\AuthenticatorInterface
*/
protected function getAuthenticator(string $method): AuthenticatorInterface
{
return $this->auth->make($method);
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/src/GitLabManager.php | src/GitLabManager.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\GitLab;
use Gitlab\Client;
use GrahamCampbell\Manager\AbstractManager;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Support\Arr;
/**
* This is the gitlab manager class.
*
* @method \Gitlab\Client connection(string|null $name = null)
* @method \Gitlab\Client reconnect(string|null $name = null)
* @method void disconnect(string|null $name = null)
* @method array<string,\Gitlab\Client> getConnections()
* @method \Gitlab\Api\DeployKeys deployKeys()
* @method \Gitlab\Api\Deployments deployments()
* @method \Gitlab\Api\Environments environments()
* @method \Gitlab\Api\Events events()
* @method \Gitlab\Api\Groups groups()
* @method \Gitlab\Api\GroupsBoards groupsBoards()
* @method \Gitlab\Api\GroupsEpics groupsEpics()
* @method \Gitlab\Api\GroupsMilestones groupsMilestones()
* @method \Gitlab\Api\IssueBoards issueBoards()
* @method \Gitlab\Api\IssueLinks issueLinks()
* @method \Gitlab\Api\Issues issues()
* @method \Gitlab\Api\IssuesStatistics issuesStatistics()
* @method \Gitlab\Api\Jobs jobs()
* @method \Gitlab\Api\Keys keys()
* @method \Gitlab\Api\MergeRequests mergeRequests()
* @method \Gitlab\Api\Milestones milestones()
* @method \Gitlab\Api\ProjectNamespaces namespaces()
* @method \Gitlab\Api\Projects projects()
* @method \Gitlab\Api\Repositories repositories()
* @method \Gitlab\Api\RepositoryFiles repositoryFiles()
* @method \Gitlab\Api\Schedules schedules()
* @method \Gitlab\Api\Search search()
* @method \Gitlab\Api\Snippets snippets()
* @method \Gitlab\Api\SystemHooks systemHooks()
* @method \Gitlab\Api\Users users()
* @method \Gitlab\Api\Tags tags()
* @method \Gitlab\Api\Version version()
* @method \Gitlab\Api\Wiki wiki()
* @method \Gitlab\Api\ApiInterface api(string $name)
* @method void authenticate(string $token, string $authMethod, string|null $sudo = null)
* @method void setUrl(string $url)
* @method \Psr\Http\Message\ResponseInterface|null getLastResponse()
* @method \Gitlab\HttpClient\Plugin\History getResponseHistory()
* @method \Http\Client\Common\HttpMethodsClientInterface getHttpClient()
* @method \Http\Message\StreamFactory getStreamFactory()
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class GitLabManager extends AbstractManager
{
protected readonly GitLabFactory $factory;
/**
* Create a new gitlab manager instance.
*
* @param \Illuminate\Contracts\Config\Repository $config
* @param \GrahamCampbell\GitLab\GitLabFactory $factory
*
* @return void
*/
public function __construct(Repository $config, GitLabFactory $factory)
{
parent::__construct($config);
$this->factory = $factory;
}
/**
* Create the connection instance.
*
* @param array $config
*
* @return \Gitlab\Client
*/
protected function createConnection(array $config): Client
{
return $this->factory->make($config);
}
/**
* Get the configuration name.
*
* @return string
*/
protected function getConfigName(): string
{
return 'gitlab';
}
/**
* Get the configuration for a connection.
*
* @param string|null $name
*
* @throws \InvalidArgumentException
*
* @return array
*/
public function getConnectionConfig(?string $name = null): array
{
$config = parent::getConnectionConfig($name);
if (is_string($cache = Arr::get($config, 'cache'))) {
$config['cache'] = $this->getNamedConfig('cache', 'Cache', $cache);
}
return $config;
}
/**
* Get the factory instance.
*
* @return \GrahamCampbell\GitLab\GitLabFactory
*/
public function getFactory(): GitLabFactory
{
return $this->factory;
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/src/HttpClient/BuilderFactory.php | src/HttpClient/BuilderFactory.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\GitLab\HttpClient;
use Gitlab\HttpClient\Builder;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\UriFactoryInterface;
/**
* This is the http client builder factory class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class BuilderFactory
{
/**
* Create a new connection factory instance.
*
* @param \Psr\Http\Client\ClientInterface $httpClient
* @param \Psr\Http\Message\RequestFactoryInterface $requestFactory
* @param \Psr\Http\Message\StreamFactoryInterface $streamFactory
* @param \Psr\Http\Message\UriFactoryInterface $uriFactory
*
* @return void
*/
public function __construct(
private readonly ClientInterface $httpClient,
private readonly RequestFactoryInterface $requestFactory,
private readonly StreamFactoryInterface $streamFactory,
private readonly UriFactoryInterface $uriFactory,
) {
}
/**
* Return a new http client builder.
*
* @return \Gitlab\HttpClient\Builder
*/
public function make(): Builder
{
return new Builder($this->httpClient, $this->requestFactory, $this->streamFactory, $this->uriFactory);
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/src/Auth/AuthenticatorFactory.php | src/Auth/AuthenticatorFactory.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\GitLab\Auth;
use GrahamCampbell\GitLab\Auth\Authenticator\AuthenticatorInterface;
use InvalidArgumentException;
/**
* This is the authenticator factory class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class AuthenticatorFactory
{
/**
* Make a new authenticator instance.
*
* @param string $method
*
* @throws \InvalidArgumentException
*
* @return \GrahamCampbell\GitLab\Auth\Authenticator\AuthenticatorInterface
*/
public function make(string $method): AuthenticatorInterface
{
return match ($method) {
'job_token' => new Authenticator\JobTokenAuthenticator(),
'oauth' => new Authenticator\OauthAuthenticator(),
'token' => new Authenticator\TokenAuthenticator(),
default => throw new InvalidArgumentException("Unsupported authentication method [$method]."),
};
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/src/Auth/Authenticator/AbstractAuthenticator.php | src/Auth/Authenticator/AbstractAuthenticator.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\GitLab\Auth\Authenticator;
use Gitlab\Client;
use InvalidArgumentException;
/**
* This is the abstract authenticator class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
abstract class AbstractAuthenticator implements AuthenticatorInterface
{
private ?Client $client = null;
/**
* Set the client to perform the authentication on.
*
* @param \Gitlab\Client $client
*
* @return \GrahamCampbell\GitLab\Auth\Authenticator\AuthenticatorInterface
*/
public function with(Client $client): AuthenticatorInterface
{
$this->client = $client;
return $this;
}
/**
* @throws \InvalidArgumentException
*
* @return \Gitlab\Client
*/
protected function getClient(): Client
{
if (!$this->client) {
throw new InvalidArgumentException('The client instance was not given to the authenticator.');
}
return $this->client;
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/src/Auth/Authenticator/TokenAuthenticator.php | src/Auth/Authenticator/TokenAuthenticator.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\GitLab\Auth\Authenticator;
use Gitlab\Client;
use InvalidArgumentException;
/**
* This is the token authenticator class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
final class TokenAuthenticator extends AbstractAuthenticator
{
/**
* Authenticate the client, and return it.
*
* @param string[] $config
*
* @throws \InvalidArgumentException
*
* @return \Gitlab\Client
*/
public function authenticate(array $config): Client
{
$client = $this->getClient();
if (!array_key_exists('token', $config)) {
throw new InvalidArgumentException('The token authenticator requires a token.');
}
$client->authenticate($config['token'], Client::AUTH_HTTP_TOKEN, $config['sudo'] ?? null);
return $client;
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/src/Auth/Authenticator/AuthenticatorInterface.php | src/Auth/Authenticator/AuthenticatorInterface.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\GitLab\Auth\Authenticator;
use Gitlab\Client;
/**
* This is the authenticator interface.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
interface AuthenticatorInterface
{
/**
* Set the client to perform the authentication on.
*
* @param \Gitlab\Client $client
*
* @return \GrahamCampbell\GitLab\Auth\Authenticator\AuthenticatorInterface
*/
public function with(Client $client): AuthenticatorInterface;
/**
* Authenticate the client, and return it.
*
* @param string[] $config
*
* @throws \InvalidArgumentException
*
* @return \Gitlab\Client
*/
public function authenticate(array $config): Client;
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/src/Auth/Authenticator/OauthAuthenticator.php | src/Auth/Authenticator/OauthAuthenticator.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\GitLab\Auth\Authenticator;
use Gitlab\Client;
use InvalidArgumentException;
/**
* This is the oauth authenticator class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
final class OauthAuthenticator extends AbstractAuthenticator
{
/**
* Authenticate the client, and return it.
*
* @param string[] $config
*
* @throws \InvalidArgumentException
*
* @return \Gitlab\Client
*/
public function authenticate(array $config): Client
{
$client = $this->getClient();
if (!array_key_exists('token', $config)) {
throw new InvalidArgumentException('The oauth authenticator requires a token.');
}
$client->authenticate($config['token'], Client::AUTH_OAUTH_TOKEN, $config['sudo'] ?? null);
return $client;
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/src/Auth/Authenticator/JobTokenAuthenticator.php | src/Auth/Authenticator/JobTokenAuthenticator.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\GitLab\Auth\Authenticator;
use Gitlab\Client;
use InvalidArgumentException;
/**
* This is the job token authenticator class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
final class JobTokenAuthenticator extends AbstractAuthenticator
{
/**
* Authenticate the client, and return it.
*
* @param string[] $config
*
* @throws \InvalidArgumentException
*
* @return \Gitlab\Client
*/
public function authenticate(array $config): Client
{
$client = $this->getClient();
if (!array_key_exists('token', $config)) {
throw new InvalidArgumentException('The job token authenticator requires a token.');
}
$client->authenticate($config['token'], Client::AUTH_HTTP_JOB_TOKEN, $config['sudo'] ?? null);
return $client;
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/src/Cache/ConnectionFactory.php | src/Cache/ConnectionFactory.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\GitLab\Cache;
use GrahamCampbell\BoundedCache\BoundedCacheInterface;
use GrahamCampbell\Manager\ConnectorInterface;
use Illuminate\Contracts\Cache\Factory;
use InvalidArgumentException;
/**
* This is the cache connection factory class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class ConnectionFactory
{
/**
* Create a new connection factory instance.
*
* @param \Illuminate\Contracts\Cache\Factory|null $cache
*
* @return void
*/
public function __construct(
private readonly ?Factory $cache = null,
) {
}
/**
* Establish a cache connection.
*
* @param array $config
*
* @throws \InvalidArgumentException
*
* @return \GrahamCampbell\BoundedCache\BoundedCacheInterface
*/
public function make(array $config): BoundedCacheInterface
{
return $this->createConnector($config)->connect($config);
}
/**
* Create a connector instance based on the configuration.
*
* @param array $config
*
* @throws \InvalidArgumentException
*
* @return \GrahamCampbell\Manager\ConnectorInterface
*/
public function createConnector(array $config): ConnectorInterface
{
if (!isset($config['driver'])) {
throw new InvalidArgumentException('A driver must be specified.');
}
switch ($config['driver']) {
case 'illuminate':
return new Connector\IlluminateConnector($this->cache);
}
throw new InvalidArgumentException("Unsupported driver [{$config['driver']}].");
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/src/Cache/Connector/IlluminateConnector.php | src/Cache/Connector/IlluminateConnector.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\GitLab\Cache\Connector;
use GrahamCampbell\BoundedCache\BoundedCache;
use GrahamCampbell\BoundedCache\BoundedCacheInterface;
use GrahamCampbell\Manager\ConnectorInterface;
use Illuminate\Contracts\Cache\Factory;
use Illuminate\Contracts\Cache\Repository;
use Illuminate\Support\Arr;
use InvalidArgumentException;
/**
* This is the illuminate connector class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
final class IlluminateConnector implements ConnectorInterface
{
private const MIN_CACHE_LIFETIME = 43200;
private const MAX_CACHE_LIFETIME = 172800;
/**
* Create a new illuminate connector instance.
*
* @param \Illuminate\Contracts\Cache\Factory|null $cache
*
* @return void
*/
public function __construct(
private readonly ?Factory $cache = null,
) {
}
/**
* Establish a cache connection.
*
* @param array $config
*
* @throws \InvalidArgumentException
*
* @return \GrahamCampbell\BoundedCache\BoundedCacheInterface
*/
public function connect(array $config): BoundedCacheInterface
{
$repository = $this->getRepository($config);
return self::getBoundedCache($repository, $config);
}
/**
* Get the cache repository.
*
* @param array $config
*
* @throws \InvalidArgumentException
*
* @return \Illuminate\Contracts\Cache\Repository
*/
private function getRepository(array $config): Repository
{
if (!$this->cache) {
throw new InvalidArgumentException('Illuminate caching support not available.');
}
$name = Arr::get($config, 'connector');
return $this->cache->store($name);
}
/**
* Get the bounded cache instance.
*
* @param \Illuminate\Contracts\Cache\Repository $repository
* @param array $config
*
* @return \GrahamCampbell\BoundedCache\BoundedCacheInterface
*/
private static function getBoundedCache(Repository $repository, array $config): BoundedCacheInterface
{
$min = Arr::get($config, 'min', self::MIN_CACHE_LIFETIME);
$max = Arr::get($config, 'max', self::MAX_CACHE_LIFETIME);
return new BoundedCache($repository, $min, $max);
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/src/Facades/GitLab.php | src/Facades/GitLab.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\GitLab\Facades;
use Illuminate\Support\Facades\Facade;
/**
* This is the gitlab facade class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class GitLab extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor(): string
{
return 'gitlab';
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/tests/AbstractTestCase.php | tests/AbstractTestCase.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\Tests\GitLab;
use GrahamCampbell\GitLab\GitLabServiceProvider;
use GrahamCampbell\TestBench\AbstractPackageTestCase;
/**
* This is the abstract test case class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
abstract class AbstractTestCase extends AbstractPackageTestCase
{
/**
* Get the service provider class.
*
* @return string
*/
protected static function getServiceProviderClass(): string
{
return GitLabServiceProvider::class;
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/tests/GitLabFactoryTest.php | tests/GitLabFactoryTest.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\Tests\GitLab;
use Gitlab\Client;
use GrahamCampbell\BoundedCache\BoundedCacheInterface;
use GrahamCampbell\GitLab\Auth\AuthenticatorFactory;
use GrahamCampbell\GitLab\Cache\ConnectionFactory;
use GrahamCampbell\GitLab\GitLabFactory;
use GrahamCampbell\GitLab\HttpClient\BuilderFactory;
use GrahamCampbell\TestBench\AbstractTestCase as AbstractTestBenchTestCase;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Psr7\HttpFactory as GuzzlePsrFactory;
use Http\Client\Common\HttpMethodsClientInterface;
use Illuminate\Contracts\Cache\Factory;
use InvalidArgumentException;
use Mockery;
/**
* This is the gitlab factory test class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class GitLabFactoryTest extends AbstractTestBenchTestCase
{
public function testMakeStandard(): void
{
[$factory, $cache] = self::getFactory();
$client = $factory->make(['token' => 'your-token', 'method' => 'token']);
self::assertInstanceOf(Client::class, $client);
self::assertInstanceOf(HttpMethodsClientInterface::class, $client->getHttpClient());
}
public function testMakeStandardWithCache(): void
{
[$factory, $cache] = self::getFactory();
$boundedCache = Mockery::mock(BoundedCacheInterface::class);
$boundedCache->shouldReceive('getMaximumLifetime')->once()->with()->andReturn(42);
$cache->shouldReceive('make')->once()->with(['name' => 'main', 'driver' => 'illuminate'])->andReturn($boundedCache);
$client = $factory->make(['token' => 'your-token', 'method' => 'token', 'cache' => ['name' => 'main', 'driver' => 'illuminate']]);
self::assertInstanceOf(Client::class, $client);
self::assertInstanceOf(HttpMethodsClientInterface::class, $client->getHttpClient());
}
public function testMakeStandardNamedCache(): void
{
[$factory, $cache] = self::getFactory();
$boundedCache = Mockery::mock(BoundedCacheInterface::class);
$boundedCache->shouldReceive('getMaximumLifetime')->once()->with()->andReturn(42);
$cache->shouldReceive('make')->once()->with(['name' => 'main', 'driver' => 'illuminate', 'connection' => 'foo'])->andReturn($boundedCache);
$client = $factory->make(['token' => 'your-token', 'method' => 'token', 'cache' => ['name' => 'main', 'driver' => 'illuminate', 'connection' => 'foo']]);
self::assertInstanceOf(Client::class, $client);
self::assertInstanceOf(HttpMethodsClientInterface::class, $client->getHttpClient());
}
public function testMakeStandardNoCacheOrBackoff(): void
{
[$factory, $cache] = self::getFactory();
$client = $factory->make(['token' => 'your-token', 'method' => 'token', 'cache' => false, 'backoff' => false]);
self::assertInstanceOf(Client::class, $client);
self::assertInstanceOf(HttpMethodsClientInterface::class, $client->getHttpClient());
}
public function testMakeStandardExplicitBackoff(): void
{
[$factory, $cache] = self::getFactory();
$client = $factory->make(['token' => 'your-token', 'method' => 'token', 'backoff' => true]);
self::assertInstanceOf(Client::class, $client);
self::assertInstanceOf(HttpMethodsClientInterface::class, $client->getHttpClient());
}
public function testMakeStandardExplicitUrl(): void
{
[$factory, $cache] = self::getFactory();
$client = $factory->make(['token' => 'your-token', 'method' => 'token', 'url' => 'https://api.example.com']);
self::assertInstanceOf(Client::class, $client);
self::assertInstanceOf(HttpMethodsClientInterface::class, $client->getHttpClient());
}
public function testMakeNoneMethod(): void
{
[$factory, $cache] = self::getFactory();
$client = $factory->make(['method' => 'none']);
self::assertInstanceOf(Client::class, $client);
self::assertInstanceOf(HttpMethodsClientInterface::class, $client->getHttpClient());
}
public function testMakeInvalidMethod(): void
{
[$factory, $cache] = self::getFactory();
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Unsupported authentication method [bar].');
$factory->make(['method' => 'bar']);
}
public function testMakeEmpty(): void
{
[$factory, $cache] = self::getFactory();
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('The gitlab factory requires an auth method.');
$factory->make([]);
}
/**
* @return array{0: GitLabFactory, 1: ConnectionFactory}
*/
private static function getFactory(): array
{
$psrFactory = new GuzzlePsrFactory();
$builder = new BuilderFactory(
new GuzzleClient(['connect_timeout' => 10, 'timeout' => 30]),
$psrFactory,
$psrFactory,
$psrFactory,
);
$cache = Mockery::mock(ConnectionFactory::class);
return [new GitLabFactory($builder, new AuthenticatorFactory(), $cache), $cache];
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/tests/AnalysisTest.php | tests/AnalysisTest.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\Tests\GitLab;
use GrahamCampbell\Analyzer\AnalysisTrait;
use Laravel\Lumen\Application;
use PHPUnit\Framework\TestCase;
/**
* This is the analysis test class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class AnalysisTest extends TestCase
{
use AnalysisTrait;
/**
* Get the code paths to analyze.
*
* @return string[]
*/
protected static function getPaths(): array
{
return [
realpath(__DIR__.'/../config'),
realpath(__DIR__.'/../src'),
realpath(__DIR__),
];
}
/**
* Get the classes to ignore not existing.
*
* @return string[]
*/
protected static function getIgnored(): array
{
return [Application::class];
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/tests/ServiceProviderTest.php | tests/ServiceProviderTest.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitHub.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\Tests\GitLab;
use Gitlab\Client;
use GrahamCampbell\GitLab\Auth\AuthenticatorFactory;
use GrahamCampbell\GitLab\Cache\ConnectionFactory;
use GrahamCampbell\GitLab\GitLabFactory;
use GrahamCampbell\GitLab\GitLabManager;
use GrahamCampbell\GitLab\HttpClient\BuilderFactory;
use GrahamCampbell\TestBenchCore\ServiceProviderTrait;
/**
* This is the service provider test class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class ServiceProviderTest extends AbstractTestCase
{
use ServiceProviderTrait;
public function testHttpClientFactoryIsInjectable(): void
{
$this->assertIsInjectable(BuilderFactory::class);
}
public function testAuthFactoryIsInjectable(): void
{
$this->assertIsInjectable(AuthenticatorFactory::class);
}
public function testCacheFactoryIsInjectable(): void
{
$this->assertIsInjectable(ConnectionFactory::class);
}
public function testGitLabFactoryIsInjectable(): void
{
$this->assertIsInjectable(GitLabFactory::class);
}
public function testGitLabManagerIsInjectable(): void
{
$this->assertIsInjectable(GitLabManager::class);
}
public function testBindings(): void
{
$this->assertIsInjectable(Client::class);
$original = $this->app['gitlab.connection'];
$this->app['gitlab']->reconnect();
$new = $this->app['gitlab.connection'];
self::assertNotSame($original, $new);
self::assertEquals($original, $new);
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/tests/GitLabManagerTest.php | tests/GitLabManagerTest.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\Tests\GitLab;
use Gitlab\Client;
use GrahamCampbell\GitLab\GitLabFactory;
use GrahamCampbell\GitLab\GitLabManager;
use GrahamCampbell\TestBench\AbstractTestCase as AbstractTestBenchTestCase;
use Illuminate\Contracts\Config\Repository;
use Mockery;
/**
* This is the gitlab manager test class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class GitLabManagerTest extends AbstractTestBenchTestCase
{
public function testCreateConnection(): void
{
$config = ['token' => 'your-token'];
$manager = self::getManager($config);
$manager->getConfig()->shouldReceive('get')->once()
->with('gitlab.default')->andReturn('main');
self::assertSame([], $manager->getConnections());
$return = $manager->connection();
self::assertInstanceOf(Client::class, $return);
self::assertArrayHasKey('main', $manager->getConnections());
}
public function testConnectionCache(): void
{
$config = ['token' => 'your-token', 'cache' => 'redis'];
$cache = ['driver' => 'illuminate', 'connection' => 'redis', 'min' => 123, 'max' => 1234];
$manager = self::getManagerWithCache($config, $cache);
self::assertSame([], $manager->getConnections());
$return = $manager->connection('oauth');
self::assertInstanceOf(Client::class, $return);
self::assertArrayHasKey('oauth', $manager->getConnections());
}
private static function getManager(array $config): GitLabManager
{
$repo = Mockery::mock(Repository::class);
$factory = Mockery::mock(GitLabFactory::class);
$manager = new GitLabManager($repo, $factory);
$manager->getConfig()->shouldReceive('get')->once()
->with('gitlab.connections')->andReturn(['main' => $config]);
$config['name'] = 'main';
$manager->getFactory()->shouldReceive('make')->once()
->with($config)->andReturn(Mockery::mock(Client::class));
return $manager;
}
private static function getManagerWithCache(array $config, array $cache): GitLabManager
{
$repo = Mockery::mock(Repository::class);
$factory = Mockery::mock(GitLabFactory::class);
$manager = new GitLabManager($repo, $factory);
$repo->shouldReceive('get')->once()
->with('gitlab.connections')->andReturn(['oauth' => $config]);
$repo->shouldReceive('get')->once()
->with('gitlab.cache')->andReturn(['redis' => $cache]);
$cache['name'] = 'redis';
$config['name'] = 'oauth';
$config['cache'] = $cache;
$factory->shouldReceive('make')->once()
->with($config)->andReturn(Mockery::mock(Client::class));
return $manager;
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/tests/Auth/AuthenticatorFactoryTest.php | tests/Auth/AuthenticatorFactoryTest.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\Tests\GitLab\Auth;
use GrahamCampbell\GitLab\Auth\Authenticator\JobTokenAuthenticator;
use GrahamCampbell\GitLab\Auth\Authenticator\OauthAuthenticator;
use GrahamCampbell\GitLab\Auth\Authenticator\TokenAuthenticator;
use GrahamCampbell\GitLab\Auth\AuthenticatorFactory;
use GrahamCampbell\Tests\GitLab\AbstractTestCase;
use InvalidArgumentException;
use TypeError;
/**
* This is the authenticator factory test class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class AuthenticatorFactoryTest extends AbstractTestCase
{
public function testMakeJobTokenAuthenticator(): void
{
$factory = new AuthenticatorFactory();
self::assertInstanceOf(JobTokenAuthenticator::class, $factory->make('job_token'));
}
public function testMakeOauthAuthenticator(): void
{
$factory = new AuthenticatorFactory();
self::assertInstanceOf(OauthAuthenticator::class, $factory->make('oauth'));
}
public function testMakeTokenAuthenticator(): void
{
$factory = new AuthenticatorFactory();
self::assertInstanceOf(TokenAuthenticator::class, $factory->make('token'));
}
public function testMakeInvalidAuthenticator(): void
{
$factory = new AuthenticatorFactory();
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Unsupported authentication method [foo].');
$factory->make('foo');
}
public function testMakeNoAuthenticator(): void
{
$factory = new AuthenticatorFactory();
$this->expectException(TypeError::class);
$factory->make(null);
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/tests/Auth/Authenticator/OauthAuthenticatorTest.php | tests/Auth/Authenticator/OauthAuthenticatorTest.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\Tests\GitLab\Auth\Authenticators;
use Gitlab\Client;
use GrahamCampbell\GitLab\Auth\Authenticator\OauthAuthenticator;
use GrahamCampbell\Tests\GitLab\AbstractTestCase;
use InvalidArgumentException;
use Mockery;
/**
* This is the oauth authenticator test class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class OauthAuthenticatorTest extends AbstractTestCase
{
public function testMakeWithMethod(): void
{
$authenticator = new OauthAuthenticator();
$client = Mockery::mock(Client::class);
$client->shouldReceive('authenticate')->once()
->with('your-token', 'oauth_token', null);
$return = $authenticator->with($client)->authenticate([
'token' => 'your-token',
'method' => 'token',
]);
self::assertInstanceOf(Client::class, $return);
}
public function testMakeWithoutMethod(): void
{
$authenticator = new OauthAuthenticator();
$client = Mockery::mock(Client::class);
$client->shouldReceive('authenticate')->once()
->with('your-token', 'oauth_token', null);
$return = $authenticator->with($client)->authenticate([
'token' => 'your-token',
]);
self::assertInstanceOf(Client::class, $return);
}
public function testMakeWithSudo(): void
{
$authenticator = new OauthAuthenticator();
$client = Mockery::mock(Client::class);
$client->shouldReceive('authenticate')->once()
->with('your-token', 'oauth_token', 'foo');
$return = $authenticator->with($client)->authenticate([
'token' => 'your-token',
'method' => 'token',
'sudo' => 'foo',
]);
self::assertInstanceOf(Client::class, $return);
}
public function testMakeWithoutToken(): void
{
$authenticator = new OauthAuthenticator();
$client = Mockery::mock(Client::class);
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('The oauth authenticator requires a token.');
$authenticator->with($client)->authenticate([]);
}
public function testMakeWithoutSettingClient(): void
{
$authenticator = new OauthAuthenticator();
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('The client instance was not given to the authenticator.');
$authenticator->authenticate([
'token' => 'your-token',
'method' => 'token',
]);
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/tests/Auth/Authenticator/JobTokenAuthenticatorTest.php | tests/Auth/Authenticator/JobTokenAuthenticatorTest.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\Tests\GitLab\Auth\Authenticators;
use Gitlab\Client;
use GrahamCampbell\GitLab\Auth\Authenticator\JobTokenAuthenticator;
use GrahamCampbell\Tests\GitLab\AbstractTestCase;
use InvalidArgumentException;
use Mockery;
/**
* This is the job token authenticator test class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class JobTokenAuthenticatorTest extends AbstractTestCase
{
public function testMakeWithMethod(): void
{
$authenticator = new JobTokenAuthenticator();
$client = Mockery::mock(Client::class);
$client->shouldReceive('authenticate')->once()
->with('your-token', 'http_job_token', null);
$return = $authenticator->with($client)->authenticate([
'token' => 'your-token',
'method' => 'token',
]);
self::assertInstanceOf(Client::class, $return);
}
public function testMakeWithoutMethod(): void
{
$authenticator = new JobTokenAuthenticator();
$client = Mockery::mock(Client::class);
$client->shouldReceive('authenticate')->once()
->with('your-token', 'http_job_token', null);
$return = $authenticator->with($client)->authenticate([
'token' => 'your-token',
]);
self::assertInstanceOf(Client::class, $return);
}
public function testMakeWithSudo(): void
{
$authenticator = new JobTokenAuthenticator();
$client = Mockery::mock(Client::class);
$client->shouldReceive('authenticate')->once()
->with('your-token', 'http_job_token', 'foo');
$return = $authenticator->with($client)->authenticate([
'token' => 'your-token',
'method' => 'token',
'sudo' => 'foo',
]);
self::assertInstanceOf(Client::class, $return);
}
public function testMakeWithoutToken(): void
{
$authenticator = new JobTokenAuthenticator();
$client = Mockery::mock(Client::class);
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('The job token authenticator requires a token.');
$authenticator->with($client)->authenticate([]);
}
public function testMakeWithoutSettingClient(): void
{
$authenticator = new JobTokenAuthenticator();
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('The client instance was not given to the authenticator.');
$authenticator->authenticate([
'token' => 'your-token',
'method' => 'token',
]);
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/tests/Auth/Authenticator/TokenAuthenticatorTest.php | tests/Auth/Authenticator/TokenAuthenticatorTest.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\Tests\GitLab\Auth\Authenticators;
use Gitlab\Client;
use GrahamCampbell\GitLab\Auth\Authenticator\TokenAuthenticator;
use GrahamCampbell\Tests\GitLab\AbstractTestCase;
use InvalidArgumentException;
use Mockery;
/**
* This is the token authenticator test class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class TokenAuthenticatorTest extends AbstractTestCase
{
public function testMakeWithMethod(): void
{
$authenticator = new TokenAuthenticator();
$client = Mockery::mock(Client::class);
$client->shouldReceive('authenticate')->once()
->with('your-token', 'http_token', null);
$return = $authenticator->with($client)->authenticate([
'token' => 'your-token',
'method' => 'token',
]);
self::assertInstanceOf(Client::class, $return);
}
public function testMakeWithoutMethod(): void
{
$authenticator = new TokenAuthenticator();
$client = Mockery::mock(Client::class);
$client->shouldReceive('authenticate')->once()
->with('your-token', 'http_token', null);
$return = $authenticator->with($client)->authenticate([
'token' => 'your-token',
]);
self::assertInstanceOf(Client::class, $return);
}
public function testMakeWithSudo(): void
{
$authenticator = new TokenAuthenticator();
$client = Mockery::mock(Client::class);
$client->shouldReceive('authenticate')->once()
->with('your-token', 'http_token', 'foo');
$return = $authenticator->with($client)->authenticate([
'token' => 'your-token',
'method' => 'token',
'sudo' => 'foo',
]);
self::assertInstanceOf(Client::class, $return);
}
public function testMakeWithoutToken(): void
{
$authenticator = new TokenAuthenticator();
$client = Mockery::mock(Client::class);
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('The token authenticator requires a token.');
$authenticator->with($client)->authenticate([]);
}
public function testMakeWithoutSettingClient(): void
{
$authenticator = new TokenAuthenticator();
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('The client instance was not given to the authenticator.');
$authenticator->authenticate([
'token' => 'your-token',
'method' => 'token',
]);
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/tests/Cache/ConnectionFactoryTest.php | tests/Cache/ConnectionFactoryTest.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\Tests\GitLab\Cache;
use GrahamCampbell\BoundedCache\BoundedCacheInterface;
use GrahamCampbell\GitLab\Cache\ConnectionFactory;
use GrahamCampbell\GitLab\Cache\Connector\IlluminateConnector;
use GrahamCampbell\TestBench\AbstractTestCase;
use Illuminate\Cache\Repository;
use Illuminate\Contracts\Cache\Factory;
use InvalidArgumentException;
use Mockery;
/**
* This is the cache connection factory test class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class ConnectionFactoryTest extends AbstractTestCase
{
public function testMake(): void
{
$cache = Mockery::mock(Factory::class);
$cache->shouldReceive('store')->once()->with('redis')->andReturn(Mockery::mock(Repository::class));
$factory = new ConnectionFactory($cache);
$return = $factory->make(['name' => 'foo', 'driver' => 'illuminate', 'connector' => 'redis']);
self::assertInstanceOf(BoundedCacheInterface::class, $return);
}
public function testCreateIlluminateConnector(): void
{
$factory = new ConnectionFactory(Mockery::mock(Factory::class));
$return = $factory->createConnector(['name' => 'foo', 'driver' => 'illuminate', 'connector' => 'redis']);
self::assertInstanceOf(IlluminateConnector::class, $return);
}
public function testCreateEmptyDriverConnector(): void
{
$factory = new ConnectionFactory(Mockery::mock(Factory::class));
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('A driver must be specified.');
$factory->createConnector([]);
}
public function testCreateUnsupportedDriverConnector(): void
{
$factory = new ConnectionFactory(Mockery::mock(Factory::class));
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Unsupported driver [unsupported].');
$factory->createConnector(['driver' => 'unsupported']);
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/tests/Cache/Connector/IlluminateConnectorTest.php | tests/Cache/Connector/IlluminateConnectorTest.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\Tests\GitLab\Cache\Connector;
use GrahamCampbell\BoundedCache\BoundedCacheInterface;
use GrahamCampbell\GitLab\Cache\Connector\IlluminateConnector;
use GrahamCampbell\TestBench\AbstractTestCase;
use Illuminate\Cache\Repository;
use Illuminate\Contracts\Cache\Factory;
use InvalidArgumentException;
use Mockery;
/**
* This is the illuminate connector test class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class IlluminateConnectorTest extends AbstractTestCase
{
public function testConnectStandard(): void
{
$cache = Mockery::mock(Factory::class);
$connector = new IlluminateConnector($cache);
$cache->shouldReceive('store')->once()->andReturn(Mockery::mock(Repository::class));
self::assertInstanceOf(BoundedCacheInterface::class, $connector->connect([]));
}
public function testConnectFull(): void
{
$cache = Mockery::mock(Factory::class);
$connector = new IlluminateConnector($cache);
$cache->shouldReceive('store')->once()->with('redis')->andReturn(Mockery::mock(Repository::class));
$return = $connector->connect([
'driver' => 'illuminate',
'connector' => 'redis',
'key' => 'bar',
'ttl' => 600,
]);
self::assertInstanceOf(BoundedCacheInterface::class, $return);
}
public function testConnectNoCacheFactory(): void
{
$connector = new IlluminateConnector();
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Illuminate caching support not available.');
$connector->connect([]);
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/tests/Facades/GitLabTest.php | tests/Facades/GitLabTest.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace GrahamCampbell\Tests\GitLab\Facades;
use GrahamCampbell\GitLab\Facades\GitLab;
use GrahamCampbell\GitLab\GitLabManager;
use GrahamCampbell\TestBenchCore\FacadeTrait;
use GrahamCampbell\Tests\GitLab\AbstractTestCase;
/**
* This is the gitlab facade test class.
*
* @author Graham Campbell <hello@gjcampbell.co.uk>
*/
class GitLabTest extends AbstractTestCase
{
use FacadeTrait;
/**
* Get the facade accessor.
*
* @return string
*/
protected static function getFacadeAccessor(): string
{
return 'gitlab';
}
/**
* Get the facade class.
*
* @return string
*/
protected static function getFacadeClass(): string
{
return GitLab::class;
}
/**
* Get the facade root.
*
* @return string
*/
protected static function getFacadeRoot(): string
{
return GitLabManager::class;
}
}
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
GrahamCampbell/Laravel-GitLab | https://github.com/GrahamCampbell/Laravel-GitLab/blob/7013225263f76fcb77cac2a76e64be36d6a88786/config/gitlab.php | config/gitlab.php | <?php
declare(strict_types=1);
/*
* This file is part of Laravel GitLab.
*
* (c) Graham Campbell <hello@gjcampbell.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
/*
|--------------------------------------------------------------------------
| Default Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the connections below you wish to use as
| your default connection for all work. Of course, you may use many
| connections at once using the manager class.
|
*/
'default' => 'main',
/*
|--------------------------------------------------------------------------
| GitLab Connections
|--------------------------------------------------------------------------
|
| Here are each of the connections setup for your application. Example
| configuration has been included, but you may add as many connections as
| you would like. Note that the 4 supported authentication methods are:
| "none", "oauth", "job_token", and "token".
|
*/
'connections' => [
'main' => [
'token' => 'your-token',
'method' => 'token',
// 'backoff' => false,
// 'cache' => false,
// 'sudo' => null,
// 'url' => null,
],
'alternative' => [
'token' => 'your-token',
'method' => 'oauth',
// 'backoff' => false,
// 'cache' => false,
// 'sudo' => null,
// 'url' => null,
],
],
/*
|--------------------------------------------------------------------------
| HTTP Cache
|--------------------------------------------------------------------------
|
| Here are each of the cache configurations setup for your application.
| Only the "illuminate" driver is provided out of the box. Example
| configuration has been included.
|
*/
'cache' => [
'main' => [
'driver' => 'illuminate',
'connector' => null, // null means use default driver
// 'min' => 43200,
// 'max' => 172800
],
'bar' => [
'driver' => 'illuminate',
'connector' => 'redis', // config/cache.php
// 'min' => 43200,
// 'max' => 172800
],
],
];
| php | MIT | 7013225263f76fcb77cac2a76e64be36d6a88786 | 2026-01-05T04:43:35.763587Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Signature.php | lib/Signature.php | <?php
namespace ClouSale\AmazonSellingPartnerAPI;
class Signature
{
/**
* ## Signature Version 4 signing process.
*
* Signature Version 4 is the process to add authentication information to AWS requests sent by HTTP.
* For security, most requests to AWS must be signed with an access key,
* which consists of an access key ID and secret access key.
* These two keys are commonly referred to as your security credentials.
* For details on how to obtain credentials for your account
*
* REF : https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
*
* PS : Guzzle Request instance doesn't allow us to update headers after instantiation
* So, we need to sign the header separately and return Authentication header back as a result.
*
* Special thanks go to github user crazyfactory / z3niths who made a better implementation of the signature method
*
* @param $host
* @param $method
* @param string $uri
* @param string $queryString
* @param array $data
*
* @throws \Exception
*
* @author crazyfactory https://github.com/crazyfactory
*/
public static function calculateSignature(
Configuration $config,
string $host,
string $method,
$uri = '',
$queryString = '',
$data = []
): array {
return self::calculateSignatureForService(
$host,
$method,
$uri,
$queryString,
$data,
'execute-api',
$config->getAccessKey(),
$config->getSecretKey(),
$config->getRegion(),
$config->getAccessToken(),
$config->getSecurityToken(),
$config->getUserAgent()
);
}
public static function calculateSignatureForService(
string $host,
string $method,
$uri,
$queryString,
$data,
string $service,
string $accessKey,
string $secretKey,
string $region,
$accessToken,
$securityToken,
$userAgent
): array {
$terminationString = 'aws4_request';
$algorithm = 'AWS4-HMAC-SHA256';
$amzdate = gmdate('Ymd\THis\Z');
$date = substr($amzdate, 0, 8);
// Prepare payload
if (is_array($data)) {
$param = json_encode($data);
if ('[]' == $param) {
$requestPayload = '';
} else {
$requestPayload = $param;
}
} else {
$requestPayload = $data;
}
// Hashed payload
$hashedPayload = hash('sha256', $requestPayload);
//Compute Canonical Headers
$canonicalHeaders = [
'host' => $host,
'user-agent' => $userAgent,
];
// Check and attach access token to request header.
if (!is_null($accessToken)) {
$canonicalHeaders['x-amz-access-token'] = $accessToken;
}
$canonicalHeaders['x-amz-date'] = $amzdate;
// Check and attach STS token to request header.
if (!is_null($securityToken)) {
$canonicalHeaders['x-amz-security-token'] = $securityToken;
}
$canonicalHeadersStr = '';
foreach ($canonicalHeaders as $h => $v) {
$canonicalHeadersStr .= $h.':'.$v."\n";
}
$signedHeadersStr = join(';', array_keys($canonicalHeaders));
//Prepare credentials scope
$credentialScope = $date.'/'.$region.'/'.$service.'/'.$terminationString;
//prepare canonical request
$canonicalRequest = $method."\n".$uri."\n".$queryString."\n".$canonicalHeadersStr."\n".$signedHeadersStr."\n".$hashedPayload;
//Prepare the string to sign
$stringToSign = $algorithm."\n".$amzdate."\n".$credentialScope."\n".hash('sha256', $canonicalRequest);
//Start signing locker process
//Reference : https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
$kSecret = 'AWS4'.$secretKey;
$kDate = hash_hmac('sha256', $date, $kSecret, true);
$kRegion = hash_hmac('sha256', $region, $kDate, true);
$kService = hash_hmac('sha256', $service, $kRegion, true);
$kSigning = hash_hmac('sha256', $terminationString, $kService, true);
//Compute the signature
$signature = trim(hash_hmac('sha256', $stringToSign, $kSigning));
//Finalize the authorization structure
$authorizationHeader = $algorithm." Credential={$accessKey}/{$credentialScope}, SignedHeaders={$signedHeadersStr}, Signature={$signature}";
return array_merge($canonicalHeaders, [
'Authorization' => $authorizationHeader,
]);
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/ExceptionThrower.php | lib/ExceptionThrower.php | <?php
namespace ClouSale\AmazonSellingPartnerAPI;
class ExceptionThrower
{
public static function throwIf($exceptionType, $condition, $message)
{
if ($condition) {
throw new $exceptionType($message);
}
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/SellingPartnerEndpoint.php | lib/SellingPartnerEndpoint.php | <?php
namespace ClouSale\AmazonSellingPartnerAPI;
class SellingPartnerEndpoint
{
public static $EUROPE = 'https://sellingpartnerapi-eu.amazon.com';
public static $FAR_EAST = 'https://sellingpartnerapi-fe.amazon.com';
public static $NORTH_AMERICA = 'https://sellingpartnerapi-na.amazon.com';
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/AssumeRole.php | lib/AssumeRole.php | <?php
namespace ClouSale\AmazonSellingPartnerAPI;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Query;
class AssumeRole
{
/** @var string */
private $accessKeyId;
/** @var string */
private $secretAccessKey;
/** @var string */
private $sessionToken;
/**
* AssumeRole constructor.
*/
public function __construct(string $accessKeyId, string $secretAccessKey, string $sessionToken)
{
$this->accessKeyId = $accessKeyId;
$this->secretAccessKey = $secretAccessKey;
$this->sessionToken = $sessionToken;
}
public function getAccessKeyId(): string
{
return $this->accessKeyId;
}
public function getSecretAccessKey(): string
{
return $this->secretAccessKey;
}
public function getSessionToken(): string
{
return $this->sessionToken;
}
/**
* @throws \GuzzleHttp\Exception\GuzzleException
*
* @author crazyfactory https://github.com/crazyfactory
*
* Special thanks go to github user crazyfactory / z3niths who made a better implementation of the signature method
*
* Thanks to
*/
public static function assume(string $region, string $accessKey, string $secretKey, string $roleArn, int $durationSeconds = 3600): AssumeRole
{
$requestOptions = [
'headers' => [
'accept' => 'application/json',
],
'form_params' => [
'Action' => 'AssumeRole',
'DurationSeconds' => $durationSeconds,
'RoleArn' => $roleArn,
'RoleSessionName' => 'amazon-sp-api-php',
'Version' => '2011-06-15',
],
];
$host = 'sts.amazonaws.com';
$uri = '/';
$signedHeader = [];
// [
// 'service' => 'sts',
// 'accessKey' => $this->config->getApiKey('access_key'),
// 'secretKey' => $this->config->getApiKey('secret_key'),
// 'region' => 'us-east-1', // Global STS region
// 'host' => $host,
// 'uri' => $uri,
// 'payload' => \GuzzleHttp\Psr7\build_query($requestOptions['form_params']),
// 'method' => 'POST',
// ]
try {
$signedHeader = Signature::calculateSignatureForService(
$host,
'POST',
$uri,
'',
Query::build($requestOptions['form_params']),
'sts',
$accessKey,
$secretKey,
'us-east-1',
null,
null,
'cs-php-sp-api-client/2.1'
);
} catch (\Exception $e) {
echo "Error (Signing process) : {$e->getMessage()}";
throw $e;
}
$client = new Client([
'base_uri' => 'https://'.$host,
]);
$requestOptions['headers'] = array_merge($requestOptions['headers'], $signedHeader);
try {
$response = $client->post($uri, $requestOptions);
$json = json_decode($response->getBody(), true);
$credentials = $json['AssumeRoleResponse']['AssumeRoleResult']['Credentials'] ?? null;
// $tokens = [
// 'access_key' => $credentials['AccessKeyId'],
// 'secret_key' => $credentials['SecretAccessKey'],
// 'session_token' => $credentials['SessionToken']
// ];
return new AssumeRole(
$credentials['AccessKeyId'],
$credentials['SecretAccessKey'],
$credentials['SessionToken']
);
// return $tokens;
} catch (\Exception $e) {
echo "Error (Signing process) : {$e->getMessage()}";
throw $e;
}
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/ApiException.php | lib/ApiException.php | <?php
/**
* ApiException.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Solicitations.
*
* With the Solicitations API you can build applications that send non-critical solicitations to buyers. You can get a list of solicitation types that are available for an order that you specify, then call an operation that sends a solicitation to the buyer for that order. Buyers cannot respond to solicitations sent by this API, and these solicitations do not appear in the Messaging section of Seller Central or in the recipient's Message Center. The Solicitations API returns responses that are formed according to the <a href=https://tools.ietf.org/html/draft-kelly-json-hal-08>JSON Hypertext Application Language</a> (HAL) standard.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI;
use Exception;
/**
* ApiException Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class ApiException extends Exception
{
/**
* The HTTP body of the server response either as Json or string.
*
* @var mixed
*/
protected $responseBody;
/**
* The HTTP header of the server response.
*
* @var string[]|null
*/
protected $responseHeaders;
/**
* The deserialized response object.
*
* @var;
*/
protected $responseObject;
/**
* Constructor.
*
* @param string $message Error message
* @param int $code HTTP status code
* @param string[]|null $responseHeaders HTTP response header
* @param mixed $responseBody HTTP decoded body of the server response either as \stdClass or string
*/
public function __construct($message = '', $code = 0, $responseHeaders = [], $responseBody = null)
{
parent::__construct($message, $code);
$this->responseHeaders = $responseHeaders;
$this->responseBody = $responseBody;
}
/**
* Gets the HTTP response header.
*
* @return string[]|null HTTP response header
*/
public function getResponseHeaders()
{
return $this->responseHeaders;
}
/**
* Gets the HTTP body of the server response either as Json or string.
*
* @return mixed HTTP body of the server response either as \stdClass or string
*/
public function getResponseBody()
{
return $this->responseBody;
}
/**
* Sets the deseralized response object (during deserialization).
*
* @param mixed $obj Deserialized response object
*
* @return void
*/
public function setResponseObject($obj)
{
$this->responseObject = $obj;
}
/**
* Gets the deseralized response object (during deserialization).
*
* @return mixed the deserialized response object
*/
public function getResponseObject()
{
return $this->responseObject;
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/ObjectSerializer.php | lib/ObjectSerializer.php | <?php
/**
* ObjectSerializer.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Solicitations.
*
* With the Solicitations API you can build applications that send non-critical solicitations to buyers. You can get a list of solicitation types that are available for an order that you specify, then call an operation that sends a solicitation to the buyer for that order. Buyers cannot respond to solicitations sent by this API, and these solicitations do not appear in the Messaging section of Seller Central or in the recipient's Message Center. The Solicitations API returns responses that are formed according to the <a href=https://tools.ietf.org/html/draft-kelly-json-hal-08>JSON Hypertext Application Language</a> (HAL) standard.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI;
/**
* ObjectSerializer Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class ObjectSerializer
{
/**
* Serialize data.
*
* @param mixed $data the data to serialize
* @param string $type the SwaggerType of the data
* @param string $format the format of the Swagger type of the data
*
* @return string|object serialized form of $data
*/
public static function sanitizeForSerialization($data, $type = null, $format = null)
{
if (is_scalar($data) || null === $data) {
return $data;
} elseif ($data instanceof \DateTime) {
return ('date' === $format) ? $data->format('Y-m-d') : $data->format(\DateTime::ATOM);
} elseif (is_array($data)) {
foreach ($data as $property => $value) {
$data[$property] = self::sanitizeForSerialization($value);
}
return $data;
} elseif (is_object($data)) {
$values = [];
$formats = $data::swaggerFormats();
foreach ($data::swaggerTypes() as $property => $swaggerType) {
$getter = $data::getters()[$property];
$value = $data->$getter();
if (null !== $value
&& !in_array($swaggerType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)
&& method_exists($swaggerType, 'getAllowableEnumValues')
&& !in_array($value, $swaggerType::getAllowableEnumValues())) {
$imploded = implode("', '", $swaggerType::getAllowableEnumValues());
throw new \InvalidArgumentException("Invalid value for enum '$swaggerType', must be one of: '$imploded'");
}
if (null !== $value) {
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $swaggerType, $formats[$property]);
}
}
return (object) $values;
} else {
return (string) $data;
}
}
/**
* Sanitize filename by removing path.
* e.g. ../../sun.gif becomes sun.gif.
*
* @param string $filename filename to be sanitized
*
* @return string the sanitized filename
*/
public static function sanitizeFilename($filename)
{
if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) {
return $match[1];
} else {
return $filename;
}
}
/**
* Take value and turn it into a string suitable for inclusion in
* the path, by url-encoding.
*
* @param string $value a string which will be part of the path
*
* @return string the serialized object
*/
public static function toPathValue($value)
{
return rawurlencode(self::toString($value));
}
/**
* Take value and turn it into a string suitable for inclusion in
* the query, by imploding comma-separated if it's an object.
* If it's a string, pass through unchanged. It will be url-encoded
* later.
*
* @param string[]|string|\DateTime $object an object to be serialized to a string
*
* @return string the serialized object
*/
public static function toQueryValue($object)
{
if (is_array($object)) {
return implode(',', $object);
} else {
return self::toString($object);
}
}
/**
* Take value and turn it into a string suitable for inclusion in
* the header. If it's a string, pass through unchanged
* If it's a datetime object, format it in ISO8601.
*
* @param string $value a string which will be part of the header
*
* @return string the header string
*/
public static function toHeaderValue($value)
{
return self::toString($value);
}
/**
* Take value and turn it into a string suitable for inclusion in
* the http body (form parameter). If it's a string, pass through unchanged
* If it's a datetime object, format it in ISO8601.
*
* @param string|\SplFileObject $value the value of the form parameter
*
* @return string the form string
*/
public static function toFormValue($value)
{
if ($value instanceof \SplFileObject) {
return $value->getRealPath();
} else {
return self::toString($value);
}
}
/**
* Take value and turn it into a string suitable for inclusion in
* the parameter. If it's a string, pass through unchanged
* If it's a datetime object, format it in ISO8601.
*
* @param string|\DateTime $value the value of the parameter
*
* @return string the header string
*/
public static function toString($value)
{
if ($value instanceof \DateTime) { // datetime in ISO8601 format
return $value->format(\DateTime::ATOM);
} else {
return $value;
}
}
/**
* Serialize an array to a string.
*
* @param array $collection collection to serialize to a string
* @param string $collectionFormat the format use for serialization (csv,
* ssv, tsv, pipes, multi)
* @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array
*
* @return string
*/
public static function serializeCollection(array $collection, $collectionFormat, $allowCollectionFormatMulti = false)
{
if ($allowCollectionFormatMulti && ('multi' === $collectionFormat)) {
// http_build_query() almost does the job for us. We just
// need to fix the result of multidimensional arrays.
return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&'));
}
switch ($collectionFormat) {
case 'pipes':
return implode('|', $collection);
case 'tsv':
return implode("\t", $collection);
case 'ssv':
return implode(' ', $collection);
case 'csv':
// Deliberate fall through. CSV is default format.
default:
return implode(',', $collection);
}
}
/**
* Deserialize a JSON string into an object.
*
* @param mixed $data object or primitive to be deserialized
* @param string $class class name is passed as a string
* @param string[] $httpHeaders HTTP headers
* @param string $discriminator discriminator if polymorphism is used
*
* @return object|array|null an single or an array of $class instances
*/
public static function deserialize($data, $class, $httpHeaders = null)
{
if (null === $data) {
return null;
} elseif ('map[' === substr($class, 0, 4)) { // for associative array e.g. map[string,int]
$inner = substr($class, 4, -1);
$deserialized = [];
if (false !== strrpos($inner, ',')) {
$subClass_array = explode(',', $inner, 2);
$subClass = $subClass_array[1];
foreach ($data as $key => $value) {
$deserialized[$key] = self::deserialize($value, $subClass, null);
}
}
return $deserialized;
} elseif (0 === strcasecmp(substr($class, -2), '[]')) {
$subClass = substr($class, 0, -2);
$values = [];
foreach ($data as $key => $value) {
$values[] = self::deserialize($value, $subClass, null);
}
return $values;
} elseif (method_exists($class, 'getSubClass')) {
$subClass = (new $class())->getSubClass();
$values = [];
foreach ($data as $key => $value) {
$values[] = self::deserialize($value, $subClass, null);
}
return $values;
} elseif ('object' === $class) {
settype($data, 'array');
return $data;
} elseif ('\DateTime' === $class) {
// Some API's return an invalid, empty string as a
// date-time property. DateTime::__construct() will return
// the current time for empty input which is probably not
// what is meant. The invalid empty string is probably to
// be interpreted as a missing field/value. Let's handle
// this graceful.
if (!empty($data)) {
return new \DateTime($data);
} else {
return null;
}
} elseif (in_array($class, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) {
settype($data, $class);
return $data;
} elseif ('\SplFileObject' === $class) {
/* @var \Psr\Http\Message\StreamInterface $data */
// determine file name
if (array_key_exists('Content-Disposition', $httpHeaders) &&
preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) {
$filename = Configuration::getDefaultConfiguration()->getTempFolderPath().DIRECTORY_SEPARATOR.self::sanitizeFilename($match[1]);
} else {
$filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), '');
}
$file = fopen($filename, 'w');
while ($chunk = $data->read(200)) {
fwrite($file, $chunk);
}
fclose($file);
return new \SplFileObject($filename, 'r');
} elseif (method_exists($class, 'getAllowableEnumValues')) {
if (!in_array($data, $class::getAllowableEnumValues())) {
$imploded = implode("', '", $class::getAllowableEnumValues());
throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'");
}
return $data;
} else {
// If a discriminator is defined and points to a valid subclass, use it.
$discriminator = $class::DISCRIMINATOR;
if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) {
$subclass = '{{invokerPackage}}\Model\\'.$data->{$discriminator};
if (is_subclass_of($subclass, $class)) {
$class = $subclass;
}
}
$instance = new $class();
foreach ($instance::swaggerTypes() as $property => $type) {
$propertySetter = $instance::setters()[$property];
if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) {
continue;
}
$propertyValue = $data->{$instance::attributeMap()[$property]};
if (isset($propertyValue)) {
$instance->$propertySetter(self::deserialize($propertyValue, $type, null));
}
}
return $instance;
}
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/HeaderSelector.php | lib/HeaderSelector.php | <?php
/**
* ApiException.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Solicitations.
*
* With the Solicitations API you can build applications that send non-critical solicitations to buyers. You can get a list of solicitation types that are available for an order that you specify, then call an operation that sends a solicitation to the buyer for that order. Buyers cannot respond to solicitations sent by this API, and these solicitations do not appear in the Messaging section of Seller Central or in the recipient's Message Center. The Solicitations API returns responses that are formed according to the <a href=https://tools.ietf.org/html/draft-kelly-json-hal-08>JSON Hypertext Application Language</a> (HAL) standard.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI;
/**
* ApiException Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class HeaderSelector
{
/**
* @param string[] $accept
* @param string[] $contentTypes
*
* @return array
*/
public function selectHeaders($accept, $contentTypes)
{
$headers = [];
$accept = $this->selectAcceptHeader($accept);
if (null !== $accept) {
$headers['Accept'] = $accept;
}
$headers['Content-Type'] = $this->selectContentTypeHeader($contentTypes);
return $headers;
}
/**
* @param string[] $accept
*
* @return array
*/
public function selectHeadersForMultipart($accept)
{
$headers = $this->selectHeaders($accept, []);
unset($headers['Content-Type']);
return $headers;
}
/**
* Return the header 'Accept' based on an array of Accept provided.
*
* @param string[] $accept Array of header
*
* @return string Accept (e.g. application/json)
*/
private function selectAcceptHeader($accept)
{
if (0 === count($accept) || (1 === count($accept) && '' === $accept[0])) {
return null;
} elseif (preg_grep("/application\/json/i", $accept)) {
return 'application/json';
} else {
return implode(',', $accept);
}
}
/**
* Return the content type based on an array of content-type provided.
*
* @param string[] $contentType Array fo content-type
*
* @return string Content-Type (e.g. application/json)
*/
private function selectContentTypeHeader($contentType)
{
if (0 === count($contentType) || (1 === count($contentType) && '' === $contentType[0])) {
return 'application/json';
} elseif (preg_grep("/application\/json/i", $contentType)) {
return 'application/json';
} else {
return implode(',', $contentType);
}
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Configuration.php | lib/Configuration.php | <?php
/**
* Configuration.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Solicitations.
*
* With the Solicitations API you can build applications that send non-critical solicitations to buyers. You can get a list of solicitation types that are available for an order that you specify, then call an operation that sends a solicitation to the buyer for that order. Buyers cannot respond to solicitations sent by this API, and these solicitations do not appear in the Messaging section of Seller Central or in the recipient's Message Center. The Solicitations API returns responses that are formed according to the <a href=https://tools.ietf.org/html/draft-kelly-json-hal-08>JSON Hypertext Application Language</a> (HAL) standard.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI;
/**
* Configuration Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class Configuration
{
private static $defaultConfiguration;
/**
* Associate array to store API key(s).
*
* @var string[]
*
* @deprecated
*/
protected $apiKeys = [];
/**
* Associate array to store API prefix (e.g. Bearer).
*
* @var string[]
*
* @deprecated
*/
protected $apiKeyPrefixes = [];
/**
* Access token for OAuth.
*
* @var string
*/
protected $accessToken = '';
/**
* The host.
*
* @var string
*/
protected $host = 'https://sellingpartnerapi-na.amazon.com';
/**
* User agent of the HTTP request, set to "PHP-Swagger" by default.
*
* @var string
*/
protected $userAgent = 'cs-php-sp-api-client/2.1';
/**
* Debug switch (default set to false).
*
* @var bool
*/
protected $debug = false;
/**
* Debug file location (log to STDOUT by default).
*
* @var string
*/
protected $debugFile = 'php://output';
/**
* Debug file location (log to STDOUT by default).
*
* @var string
*/
protected $tempFolderPath;
/** @var string|null */
protected $securityToken;
/** @var string|null */
protected $accessKey;
/** @var string|null */
protected $secretKey;
/** @var string|null */
protected $region;
/**
* Constructor.
*/
public function __construct()
{
$this->tempFolderPath = sys_get_temp_dir();
}
/**
* Sets API key.
*
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
* @param string $key API key or token
*
* @return $this
*
* @deprecated use setSecurityToken(), setAccessKey(), setSecretKey() instead
*/
public function setApiKey(string $apiKeyIdentifier, string $key): self
{
$this->apiKeys[$apiKeyIdentifier] = $key;
if ('accessKey' == $apiKeyIdentifier) {
$this->setAccessKey($key);
}
if ('secretKey' == $apiKeyIdentifier) {
$this->setSecretKey($key);
}
if ('region' == $apiKeyIdentifier) {
$this->setRegion($key);
}
if ('sessionToken' == $apiKeyIdentifier || 'securityToken' == $apiKeyIdentifier) {
$this->setSecurityToken($key);
}
return $this;
}
/**
* Gets API key.
*
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
*
* @return string|null API key or token
*
* @deprecated
*/
public function getApiKey($apiKeyIdentifier): ?string
{
return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null;
}
/**
* Sets the prefix for API key (e.g. Bearer).
*
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
* @param string $prefix API key prefix, e.g. Bearer
*
* @return $this
*/
public function setApiKeyPrefix($apiKeyIdentifier, $prefix)
{
$this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix;
return $this;
}
/**
* Gets API key prefix.
*
* @param string $apiKeyIdentifier API key identifier (authentication scheme)
*
* @return string
*
* @deprecated
*/
public function getApiKeyPrefix($apiKeyIdentifier)
{
return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null;
}
/**
* Sets the access token for OAuth.
*
* @param string $accessToken Token for OAuth
*
* @return $this
*/
public function setAccessToken($accessToken)
{
$this->accessToken = $accessToken;
return $this;
}
/**
* Gets the access token for OAuth.
*
* @return string Access token for OAuth
*/
public function getAccessToken()
{
return $this->accessToken;
}
/**
* Sets the host.
*
* @param string $host Host
*
* @return $this
*/
public function setHost($host)
{
$this->host = $host;
return $this;
}
/**
* Gets the host.
*
* @return string Host
*/
public function getHost()
{
return $this->host;
}
/**
* Sets the user agent of the api client.
*
* @param string $userAgent the user agent of the api client
*
* @throws \InvalidArgumentException
*
* @return $this
*/
public function setUserAgent($userAgent)
{
if (!is_string($userAgent)) {
throw new \InvalidArgumentException('User-agent must be a string.');
}
$this->userAgent = $userAgent;
return $this;
}
/**
* Gets the user agent of the api client.
*
* @return string user agent
*/
public function getUserAgent()
{
return $this->userAgent;
}
/**
* Sets debug flag.
*
* @param bool $debug Debug flag
*
* @return $this
*/
public function setDebug($debug)
{
$this->debug = $debug;
return $this;
}
/**
* Gets the debug flag.
*
* @return bool
*/
public function getDebug()
{
return $this->debug;
}
/**
* Sets the debug file.
*
* @param string $debugFile Debug file
*
* @return $this
*/
public function setDebugFile($debugFile)
{
$this->debugFile = $debugFile;
return $this;
}
/**
* Gets the debug file.
*
* @return string
*/
public function getDebugFile()
{
return $this->debugFile;
}
/**
* Sets the temp folder path.
*
* @param string $tempFolderPath Temp folder path
*
* @return $this
*/
public function setTempFolderPath($tempFolderPath)
{
$this->tempFolderPath = $tempFolderPath;
return $this;
}
/**
* Gets the temp folder path.
*
* @return string Temp folder path
*/
public function getTempFolderPath()
{
return $this->tempFolderPath;
}
/**
* Gets the default configuration instance.
*
* @return Configuration
*/
public static function getDefaultConfiguration()
{
if (null === self::$defaultConfiguration) {
self::$defaultConfiguration = new Configuration();
}
return self::$defaultConfiguration;
}
/**
* Sets the detault configuration instance.
*
* @param Configuration $config An instance of the Configuration Object
*
* @return void
*/
public static function setDefaultConfiguration(Configuration $config)
{
self::$defaultConfiguration = $config;
}
/**
* Gets the essential information for debugging.
*
* @return string The report for debugging
*/
public static function toDebugReport()
{
$report = 'PHP SDK (ClouSale\AmazonSellingPartnerAPI) Debug Report:'.PHP_EOL;
$report .= ' OS: '.php_uname().PHP_EOL;
$report .= ' PHP Version: '.PHP_VERSION.PHP_EOL;
$report .= ' OpenAPI Spec Version: v1'.PHP_EOL;
$report .= ' Temp Folder Path: '.self::getDefaultConfiguration()->getTempFolderPath().PHP_EOL;
return $report;
}
/**
* Get API key (with prefix if set).
*
* @param string $apiKeyIdentifier name of apikey
*
* @return string API key with the prefix
*/
public function getApiKeyWithPrefix($apiKeyIdentifier)
{
$prefix = $this->getApiKeyPrefix($apiKeyIdentifier);
$apiKey = $this->getApiKey($apiKeyIdentifier);
if (null === $apiKey) {
return null;
}
if (null === $prefix) {
$keyWithPrefix = $apiKey;
} else {
$keyWithPrefix = $prefix.' '.$apiKey;
}
return $keyWithPrefix;
}
public function getSecurityToken(): ?string
{
return $this->securityToken;
}
public function setSecurityToken(?string $securityToken): void
{
$this->securityToken = $securityToken;
}
public function getAccessKey(): ?string
{
return $this->accessKey;
}
public function setAccessKey(?string $accessKey): void
{
$this->accessKey = $accessKey;
}
public function getSecretKey(): ?string
{
return $this->secretKey;
}
public function setSecretKey(?string $secretKey): void
{
$this->secretKey = $secretKey;
}
public function getRegion(): ?string
{
return $this->region;
}
public function setRegion(?string $region): void
{
$this->region = $region;
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/SellingPartnerRegion.php | lib/SellingPartnerRegion.php | <?php
namespace ClouSale\AmazonSellingPartnerAPI;
class SellingPartnerRegion
{
public static $EUROPE = 'eu-west-1';
public static $FAR_EAST = 'us-west-2';
public static $NORTH_AMERICA = 'us-east-1';
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/SellingPartnerOAuth.php | lib/SellingPartnerOAuth.php | <?php
namespace ClouSale\AmazonSellingPartnerAPI;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\RequestOptions;
class SellingPartnerOAuth
{
/**
* @param $refreshToken
* @param $clientId
* @param $clientSecret
*
* @throws GuzzleException
*/
public static function getAccessTokenFromRefreshToken($refreshToken, $clientId, $clientSecret): ?string
{
$client = new Client();
$params = [
'grant_type' => 'refresh_token',
'refresh_token' => $refreshToken,
'client_id' => $clientId,
'client_secret' => $clientSecret,
];
$options = array_merge([
RequestOptions::HEADERS => ['Accept' => 'application/json'],
RequestOptions::HTTP_ERRORS => false,
'curl' => [
CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2,
],
], $params ? [RequestOptions::FORM_PARAMS => $params] : []);
$response = $client->request('POST', 'https://api.amazon.com/auth/o2/token', $options);
$body = $response->getBody()->getContents();
$bodyAsJson = json_decode($body, true);
return $bodyAsJson['access_token'];
}
/**
* @throws GuzzleException
* @throws SellingPartnerOAuthException
*/
public static function getRefreshTokenFromLwaAuthorizationCode(
string $lwaAuthorizationCode,
string $clientId,
string $clientSecret,
string $redirectUri
): ?string {
$client = new Client();
$params = [
'grant_type' => 'authorization_code',
'client_id' => $clientId,
'client_secret' => $clientSecret,
'code' => $lwaAuthorizationCode,
'redirect_uri' => $redirectUri,
];
$options = array_merge([
RequestOptions::HEADERS => ['Accept' => 'application/json'],
RequestOptions::HTTP_ERRORS => false,
'curl' => [
CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2,
],
], $params ? [RequestOptions::FORM_PARAMS => $params] : []);
$response = $client->request('POST', 'https://api.amazon.com/auth/o2/token', $options);
$body = $response->getBody()->getContents();
$bodyAsJson = json_decode($body, true);
if (isset($bodyAsJson['error_description'])) {
throw new SellingPartnerOAuthException($bodyAsJson['error_description'], $bodyAsJson['error']);
}
return $bodyAsJson['refresh_token'];
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/SellingPartnerOAuthException.php | lib/SellingPartnerOAuthException.php | <?php
namespace ClouSale\AmazonSellingPartnerAPI;
use Exception;
use Throwable;
class SellingPartnerOAuthException extends Exception
{
public function __construct($message = '', $code = 0, Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Helpers/SellingPartnerApiRequest.php | lib/Helpers/SellingPartnerApiRequest.php | <?php
namespace ClouSale\AmazonSellingPartnerAPI\Helpers;
use ClouSale\AmazonSellingPartnerAPI\ApiException;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use ClouSale\AmazonSellingPartnerAPI\Signature;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\MultipartStream;
use GuzzleHttp\Psr7\Query;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\RequestOptions;
use GuzzleHttp\Utils;
/**
* Trait SellingPartnerApiRequest.
*
* @author Stefan Neuhaus / ClouSale
*/
trait SellingPartnerApiRequest
{
private function generateRequest(
bool $multipart,
array $formParams,
array $queryParams,
string $resourcePath,
array $headerParams,
string $method,
$httpBody
): Request {
if (null != $formParams) {
ksort($formParams);
}
if (null != $queryParams) {
ksort($queryParams);
}
// body params
$_tempBody = $httpBody;
if ($multipart) {
$headers = $this->headerSelector->selectHeadersForMultipart(
['application/json']
);
} else {
$headers = $this->headerSelector->selectHeaders(
['application/json'],
[]
);
}
// for model (json/xml)
if (isset($_tempBody)) {
// $_tempBody is the method argument, if present
$httpBody = $_tempBody;
// \stdClass has no __toString(), so we should encode it manually
if ($httpBody instanceof \stdClass && 'application/json' === $headers['Content-Type']) {
$httpBody = Utils::jsonEncode($httpBody);
}
} elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
$multipartContents[] = [
'name' => $formParamName,
'contents' => $formParamValue,
];
}
// for HTTP post (form)
$httpBody = new MultipartStream($multipartContents);
} elseif ('application/json' === $headers['Content-Type']) {
$httpBody = Utils::jsonEncode($formParams);
} else {
// for HTTP post (form)
$httpBody = Query::build($formParams);
}
}
$query = Query::build($queryParams);
$amazonHeader = Signature::calculateSignature(
$this->config,
str_replace('https://', '', $this->config->getHost()),
$method,
$resourcePath,
$query,
(string) $httpBody,
);
$headers = array_merge(
$headerParams,
$headers,
$amazonHeader
);
return new Request(
$method,
$this->config->getHost().$resourcePath.($query ? "?{$query}" : ''),
$headers,
$httpBody
);
}
/**
* @throws ApiException
*/
private function sendRequest(Request $request, string $returnType): array
{
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, $request->getUri()), $statusCode, $response->getHeaders(), $response->getBody());
}
$responseBody = $response->getBody();
if ('\SplFileObject' === $returnType) {
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if (!in_array($returnType, ['string', 'integer', 'bool'])) {
$content = json_decode($content);
}
}
// var_dump($content);
// exit();
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders(),
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 503:
case 500:
case 429:
case 404:
case 403:
case 401:
case 400:
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
$returnType,
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
}
throw $e;
}
}
/**
* Create http client option.
*
* @throws \RuntimeException on file opening failure
*
* @return array of http client options
*/
protected function createHttpClientOption(): array
{
$options = [];
if ($this->config->getDebug()) {
$options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
if (!$options[RequestOptions::DEBUG]) {
throw new \RuntimeException('Failed to open the debug file: '.$this->config->getDebugFile());
}
}
return $options;
}
/**
* @throws ApiException
*
* @return mixed
*/
private function sendRequestAsync(Request $request, string $returnType)
{
return $this->client
->sendAsync($request, $this->createHttpClientOption())
->then(
function ($response) use ($returnType) {
$responseBody = $response->getBody();
if ('\SplFileObject' === $returnType) {
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if ('string' !== $returnType) {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders(),
];
},
function ($exception) {
$response = $exception->getResponse();
$statusCode = $response->getStatusCode();
throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, $exception->getRequest()->getUri()), $statusCode, $response->getHeaders(), $response->getBody());
}
);
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/ShippingApi.php | lib/Api/ShippingApi.php | <?php
/**
* ShippingApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\GetShipmentsResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CancelShipmentResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CreateShipmentResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Shipping\GetAccountResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Shipping\GetRatesResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Shipping\GetTrackingInformationResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseLabelsResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseShipmentResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RetrieveShippingLabelResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Psr7\Request;
/**
* ShippingApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class ShippingApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation cancelShipment.
*
* @param string $shipment_id shipment_id (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CancelShipmentResponse
*/
public function cancelShipment($shipment_id)
{
list($response) = $this->cancelShipmentWithHttpInfo($shipment_id);
return $response;
}
/**
* Operation cancelShipmentWithHttpInfo.
*
* @param string $shipment_id (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CancelShipmentResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function cancelShipmentWithHttpInfo($shipment_id)
{
$request = $this->cancelShipmentRequest($shipment_id);
return $this->sendRequest($request, CancelShipmentResponse::class);
}
/**
* Operation cancelShipmentAsync.
*
* @param string $shipment_id (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function cancelShipmentAsync($shipment_id)
{
return $this->cancelShipmentAsyncWithHttpInfo($shipment_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation cancelShipmentAsyncWithHttpInfo.
*
* @param string $shipment_id (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function cancelShipmentAsyncWithHttpInfo($shipment_id)
{
$request = $this->cancelShipmentRequest($shipment_id);
return $this->sendRequestAsync($request, CancelShipmentResponse::class);
}
/**
* Create request for operation 'cancelShipment'.
*
* @param string $shipment_id (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function cancelShipmentRequest($shipment_id)
{
// verify the required parameter 'shipment_id' is set
if (null === $shipment_id || (is_array($shipment_id) && 0 === count($shipment_id))) {
throw new \InvalidArgumentException('Missing the required parameter $shipment_id when calling cancelShipment');
}
$resourcePath = '/shipping/v1/shipments/{shipmentId}/cancel';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $shipment_id) {
$resourcePath = str_replace(
'{'.'shipmentId'.'}',
ObjectSerializer::toPathValue($shipment_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation createShipment.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CreateShipmentRequest $body body (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CreateShipmentResponse
*/
public function createShipment($body)
{
list($response) = $this->createShipmentWithHttpInfo($body);
return $response;
}
/**
* Operation createShipmentWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CreateShipmentRequest $body (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CreateShipmentResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function createShipmentWithHttpInfo($body)
{
$request = $this->createShipmentRequest($body);
return $this->sendRequest($request, CreateShipmentResponse::class);
}
/**
* Operation createShipmentAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CreateShipmentRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createShipmentAsync($body)
{
return $this->createShipmentAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createShipmentAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CreateShipmentRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createShipmentAsyncWithHttpInfo($body)
{
$request = $this->createShipmentRequest($body);
return $this->sendRequestAsync($request, CreateShipmentResponse::class);
}
/**
* Create request for operation 'createShipment'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CreateShipmentRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function createShipmentRequest($body)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling createShipment');
}
$resourcePath = '/shipping/v1/shipments';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation getAccount.
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\GetAccountResponse
*/
public function getAccount()
{
list($response) = $this->getAccountWithHttpInfo();
return $response;
}
/**
* Operation getAccountWithHttpInfo.
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\GetAccountResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getAccountWithHttpInfo()
{
$request = $this->getAccountRequest();
return $this->sendRequest($request, GetAccountResponse::class);
}
/**
* Operation getAccountAsync.
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAccountAsync()
{
return $this->getAccountAsyncWithHttpInfo()
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAccountAsyncWithHttpInfo.
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAccountAsyncWithHttpInfo()
{
$request = $this->getAccountRequest();
return $this->sendRequestAsync($request, GetAccountResponse::class);
}
/**
* Create request for operation 'getAccount'.
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getAccountRequest()
{
$resourcePath = '/shipping/v1/account';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getRates.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\GetRatesRequest $body body (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\GetRatesResponse
*/
public function getRates($body)
{
list($response) = $this->getRatesWithHttpInfo($body);
return $response;
}
/**
* Operation getRatesWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\GetRatesRequest $body (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\GetRatesResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getRatesWithHttpInfo($body)
{
$request = $this->getRatesRequest($body);
return $this->sendRequest($request, GetRatesResponse::class);
}
/**
* Operation getRatesAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\GetRatesRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getRatesAsync($body)
{
return $this->getRatesAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getRatesAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\GetRatesRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getRatesAsyncWithHttpInfo($body)
{
$request = $this->getRatesRequest($body);
return $this->sendRequestAsync($request, GetRatesResponse::class);
}
/**
* Create request for operation 'getRates'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\GetRatesRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getRatesRequest($body)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling getRates');
}
$resourcePath = '/shipping/v1/rates';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation getShipment.
*
* @param string $shipment_id shipment_id (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\GetShipmentResponse
*/
public function getShipment($shipment_id)
{
list($response) = $this->getShipmentWithHttpInfo($shipment_id);
return $response;
}
/**
* Operation getShipmentWithHttpInfo.
*
* @param string $shipment_id (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\GetShipmentResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getShipmentWithHttpInfo($shipment_id)
{
$request = $this->getShipmentRequest($shipment_id);
return $this->sendRequest($request, GetShipmentsResponse::class);
}
/**
* Operation getShipmentAsync.
*
* @param string $shipment_id (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getShipmentAsync($shipment_id)
{
return $this->getShipmentAsyncWithHttpInfo($shipment_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getShipmentAsyncWithHttpInfo.
*
* @param string $shipment_id (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getShipmentAsyncWithHttpInfo($shipment_id)
{
$request = $this->getShipmentRequest($shipment_id);
return $this->sendRequestAsync($request, GetShipmentsResponse::class);
}
/**
* Create request for operation 'getShipment'.
*
* @param string $shipment_id (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getShipmentRequest($shipment_id)
{
// verify the required parameter 'shipment_id' is set
if (null === $shipment_id || (is_array($shipment_id) && 0 === count($shipment_id))) {
throw new \InvalidArgumentException('Missing the required parameter $shipment_id when calling getShipment');
}
$resourcePath = '/shipping/v1/shipments/{shipmentId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $shipment_id) {
$resourcePath = str_replace(
'{'.'shipmentId'.'}',
ObjectSerializer::toPathValue($shipment_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getTrackingInformation.
*
* @param string $tracking_id tracking_id (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\GetTrackingInformationResponse
*/
public function getTrackingInformation($tracking_id)
{
list($response) = $this->getTrackingInformationWithHttpInfo($tracking_id);
return $response;
}
/**
* Operation getTrackingInformationWithHttpInfo.
*
* @param string $tracking_id (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\GetTrackingInformationResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getTrackingInformationWithHttpInfo($tracking_id)
{
$request = $this->getTrackingInformationRequest($tracking_id);
return $this->sendRequest($request, GetTrackingInformationResponse::class);
}
/**
* Operation getTrackingInformationAsync.
*
* @param string $tracking_id (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTrackingInformationAsync($tracking_id)
{
return $this->getTrackingInformationAsyncWithHttpInfo($tracking_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getTrackingInformationAsyncWithHttpInfo.
*
* @param string $tracking_id (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getTrackingInformationAsyncWithHttpInfo($tracking_id)
{
$request = $this->getTrackingInformationRequest($tracking_id);
return $this->sendRequestAsync($request, GetTrackingInformationResponse::class);
}
/**
* Create request for operation 'getTrackingInformation'.
*
* @param string $tracking_id (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getTrackingInformationRequest($tracking_id)
{
// verify the required parameter 'tracking_id' is set
if (null === $tracking_id || (is_array($tracking_id) && 0 === count($tracking_id))) {
throw new \InvalidArgumentException('Missing the required parameter $tracking_id when calling getTrackingInformation');
}
$resourcePath = '/shipping/v1/tracking/{trackingId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $tracking_id) {
$resourcePath = str_replace(
'{'.'trackingId'.'}',
ObjectSerializer::toPathValue($tracking_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation purchaseLabels.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseLabelsRequest $body body (required)
* @param string $shipment_id shipment_id (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseLabelsResponse
*/
public function purchaseLabels($body, $shipment_id)
{
list($response) = $this->purchaseLabelsWithHttpInfo($body, $shipment_id);
return $response;
}
/**
* Operation purchaseLabelsWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseLabelsRequest $body (required)
* @param string $shipment_id (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseLabelsResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function purchaseLabelsWithHttpInfo($body, $shipment_id)
{
$request = $this->purchaseLabelsRequest($body, $shipment_id);
return $this->sendRequest($request, PurchaseLabelsResponse::class);
}
/**
* Operation purchaseLabelsAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseLabelsRequest $body (required)
* @param string $shipment_id (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function purchaseLabelsAsync($body, $shipment_id)
{
return $this->purchaseLabelsAsyncWithHttpInfo($body, $shipment_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation purchaseLabelsAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseLabelsRequest $body (required)
* @param string $shipment_id (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function purchaseLabelsAsyncWithHttpInfo($body, $shipment_id)
{
$request = $this->purchaseLabelsRequest($body, $shipment_id);
return $this->sendRequestAsync($request, PurchaseLabelsResponse::class);
}
/**
* Create request for operation 'purchaseLabels'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseLabelsRequest $body (required)
* @param string $shipment_id (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function purchaseLabelsRequest($body, $shipment_id)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling purchaseLabels');
}
// verify the required parameter 'shipment_id' is set
if (null === $shipment_id || (is_array($shipment_id) && 0 === count($shipment_id))) {
throw new \InvalidArgumentException('Missing the required parameter $shipment_id when calling purchaseLabels');
}
$resourcePath = '/shipping/v1/shipments/{shipmentId}/purchaseLabels';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
// path params
if (null !== $shipment_id) {
$resourcePath = str_replace(
'{'.'shipmentId'.'}',
ObjectSerializer::toPathValue($shipment_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation purchaseShipment.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseShipmentRequest $body body (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseShipmentResponse
*/
public function purchaseShipment($body)
{
list($response) = $this->purchaseShipmentWithHttpInfo($body);
return $response;
}
/**
* Operation purchaseShipmentWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseShipmentRequest $body (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseShipmentResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function purchaseShipmentWithHttpInfo($body)
{
$request = $this->purchaseShipmentRequest($body);
return $this->sendRequest($request, PurchaseShipmentResponse::class);
}
/**
* Operation purchaseShipmentAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseShipmentRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function purchaseShipmentAsync($body)
{
return $this->purchaseShipmentAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation purchaseShipmentAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseShipmentRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function purchaseShipmentAsyncWithHttpInfo($body)
{
$request = $this->purchaseShipmentRequest($body);
return $this->sendRequestAsync($request, PurchaseShipmentResponse::class);
}
/**
* Create request for operation 'purchaseShipment'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseShipmentRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function purchaseShipmentRequest($body)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling purchaseShipment');
}
$resourcePath = '/shipping/v1/purchaseShipment';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation retrieveShippingLabel.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RetrieveShippingLabelRequest $body body (required)
* @param string $shipment_id shipment_id (required)
* @param string $tracking_id tracking_id (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RetrieveShippingLabelResponse
*/
public function retrieveShippingLabel($body, $shipment_id, $tracking_id)
{
list($response) = $this->retrieveShippingLabelWithHttpInfo($body, $shipment_id, $tracking_id);
return $response;
}
/**
* Operation retrieveShippingLabelWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RetrieveShippingLabelRequest $body (required)
* @param string $shipment_id (required)
* @param string $tracking_id (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RetrieveShippingLabelResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function retrieveShippingLabelWithHttpInfo($body, $shipment_id, $tracking_id)
{
$request = $this->retrieveShippingLabelRequest($body, $shipment_id, $tracking_id);
return $this->sendRequest($request, RetrieveShippingLabelResponse::class);
}
/**
* Operation retrieveShippingLabelAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RetrieveShippingLabelRequest $body (required)
* @param string $shipment_id (required)
* @param string $tracking_id (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function retrieveShippingLabelAsync($body, $shipment_id, $tracking_id)
{
return $this->retrieveShippingLabelAsyncWithHttpInfo($body, $shipment_id, $tracking_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation retrieveShippingLabelAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RetrieveShippingLabelRequest $body (required)
* @param string $shipment_id (required)
* @param string $tracking_id (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function retrieveShippingLabelAsyncWithHttpInfo($body, $shipment_id, $tracking_id)
{
$request = $this->retrieveShippingLabelRequest($body, $shipment_id, $tracking_id);
return $this->sendRequestAsync($request, RetrieveShippingLabelResponse::class);
}
/**
* Create request for operation 'retrieveShippingLabel'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RetrieveShippingLabelRequest $body (required)
* @param string $shipment_id (required)
* @param string $tracking_id (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function retrieveShippingLabelRequest($body, $shipment_id, $tracking_id)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling retrieveShippingLabel');
}
// verify the required parameter 'shipment_id' is set
if (null === $shipment_id || (is_array($shipment_id) && 0 === count($shipment_id))) {
throw new \InvalidArgumentException('Missing the required parameter $shipment_id when calling retrieveShippingLabel');
}
// verify the required parameter 'tracking_id' is set
if (null === $tracking_id || (is_array($tracking_id) && 0 === count($tracking_id))) {
throw new \InvalidArgumentException('Missing the required parameter $tracking_id when calling retrieveShippingLabel');
}
$resourcePath = '/shipping/v1/shipments/{shipmentId}/containers/{trackingId}/label';
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | true |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/FbaInventoryApi.php | lib/Api/FbaInventoryApi.php | <?php
/**
* FbaInventoryApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for FBA Inventory.
*
* The Selling Partner API for FBA Inventory lets you programmatically retrieve information about inventory in Amazon's fulfillment network.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\FbaInventory\GetInventorySummariesResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Psr7\Request;
/**
* FbaInventoryApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class FbaInventoryApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation getInventorySummaries.
*
* @param string $granularity_type The granularity type for the inventory aggregation level. (required)
* @param string $granularity_id The granularity ID for the inventory aggregation level. (required)
* @param string[] $marketplace_ids The marketplace ID for the marketplace for which to return inventory summaries. (required)
* @param bool $details true to return inventory summaries with additional summarized inventory details and quantities. Otherwise, returns inventory summaries only (default value). (optional, default to false)
* @param \DateTime $start_date_time A start date and time in ISO8601 format. If specified, all inventory summaries that have changed since then are returned. You must specify a date and time that is no earlier than 18 months prior to the date and time when you call the API. Note: Changes in inboundWorkingQuantity, inboundShippedQuantity and inboundReceivingQuantity are not detected. (optional)
* @param string[] $seller_skus A list of seller SKUs for which to return inventory summaries. You may specify up to 50 SKUs. (optional)
* @param string $next_token String token returned in the response of your previous request. (optional)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FbaInventory\GetInventorySummariesResponse
*/
public function getInventorySummaries($granularity_type, $granularity_id, $marketplace_ids, $details = 'false', $start_date_time = null, $seller_skus = null, $next_token = null)
{
list($response) = $this->getInventorySummariesWithHttpInfo($granularity_type, $granularity_id, $marketplace_ids, $details, $start_date_time, $seller_skus, $next_token);
return $response;
}
/**
* Operation getInventorySummariesWithHttpInfo.
*
* @param string $granularity_type The granularity type for the inventory aggregation level. (required)
* @param string $granularity_id The granularity ID for the inventory aggregation level. (required)
* @param string[] $marketplace_ids The marketplace ID for the marketplace for which to return inventory summaries. (required)
* @param bool $details true to return inventory summaries with additional summarized inventory details and quantities. Otherwise, returns inventory summaries only (default value). (optional, default to false)
* @param \DateTime $start_date_time A start date and time in ISO8601 format. If specified, all inventory summaries that have changed since then are returned. You must specify a date and time that is no earlier than 18 months prior to the date and time when you call the API. Note: Changes in inboundWorkingQuantity, inboundShippedQuantity and inboundReceivingQuantity are not detected. (optional)
* @param string[] $seller_skus A list of seller SKUs for which to return inventory summaries. You may specify up to 50 SKUs. (optional)
* @param string $next_token String token returned in the response of your previous request. (optional)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FbaInventory\GetInventorySummariesResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getInventorySummariesWithHttpInfo($granularity_type, $granularity_id, $marketplace_ids, $details = 'false', $start_date_time = null, $seller_skus = null, $next_token = null)
{
$request = $this->getInventorySummariesRequest($granularity_type, $granularity_id, $marketplace_ids, $details, $start_date_time, $seller_skus, $next_token);
return $this->sendRequest($request, GetInventorySummariesResponse::class);
}
/**
* Operation getInventorySummariesAsync.
*
* @param string $granularity_type The granularity type for the inventory aggregation level. (required)
* @param string $granularity_id The granularity ID for the inventory aggregation level. (required)
* @param string[] $marketplace_ids The marketplace ID for the marketplace for which to return inventory summaries. (required)
* @param bool $details true to return inventory summaries with additional summarized inventory details and quantities. Otherwise, returns inventory summaries only (default value). (optional, default to false)
* @param \DateTime $start_date_time A start date and time in ISO8601 format. If specified, all inventory summaries that have changed since then are returned. You must specify a date and time that is no earlier than 18 months prior to the date and time when you call the API. Note: Changes in inboundWorkingQuantity, inboundShippedQuantity and inboundReceivingQuantity are not detected. (optional)
* @param string[] $seller_skus A list of seller SKUs for which to return inventory summaries. You may specify up to 50 SKUs. (optional)
* @param string $next_token String token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInventorySummariesAsync($granularity_type, $granularity_id, $marketplace_ids, $details = 'false', $start_date_time = null, $seller_skus = null, $next_token = null)
{
return $this->getInventorySummariesAsyncWithHttpInfo($granularity_type, $granularity_id, $marketplace_ids, $details, $start_date_time, $seller_skus, $next_token)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getInventorySummariesAsyncWithHttpInfo.
*
* @param string $granularity_type The granularity type for the inventory aggregation level. (required)
* @param string $granularity_id The granularity ID for the inventory aggregation level. (required)
* @param string[] $marketplace_ids The marketplace ID for the marketplace for which to return inventory summaries. (required)
* @param bool $details true to return inventory summaries with additional summarized inventory details and quantities. Otherwise, returns inventory summaries only (default value). (optional, default to false)
* @param \DateTime $start_date_time A start date and time in ISO8601 format. If specified, all inventory summaries that have changed since then are returned. You must specify a date and time that is no earlier than 18 months prior to the date and time when you call the API. Note: Changes in inboundWorkingQuantity, inboundShippedQuantity and inboundReceivingQuantity are not detected. (optional)
* @param string[] $seller_skus A list of seller SKUs for which to return inventory summaries. You may specify up to 50 SKUs. (optional)
* @param string $next_token String token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getInventorySummariesAsyncWithHttpInfo($granularity_type, $granularity_id, $marketplace_ids, $details = 'false', $start_date_time = null, $seller_skus = null, $next_token = null)
{
$request = $this->getInventorySummariesRequest($granularity_type, $granularity_id, $marketplace_ids, $details, $start_date_time, $seller_skus, $next_token);
return $this->sendRequestAsync($request, GetInventorySummariesResponse::class);
}
/**
* Create request for operation 'getInventorySummaries'.
*
* @param string $granularity_type The granularity type for the inventory aggregation level. (required)
* @param string $granularity_id The granularity ID for the inventory aggregation level. (required)
* @param string[] $marketplace_ids The marketplace ID for the marketplace for which to return inventory summaries. (required)
* @param bool $details true to return inventory summaries with additional summarized inventory details and quantities. Otherwise, returns inventory summaries only (default value). (optional, default to false)
* @param \DateTime $start_date_time A start date and time in ISO8601 format. If specified, all inventory summaries that have changed since then are returned. You must specify a date and time that is no earlier than 18 months prior to the date and time when you call the API. Note: Changes in inboundWorkingQuantity, inboundShippedQuantity and inboundReceivingQuantity are not detected. (optional)
* @param string[] $seller_skus A list of seller SKUs for which to return inventory summaries. You may specify up to 50 SKUs. (optional)
* @param string $next_token String token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getInventorySummariesRequest($granularity_type, $granularity_id, $marketplace_ids, $details = 'false', $start_date_time = null, $seller_skus = null, $next_token = null)
{
// verify the required parameter 'granularity_type' is set
if (null === $granularity_type || (is_array($granularity_type) && 0 === count($granularity_type))) {
throw new \InvalidArgumentException('Missing the required parameter $granularity_type when calling getInventorySummaries');
}
// verify the required parameter 'granularity_id' is set
if (null === $granularity_id || (is_array($granularity_id) && 0 === count($granularity_id))) {
throw new \InvalidArgumentException('Missing the required parameter $granularity_id when calling getInventorySummaries');
}
// verify the required parameter 'marketplace_ids' is set
if (null === $marketplace_ids || (is_array($marketplace_ids) && 0 === count($marketplace_ids))) {
throw new \InvalidArgumentException('Missing the required parameter $marketplace_ids when calling getInventorySummaries');
}
$resourcePath = '/fba/inventory/v1/summaries';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $details) {
$queryParams['details'] = ObjectSerializer::toQueryValue($details);
}
// query params
if (null !== $granularity_type) {
$queryParams['granularityType'] = ObjectSerializer::toQueryValue($granularity_type);
}
// query params
if (null !== $granularity_id) {
$queryParams['granularityId'] = ObjectSerializer::toQueryValue($granularity_id);
}
// query params
if (null !== $start_date_time) {
$queryParams['startDateTime'] = ObjectSerializer::toQueryValue($start_date_time);
}
// query params
if (is_array($seller_skus)) {
$seller_skus = ObjectSerializer::serializeCollection($seller_skus, 'csv', true);
}
if (null !== $seller_skus) {
$queryParams['sellerSkus'] = ObjectSerializer::toQueryValue($seller_skus);
}
// query params
if (null !== $next_token) {
$queryParams['nextToken'] = ObjectSerializer::toQueryValue($next_token);
}
// query params
if (is_array($marketplace_ids)) {
$marketplace_ids = ObjectSerializer::serializeCollection($marketplace_ids, 'csv', true);
}
if (null !== $marketplace_ids) {
$queryParams['marketplaceIds'] = ObjectSerializer::toQueryValue($marketplace_ids);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/FeesApi.php | lib/Api/FeesApi.php | <?php
/**
* FeesApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Product Fees.
*
* The Selling Partner API for Product Fees lets you programmatically retrieve estimated fees for a product. You can then account for those fees in your pricing.
*
* OpenAPI spec version: v0
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\ProductFees\GetMyFeesEstimateResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
/**
* FeesApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class FeesApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation getMyFeesEstimateForASIN.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\ProductFees\GetMyFeesEstimateRequest $body body (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\ProductFees\GetMyFeesEstimateResponse
*/
public function getMyFeesEstimateForASIN($body, $asin)
{
list($response) = $this->getMyFeesEstimateForASINWithHttpInfo($body, $asin);
return $response;
}
/**
* Operation getMyFeesEstimateForASINWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\ProductFees\GetMyFeesEstimateRequest $body (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\ProductFees\GetMyFeesEstimateResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getMyFeesEstimateForASINWithHttpInfo($body, $asin)
{
$request = $this->getMyFeesEstimateForASINRequest($body, $asin);
return $this->sendRequest($request, GetMyFeesEstimateResponse::class);
}
/**
* Operation getMyFeesEstimateForASINAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\ProductFees\GetMyFeesEstimateRequest $body (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getMyFeesEstimateForASINAsync($body, $asin)
{
return $this->getMyFeesEstimateForASINAsyncWithHttpInfo($body, $asin)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getMyFeesEstimateForASINAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\ProductFees\GetMyFeesEstimateRequest $body (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getMyFeesEstimateForASINAsyncWithHttpInfo($body, $asin)
{
$request = $this->getMyFeesEstimateForASINRequest($body, $asin);
return $this->sendRequestAsync($request, GetMyFeesEstimateResponse::class);
}
/**
* Create request for operation 'getMyFeesEstimateForASIN'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\ProductFees\GetMyFeesEstimateRequest $body (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getMyFeesEstimateForASINRequest($body, $asin)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling getMyFeesEstimateForASIN');
}
// verify the required parameter 'asin' is set
if (null === $asin || (is_array($asin) && 0 === count($asin))) {
throw new \InvalidArgumentException('Missing the required parameter $asin when calling getMyFeesEstimateForASIN');
}
$resourcePath = '/products/fees/v0/items/{Asin}/feesEstimate';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
// path params
if (null !== $asin) {
$resourcePath = str_replace(
'{'.'Asin'.'}',
ObjectSerializer::toPathValue($asin),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation getMyFeesEstimateForSKU.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\ProductFees\GetMyFeesEstimateRequest $body body (required)
* @param string $seller_sku Used to identify an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\ProductFees\GetMyFeesEstimateResponse
*/
public function getMyFeesEstimateForSKU($body, $seller_sku)
{
list($response) = $this->getMyFeesEstimateForSKUWithHttpInfo($body, $seller_sku);
return $response;
}
/**
* Operation getMyFeesEstimateForSKUWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\ProductFees\GetMyFeesEstimateRequest $body (required)
* @param string $seller_sku Used to identify an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\ProductFees\GetMyFeesEstimateResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getMyFeesEstimateForSKUWithHttpInfo($body, $seller_sku)
{
$request = $this->getMyFeesEstimateForSKURequest($body, $seller_sku);
return $this->sendRequest($request, GetMyFeesEstimateResponse::class);
}
/**
* Operation getMyFeesEstimateForSKUAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\ProductFees\GetMyFeesEstimateRequest $body (required)
* @param string $seller_sku Used to identify an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getMyFeesEstimateForSKUAsync($body, $seller_sku)
{
return $this->getMyFeesEstimateForSKUAsyncWithHttpInfo($body, $seller_sku)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getMyFeesEstimateForSKUAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\ProductFees\GetMyFeesEstimateRequest $body (required)
* @param string $seller_sku Used to identify an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getMyFeesEstimateForSKUAsyncWithHttpInfo($body, $seller_sku)
{
$request = $this->getMyFeesEstimateForSKURequest($body, $seller_sku);
return $this->sendRequestAsync($request, GetMyFeesEstimateResponse::class);
}
/**
* Create request for operation 'getMyFeesEstimateForSKU'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\ProductFees\GetMyFeesEstimateRequest $body (required)
* @param string $seller_sku Used to identify an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getMyFeesEstimateForSKURequest($body, $seller_sku)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling getMyFeesEstimateForSKU');
}
// verify the required parameter 'seller_sku' is set
if (null === $seller_sku || (is_array($seller_sku) && 0 === count($seller_sku))) {
throw new \InvalidArgumentException('Missing the required parameter $seller_sku when calling getMyFeesEstimateForSKU');
}
$resourcePath = '/products/fees/v0/listings/{SellerSKU}/feesEstimate';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
// path params
if (null !== $seller_sku) {
$resourcePath = str_replace(
'{'.'SellerSKU'.'}',
ObjectSerializer::toPathValue($seller_sku),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/NotificationsApi.php | lib/Api/NotificationsApi.php | <?php
/**
* NotificationsApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Notifications.
*
* The Selling Partner API for Notifications lets you subscribe to notifications that are relevant to a selling partner's business. Using this API you can create a destination to receive notifications, subscribe to notifications, delete notification subscriptions, and more.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\ExceptionThrower;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\Notifications\CreateDestinationResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Notifications\CreateSubscriptionResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Notifications\DeleteDestinationResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Notifications\DeleteSubscriptionByIdResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Notifications\GetDestinationResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Notifications\GetDestinationsResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Notifications\GetSubscriptionByIdResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Notifications\GetSubscriptionResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Psr7\Request;
/**
* NotificationsApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class NotificationsApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation createDestination.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\CreateDestinationRequest $body body (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\CreateDestinationResponse
*/
public function createDestination($body)
{
list($response) = $this->createDestinationWithHttpInfo($body);
return $response;
}
/**
* Operation createDestinationWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\CreateDestinationRequest $body (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\CreateDestinationResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function createDestinationWithHttpInfo($body)
{
$request = $this->createDestinationRequest($body);
return $this->sendRequest($request, CreateDestinationResponse::class);
}
/**
* Operation createDestinationAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\CreateDestinationRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createDestinationAsync($body)
{
return $this->createDestinationAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createDestinationAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\CreateDestinationRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createDestinationAsyncWithHttpInfo($body)
{
$request = $this->createDestinationRequest($body);
return $this->sendRequestAsync($request, CreateDestinationResponse::class);
}
/**
* Create request for operation 'createDestination'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\CreateDestinationRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function createDestinationRequest($body)
{
// verify the required parameter 'body' is set
ExceptionThrower::throwIf(\InvalidArgumentException::class, null === $body || (is_array($body) && 0 === count($body)), 'Missing the required parameter $body when calling createDestination');
$resourcePath = '/notifications/v1/destinations';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation createSubscription.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\CreateSubscriptionRequest $body body (required)
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\CreateSubscriptionResponse
*/
public function createSubscription($body, $notification_type)
{
list($response) = $this->createSubscriptionWithHttpInfo($body, $notification_type);
return $response;
}
/**
* Operation createSubscriptionWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\CreateSubscriptionRequest $body (required)
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\CreateSubscriptionResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function createSubscriptionWithHttpInfo($body, $notification_type)
{
$request = $this->createSubscriptionRequest($body, $notification_type);
return $this->sendRequest($request, CreateSubscriptionResponse::class);
}
/**
* Operation createSubscriptionAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\CreateSubscriptionRequest $body (required)
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createSubscriptionAsync($body, $notification_type)
{
return $this->createSubscriptionAsyncWithHttpInfo($body, $notification_type)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createSubscriptionAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\CreateSubscriptionRequest $body (required)
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createSubscriptionAsyncWithHttpInfo($body, $notification_type)
{
$request = $this->createSubscriptionRequest($body, $notification_type);
return $this->sendRequestAsync($request, CreateSubscriptionResponse::class);
}
/**
* Create request for operation 'createSubscription'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\CreateSubscriptionRequest $body (required)
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function createSubscriptionRequest($body, $notification_type)
{
ExceptionThrower::throwIf(\InvalidArgumentException::class, null === $body || (is_array($body) && 0 === count($body)), 'Missing the required parameter $body when calling createSubscription');
ExceptionThrower::throwIf(\InvalidArgumentException::class, null === $notification_type || (is_array($notification_type) && 0 === count($notification_type)), 'Missing the required parameter $notification_type when calling createSubscription');
$resourcePath = '/notifications/v1/subscriptions/{notificationType}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
// path params
if (null !== $notification_type) {
$resourcePath = str_replace(
'{'.'notificationType'.'}',
ObjectSerializer::toPathValue($notification_type),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation deleteDestination.
*
* @param string $destination_id The identifier for the destination that you want to delete. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\DeleteDestinationResponse
*/
public function deleteDestination($destination_id)
{
list($response) = $this->deleteDestinationWithHttpInfo($destination_id);
return $response;
}
/**
* Operation deleteDestinationWithHttpInfo.
*
* @param string $destination_id The identifier for the destination that you want to delete. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\DeleteDestinationResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteDestinationWithHttpInfo($destination_id)
{
$request = $this->deleteDestinationRequest($destination_id);
return $this->sendRequest($request, DeleteDestinationResponse::class);
}
/**
* Operation deleteDestinationAsync.
*
* @param string $destination_id The identifier for the destination that you want to delete. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteDestinationAsync($destination_id)
{
return $this->deleteDestinationAsyncWithHttpInfo($destination_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteDestinationAsyncWithHttpInfo.
*
* @param string $destination_id The identifier for the destination that you want to delete. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteDestinationAsyncWithHttpInfo($destination_id)
{
$request = $this->deleteDestinationRequest($destination_id);
return $this->sendRequestAsync($request, DeleteDestinationResponse::class);
}
/**
* Create request for operation 'deleteDestination'.
*
* @param string $destination_id The identifier for the destination that you want to delete. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function deleteDestinationRequest($destination_id)
{
// verify the required parameter 'destination_id' is set
if (null === $destination_id || (is_array($destination_id) && 0 === count($destination_id))) {
throw new \InvalidArgumentException('Missing the required parameter $destination_id when calling deleteDestination');
}
$resourcePath = '/notifications/v1/destinations/{destinationId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $destination_id) {
$resourcePath = str_replace(
'{'.'destinationId'.'}',
ObjectSerializer::toPathValue($destination_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'DELETE', $httpBody);
}
/**
* Operation deleteSubscriptionById.
*
* @param string $subscription_id The identifier for the subscription that you want to delete. (required)
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\DeleteSubscriptionByIdResponse
*/
public function deleteSubscriptionById($subscription_id, $notification_type)
{
list($response) = $this->deleteSubscriptionByIdWithHttpInfo($subscription_id, $notification_type);
return $response;
}
/**
* Operation deleteSubscriptionByIdWithHttpInfo.
*
* @param string $subscription_id The identifier for the subscription that you want to delete. (required)
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\DeleteSubscriptionByIdResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteSubscriptionByIdWithHttpInfo($subscription_id, $notification_type)
{
$request = $this->deleteSubscriptionByIdRequest($subscription_id, $notification_type);
return $this->sendRequest($request, DeleteSubscriptionByIdResponse::class);
}
/**
* Operation deleteSubscriptionByIdAsync.
*
* @param string $subscription_id The identifier for the subscription that you want to delete. (required)
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteSubscriptionByIdAsync($subscription_id, $notification_type)
{
return $this->deleteSubscriptionByIdAsyncWithHttpInfo($subscription_id, $notification_type)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteSubscriptionByIdAsyncWithHttpInfo.
*
* @param string $subscription_id The identifier for the subscription that you want to delete. (required)
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteSubscriptionByIdAsyncWithHttpInfo($subscription_id, $notification_type)
{
$request = $this->deleteSubscriptionByIdRequest($subscription_id, $notification_type);
return $this->sendRequestAsync($request, DeleteSubscriptionByIdResponse::class);
}
/**
* Create request for operation 'deleteSubscriptionById'.
*
* @param string $subscription_id The identifier for the subscription that you want to delete. (required)
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function deleteSubscriptionByIdRequest($subscription_id, $notification_type)
{
// verify the required parameter 'subscription_id' is set
if (null === $subscription_id || (is_array($subscription_id) && 0 === count($subscription_id))) {
throw new \InvalidArgumentException('Missing the required parameter $subscription_id when calling deleteSubscriptionById');
}
// verify the required parameter 'notification_type' is set
if (null === $notification_type || (is_array($notification_type) && 0 === count($notification_type))) {
throw new \InvalidArgumentException('Missing the required parameter $notification_type when calling deleteSubscriptionById');
}
$resourcePath = '/notifications/v1/subscriptions/{notificationType}/{subscriptionId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $subscription_id) {
$resourcePath = str_replace(
'{'.'subscriptionId'.'}',
ObjectSerializer::toPathValue($subscription_id),
$resourcePath
);
}
// path params
if (null !== $notification_type) {
$resourcePath = str_replace(
'{'.'notificationType'.'}',
ObjectSerializer::toPathValue($notification_type),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'DELETE', $httpBody);
}
/**
* Operation getDestination.
*
* @param string $destination_id The identifier generated when you created the destination. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\GetDestinationResponse
*/
public function getDestination($destination_id)
{
list($response) = $this->getDestinationWithHttpInfo($destination_id);
return $response;
}
/**
* Operation getDestinationWithHttpInfo.
*
* @param string $destination_id The identifier generated when you created the destination. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\GetDestinationResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getDestinationWithHttpInfo($destination_id)
{
$request = $this->getDestinationRequest($destination_id);
return $this->sendRequest($request, GetDestinationResponse::class);
}
/**
* Operation getDestinationAsync.
*
* @param string $destination_id The identifier generated when you created the destination. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getDestinationAsync($destination_id)
{
return $this->getDestinationAsyncWithHttpInfo($destination_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getDestinationAsyncWithHttpInfo.
*
* @param string $destination_id The identifier generated when you created the destination. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getDestinationAsyncWithHttpInfo($destination_id)
{
$request = $this->getDestinationRequest($destination_id);
return $this->sendRequestAsync($request, GetDestinationResponse::class);
}
/**
* Create request for operation 'getDestination'.
*
* @param string $destination_id The identifier generated when you created the destination. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getDestinationRequest($destination_id)
{
// verify the required parameter 'destination_id' is set
if (null === $destination_id || (is_array($destination_id) && 0 === count($destination_id))) {
throw new \InvalidArgumentException('Missing the required parameter $destination_id when calling getDestination');
}
$resourcePath = '/notifications/v1/destinations/{destinationId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $destination_id) {
$resourcePath = str_replace(
'{'.'destinationId'.'}',
ObjectSerializer::toPathValue($destination_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getDestinations.
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\GetDestinationsResponse
*/
public function getDestinations()
{
list($response) = $this->getDestinationsWithHttpInfo();
return $response;
}
/**
* Operation getDestinationsWithHttpInfo.
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\GetDestinationsResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getDestinationsWithHttpInfo()
{
$request = $this->getDestinationsRequest();
return $this->sendRequest($request, GetDestinationsResponse::class);
}
/**
* Operation getDestinationsAsync.
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getDestinationsAsync()
{
return $this->getDestinationsAsyncWithHttpInfo()
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getDestinationsAsyncWithHttpInfo.
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getDestinationsAsyncWithHttpInfo()
{
$request = $this->getDestinationsRequest();
return $this->sendRequestAsync($request, GetDestinationsResponse::class);
}
/**
* Create request for operation 'getDestinations'.
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getDestinationsRequest()
{
$resourcePath = '/notifications/v1/destinations';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getSubscription.
*
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\GetSubscriptionResponse
*/
public function getSubscription($notification_type)
{
list($response) = $this->getSubscriptionWithHttpInfo($notification_type);
return $response;
}
/**
* Operation getSubscriptionWithHttpInfo.
*
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\GetSubscriptionResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getSubscriptionWithHttpInfo($notification_type)
{
$request = $this->getSubscriptionRequest($notification_type);
return $this->sendRequest($request, GetSubscriptionResponse::class);
}
/**
* Operation getSubscriptionAsync.
*
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSubscriptionAsync($notification_type)
{
return $this->getSubscriptionAsyncWithHttpInfo($notification_type)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSubscriptionAsyncWithHttpInfo.
*
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSubscriptionAsyncWithHttpInfo($notification_type)
{
$request = $this->getSubscriptionRequest($notification_type);
return $this->sendRequestAsync($request, GetSubscriptionResponse::class);
}
/**
* Create request for operation 'getSubscription'.
*
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getSubscriptionRequest($notification_type)
{
// verify the required parameter 'notification_type' is set
if (null === $notification_type || (is_array($notification_type) && 0 === count($notification_type))) {
throw new \InvalidArgumentException('Missing the required parameter $notification_type when calling getSubscription');
}
$resourcePath = '/notifications/v1/subscriptions/{notificationType}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $notification_type) {
$resourcePath = str_replace(
'{'.'notificationType'.'}',
ObjectSerializer::toPathValue($notification_type),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getSubscriptionById.
*
* @param string $subscription_id The identifier for the subscription that you want to get. (required)
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\GetSubscriptionByIdResponse
*/
public function getSubscriptionById($subscription_id, $notification_type)
{
list($response) = $this->getSubscriptionByIdWithHttpInfo($subscription_id, $notification_type);
return $response;
}
/**
* Operation getSubscriptionByIdWithHttpInfo.
*
* @param string $subscription_id The identifier for the subscription that you want to get. (required)
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Notifications\GetSubscriptionByIdResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getSubscriptionByIdWithHttpInfo($subscription_id, $notification_type)
{
$request = $this->getSubscriptionByIdRequest($subscription_id, $notification_type);
return $this->sendRequest($request, GetSubscriptionByIdResponse::class);
}
/**
* Operation getSubscriptionByIdAsync.
*
* @param string $subscription_id The identifier for the subscription that you want to get. (required)
* @param string $notification_type The type of notification to which you want to subscribe. For more information about notification types, see the Notifications API Use Case Guide. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSubscriptionByIdAsync($subscription_id, $notification_type)
{
return $this->getSubscriptionByIdAsyncWithHttpInfo($subscription_id, $notification_type)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSubscriptionByIdAsyncWithHttpInfo.
*
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | true |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/SmallAndLightApi.php | lib/Api/SmallAndLightApi.php | <?php
/**
* SmallAndLightApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for FBA Small And Light.
*
* The Selling Partner API for FBA Small and Light lets you help sellers manage their listings in the Small and Light program. The program reduces the cost of fulfilling orders for small and lightweight FBA inventory. You can enroll or remove items from the program and check item eligibility and enrollment status. You can also preview the estimated program fees charged to a seller for items sold while enrolled in the program.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightEligibility;
use ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightEnrollment;
use ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightFeePreviews;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
/**
* SmallAndLightApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class SmallAndLightApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation deleteSmallAndLightEnrollmentBySellerSKU.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace in which to remove the item from the Small and Light program. Note: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return void
*/
public function deleteSmallAndLightEnrollmentBySellerSKU($seller_sku, $marketplace_ids)
{
$this->deleteSmallAndLightEnrollmentBySellerSKUWithHttpInfo($seller_sku, $marketplace_ids);
}
/**
* Operation deleteSmallAndLightEnrollmentBySellerSKUWithHttpInfo.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace in which to remove the item from the Small and Light program. Note: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of null, HTTP status code, HTTP response headers (array of strings)
*/
public function deleteSmallAndLightEnrollmentBySellerSKUWithHttpInfo($seller_sku, $marketplace_ids)
{
$returnType = '';
$request = $this->deleteSmallAndLightEnrollmentBySellerSKURequest($seller_sku, $marketplace_ids);
return $this->sendRequest($request, SmallAndLightEnrollment::class);
}
/**
* Operation deleteSmallAndLightEnrollmentBySellerSKUAsync.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace in which to remove the item from the Small and Light program. Note: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteSmallAndLightEnrollmentBySellerSKUAsync($seller_sku, $marketplace_ids)
{
return $this->deleteSmallAndLightEnrollmentBySellerSKUAsyncWithHttpInfo($seller_sku, $marketplace_ids)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation deleteSmallAndLightEnrollmentBySellerSKUAsyncWithHttpInfo.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace in which to remove the item from the Small and Light program. Note: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function deleteSmallAndLightEnrollmentBySellerSKUAsyncWithHttpInfo($seller_sku, $marketplace_ids)
{
$request = $this->deleteSmallAndLightEnrollmentBySellerSKURequest($seller_sku, $marketplace_ids);
return $this->sendRequestAsync($request, SmallAndLightEnrollment::class);
}
/**
* Create request for operation 'deleteSmallAndLightEnrollmentBySellerSKU'.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace in which to remove the item from the Small and Light program. Note: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function deleteSmallAndLightEnrollmentBySellerSKURequest($seller_sku, $marketplace_ids)
{
// verify the required parameter 'seller_sku' is set
if (null === $seller_sku || (is_array($seller_sku) && 0 === count($seller_sku))) {
throw new \InvalidArgumentException('Missing the required parameter $seller_sku when calling deleteSmallAndLightEnrollmentBySellerSKU');
}
// verify the required parameter 'marketplace_ids' is set
if (null === $marketplace_ids || (is_array($marketplace_ids) && 0 === count($marketplace_ids))) {
throw new \InvalidArgumentException('Missing the required parameter $marketplace_ids when calling deleteSmallAndLightEnrollmentBySellerSKU');
}
$resourcePath = '/fba/smallAndLight/v1/enrollments/{sellerSKU}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (is_array($marketplace_ids)) {
$marketplace_ids = ObjectSerializer::serializeCollection($marketplace_ids, 'csv', true);
}
if (null !== $marketplace_ids) {
$queryParams['marketplaceIds'] = ObjectSerializer::toQueryValue($marketplace_ids);
}
// path params
if (null !== $seller_sku) {
$resourcePath = str_replace(
'{'.'sellerSKU'.'}',
ObjectSerializer::toPathValue($seller_sku),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'DELETE', $httpBody);
}
/**
* Operation getSmallAndLightEligibilityBySellerSKU.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace for which the eligibility status is retrieved. NOTE: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightEligibility
*/
public function getSmallAndLightEligibilityBySellerSKU($seller_sku, $marketplace_ids)
{
list($response) = $this->getSmallAndLightEligibilityBySellerSKUWithHttpInfo($seller_sku, $marketplace_ids);
return $response;
}
/**
* Operation getSmallAndLightEligibilityBySellerSKUWithHttpInfo.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace for which the eligibility status is retrieved. NOTE: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightEligibility, HTTP status code, HTTP response headers (array of strings)
*/
public function getSmallAndLightEligibilityBySellerSKUWithHttpInfo($seller_sku, $marketplace_ids)
{
$request = $this->getSmallAndLightEligibilityBySellerSKURequest($seller_sku, $marketplace_ids);
return $this->sendRequest($request, SmallAndLightEligibility::class);
}
/**
* Operation getSmallAndLightEligibilityBySellerSKUAsync.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace for which the eligibility status is retrieved. NOTE: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSmallAndLightEligibilityBySellerSKUAsync($seller_sku, $marketplace_ids)
{
return $this->getSmallAndLightEligibilityBySellerSKUAsyncWithHttpInfo($seller_sku, $marketplace_ids)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSmallAndLightEligibilityBySellerSKUAsyncWithHttpInfo.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace for which the eligibility status is retrieved. NOTE: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSmallAndLightEligibilityBySellerSKUAsyncWithHttpInfo($seller_sku, $marketplace_ids)
{
$request = $this->getSmallAndLightEligibilityBySellerSKURequest($seller_sku, $marketplace_ids);
return $this->sendRequestAsync($request, SmallAndLightEligibility::class);
}
/**
* Create request for operation 'getSmallAndLightEligibilityBySellerSKU'.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace for which the eligibility status is retrieved. NOTE: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getSmallAndLightEligibilityBySellerSKURequest($seller_sku, $marketplace_ids)
{
// verify the required parameter 'seller_sku' is set
if (null === $seller_sku || (is_array($seller_sku) && 0 === count($seller_sku))) {
throw new \InvalidArgumentException('Missing the required parameter $seller_sku when calling getSmallAndLightEligibilityBySellerSKU');
}
// verify the required parameter 'marketplace_ids' is set
if (null === $marketplace_ids || (is_array($marketplace_ids) && 0 === count($marketplace_ids))) {
throw new \InvalidArgumentException('Missing the required parameter $marketplace_ids when calling getSmallAndLightEligibilityBySellerSKU');
}
$resourcePath = '/fba/smallAndLight/v1/eligibilities/{sellerSKU}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (is_array($marketplace_ids)) {
$marketplace_ids = ObjectSerializer::serializeCollection($marketplace_ids, 'csv', true);
}
if (null !== $marketplace_ids) {
$queryParams['marketplaceIds'] = ObjectSerializer::toQueryValue($marketplace_ids);
}
// path params
if (null !== $seller_sku) {
$resourcePath = str_replace(
'{'.'sellerSKU'.'}',
ObjectSerializer::toPathValue($seller_sku),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getSmallAndLightEnrollmentBySellerSKU.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace for which the enrollment status is retrieved. Note: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightEnrollment
*/
public function getSmallAndLightEnrollmentBySellerSKU($seller_sku, $marketplace_ids)
{
list($response) = $this->getSmallAndLightEnrollmentBySellerSKUWithHttpInfo($seller_sku, $marketplace_ids);
return $response;
}
/**
* Operation getSmallAndLightEnrollmentBySellerSKUWithHttpInfo.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace for which the enrollment status is retrieved. Note: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightEnrollment, HTTP status code, HTTP response headers (array of strings)
*/
public function getSmallAndLightEnrollmentBySellerSKUWithHttpInfo($seller_sku, $marketplace_ids)
{
$request = $this->getSmallAndLightEnrollmentBySellerSKURequest($seller_sku, $marketplace_ids);
return $this->sendRequest($request, SmallAndLightEnrollment::class);
}
/**
* Operation getSmallAndLightEnrollmentBySellerSKUAsync.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace for which the enrollment status is retrieved. Note: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSmallAndLightEnrollmentBySellerSKUAsync($seller_sku, $marketplace_ids)
{
return $this->getSmallAndLightEnrollmentBySellerSKUAsyncWithHttpInfo($seller_sku, $marketplace_ids)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSmallAndLightEnrollmentBySellerSKUAsyncWithHttpInfo.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace for which the enrollment status is retrieved. Note: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSmallAndLightEnrollmentBySellerSKUAsyncWithHttpInfo($seller_sku, $marketplace_ids)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightEnrollment';
$request = $this->getSmallAndLightEnrollmentBySellerSKURequest($seller_sku, $marketplace_ids);
return $this->sendRequestAsync($request, SmallAndLightEnrollment::class);
}
/**
* Create request for operation 'getSmallAndLightEnrollmentBySellerSKU'.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace for which the enrollment status is retrieved. Note: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getSmallAndLightEnrollmentBySellerSKURequest($seller_sku, $marketplace_ids)
{
// verify the required parameter 'seller_sku' is set
if (null === $seller_sku || (is_array($seller_sku) && 0 === count($seller_sku))) {
throw new \InvalidArgumentException('Missing the required parameter $seller_sku when calling getSmallAndLightEnrollmentBySellerSKU');
}
// verify the required parameter 'marketplace_ids' is set
if (null === $marketplace_ids || (is_array($marketplace_ids) && 0 === count($marketplace_ids))) {
throw new \InvalidArgumentException('Missing the required parameter $marketplace_ids when calling getSmallAndLightEnrollmentBySellerSKU');
}
$resourcePath = '/fba/smallAndLight/v1/enrollments/{sellerSKU}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (is_array($marketplace_ids)) {
$marketplace_ids = ObjectSerializer::serializeCollection($marketplace_ids, 'csv', true);
}
if (null !== $marketplace_ids) {
$queryParams['marketplaceIds'] = ObjectSerializer::toQueryValue($marketplace_ids);
}
// path params
if (null !== $seller_sku) {
$resourcePath = str_replace(
'{'.'sellerSKU'.'}',
ObjectSerializer::toPathValue($seller_sku),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getSmallAndLightFeePreview.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightFeePreviewRequest $body body (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightFeePreviews
*/
public function getSmallAndLightFeePreview($body)
{
list($response) = $this->getSmallAndLightFeePreviewWithHttpInfo($body);
return $response;
}
/**
* Operation getSmallAndLightFeePreviewWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightFeePreviewRequest $body (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightFeePreviews, HTTP status code, HTTP response headers (array of strings)
*/
public function getSmallAndLightFeePreviewWithHttpInfo($body)
{
$request = $this->getSmallAndLightFeePreviewRequest($body);
return $this->sendRequest($request, SmallAndLightFeePreviews::class);
}
/**
* Operation getSmallAndLightFeePreviewAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightFeePreviewRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSmallAndLightFeePreviewAsync($body)
{
return $this->getSmallAndLightFeePreviewAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSmallAndLightFeePreviewAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightFeePreviewRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSmallAndLightFeePreviewAsyncWithHttpInfo($body)
{
$request = $this->getSmallAndLightFeePreviewRequest($body);
return $this->sendRequestAsync($request, SmallAndLightFeePreviews::class);
}
/**
* Create request for operation 'getSmallAndLightFeePreview'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightFeePreviewRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getSmallAndLightFeePreviewRequest($body)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling getSmallAndLightFeePreview');
}
$resourcePath = '/fba/smallAndLight/v1/feePreviews';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation putSmallAndLightEnrollmentBySellerSKU.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace in which to enroll the item. Note: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightEnrollment
*/
public function putSmallAndLightEnrollmentBySellerSKU($seller_sku, $marketplace_ids)
{
list($response) = $this->putSmallAndLightEnrollmentBySellerSKUWithHttpInfo($seller_sku, $marketplace_ids);
return $response;
}
/**
* Operation putSmallAndLightEnrollmentBySellerSKUWithHttpInfo.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace in which to enroll the item. Note: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FbaSmallAndLight\SmallAndLightEnrollment, HTTP status code, HTTP response headers (array of strings)
*/
public function putSmallAndLightEnrollmentBySellerSKUWithHttpInfo($seller_sku, $marketplace_ids)
{
$request = $this->putSmallAndLightEnrollmentBySellerSKURequest($seller_sku, $marketplace_ids);
return $this->sendRequest($request, SmallAndLightEnrollment::class);
}
/**
* Operation putSmallAndLightEnrollmentBySellerSKUAsync.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace in which to enroll the item. Note: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function putSmallAndLightEnrollmentBySellerSKUAsync($seller_sku, $marketplace_ids)
{
return $this->putSmallAndLightEnrollmentBySellerSKUAsyncWithHttpInfo($seller_sku, $marketplace_ids)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation putSmallAndLightEnrollmentBySellerSKUAsyncWithHttpInfo.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace in which to enroll the item. Note: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function putSmallAndLightEnrollmentBySellerSKUAsyncWithHttpInfo($seller_sku, $marketplace_ids)
{
$request = $this->putSmallAndLightEnrollmentBySellerSKURequest($seller_sku, $marketplace_ids);
return $this->sendRequestAsync($request, SmallAndLightEnrollment::class);
}
/**
* Create request for operation 'putSmallAndLightEnrollmentBySellerSKU'.
*
* @param string $seller_sku The seller SKU that identifies the item. (required)
* @param string[] $marketplace_ids The marketplace in which to enroll the item. Note: Accepts a single marketplace only. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function putSmallAndLightEnrollmentBySellerSKURequest($seller_sku, $marketplace_ids)
{
// verify the required parameter 'seller_sku' is set
if (null === $seller_sku || (is_array($seller_sku) && 0 === count($seller_sku))) {
throw new \InvalidArgumentException('Missing the required parameter $seller_sku when calling putSmallAndLightEnrollmentBySellerSKU');
}
// verify the required parameter 'marketplace_ids' is set
if (null === $marketplace_ids || (is_array($marketplace_ids) && 0 === count($marketplace_ids))) {
throw new \InvalidArgumentException('Missing the required parameter $marketplace_ids when calling putSmallAndLightEnrollmentBySellerSKU');
}
$resourcePath = '/fba/smallAndLight/v1/enrollments/{sellerSKU}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (is_array($marketplace_ids)) {
$marketplace_ids = ObjectSerializer::serializeCollection($marketplace_ids, 'csv', true);
}
if (null !== $marketplace_ids) {
$queryParams['marketplaceIds'] = ObjectSerializer::toQueryValue($marketplace_ids);
}
// path params
if (null !== $seller_sku) {
$resourcePath = str_replace(
'{'.'sellerSKU'.'}',
ObjectSerializer::toPathValue($seller_sku),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'PUT', $httpBody);
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/SellersApi.php | lib/Api/SellersApi.php | <?php
/**
* SellersApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Sellers.
*
* The Selling Partner API for Sellers lets you retrieve information on behalf of sellers about their seller account, such as the marketplaces they participate in. Along with listing the marketplaces that a seller can sell in, the API also provides additional information about the marketplace such as the default language and the default currency. The API also provides seller-specific information such as whether the seller has suspended listings in that marketplace.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\Sellers\GetMarketplaceParticipationsResponse;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Psr7\Request;
/**
* SellersApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class SellersApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation getMarketplaceParticipations.
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Sellers\GetMarketplaceParticipationsResponse
*/
public function getMarketplaceParticipations()
{
list($response) = $this->getMarketplaceParticipationsWithHttpInfo();
return $response;
}
/**
* Operation getMarketplaceParticipationsWithHttpInfo.
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Sellers\GetMarketplaceParticipationsResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getMarketplaceParticipationsWithHttpInfo()
{
$request = $this->getMarketplaceParticipationsRequest();
return $this->sendRequest($request, GetMarketplaceParticipationsResponse::class);
}
/**
* Operation getMarketplaceParticipationsAsync.
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getMarketplaceParticipationsAsync()
{
return $this->getMarketplaceParticipationsAsyncWithHttpInfo()
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getMarketplaceParticipationsAsyncWithHttpInfo.
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getMarketplaceParticipationsAsyncWithHttpInfo()
{
$request = $this->getMarketplaceParticipationsRequest();
return $this->sendRequest($request, GetMarketplaceParticipationsResponse::class);
}
/**
* Create request for operation 'getMarketplaceParticipations'.
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getMarketplaceParticipationsRequest()
{
$resourcePath = '/sellers/v1/marketplaceParticipations';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/SolicitationsApi.php | lib/Api/SolicitationsApi.php | <?php
/**
* SolicitationsApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Solicitations.
*
* With the Solicitations API you can build applications that send non-critical solicitations to buyers. You can get a list of solicitation types that are available for an order that you specify, then call an operation that sends a solicitation to the buyer for that order. Buyers cannot respond to solicitations sent by this API, and these solicitations do not appear in the Messaging section of Seller Central or in the recipient's Message Center. The Solicitations API returns responses that are formed according to the <a href=https://tools.ietf.org/html/draft-kelly-json-hal-08>JSON Hypertext Application Language</a> (HAL) standard.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\Solicitations\CreateProductReviewAndSellerFeedbackSolicitationResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Solicitations\GetSolicitationActionsForOrderResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Psr7\Request;
/**
* SolicitationsApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class SolicitationsApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation createProductReviewAndSellerFeedbackSolicitation.
*
* @param string $amazon_order_id An Amazon order identifier. This specifies the order for which a solicitation is sent. (required)
* @param string[] $marketplace_ids A marketplace identifier. This specifies the marketplace in which the order was placed. Only one marketplace can be specified. (required)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Solicitations\CreateProductReviewAndSellerFeedbackSolicitationResponse
*/
public function createProductReviewAndSellerFeedbackSolicitation($amazon_order_id, $marketplace_ids)
{
list($response) = $this->createProductReviewAndSellerFeedbackSolicitationWithHttpInfo($amazon_order_id, $marketplace_ids);
return $response;
}
/**
* Operation createProductReviewAndSellerFeedbackSolicitationWithHttpInfo.
*
* @param string $amazon_order_id An Amazon order identifier. This specifies the order for which a solicitation is sent. (required)
* @param string[] $marketplace_ids A marketplace identifier. This specifies the marketplace in which the order was placed. Only one marketplace can be specified. (required)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Solicitations\CreateProductReviewAndSellerFeedbackSolicitationResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function createProductReviewAndSellerFeedbackSolicitationWithHttpInfo($amazon_order_id, $marketplace_ids)
{
$request = $this->createProductReviewAndSellerFeedbackSolicitationRequest($amazon_order_id, $marketplace_ids);
return $this->sendRequest($request, CreateProductReviewAndSellerFeedbackSolicitationResponse::class);
}
/**
* Operation createProductReviewAndSellerFeedbackSolicitationAsync.
*
* @param string $amazon_order_id An Amazon order identifier. This specifies the order for which a solicitation is sent. (required)
* @param string[] $marketplace_ids A marketplace identifier. This specifies the marketplace in which the order was placed. Only one marketplace can be specified. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createProductReviewAndSellerFeedbackSolicitationAsync($amazon_order_id, $marketplace_ids)
{
return $this->createProductReviewAndSellerFeedbackSolicitationAsyncWithHttpInfo($amazon_order_id, $marketplace_ids)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createProductReviewAndSellerFeedbackSolicitationAsyncWithHttpInfo.
*
* @param string $amazon_order_id An Amazon order identifier. This specifies the order for which a solicitation is sent. (required)
* @param string[] $marketplace_ids A marketplace identifier. This specifies the marketplace in which the order was placed. Only one marketplace can be specified. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createProductReviewAndSellerFeedbackSolicitationAsyncWithHttpInfo($amazon_order_id, $marketplace_ids)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Solicitations\CreateProductReviewAndSellerFeedbackSolicitationResponse';
$request = $this->createProductReviewAndSellerFeedbackSolicitationRequest($amazon_order_id, $marketplace_ids);
return $this->sendRequestAsync($request, CreateProductReviewAndSellerFeedbackSolicitationResponse::class);
}
/**
* Create request for operation 'createProductReviewAndSellerFeedbackSolicitation'.
*
* @param string $amazon_order_id An Amazon order identifier. This specifies the order for which a solicitation is sent. (required)
* @param string[] $marketplace_ids A marketplace identifier. This specifies the marketplace in which the order was placed. Only one marketplace can be specified. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function createProductReviewAndSellerFeedbackSolicitationRequest($amazon_order_id, $marketplace_ids)
{
// verify the required parameter 'amazon_order_id' is set
if (null === $amazon_order_id || (is_array($amazon_order_id) && 0 === count($amazon_order_id))) {
throw new \InvalidArgumentException('Missing the required parameter $amazon_order_id when calling createProductReviewAndSellerFeedbackSolicitation');
}
// verify the required parameter 'marketplace_ids' is set
if (null === $marketplace_ids || (is_array($marketplace_ids) && 0 === count($marketplace_ids))) {
throw new \InvalidArgumentException('Missing the required parameter $marketplace_ids when calling createProductReviewAndSellerFeedbackSolicitation');
}
$resourcePath = '/solicitations/v1/orders/{amazonOrderId}/solicitations/productReviewAndSellerFeedback';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (is_array($marketplace_ids)) {
$marketplace_ids = ObjectSerializer::serializeCollection($marketplace_ids, 'csv', true);
}
if (null !== $marketplace_ids) {
$queryParams['marketplaceIds'] = ObjectSerializer::toQueryValue($marketplace_ids);
}
// path params
if (null !== $amazon_order_id) {
$resourcePath = str_replace(
'{'.'amazonOrderId'.'}',
ObjectSerializer::toPathValue($amazon_order_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation getSolicitationActionsForOrder.
*
* @param string $amazon_order_id An Amazon order identifier. This specifies the order for which you want a list of available solicitation types. (required)
* @param string[] $marketplace_ids A marketplace identifier. This specifies the marketplace in which the order was placed. Only one marketplace can be specified. (required)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Solicitations\GetSolicitationActionsForOrderResponse
*/
public function getSolicitationActionsForOrder($amazon_order_id, $marketplace_ids)
{
list($response) = $this->getSolicitationActionsForOrderWithHttpInfo($amazon_order_id, $marketplace_ids);
return $response;
}
/**
* Operation getSolicitationActionsForOrderWithHttpInfo.
*
* @param string $amazon_order_id An Amazon order identifier. This specifies the order for which you want a list of available solicitation types. (required)
* @param string[] $marketplace_ids A marketplace identifier. This specifies the marketplace in which the order was placed. Only one marketplace can be specified. (required)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Solicitations\GetSolicitationActionsForOrderResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getSolicitationActionsForOrderWithHttpInfo($amazon_order_id, $marketplace_ids)
{
$request = $this->getSolicitationActionsForOrderRequest($amazon_order_id, $marketplace_ids);
return $this->sendRequest($request, GetSolicitationActionsForOrderResponse::class);
}
/**
* Operation getSolicitationActionsForOrderAsync.
*
* @param string $amazon_order_id An Amazon order identifier. This specifies the order for which you want a list of available solicitation types. (required)
* @param string[] $marketplace_ids A marketplace identifier. This specifies the marketplace in which the order was placed. Only one marketplace can be specified. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSolicitationActionsForOrderAsync($amazon_order_id, $marketplace_ids)
{
return $this->getSolicitationActionsForOrderAsyncWithHttpInfo($amazon_order_id, $marketplace_ids)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getSolicitationActionsForOrderAsyncWithHttpInfo.
*
* @param string $amazon_order_id An Amazon order identifier. This specifies the order for which you want a list of available solicitation types. (required)
* @param string[] $marketplace_ids A marketplace identifier. This specifies the marketplace in which the order was placed. Only one marketplace can be specified. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getSolicitationActionsForOrderAsyncWithHttpInfo($amazon_order_id, $marketplace_ids)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Solicitations\GetSolicitationActionsForOrderResponse';
$request = $this->getSolicitationActionsForOrderRequest($amazon_order_id, $marketplace_ids);
return $this->sendRequestAsync($request, GetSolicitationActionsForOrderResponse::class);
}
/**
* Create request for operation 'getSolicitationActionsForOrder'.
*
* @param string $amazon_order_id An Amazon order identifier. This specifies the order for which you want a list of available solicitation types. (required)
* @param string[] $marketplace_ids A marketplace identifier. This specifies the marketplace in which the order was placed. Only one marketplace can be specified. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getSolicitationActionsForOrderRequest($amazon_order_id, $marketplace_ids)
{
// verify the required parameter 'amazon_order_id' is set
if (null === $amazon_order_id || (is_array($amazon_order_id) && 0 === count($amazon_order_id))) {
throw new \InvalidArgumentException('Missing the required parameter $amazon_order_id when calling getSolicitationActionsForOrder');
}
// verify the required parameter 'marketplace_ids' is set
if (null === $marketplace_ids || (is_array($marketplace_ids) && 0 === count($marketplace_ids))) {
throw new \InvalidArgumentException('Missing the required parameter $marketplace_ids when calling getSolicitationActionsForOrder');
}
$resourcePath = '/solicitations/v1/orders/{amazonOrderId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (is_array($marketplace_ids)) {
$marketplace_ids = ObjectSerializer::serializeCollection($marketplace_ids, 'csv', true);
}
if (null !== $marketplace_ids) {
$queryParams['marketplaceIds'] = ObjectSerializer::toQueryValue($marketplace_ids);
}
// path params
if (null !== $amazon_order_id) {
$resourcePath = str_replace(
'{'.'amazonOrderId'.'}',
ObjectSerializer::toPathValue($amazon_order_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/ProductPricingApi.php | lib/Api/ProductPricingApi.php | <?php
/**
* ProductPricingApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Pricing.
*
* The Selling Partner API for Pricing helps you programmatically retrieve product pricing and offer information for Amazon Marketplace products.
*
* OpenAPI spec version: v0
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\ProductPricing\GetOffersResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\ProductPricing\GetPricingResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Psr7\Request;
/**
* ProductPricingApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class ProductPricingApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation getCompetitivePricing.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_type Indicates whether ASIN values or seller SKU values are used to identify items. If you specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you provide in the Skus parameter. Possible values: Asin, Sku. (required)
* @param string[] $asins A list of up to twenty Amazon Standard Identification Number (ASIN) values used to identify items in the given marketplace. (optional)
* @param string[] $skus A list of up to twenty seller SKU values used to identify items in the given marketplace. (optional)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\ProductPricing\GetPricingResponse
*/
public function getCompetitivePricing($marketplace_id, $item_type, $asins = null, $skus = null)
{
list($response) = $this->getCompetitivePricingWithHttpInfo($marketplace_id, $item_type, $asins, $skus);
return $response;
}
/**
* Operation getCompetitivePricingWithHttpInfo.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_type Indicates whether ASIN values or seller SKU values are used to identify items. If you specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you provide in the Skus parameter. Possible values: Asin, Sku. (required)
* @param string[] $asins A list of up to twenty Amazon Standard Identification Number (ASIN) values used to identify items in the given marketplace. (optional)
* @param string[] $skus A list of up to twenty seller SKU values used to identify items in the given marketplace. (optional)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\ProductPricing\GetPricingResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getCompetitivePricingWithHttpInfo($marketplace_id, $item_type, $asins = null, $skus = null)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\ProductPricing\GetPricingResponse';
$request = $this->getCompetitivePricingRequest($marketplace_id, $item_type, $asins, $skus);
return $this->sendRequest($request, GetPricingResponse::class);
}
/**
* Operation getCompetitivePricingAsync.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_type Indicates whether ASIN values or seller SKU values are used to identify items. If you specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you provide in the Skus parameter. Possible values: Asin, Sku. (required)
* @param string[] $asins A list of up to twenty Amazon Standard Identification Number (ASIN) values used to identify items in the given marketplace. (optional)
* @param string[] $skus A list of up to twenty seller SKU values used to identify items in the given marketplace. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getCompetitivePricingAsync($marketplace_id, $item_type, $asins = null, $skus = null)
{
return $this->getCompetitivePricingAsyncWithHttpInfo($marketplace_id, $item_type, $asins, $skus)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getCompetitivePricingAsyncWithHttpInfo.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_type Indicates whether ASIN values or seller SKU values are used to identify items. If you specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you provide in the Skus parameter. Possible values: Asin, Sku. (required)
* @param string[] $asins A list of up to twenty Amazon Standard Identification Number (ASIN) values used to identify items in the given marketplace. (optional)
* @param string[] $skus A list of up to twenty seller SKU values used to identify items in the given marketplace. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getCompetitivePricingAsyncWithHttpInfo($marketplace_id, $item_type, $asins = null, $skus = null)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\ProductPricing\GetPricingResponse';
$request = $this->getCompetitivePricingRequest($marketplace_id, $item_type, $asins, $skus);
return $this->sendRequestAsync($request, GetPricingResponse::class);
}
/**
* Create request for operation 'getCompetitivePricing'.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_type Indicates whether ASIN values or seller SKU values are used to identify items. If you specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you provide in the Skus parameter. Possible values: Asin, Sku. (required)
* @param string[] $asins A list of up to twenty Amazon Standard Identification Number (ASIN) values used to identify items in the given marketplace. (optional)
* @param string[] $skus A list of up to twenty seller SKU values used to identify items in the given marketplace. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getCompetitivePricingRequest($marketplace_id, $item_type, $asins = null, $skus = null)
{
// verify the required parameter 'marketplace_id' is set
if (null === $marketplace_id || (is_array($marketplace_id) && 0 === count($marketplace_id))) {
throw new \InvalidArgumentException('Missing the required parameter $marketplace_id when calling getCompetitivePricing');
}
// verify the required parameter 'item_type' is set
if (null === $item_type || (is_array($item_type) && 0 === count($item_type))) {
throw new \InvalidArgumentException('Missing the required parameter $item_type when calling getCompetitivePricing');
}
$resourcePath = '/products/pricing/v0/competitivePrice';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $marketplace_id) {
$queryParams['MarketplaceId'] = ObjectSerializer::toQueryValue($marketplace_id);
}
// query params
if (is_array($asins)) {
$asins = ObjectSerializer::serializeCollection($asins, 'csv', true);
}
if (null !== $asins) {
$queryParams['Asins'] = ObjectSerializer::toQueryValue($asins);
}
// query params
if (is_array($skus)) {
$skus = ObjectSerializer::serializeCollection($skus, 'csv', true);
}
if (null !== $skus) {
$queryParams['Skus'] = ObjectSerializer::toQueryValue($skus);
}
// query params
if (null !== $item_type) {
$queryParams['ItemType'] = ObjectSerializer::toQueryValue($item_type);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getItemOffers.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_condition Filters the offer listings to be considered based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (required)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\ProductPricing\GetOffersResponse
*/
public function getItemOffers($marketplace_id, $item_condition, $asin)
{
list($response) = $this->getItemOffersWithHttpInfo($marketplace_id, $item_condition, $asin);
return $response;
}
/**
* Operation getItemOffersWithHttpInfo.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_condition Filters the offer listings to be considered based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (required)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\ProductPricing\GetOffersResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getItemOffersWithHttpInfo($marketplace_id, $item_condition, $asin)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\ProductPricing\GetOffersResponse';
$request = $this->getItemOffersRequest($marketplace_id, $item_condition, $asin);
return $this->sendRequest($request, GetOffersResponse::class);
}
/**
* Operation getItemOffersAsync.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_condition Filters the offer listings to be considered based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getItemOffersAsync($marketplace_id, $item_condition, $asin)
{
return $this->getItemOffersAsyncWithHttpInfo($marketplace_id, $item_condition, $asin)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getItemOffersAsyncWithHttpInfo.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_condition Filters the offer listings to be considered based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getItemOffersAsyncWithHttpInfo($marketplace_id, $item_condition, $asin)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\ProductPricing\GetOffersResponse';
$request = $this->getItemOffersRequest($marketplace_id, $item_condition, $asin);
return $this->sendRequestAsync($request, GetOffersResponse::class);
}
/**
* Create request for operation 'getItemOffers'.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_condition Filters the offer listings to be considered based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getItemOffersRequest($marketplace_id, $item_condition, $asin)
{
// verify the required parameter 'marketplace_id' is set
if (null === $marketplace_id || (is_array($marketplace_id) && 0 === count($marketplace_id))) {
throw new \InvalidArgumentException('Missing the required parameter $marketplace_id when calling getItemOffers');
}
// verify the required parameter 'item_condition' is set
if (null === $item_condition || (is_array($item_condition) && 0 === count($item_condition))) {
throw new \InvalidArgumentException('Missing the required parameter $item_condition when calling getItemOffers');
}
// verify the required parameter 'asin' is set
if (null === $asin || (is_array($asin) && 0 === count($asin))) {
throw new \InvalidArgumentException('Missing the required parameter $asin when calling getItemOffers');
}
$resourcePath = '/products/pricing/v0/items/{Asin}/offers';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $marketplace_id) {
$queryParams['MarketplaceId'] = ObjectSerializer::toQueryValue($marketplace_id);
}
// query params
if (null !== $item_condition) {
$queryParams['ItemCondition'] = ObjectSerializer::toQueryValue($item_condition);
}
// path params
if (null !== $asin) {
$resourcePath = str_replace(
'{'.'Asin'.'}',
ObjectSerializer::toPathValue($asin),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getListingOffers.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_condition Filters the offer listings based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. (required)
* @param string $seller_sku Identifies an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (required)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\ProductPricing\GetOffersResponse
*/
public function getListingOffers($marketplace_id, $item_condition, $seller_sku)
{
list($response) = $this->getListingOffersWithHttpInfo($marketplace_id, $item_condition, $seller_sku);
return $response;
}
/**
* Operation getListingOffersWithHttpInfo.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_condition Filters the offer listings based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. (required)
* @param string $seller_sku Identifies an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (required)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\ProductPricing\GetOffersResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getListingOffersWithHttpInfo($marketplace_id, $item_condition, $seller_sku)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\ProductPricing\GetOffersResponse';
$request = $this->getListingOffersRequest($marketplace_id, $item_condition, $seller_sku);
return $this->sendRequest($request, GetOffersResponse::class);
}
/**
* Operation getListingOffersAsync.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_condition Filters the offer listings based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. (required)
* @param string $seller_sku Identifies an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getListingOffersAsync($marketplace_id, $item_condition, $seller_sku)
{
return $this->getListingOffersAsyncWithHttpInfo($marketplace_id, $item_condition, $seller_sku)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getListingOffersAsyncWithHttpInfo.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_condition Filters the offer listings based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. (required)
* @param string $seller_sku Identifies an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getListingOffersAsyncWithHttpInfo($marketplace_id, $item_condition, $seller_sku)
{
$request = $this->getListingOffersRequest($marketplace_id, $item_condition, $seller_sku);
return $this->sendRequestAsync($request, GetOffersResponse::class);
}
/**
* Create request for operation 'getListingOffers'.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_condition Filters the offer listings based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. (required)
* @param string $seller_sku Identifies an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getListingOffersRequest($marketplace_id, $item_condition, $seller_sku)
{
// verify the required parameter 'marketplace_id' is set
if (null === $marketplace_id || (is_array($marketplace_id) && 0 === count($marketplace_id))) {
throw new \InvalidArgumentException('Missing the required parameter $marketplace_id when calling getListingOffers');
}
// verify the required parameter 'item_condition' is set
if (null === $item_condition || (is_array($item_condition) && 0 === count($item_condition))) {
throw new \InvalidArgumentException('Missing the required parameter $item_condition when calling getListingOffers');
}
// verify the required parameter 'seller_sku' is set
if (null === $seller_sku || (is_array($seller_sku) && 0 === count($seller_sku))) {
throw new \InvalidArgumentException('Missing the required parameter $seller_sku when calling getListingOffers');
}
$resourcePath = '/products/pricing/v0/listings/{SellerSKU}/offers';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $marketplace_id) {
$queryParams['MarketplaceId'] = ObjectSerializer::toQueryValue($marketplace_id);
}
// query params
if (null !== $item_condition) {
$queryParams['ItemCondition'] = ObjectSerializer::toQueryValue($item_condition);
}
// path params
if (null !== $seller_sku) {
$resourcePath = str_replace(
'{'.'SellerSKU'.'}',
ObjectSerializer::toPathValue($seller_sku),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getPricing.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_type Indicates whether ASIN values or seller SKU values are used to identify items. If you specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you provide in the Skus parameter. (required)
* @param string[] $asins A list of up to twenty Amazon Standard Identification Number (ASIN) values used to identify items in the given marketplace. (optional)
* @param string[] $skus A list of up to twenty seller SKU values used to identify items in the given marketplace. (optional)
* @param string $item_condition Filters the offer listings based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. (optional)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\ProductPricing\GetPricingResponse
*/
public function getPricing($marketplace_id, $item_type, $asins = null, $skus = null, $item_condition = null)
{
list($response) = $this->getPricingWithHttpInfo($marketplace_id, $item_type, $asins, $skus, $item_condition);
return $response;
}
/**
* Operation getPricingWithHttpInfo.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_type Indicates whether ASIN values or seller SKU values are used to identify items. If you specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you provide in the Skus parameter. (required)
* @param string[] $asins A list of up to twenty Amazon Standard Identification Number (ASIN) values used to identify items in the given marketplace. (optional)
* @param string[] $skus A list of up to twenty seller SKU values used to identify items in the given marketplace. (optional)
* @param string $item_condition Filters the offer listings based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. (optional)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\ProductPricing\GetPricingResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getPricingWithHttpInfo($marketplace_id, $item_type, $asins = null, $skus = null, $item_condition = null)
{
$request = $this->getPricingRequest($marketplace_id, $item_type, $asins, $skus, $item_condition);
return $this->sendRequest($request, GetPricingResponse::class);
}
/**
* Operation getPricingAsync.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_type Indicates whether ASIN values or seller SKU values are used to identify items. If you specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you provide in the Skus parameter. (required)
* @param string[] $asins A list of up to twenty Amazon Standard Identification Number (ASIN) values used to identify items in the given marketplace. (optional)
* @param string[] $skus A list of up to twenty seller SKU values used to identify items in the given marketplace. (optional)
* @param string $item_condition Filters the offer listings based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getPricingAsync($marketplace_id, $item_type, $asins = null, $skus = null, $item_condition = null)
{
return $this->getPricingAsyncWithHttpInfo($marketplace_id, $item_type, $asins, $skus, $item_condition)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getPricingAsyncWithHttpInfo.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_type Indicates whether ASIN values or seller SKU values are used to identify items. If you specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you provide in the Skus parameter. (required)
* @param string[] $asins A list of up to twenty Amazon Standard Identification Number (ASIN) values used to identify items in the given marketplace. (optional)
* @param string[] $skus A list of up to twenty seller SKU values used to identify items in the given marketplace. (optional)
* @param string $item_condition Filters the offer listings based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getPricingAsyncWithHttpInfo($marketplace_id, $item_type, $asins = null, $skus = null, $item_condition = null)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\ProductPricing\GetPricingResponse';
$request = $this->getPricingRequest($marketplace_id, $item_type, $asins, $skus, $item_condition);
return $this->sendRequestAsync($request, GetPricingResponse::class);
}
/**
* Create request for operation 'getPricing'.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which prices are returned. (required)
* @param string $item_type Indicates whether ASIN values or seller SKU values are used to identify items. If you specify Asin, the information in the response will be dependent on the list of Asins you provide in the Asins parameter. If you specify Sku, the information in the response will be dependent on the list of Skus you provide in the Skus parameter. (required)
* @param string[] $asins A list of up to twenty Amazon Standard Identification Number (ASIN) values used to identify items in the given marketplace. (optional)
* @param string[] $skus A list of up to twenty seller SKU values used to identify items in the given marketplace. (optional)
* @param string $item_condition Filters the offer listings based on item condition. Possible values: New, Used, Collectible, Refurbished, Club. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getPricingRequest($marketplace_id, $item_type, $asins = null, $skus = null, $item_condition = null)
{
// verify the required parameter 'marketplace_id' is set
if (null === $marketplace_id || (is_array($marketplace_id) && 0 === count($marketplace_id))) {
throw new \InvalidArgumentException('Missing the required parameter $marketplace_id when calling getPricing');
}
// verify the required parameter 'item_type' is set
if (null === $item_type || (is_array($item_type) && 0 === count($item_type))) {
throw new \InvalidArgumentException('Missing the required parameter $item_type when calling getPricing');
}
$resourcePath = '/products/pricing/v0/price';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $marketplace_id) {
$queryParams['MarketplaceId'] = ObjectSerializer::toQueryValue($marketplace_id);
}
// query params
if (is_array($asins)) {
$asins = ObjectSerializer::serializeCollection($asins, 'csv', true);
}
if (null !== $asins) {
$queryParams['Asins'] = ObjectSerializer::toQueryValue($asins);
}
// query params
if (is_array($skus)) {
$skus = ObjectSerializer::serializeCollection($skus, 'csv', true);
}
if (null !== $skus) {
$queryParams['Skus'] = ObjectSerializer::toQueryValue($skus);
}
// query params
if (null !== $item_type) {
$queryParams['ItemType'] = ObjectSerializer::toQueryValue($item_type);
}
// query params
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | true |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/MerchantFulfillmentApi.php | lib/Api/MerchantFulfillmentApi.php | <?php
/**
* MerchantFulfillmentApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Merchant Fulfillment.
*
* The Selling Partner API for Merchant Fulfillment helps you build applications that let sellers purchase shipping for non-Prime and Prime orders using Amazon’s Buy Shipping Services.
*
* OpenAPI spec version: v0
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\ApiException;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\GetShipmentsResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetAdditionalSellerInputsResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CancelShipmentResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CreateShipmentResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Promise\PromiseInterface;
use InvalidArgumentException;
/**
* MerchantFulfillmentApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class MerchantFulfillmentApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation cancelShipment.
*
* @param string $shipment_id The Amazon-defined shipment identifier for the shipment to cancel. (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\CancelShipmentResponse
*/
public function cancelShipment($shipment_id)
{
list($response) = $this->cancelShipmentWithHttpInfo($shipment_id);
return $response;
}
/**
* Operation cancelShipmentWithHttpInfo.
*
* @param string $shipment_id The Amazon-defined shipment identifier for the shipment to cancel. (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\CancelShipmentResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function cancelShipmentWithHttpInfo($shipment_id)
{
$request = $this->cancelShipmentRequest($shipment_id);
return $this->sendRequest($request, CancelShipmentResponse::class);
}
/**
* Operation cancelShipmentAsync.
*
* @param string $shipment_id The Amazon-defined shipment identifier for the shipment to cancel. (required)
*
* @throws InvalidArgumentException
*
* @return PromiseInterface
*/
public function cancelShipmentAsync($shipment_id)
{
return $this->cancelShipmentAsyncWithHttpInfo($shipment_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation cancelShipmentAsyncWithHttpInfo.
*
* @param string $shipment_id The Amazon-defined shipment identifier for the shipment to cancel. (required)
*
* @throws InvalidArgumentException
*
* @return PromiseInterface
*/
public function cancelShipmentAsyncWithHttpInfo($shipment_id)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\CancelShipmentResponse';
$request = $this->cancelShipmentRequest($shipment_id);
return $this->sendRequestAsync($request, CancelShipmentResponse::class);
}
/**
* Create request for operation 'cancelShipment'.
*
* @param string $shipment_id The Amazon-defined shipment identifier for the shipment to cancel. (required)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function cancelShipmentRequest($shipment_id)
{
// verify the required parameter 'shipment_id' is set
if (null === $shipment_id || (is_array($shipment_id) && 0 === count($shipment_id))) {
throw new InvalidArgumentException('Missing the required parameter $shipment_id when calling cancelShipment');
}
$resourcePath = '/mfn/v0/shipments/{shipmentId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $shipment_id) {
$resourcePath = str_replace(
'{'.'shipmentId'.'}',
ObjectSerializer::toPathValue($shipment_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'DELETE', $httpBody);
}
/**
* Operation cancelShipmentOld.
*
* @param string $shipment_id The Amazon-defined shipment identifier for the shipment to cancel. (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\CancelShipmentResponse
*/
public function cancelShipmentOld($shipment_id)
{
list($response) = $this->cancelShipmentOldWithHttpInfo($shipment_id);
return $response;
}
/**
* Operation cancelShipmentOldWithHttpInfo.
*
* @param string $shipment_id The Amazon-defined shipment identifier for the shipment to cancel. (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\CancelShipmentResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function cancelShipmentOldWithHttpInfo($shipment_id)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\CancelShipmentResponse';
$request = $this->cancelShipmentOldRequest($shipment_id);
return $this->sendRequest($request, CancelShipmentResponse::class);
}
/**
* Operation cancelShipmentOldAsync.
*
* @param string $shipment_id The Amazon-defined shipment identifier for the shipment to cancel. (required)
*
* @throws InvalidArgumentException
*
* @return PromiseInterface
*/
public function cancelShipmentOldAsync($shipment_id)
{
return $this->cancelShipmentOldAsyncWithHttpInfo($shipment_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation cancelShipmentOldAsyncWithHttpInfo.
*
* @param string $shipment_id The Amazon-defined shipment identifier for the shipment to cancel. (required)
*
* @throws InvalidArgumentException
*
* @return PromiseInterface
*/
public function cancelShipmentOldAsyncWithHttpInfo($shipment_id)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\CancelShipmentResponse';
$request = $this->cancelShipmentOldRequest($shipment_id);
return $this->sendRequestAsync($request, CancelShipmentResponse::class);
}
/**
* Create request for operation 'cancelShipmentOld'.
*
* @param string $shipment_id The Amazon-defined shipment identifier for the shipment to cancel. (required)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function cancelShipmentOldRequest($shipment_id)
{
// verify the required parameter 'shipment_id' is set
if (null === $shipment_id || (is_array($shipment_id) && 0 === count($shipment_id))) {
throw new InvalidArgumentException('Missing the required parameter $shipment_id when calling cancelShipmentOld');
}
$resourcePath = '/mfn/v0/shipments/{shipmentId}/cancel';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $shipment_id) {
$resourcePath = str_replace(
'{'.'shipmentId'.'}',
ObjectSerializer::toPathValue($shipment_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'PUT', $httpBody);
}
/**
* Operation createShipment.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\CreateShipmentRequest $body body (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\CreateShipmentResponse
*/
public function createShipment($body)
{
list($response) = $this->createShipmentWithHttpInfo($body);
return $response;
}
/**
* Operation createShipmentWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\CreateShipmentRequest $body (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\CreateShipmentResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function createShipmentWithHttpInfo($body)
{
$request = $this->createShipmentRequest($body);
return $this->sendRequest($request, CreateShipmentResponse::class);
}
/**
* Operation createShipmentAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\CreateShipmentRequest $body (required)
*
* @throws InvalidArgumentException
*
* @return PromiseInterface
*/
public function createShipmentAsync($body)
{
return $this->createShipmentAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createShipmentAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\CreateShipmentRequest $body (required)
*
* @throws InvalidArgumentException
*
* @return PromiseInterface
*/
public function createShipmentAsyncWithHttpInfo($body)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\CreateShipmentResponse';
$request = $this->createShipmentRequest($body);
return $this->sendRequestAsync($request, CreateShipmentResponse::class);
}
/**
* Create request for operation 'createShipment'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\CreateShipmentRequest $body (required)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function createShipmentRequest($body)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new InvalidArgumentException('Missing the required parameter $body when calling createShipment');
}
$resourcePath = '/mfn/v0/shipments';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation getAdditionalSellerInputs.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetAdditionalSellerInputsRequest $body body (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetAdditionalSellerInputsResponse
*/
public function getAdditionalSellerInputs($body)
{
list($response) = $this->getAdditionalSellerInputsWithHttpInfo($body);
return $response;
}
/**
* Operation getAdditionalSellerInputsWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetAdditionalSellerInputsRequest $body (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetAdditionalSellerInputsResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getAdditionalSellerInputsWithHttpInfo($body)
{
$request = $this->getAdditionalSellerInputsRequest($body);
return $this->sendRequest($request, GetAdditionalSellerInputsResponse::class);
}
/**
* Operation getAdditionalSellerInputsAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetAdditionalSellerInputsRequest $body (required)
*
* @throws InvalidArgumentException
*
* @return PromiseInterface
*/
public function getAdditionalSellerInputsAsync($body)
{
return $this->getAdditionalSellerInputsAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAdditionalSellerInputsAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetAdditionalSellerInputsRequest $body (required)
*
* @throws InvalidArgumentException
*
* @return PromiseInterface
*/
public function getAdditionalSellerInputsAsyncWithHttpInfo($body)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetAdditionalSellerInputsResponse';
$request = $this->getAdditionalSellerInputsRequest($body);
return $this->sendRequestAsync($request, GetAdditionalSellerInputsResponse::class);
}
/**
* Create request for operation 'getAdditionalSellerInputs'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetAdditionalSellerInputsRequest $body (required)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getAdditionalSellerInputsRequest($body)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new InvalidArgumentException('Missing the required parameter $body when calling getAdditionalSellerInputs');
}
$resourcePath = '/mfn/v0/additionalSellerInputs';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation getAdditionalSellerInputsOld.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetAdditionalSellerInputsRequest $body body (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetAdditionalSellerInputsResponse
*/
public function getAdditionalSellerInputsOld($body)
{
list($response) = $this->getAdditionalSellerInputsOldWithHttpInfo($body);
return $response;
}
/**
* Operation getAdditionalSellerInputsOldWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetAdditionalSellerInputsRequest $body (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetAdditionalSellerInputsResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getAdditionalSellerInputsOldWithHttpInfo($body)
{
$request = $this->getAdditionalSellerInputsOldRequest($body);
return $this->sendRequest($request, GetAdditionalSellerInputsResponse::class);
}
/**
* Operation getAdditionalSellerInputsOldAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetAdditionalSellerInputsRequest $body (required)
*
* @throws InvalidArgumentException
*
* @return PromiseInterface
*/
public function getAdditionalSellerInputsOldAsync($body)
{
return $this->getAdditionalSellerInputsOldAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAdditionalSellerInputsOldAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetAdditionalSellerInputsRequest $body (required)
*
* @throws InvalidArgumentException
*
* @return PromiseInterface
*/
public function getAdditionalSellerInputsOldAsyncWithHttpInfo($body)
{
$request = $this->getAdditionalSellerInputsOldRequest($body);
return $this->sendRequestAsync($request, GetAdditionalSellerInputsResponse::class);
}
/**
* Create request for operation 'getAdditionalSellerInputsOld'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetAdditionalSellerInputsRequest $body (required)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getAdditionalSellerInputsOldRequest($body)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new InvalidArgumentException('Missing the required parameter $body when calling getAdditionalSellerInputsOld');
}
$resourcePath = '/mfn/v0/sellerInputs';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getEligibleShipmentServices.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesRequest $body body (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesResponse
*/
public function getEligibleShipmentServices($body)
{
list($response) = $this->getEligibleShipmentServicesWithHttpInfo($body);
return $response;
}
/**
* Operation getEligibleShipmentServicesWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesRequest $body (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getEligibleShipmentServicesWithHttpInfo($body)
{
$request = $this->getEligibleShipmentServicesRequest($body);
return $this->sendRequest($request, GetEligibleShipmentServicesResponse::class);
}
/**
* Operation getEligibleShipmentServicesAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesRequest $body (required)
*
* @throws InvalidArgumentException
*
* @return PromiseInterface
*/
public function getEligibleShipmentServicesAsync($body)
{
return $this->getEligibleShipmentServicesAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEligibleShipmentServicesAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesRequest $body (required)
*
* @throws InvalidArgumentException
*
* @return PromiseInterface
*/
public function getEligibleShipmentServicesAsyncWithHttpInfo($body)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesResponse';
$request = $this->getEligibleShipmentServicesRequest($body);
return $this->sendRequestAsync($request, GetEligibleShipmentServicesResponse::class);
}
/**
* Create request for operation 'getEligibleShipmentServices'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesRequest $body (required)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getEligibleShipmentServicesRequest($body)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new InvalidArgumentException('Missing the required parameter $body when calling getEligibleShipmentServices');
}
$resourcePath = '/mfn/v0/eligibleShippingServices';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation getEligibleShipmentServicesOld.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesRequest $body body (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesResponse
*/
public function getEligibleShipmentServicesOld($body)
{
list($response) = $this->getEligibleShipmentServicesOldWithHttpInfo($body);
return $response;
}
/**
* Operation getEligibleShipmentServicesOldWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesRequest $body (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getEligibleShipmentServicesOldWithHttpInfo($body)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesResponse';
$request = $this->getEligibleShipmentServicesOldRequest($body);
return $this->sendRequest($request, GetEligibleShipmentServicesResponse::class);
}
/**
* Operation getEligibleShipmentServicesOldAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesRequest $body (required)
*
* @throws InvalidArgumentException
*
* @return PromiseInterface
*/
public function getEligibleShipmentServicesOldAsync($body)
{
return $this->getEligibleShipmentServicesOldAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getEligibleShipmentServicesOldAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesRequest $body (required)
*
* @throws InvalidArgumentException
*
* @return PromiseInterface
*/
public function getEligibleShipmentServicesOldAsyncWithHttpInfo($body)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesResponse';
$request = $this->getEligibleShipmentServicesOldRequest($body);
return $this->sendRequest($request, GetEligibleShipmentServicesResponse::class);
}
/**
* Create request for operation 'getEligibleShipmentServicesOld'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetEligibleShipmentServicesRequest $body (required)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getEligibleShipmentServicesOldRequest($body)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new InvalidArgumentException('Missing the required parameter $body when calling getEligibleShipmentServicesOld');
}
$resourcePath = '/mfn/v0/eligibleServices';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation getShipment.
*
* @param string $shipment_id The Amazon-defined shipment identifier for the shipment. (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetShipmentResponse
*/
public function getShipment($shipment_id)
{
list($response) = $this->getShipmentWithHttpInfo($shipment_id);
return $response;
}
/**
* Operation getShipmentWithHttpInfo.
*
* @param string $shipment_id The Amazon-defined shipment identifier for the shipment. (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\MerchantFulfillment\GetShipmentResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getShipmentWithHttpInfo($shipment_id)
{
$request = $this->getShipmentRequest($shipment_id);
return $this->sendRequest($request, GetShipmentsResponse::class);
}
/**
* Operation getShipmentAsync.
*
* @param string $shipment_id The Amazon-defined shipment identifier for the shipment. (required)
*
* @throws InvalidArgumentException
*
* @return PromiseInterface
*/
public function getShipmentAsync($shipment_id)
{
return $this->getShipmentAsyncWithHttpInfo($shipment_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getShipmentAsyncWithHttpInfo.
*
* @param string $shipment_id The Amazon-defined shipment identifier for the shipment. (required)
*
* @throws InvalidArgumentException
*
* @return PromiseInterface
*/
public function getShipmentAsyncWithHttpInfo($shipment_id)
{
$request = $this->getShipmentRequest($shipment_id);
return $this->sendRequestAsync($request, GetShipmentsResponse::class);
}
/**
* Create request for operation 'getShipment'.
*
* @param string $shipment_id The Amazon-defined shipment identifier for the shipment. (required)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getShipmentRequest($shipment_id)
{
// verify the required parameter 'shipment_id' is set
if (null === $shipment_id || (is_array($shipment_id) && 0 === count($shipment_id))) {
throw new InvalidArgumentException('Missing the required parameter $shipment_id when calling getShipment');
}
$resourcePath = '/mfn/v0/shipments/{shipmentId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $shipment_id) {
$resourcePath = str_replace(
'{'.'shipmentId'.'}',
ObjectSerializer::toPathValue($shipment_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/FinancesApi.php | lib/Api/FinancesApi.php | <?php
/**
* DefaultApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Finances.
*
* The Selling Partner API for Finances helps you obtain financial information relevant to a seller's business. You can obtain financial events for a given order, financial event group, or date range without having to wait until a statement period closes. You can also obtain financial event groups for a given date range.
*
* OpenAPI spec version: v0
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\Finances\ListFinancialEventGroupsResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Finances\ListFinancialEventsResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
/**
* DefaultApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class FinancesApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation listFinancialEventGroups.
*
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param \DateTime $financial_event_group_started_before A date used for selecting financial event groups that opened before (but not at) a specified date and time, in ISO 8601 format. The date-time must be later than FinancialEventGroupStartedAfter and no later than two minutes before the request was submitted. If FinancialEventGroupStartedAfter and FinancialEventGroupStartedBefore are more than 180 days apart, no financial event groups are returned. (optional)
* @param \DateTime $financial_event_group_started_after A date used for selecting financial event groups that opened after (or at) a specified date and time, in ISO 8601 format. The date-time must be no later than two minutes before the request was submitted. (optional)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Finances\ListFinancialEventGroupsResponse
*/
public function listFinancialEventGroups($max_results_per_page = '100', $financial_event_group_started_before = null, $financial_event_group_started_after = null, $next_token = null)
{
list($response) = $this->listFinancialEventGroupsWithHttpInfo($max_results_per_page, $financial_event_group_started_before, $financial_event_group_started_after, $next_token);
return $response;
}
/**
* Operation listFinancialEventGroupsWithHttpInfo.
*
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param \DateTime $financial_event_group_started_before A date used for selecting financial event groups that opened before (but not at) a specified date and time, in ISO 8601 format. The date-time must be later than FinancialEventGroupStartedAfter and no later than two minutes before the request was submitted. If FinancialEventGroupStartedAfter and FinancialEventGroupStartedBefore are more than 180 days apart, no financial event groups are returned. (optional)
* @param \DateTime $financial_event_group_started_after A date used for selecting financial event groups that opened after (or at) a specified date and time, in ISO 8601 format. The date-time must be no later than two minutes before the request was submitted. (optional)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Finances\ListFinancialEventGroupsResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function listFinancialEventGroupsWithHttpInfo($max_results_per_page = '100', $financial_event_group_started_before = null, $financial_event_group_started_after = null, $next_token = null)
{
$request = $this->listFinancialEventGroupsRequest($max_results_per_page, $financial_event_group_started_before, $financial_event_group_started_after, $next_token);
return $this->sendRequest($request, ListFinancialEventGroupsResponse::class);
}
/**
* Operation listFinancialEventGroupsAsync.
*
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param \DateTime $financial_event_group_started_before A date used for selecting financial event groups that opened before (but not at) a specified date and time, in ISO 8601 format. The date-time must be later than FinancialEventGroupStartedAfter and no later than two minutes before the request was submitted. If FinancialEventGroupStartedAfter and FinancialEventGroupStartedBefore are more than 180 days apart, no financial event groups are returned. (optional)
* @param \DateTime $financial_event_group_started_after A date used for selecting financial event groups that opened after (or at) a specified date and time, in ISO 8601 format. The date-time must be no later than two minutes before the request was submitted. (optional)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function listFinancialEventGroupsAsync($max_results_per_page = '100', $financial_event_group_started_before = null, $financial_event_group_started_after = null, $next_token = null)
{
return $this->listFinancialEventGroupsAsyncWithHttpInfo($max_results_per_page, $financial_event_group_started_before, $financial_event_group_started_after, $next_token)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation listFinancialEventGroupsAsyncWithHttpInfo.
*
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param \DateTime $financial_event_group_started_before A date used for selecting financial event groups that opened before (but not at) a specified date and time, in ISO 8601 format. The date-time must be later than FinancialEventGroupStartedAfter and no later than two minutes before the request was submitted. If FinancialEventGroupStartedAfter and FinancialEventGroupStartedBefore are more than 180 days apart, no financial event groups are returned. (optional)
* @param \DateTime $financial_event_group_started_after A date used for selecting financial event groups that opened after (or at) a specified date and time, in ISO 8601 format. The date-time must be no later than two minutes before the request was submitted. (optional)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function listFinancialEventGroupsAsyncWithHttpInfo($max_results_per_page = '100', $financial_event_group_started_before = null, $financial_event_group_started_after = null, $next_token = null)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Finances\ListFinancialEventGroupsResponse';
$request = $this->listFinancialEventGroupsRequest($max_results_per_page, $financial_event_group_started_before, $financial_event_group_started_after, $next_token);
return $this->sendRequestAsync($request, ListFinancialEventGroupsResponse::class);
}
/**
* Create request for operation 'listFinancialEventGroups'.
*
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param \DateTime $financial_event_group_started_before A date used for selecting financial event groups that opened before (but not at) a specified date and time, in ISO 8601 format. The date-time must be later than FinancialEventGroupStartedAfter and no later than two minutes before the request was submitted. If FinancialEventGroupStartedAfter and FinancialEventGroupStartedBefore are more than 180 days apart, no financial event groups are returned. (optional)
* @param \DateTime $financial_event_group_started_after A date used for selecting financial event groups that opened after (or at) a specified date and time, in ISO 8601 format. The date-time must be no later than two minutes before the request was submitted. (optional)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function listFinancialEventGroupsRequest($max_results_per_page = '100', $financial_event_group_started_before = null, $financial_event_group_started_after = null, $next_token = null)
{
$resourcePath = '/finances/v0/financialEventGroups';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $max_results_per_page) {
$queryParams['MaxResultsPerPage'] = ObjectSerializer::toQueryValue($max_results_per_page);
}
// query params
if (null !== $financial_event_group_started_before) {
$queryParams['FinancialEventGroupStartedBefore'] = ObjectSerializer::toQueryValue($financial_event_group_started_before);
}
// query params
if (null !== $financial_event_group_started_after) {
$queryParams['FinancialEventGroupStartedAfter'] = ObjectSerializer::toQueryValue($financial_event_group_started_after);
}
// query params
if (null !== $next_token) {
$queryParams['NextToken'] = ObjectSerializer::toQueryValue($next_token);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation listFinancialEvents.
*
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param \DateTime $posted_after A date used for selecting financial events posted after (or at) a specified time. The date-time must be no later than two minutes before the request was submitted, in ISO 8601 date time format. (optional)
* @param \DateTime $posted_before A date used for selecting financial events posted before (but not at) a specified time. The date-time must be later than PostedAfter and no later than two minutes before the request was submitted, in ISO 8601 date time format. If PostedAfter and PostedBefore are more than 180 days apart, no financial events are returned. You must specify the PostedAfter parameter if you specify the PostedBefore parameter. Default: Now minus two minutes. (optional)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Finances\ListFinancialEventsResponse
*/
public function listFinancialEvents($max_results_per_page = '100', $posted_after = null, $posted_before = null, $next_token = null)
{
list($response) = $this->listFinancialEventsWithHttpInfo($max_results_per_page, $posted_after, $posted_before, $next_token);
return $response;
}
/**
* Operation listFinancialEventsWithHttpInfo.
*
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param \DateTime $posted_after A date used for selecting financial events posted after (or at) a specified time. The date-time must be no later than two minutes before the request was submitted, in ISO 8601 date time format. (optional)
* @param \DateTime $posted_before A date used for selecting financial events posted before (but not at) a specified time. The date-time must be later than PostedAfter and no later than two minutes before the request was submitted, in ISO 8601 date time format. If PostedAfter and PostedBefore are more than 180 days apart, no financial events are returned. You must specify the PostedAfter parameter if you specify the PostedBefore parameter. Default: Now minus two minutes. (optional)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Finances\ListFinancialEventsResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function listFinancialEventsWithHttpInfo($max_results_per_page = '100', $posted_after = null, $posted_before = null, $next_token = null)
{
$request = $this->listFinancialEventsRequest($max_results_per_page, $posted_after, $posted_before, $next_token);
return $this->sendRequest($request, ListFinancialEventsResponse::class);
}
/**
* Operation listFinancialEventsAsync.
*
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param \DateTime $posted_after A date used for selecting financial events posted after (or at) a specified time. The date-time must be no later than two minutes before the request was submitted, in ISO 8601 date time format. (optional)
* @param \DateTime $posted_before A date used for selecting financial events posted before (but not at) a specified time. The date-time must be later than PostedAfter and no later than two minutes before the request was submitted, in ISO 8601 date time format. If PostedAfter and PostedBefore are more than 180 days apart, no financial events are returned. You must specify the PostedAfter parameter if you specify the PostedBefore parameter. Default: Now minus two minutes. (optional)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function listFinancialEventsAsync($max_results_per_page = '100', $posted_after = null, $posted_before = null, $next_token = null)
{
return $this->listFinancialEventsAsyncWithHttpInfo($max_results_per_page, $posted_after, $posted_before, $next_token)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation listFinancialEventsAsyncWithHttpInfo.
*
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param \DateTime $posted_after A date used for selecting financial events posted after (or at) a specified time. The date-time must be no later than two minutes before the request was submitted, in ISO 8601 date time format. (optional)
* @param \DateTime $posted_before A date used for selecting financial events posted before (but not at) a specified time. The date-time must be later than PostedAfter and no later than two minutes before the request was submitted, in ISO 8601 date time format. If PostedAfter and PostedBefore are more than 180 days apart, no financial events are returned. You must specify the PostedAfter parameter if you specify the PostedBefore parameter. Default: Now minus two minutes. (optional)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function listFinancialEventsAsyncWithHttpInfo($max_results_per_page = '100', $posted_after = null, $posted_before = null, $next_token = null)
{
$request = $this->listFinancialEventsRequest($max_results_per_page, $posted_after, $posted_before, $next_token);
return $this->sendRequestAsync($request, ListFinancialEventsResponse::class);
}
/**
* Create request for operation 'listFinancialEvents'.
*
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param \DateTime $posted_after A date used for selecting financial events posted after (or at) a specified time. The date-time must be no later than two minutes before the request was submitted, in ISO 8601 date time format. (optional)
* @param \DateTime $posted_before A date used for selecting financial events posted before (but not at) a specified time. The date-time must be later than PostedAfter and no later than two minutes before the request was submitted, in ISO 8601 date time format. If PostedAfter and PostedBefore are more than 180 days apart, no financial events are returned. You must specify the PostedAfter parameter if you specify the PostedBefore parameter. Default: Now minus two minutes. (optional)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function listFinancialEventsRequest($max_results_per_page = '100', $posted_after = null, $posted_before = null, $next_token = null)
{
$resourcePath = '/finances/v0/financialEvents';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $max_results_per_page) {
$queryParams['MaxResultsPerPage'] = ObjectSerializer::toQueryValue($max_results_per_page);
}
// query params
if (null !== $posted_after) {
$queryParams['PostedAfter'] = ObjectSerializer::toQueryValue($posted_after);
}
// query params
if (null !== $posted_before) {
$queryParams['PostedBefore'] = ObjectSerializer::toQueryValue($posted_before);
}
// query params
if (null !== $next_token) {
$queryParams['NextToken'] = ObjectSerializer::toQueryValue($next_token);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation listFinancialEventsByGroupId.
*
* @param string $event_group_id The identifier of the financial event group to which the events belong. (required)
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Finances\ListFinancialEventsResponse
*/
public function listFinancialEventsByGroupId($event_group_id, $max_results_per_page = '100', $next_token = null)
{
list($response) = $this->listFinancialEventsByGroupIdWithHttpInfo($event_group_id, $max_results_per_page, $next_token);
return $response;
}
/**
* Operation listFinancialEventsByGroupIdWithHttpInfo.
*
* @param string $event_group_id The identifier of the financial event group to which the events belong. (required)
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Finances\ListFinancialEventsResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function listFinancialEventsByGroupIdWithHttpInfo($event_group_id, $max_results_per_page = '100', $next_token = null)
{
$request = $this->listFinancialEventsByGroupIdRequest($event_group_id, $max_results_per_page, $next_token);
return $this->sendRequest($request, ListFinancialEventsResponse::class);
}
/**
* Operation listFinancialEventsByGroupIdAsync.
*
* @param string $event_group_id The identifier of the financial event group to which the events belong. (required)
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function listFinancialEventsByGroupIdAsync($event_group_id, $max_results_per_page = '100', $next_token = null)
{
return $this->listFinancialEventsByGroupIdAsyncWithHttpInfo($event_group_id, $max_results_per_page, $next_token)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation listFinancialEventsByGroupIdAsyncWithHttpInfo.
*
* @param string $event_group_id The identifier of the financial event group to which the events belong. (required)
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function listFinancialEventsByGroupIdAsyncWithHttpInfo($event_group_id, $max_results_per_page = '100', $next_token = null)
{
$request = $this->listFinancialEventsByGroupIdRequest($event_group_id, $max_results_per_page, $next_token);
return $this->sendRequestAsync($request, ListFinancialEventsResponse::class);
}
/**
* Create request for operation 'listFinancialEventsByGroupId'.
*
* @param string $event_group_id The identifier of the financial event group to which the events belong. (required)
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function listFinancialEventsByGroupIdRequest($event_group_id, $max_results_per_page = '100', $next_token = null)
{
// verify the required parameter 'event_group_id' is set
if (null === $event_group_id || (is_array($event_group_id) && 0 === count($event_group_id))) {
throw new \InvalidArgumentException('Missing the required parameter $event_group_id when calling listFinancialEventsByGroupId');
}
$resourcePath = '/finances/v0/financialEventGroups/{eventGroupId}/financialEvents';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $max_results_per_page) {
$queryParams['MaxResultsPerPage'] = ObjectSerializer::toQueryValue($max_results_per_page);
}
// query params
if (null !== $next_token) {
$queryParams['NextToken'] = ObjectSerializer::toQueryValue($next_token);
}
// path params
if (null !== $event_group_id) {
$resourcePath = str_replace(
'{'.'eventGroupId'.'}',
ObjectSerializer::toPathValue($event_group_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation listFinancialEventsByOrderId.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Finances\ListFinancialEventsResponse
*/
public function listFinancialEventsByOrderId($order_id, $max_results_per_page = '100', $next_token = null)
{
list($response) = $this->listFinancialEventsByOrderIdWithHttpInfo($order_id, $max_results_per_page, $next_token);
return $response;
}
/**
* Operation listFinancialEventsByOrderIdWithHttpInfo.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Finances\ListFinancialEventsResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function listFinancialEventsByOrderIdWithHttpInfo($order_id, $max_results_per_page = '100', $next_token = null)
{
$request = $this->listFinancialEventsByOrderIdRequest($order_id, $max_results_per_page, $next_token);
return $this->sendRequest($request, ListFinancialEventsResponse::class);
}
/**
* Operation listFinancialEventsByOrderIdAsync.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function listFinancialEventsByOrderIdAsync($order_id, $max_results_per_page = '100', $next_token = null)
{
return $this->listFinancialEventsByOrderIdAsyncWithHttpInfo($order_id, $max_results_per_page, $next_token)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation listFinancialEventsByOrderIdAsyncWithHttpInfo.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function listFinancialEventsByOrderIdAsyncWithHttpInfo($order_id, $max_results_per_page = '100', $next_token = null)
{
$request = $this->listFinancialEventsByOrderIdRequest($order_id, $max_results_per_page, $next_token);
return $this->sendRequestAsync($request, ListFinancialEventsResponse::class);
}
/**
* Create request for operation 'listFinancialEventsByOrderId'.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
* @param int $max_results_per_page The maximum number of results to return per page. (optional, default to 100)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function listFinancialEventsByOrderIdRequest($order_id, $max_results_per_page = '100', $next_token = null)
{
// verify the required parameter 'order_id' is set
if (null === $order_id || (is_array($order_id) && 0 === count($order_id))) {
throw new \InvalidArgumentException('Missing the required parameter $order_id when calling listFinancialEventsByOrderId');
}
$resourcePath = '/finances/v0/orders/{orderId}/financialEvents';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $max_results_per_page) {
$queryParams['MaxResultsPerPage'] = ObjectSerializer::toQueryValue($max_results_per_page);
}
// query params
if (null !== $next_token) {
$queryParams['NextToken'] = ObjectSerializer::toQueryValue($next_token);
}
// path params
if (null !== $order_id) {
$resourcePath = str_replace(
'{'.'orderId'.'}',
ObjectSerializer::toPathValue($order_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/FeedsApi.php | lib/Api/FeedsApi.php | <?php
/**
* FeedsApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Feeds.
*
* The Selling Partner API for Feeds lets you upload data to Amazon on behalf of a selling partner.
*
* OpenAPI spec version: 2020-09-04
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CancelFeedResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedDocumentResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Feeds\GetFeedDocumentResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Feeds\GetFeedResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Feeds\GetFeedsResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
/**
* FeedsApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class FeedsApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation cancelFeed.
*
* @param string $feed_id The identifier for the feed. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CancelFeedResponse
*/
public function cancelFeed($feed_id)
{
list($response) = $this->cancelFeedWithHttpInfo($feed_id);
return $response;
}
/**
* Operation cancelFeedWithHttpInfo.
*
* @param string $feed_id The identifier for the feed. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CancelFeedResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function cancelFeedWithHttpInfo($feed_id)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CancelFeedResponse';
$request = $this->cancelFeedRequest($feed_id);
return $this->sendRequest($request, CancelFeedResponse::class);
}
/**
* Operation cancelFeedAsync.
*
* @param string $feed_id The identifier for the feed. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function cancelFeedAsync($feed_id)
{
return $this->cancelFeedAsyncWithHttpInfo($feed_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation cancelFeedAsyncWithHttpInfo.
*
* @param string $feed_id The identifier for the feed. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function cancelFeedAsyncWithHttpInfo($feed_id)
{
$request = $this->cancelFeedRequest($feed_id);
return $this->sendRequestAsync($request, CancelFeedResponse::class);
}
/**
* Create request for operation 'cancelFeed'.
*
* @param string $feed_id The identifier for the feed. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function cancelFeedRequest($feed_id)
{
// verify the required parameter 'feed_id' is set
if (null === $feed_id || (is_array($feed_id) && 0 === count($feed_id))) {
throw new \InvalidArgumentException('Missing the required parameter $feed_id when calling cancelFeed');
}
$resourcePath = '/feeds/2020-09-04/feeds/{feedId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $feed_id) {
$resourcePath = str_replace(
'{'.'feedId'.'}',
ObjectSerializer::toPathValue($feed_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'DELETE', $httpBody);
}
/**
* Operation createFeed.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedSpecification $body body (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedResponse
*/
public function createFeed($body)
{
list($response) = $this->createFeedWithHttpInfo($body);
return $response;
}
/**
* Operation createFeedWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedSpecification $body (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function createFeedWithHttpInfo($body)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedResponse';
$request = $this->createFeedRequest($body);
return $this->sendRequest($request, CreateFeedResponse::class);
}
/**
* Operation createFeedAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedSpecification $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createFeedAsync($body)
{
return $this->createFeedAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createFeedAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedSpecification $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createFeedAsyncWithHttpInfo($body)
{
$request = $this->createFeedRequest($body);
return $this->sendRequestAsync($request, CreateFeedResponse::class);
}
/**
* Create request for operation 'createFeed'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedSpecification $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function createFeedRequest($body)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling createFeed');
}
$resourcePath = '/feeds/2020-09-04/feeds';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation createFeedDocument.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedDocumentSpecification $body body (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedDocumentResponse
*/
public function createFeedDocument($body)
{
list($response) = $this->createFeedDocumentWithHttpInfo($body);
return $response;
}
/**
* Operation createFeedDocumentWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedDocumentSpecification $body (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedDocumentResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function createFeedDocumentWithHttpInfo($body)
{
$request = $this->createFeedDocumentRequest($body);
return $this->sendRequest($request, CreateFeedDocumentResponse::class);
}
/**
* Operation createFeedDocumentAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedDocumentSpecification $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createFeedDocumentAsync($body)
{
return $this->createFeedDocumentAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createFeedDocumentAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedDocumentSpecification $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createFeedDocumentAsyncWithHttpInfo($body)
{
$request = $this->createFeedDocumentRequest($body);
return $this->sendRequestAsync($request, CreateFeedDocumentResponse::class);
}
/**
* Create request for operation 'createFeedDocument'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedDocumentSpecification $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function createFeedDocumentRequest($body)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling createFeedDocument');
}
$resourcePath = '/feeds/2020-09-04/documents';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation getFeed.
*
* @param string $feed_id The identifier for the feed. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\GetFeedResponse
*/
public function getFeed($feed_id)
{
list($response) = $this->getFeedWithHttpInfo($feed_id);
return $response;
}
/**
* Operation getFeedWithHttpInfo.
*
* @param string $feed_id The identifier for the feed. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\GetFeedResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getFeedWithHttpInfo($feed_id)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Feeds\GetFeedResponse';
$request = $this->getFeedRequest($feed_id);
return $this->sendRequest($request, GetFeedResponse::class);
}
/**
* Operation getFeedAsync.
*
* @param string $feed_id The identifier for the feed. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getFeedAsync($feed_id)
{
return $this->getFeedAsyncWithHttpInfo($feed_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getFeedAsyncWithHttpInfo.
*
* @param string $feed_id The identifier for the feed. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getFeedAsyncWithHttpInfo($feed_id)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Feeds\GetFeedResponse';
$request = $this->getFeedRequest($feed_id);
return $this->sendRequestAsync($request, GetFeedResponse::class);
}
/**
* Create request for operation 'getFeed'.
*
* @param string $feed_id The identifier for the feed. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getFeedRequest($feed_id)
{
// verify the required parameter 'feed_id' is set
if (null === $feed_id || (is_array($feed_id) && 0 === count($feed_id))) {
throw new \InvalidArgumentException('Missing the required parameter $feed_id when calling getFeed');
}
$resourcePath = '/feeds/2020-09-04/feeds/{feedId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $feed_id) {
$resourcePath = str_replace(
'{'.'feedId'.'}',
ObjectSerializer::toPathValue($feed_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getFeedDocument.
*
* @param string $feed_document_id The identifier of the feed document. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\GetFeedDocumentResponse
*/
public function getFeedDocument($feed_document_id)
{
list($response) = $this->getFeedDocumentWithHttpInfo($feed_document_id);
return $response;
}
/**
* Operation getFeedDocumentWithHttpInfo.
*
* @param string $feed_document_id The identifier of the feed document. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\GetFeedDocumentResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getFeedDocumentWithHttpInfo($feed_document_id)
{
$request = $this->getFeedDocumentRequest($feed_document_id);
return $this->sendRequest($request, GetFeedDocumentResponse::class);
}
/**
* Operation getFeedDocumentAsync.
*
* @param string $feed_document_id The identifier of the feed document. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getFeedDocumentAsync($feed_document_id)
{
return $this->getFeedDocumentAsyncWithHttpInfo($feed_document_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getFeedDocumentAsyncWithHttpInfo.
*
* @param string $feed_document_id The identifier of the feed document. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getFeedDocumentAsyncWithHttpInfo($feed_document_id)
{
$request = $this->getFeedDocumentRequest($feed_document_id);
return $this->sendRequestAsync($request, GetFeedDocumentResponse::class);
}
/**
* Create request for operation 'getFeedDocument'.
*
* @param string $feed_document_id The identifier of the feed document. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getFeedDocumentRequest($feed_document_id)
{
// verify the required parameter 'feed_document_id' is set
if (null === $feed_document_id || (is_array($feed_document_id) && 0 === count($feed_document_id))) {
throw new \InvalidArgumentException('Missing the required parameter $feed_document_id when calling getFeedDocument');
}
$resourcePath = '/feeds/2020-09-04/documents/{feedDocumentId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $feed_document_id) {
$resourcePath = str_replace(
'{'.'feedDocumentId'.'}',
ObjectSerializer::toPathValue($feed_document_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getFeeds.
*
* @param string[] $feed_types A list of feed types used to filter feeds. When feedTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either feedTypes or nextToken is required. (optional)
* @param string[] $marketplace_ids A list of marketplace identifiers used to filter feeds. The feeds returned will match at least one of the marketplaces that you specify. (optional)
* @param int $page_size The maximum number of feeds to return in a single call. (optional, default to 10)
* @param string[] $processing_statuses A list of processing statuses used to filter feeds. (optional)
* @param \DateTime $created_since The earliest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is 90 days ago. Feeds are retained for a maximum of 90 days. (optional)
* @param \DateTime $created_until The latest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is now. (optional)
* @param string $next_token A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getFeeds operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail. (optional)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\GetFeedsResponse
*/
public function getFeeds($feed_types = null, $marketplace_ids = null, $page_size = '10', $processing_statuses = null, $created_since = null, $created_until = null, $next_token = null)
{
list($response) = $this->getFeedsWithHttpInfo($feed_types, $marketplace_ids, $page_size, $processing_statuses, $created_since, $created_until, $next_token);
return $response;
}
/**
* Operation getFeedsWithHttpInfo.
*
* @param string[] $feed_types A list of feed types used to filter feeds. When feedTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either feedTypes or nextToken is required. (optional)
* @param string[] $marketplace_ids A list of marketplace identifiers used to filter feeds. The feeds returned will match at least one of the marketplaces that you specify. (optional)
* @param int $page_size The maximum number of feeds to return in a single call. (optional, default to 10)
* @param string[] $processing_statuses A list of processing statuses used to filter feeds. (optional)
* @param \DateTime $created_since The earliest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is 90 days ago. Feeds are retained for a maximum of 90 days. (optional)
* @param \DateTime $created_until The latest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is now. (optional)
* @param string $next_token A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getFeeds operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail. (optional)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\GetFeedsResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getFeedsWithHttpInfo($feed_types = null, $marketplace_ids = null, $page_size = '10', $processing_statuses = null, $created_since = null, $created_until = null, $next_token = null)
{
$request = $this->getFeedsRequest($feed_types, $marketplace_ids, $page_size, $processing_statuses, $created_since, $created_until, $next_token);
return $this->sendRequest($request, GetFeedsResponse::class);
}
/**
* Operation getFeedsAsync.
*
* @param string[] $feed_types A list of feed types used to filter feeds. When feedTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either feedTypes or nextToken is required. (optional)
* @param string[] $marketplace_ids A list of marketplace identifiers used to filter feeds. The feeds returned will match at least one of the marketplaces that you specify. (optional)
* @param int $page_size The maximum number of feeds to return in a single call. (optional, default to 10)
* @param string[] $processing_statuses A list of processing statuses used to filter feeds. (optional)
* @param \DateTime $created_since The earliest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is 90 days ago. Feeds are retained for a maximum of 90 days. (optional)
* @param \DateTime $created_until The latest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is now. (optional)
* @param string $next_token A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getFeeds operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getFeedsAsync($feed_types = null, $marketplace_ids = null, $page_size = '10', $processing_statuses = null, $created_since = null, $created_until = null, $next_token = null)
{
return $this->getFeedsAsyncWithHttpInfo($feed_types, $marketplace_ids, $page_size, $processing_statuses, $created_since, $created_until, $next_token)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getFeedsAsyncWithHttpInfo.
*
* @param string[] $feed_types A list of feed types used to filter feeds. When feedTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either feedTypes or nextToken is required. (optional)
* @param string[] $marketplace_ids A list of marketplace identifiers used to filter feeds. The feeds returned will match at least one of the marketplaces that you specify. (optional)
* @param int $page_size The maximum number of feeds to return in a single call. (optional, default to 10)
* @param string[] $processing_statuses A list of processing statuses used to filter feeds. (optional)
* @param \DateTime $created_since The earliest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is 90 days ago. Feeds are retained for a maximum of 90 days. (optional)
* @param \DateTime $created_until The latest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is now. (optional)
* @param string $next_token A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getFeeds operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getFeedsAsyncWithHttpInfo($feed_types = null, $marketplace_ids = null, $page_size = '10', $processing_statuses = null, $created_since = null, $created_until = null, $next_token = null)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Feeds\GetFeedsResponse';
$request = $this->getFeedsRequest($feed_types, $marketplace_ids, $page_size, $processing_statuses, $created_since, $created_until, $next_token);
return $this->sendRequestAsync($request, GetFeedsResponse::class);
}
/**
* Create request for operation 'getFeeds'.
*
* @param string[] $feed_types A list of feed types used to filter feeds. When feedTypes is provided, the other filter parameters (processingStatuses, marketplaceIds, createdSince, createdUntil) and pageSize may also be provided. Either feedTypes or nextToken is required. (optional)
* @param string[] $marketplace_ids A list of marketplace identifiers used to filter feeds. The feeds returned will match at least one of the marketplaces that you specify. (optional)
* @param int $page_size The maximum number of feeds to return in a single call. (optional, default to 10)
* @param string[] $processing_statuses A list of processing statuses used to filter feeds. (optional)
* @param \DateTime $created_since The earliest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is 90 days ago. Feeds are retained for a maximum of 90 days. (optional)
* @param \DateTime $created_until The latest feed creation date and time for feeds included in the response, in ISO 8601 format. The default is now. (optional)
* @param string $next_token A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getFeeds operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getFeedsRequest($feed_types = null, $marketplace_ids = null, $page_size = '10', $processing_statuses = null, $created_since = null, $created_until = null, $next_token = null)
{
$resourcePath = '/feeds/2020-09-04/feeds';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (is_array($feed_types)) {
$feed_types = ObjectSerializer::serializeCollection($feed_types, 'csv', true);
}
if (null !== $feed_types) {
$queryParams['feedTypes'] = ObjectSerializer::toQueryValue($feed_types);
}
// query params
if (is_array($marketplace_ids)) {
$marketplace_ids = ObjectSerializer::serializeCollection($marketplace_ids, 'csv', true);
}
if (null !== $marketplace_ids) {
$queryParams['marketplaceIds'] = ObjectSerializer::toQueryValue($marketplace_ids);
}
// query params
if (null !== $page_size) {
$queryParams['pageSize'] = ObjectSerializer::toQueryValue($page_size);
}
// query params
if (is_array($processing_statuses)) {
$processing_statuses = ObjectSerializer::serializeCollection($processing_statuses, 'csv', true);
}
if (null !== $processing_statuses) {
$queryParams['processingStatuses'] = ObjectSerializer::toQueryValue($processing_statuses);
}
// query params
if (null !== $created_since) {
$queryParams['createdSince'] = ObjectSerializer::toQueryValue($created_since);
}
// query params
if (null !== $created_until) {
$queryParams['createdUntil'] = ObjectSerializer::toQueryValue($created_until);
}
// query params
if (null !== $next_token) {
$queryParams['nextToken'] = ObjectSerializer::toQueryValue($next_token);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/ServiceApi.php | lib/Api/ServiceApi.php | <?php
/**
* ServiceApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Services.
*
* With the Services API, you can build applications that help service providers get and modify their service orders.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\Services\CancelServiceJobByServiceJobIdResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Services\CompleteServiceJobByServiceJobIdResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Services\GetServiceJobByServiceJobIdResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Services\GetServiceJobsResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Services\SetAppointmentResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Psr7\Request;
/**
* ServiceApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class ServiceApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation addAppointmentForServiceJobByServiceJobId.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Services\AddAppointmentRequest $body Add appointment operation input details. (required)
* @param string $service_job_id An Amazon defined service job identifier. (required)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Services\SetAppointmentResponse
*/
public function addAppointmentForServiceJobByServiceJobId($body, $service_job_id)
{
list($response) = $this->addAppointmentForServiceJobByServiceJobIdWithHttpInfo($body, $service_job_id);
return $response;
}
/**
* Operation addAppointmentForServiceJobByServiceJobIdWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Services\AddAppointmentRequest $body Add appointment operation input details. (required)
* @param string $service_job_id An Amazon defined service job identifier. (required)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Services\SetAppointmentResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function addAppointmentForServiceJobByServiceJobIdWithHttpInfo($body, $service_job_id)
{
$request = $this->addAppointmentForServiceJobByServiceJobIdRequest($body, $service_job_id);
return $this->sendRequest($request, SetAppointmentResponse::class);
}
/**
* Operation addAppointmentForServiceJobByServiceJobIdAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Services\AddAppointmentRequest $body Add appointment operation input details. (required)
* @param string $service_job_id An Amazon defined service job identifier. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function addAppointmentForServiceJobByServiceJobIdAsync($body, $service_job_id)
{
return $this->addAppointmentForServiceJobByServiceJobIdAsyncWithHttpInfo($body, $service_job_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation addAppointmentForServiceJobByServiceJobIdAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Services\AddAppointmentRequest $body Add appointment operation input details. (required)
* @param string $service_job_id An Amazon defined service job identifier. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function addAppointmentForServiceJobByServiceJobIdAsyncWithHttpInfo($body, $service_job_id)
{
$request = $this->addAppointmentForServiceJobByServiceJobIdRequest($body, $service_job_id);
return $this->sendRequestAsync($request, SetAppointmentResponse::class);
}
/**
* Create request for operation 'addAppointmentForServiceJobByServiceJobId'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Services\AddAppointmentRequest $body Add appointment operation input details. (required)
* @param string $service_job_id An Amazon defined service job identifier. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function addAppointmentForServiceJobByServiceJobIdRequest($body, $service_job_id)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling addAppointmentForServiceJobByServiceJobId');
}
// verify the required parameter 'service_job_id' is set
if (null === $service_job_id || (is_array($service_job_id) && 0 === count($service_job_id))) {
throw new \InvalidArgumentException('Missing the required parameter $service_job_id when calling addAppointmentForServiceJobByServiceJobId');
}
$resourcePath = '/service/v1/serviceJobs/{serviceJobId}/appointments';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
// path params
if (null !== $service_job_id) {
$resourcePath = str_replace(
'{'.'serviceJobId'.'}',
ObjectSerializer::toPathValue($service_job_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation cancelServiceJobByServiceJobId.
*
* @param string $service_job_id An Amazon defined service job identifier. (required)
* @param string $cancellation_reason_code A cancel reason code that specifies the reason for cancelling a service job. (required)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Services\CancelServiceJobByServiceJobIdResponse
*/
public function cancelServiceJobByServiceJobId($service_job_id, $cancellation_reason_code)
{
list($response) = $this->cancelServiceJobByServiceJobIdWithHttpInfo($service_job_id, $cancellation_reason_code);
return $response;
}
/**
* Operation cancelServiceJobByServiceJobIdWithHttpInfo.
*
* @param string $service_job_id An Amazon defined service job identifier. (required)
* @param string $cancellation_reason_code A cancel reason code that specifies the reason for cancelling a service job. (required)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Services\CancelServiceJobByServiceJobIdResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function cancelServiceJobByServiceJobIdWithHttpInfo($service_job_id, $cancellation_reason_code)
{
$request = $this->cancelServiceJobByServiceJobIdRequest($service_job_id, $cancellation_reason_code);
return $this->sendRequest($request, CancelServiceJobByServiceJobIdResponse::class);
}
/**
* Operation cancelServiceJobByServiceJobIdAsync.
*
* @param string $service_job_id An Amazon defined service job identifier. (required)
* @param string $cancellation_reason_code A cancel reason code that specifies the reason for cancelling a service job. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function cancelServiceJobByServiceJobIdAsync($service_job_id, $cancellation_reason_code)
{
return $this->cancelServiceJobByServiceJobIdAsyncWithHttpInfo($service_job_id, $cancellation_reason_code)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation cancelServiceJobByServiceJobIdAsyncWithHttpInfo.
*
* @param string $service_job_id An Amazon defined service job identifier. (required)
* @param string $cancellation_reason_code A cancel reason code that specifies the reason for cancelling a service job. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function cancelServiceJobByServiceJobIdAsyncWithHttpInfo($service_job_id, $cancellation_reason_code)
{
$request = $this->cancelServiceJobByServiceJobIdRequest($service_job_id, $cancellation_reason_code);
return $this->sendRequestAsync($request, CancelServiceJobByServiceJobIdResponse::class);
}
/**
* Create request for operation 'cancelServiceJobByServiceJobId'.
*
* @param string $service_job_id An Amazon defined service job identifier. (required)
* @param string $cancellation_reason_code A cancel reason code that specifies the reason for cancelling a service job. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function cancelServiceJobByServiceJobIdRequest($service_job_id, $cancellation_reason_code)
{
// verify the required parameter 'service_job_id' is set
if (null === $service_job_id || (is_array($service_job_id) && 0 === count($service_job_id))) {
throw new \InvalidArgumentException('Missing the required parameter $service_job_id when calling cancelServiceJobByServiceJobId');
}
// verify the required parameter 'cancellation_reason_code' is set
if (null === $cancellation_reason_code || (is_array($cancellation_reason_code) && 0 === count($cancellation_reason_code))) {
throw new \InvalidArgumentException('Missing the required parameter $cancellation_reason_code when calling cancelServiceJobByServiceJobId');
}
$resourcePath = '/service/v1/serviceJobs/{serviceJobId}/cancellations';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $cancellation_reason_code) {
$queryParams['cancellationReasonCode'] = ObjectSerializer::toQueryValue($cancellation_reason_code);
}
// path params
if (null !== $service_job_id) {
$resourcePath = str_replace(
'{'.'serviceJobId'.'}',
ObjectSerializer::toPathValue($service_job_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'PUT', $httpBody);
}
/**
* Operation completeServiceJobByServiceJobId.
*
* @param string $service_job_id An Amazon defined service job identifier. (required)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Services\CompleteServiceJobByServiceJobIdResponse
*/
public function completeServiceJobByServiceJobId($service_job_id)
{
list($response) = $this->completeServiceJobByServiceJobIdWithHttpInfo($service_job_id);
return $response;
}
/**
* Operation completeServiceJobByServiceJobIdWithHttpInfo.
*
* @param string $service_job_id An Amazon defined service job identifier. (required)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Services\CompleteServiceJobByServiceJobIdResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function completeServiceJobByServiceJobIdWithHttpInfo($service_job_id)
{
$request = $this->completeServiceJobByServiceJobIdRequest($service_job_id);
return $this->sendRequest($request, CompleteServiceJobByServiceJobIdResponse::class);
}
/**
* Operation completeServiceJobByServiceJobIdAsync.
*
* @param string $service_job_id An Amazon defined service job identifier. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function completeServiceJobByServiceJobIdAsync($service_job_id)
{
return $this->completeServiceJobByServiceJobIdAsyncWithHttpInfo($service_job_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation completeServiceJobByServiceJobIdAsyncWithHttpInfo.
*
* @param string $service_job_id An Amazon defined service job identifier. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function completeServiceJobByServiceJobIdAsyncWithHttpInfo($service_job_id)
{
$request = $this->completeServiceJobByServiceJobIdRequest($service_job_id);
return $this->sendRequestAsync($request, CompleteServiceJobByServiceJobIdResponse::class);
}
/**
* Create request for operation 'completeServiceJobByServiceJobId'.
*
* @param string $service_job_id An Amazon defined service job identifier. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function completeServiceJobByServiceJobIdRequest($service_job_id)
{
// verify the required parameter 'service_job_id' is set
if (null === $service_job_id || (is_array($service_job_id) && 0 === count($service_job_id))) {
throw new \InvalidArgumentException('Missing the required parameter $service_job_id when calling completeServiceJobByServiceJobId');
}
$resourcePath = '/service/v1/serviceJobs/{serviceJobId}/completions';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'PUT', $httpBody);
}
/**
* Operation getServiceJobByServiceJobId.
*
* @param string $service_job_id A service job identifier. (required)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Services\GetServiceJobByServiceJobIdResponse
*/
public function getServiceJobByServiceJobId($service_job_id)
{
list($response) = $this->getServiceJobByServiceJobIdWithHttpInfo($service_job_id);
return $response;
}
/**
* Operation getServiceJobByServiceJobIdWithHttpInfo.
*
* @param string $service_job_id A service job identifier. (required)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Services\GetServiceJobByServiceJobIdResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getServiceJobByServiceJobIdWithHttpInfo($service_job_id)
{
$request = $this->getServiceJobByServiceJobIdRequest($service_job_id);
return $this->sendRequest($request, GetServiceJobByServiceJobIdResponse::class);
}
/**
* Operation getServiceJobByServiceJobIdAsync.
*
* @param string $service_job_id A service job identifier. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getServiceJobByServiceJobIdAsync($service_job_id)
{
return $this->getServiceJobByServiceJobIdAsyncWithHttpInfo($service_job_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getServiceJobByServiceJobIdAsyncWithHttpInfo.
*
* @param string $service_job_id A service job identifier. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getServiceJobByServiceJobIdAsyncWithHttpInfo($service_job_id)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Services\GetServiceJobByServiceJobIdResponse';
$request = $this->getServiceJobByServiceJobIdRequest($service_job_id);
return $this->sendRequestAsync($request, GetServiceJobByServiceJobIdResponse::class);
}
/**
* Create request for operation 'getServiceJobByServiceJobId'.
*
* @param string $service_job_id A service job identifier. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getServiceJobByServiceJobIdRequest($service_job_id)
{
// verify the required parameter 'service_job_id' is set
if (null === $service_job_id || (is_array($service_job_id) && 0 === count($service_job_id))) {
throw new \InvalidArgumentException('Missing the required parameter $service_job_id when calling getServiceJobByServiceJobId');
}
$resourcePath = '/service/v1/serviceJobs/{serviceJobId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $service_job_id) {
$resourcePath = str_replace(
'{'.'serviceJobId'.'}',
ObjectSerializer::toPathValue($service_job_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getServiceJobs.
*
* @param string[] $marketplace_ids Used to select jobs that were placed in the specified marketplaces. (required)
* @param string[] $service_order_ids List of service order ids for the query you want to perform.Max values supported 20. (optional)
* @param string[] $service_job_status A list of one or more job status by which to filter the list of jobs. (optional)
* @param string $page_token String returned in the response of your previous request. (optional)
* @param int $page_size A non-negative integer that indicates the maximum number of jobs to return in the list, Value must be 1 - 20. Default 20. (optional, default to 20)
* @param string $sort_field Sort fields on which you want to sort the output. (optional)
* @param string $sort_order Sort order for the query you want to perform. (optional)
* @param string $created_after A date used for selecting jobs created after (or at) a specified time must be in ISO 8601 format. Required if LastUpdatedAfter is not specified.Specifying both CreatedAfter and LastUpdatedAfter returns an error. (optional)
* @param string $created_before A date used for selecting jobs created before (or at) a specified time must be in ISO 8601 format. (optional)
* @param string $last_updated_after A date used for selecting jobs updated after (or at) a specified time must be in ISO 8601 format. Required if createdAfter is not specified.Specifying both CreatedAfter and LastUpdatedAfter returns an error. (optional)
* @param string $last_updated_before A date used for selecting jobs updated before (or at) a specified time must be in ISO 8601 format. (optional)
* @param string $schedule_start_date A date used for filtering jobs schedule after (or at) a specified time must be in ISO 8601 format. schedule end date should not be earlier than schedule start date. (optional)
* @param string $schedule_end_date A date used for filtering jobs schedule before (or at) a specified time must be in ISO 8601 format. schedule end date should not be earlier than schedule start date. (optional)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Services\GetServiceJobsResponse
*/
public function getServiceJobs($marketplace_ids, $service_order_ids = null, $service_job_status = null, $page_token = null, $page_size = '20', $sort_field = null, $sort_order = null, $created_after = null, $created_before = null, $last_updated_after = null, $last_updated_before = null, $schedule_start_date = null, $schedule_end_date = null)
{
list($response) = $this->getServiceJobsWithHttpInfo($marketplace_ids, $service_order_ids, $service_job_status, $page_token, $page_size, $sort_field, $sort_order, $created_after, $created_before, $last_updated_after, $last_updated_before, $schedule_start_date, $schedule_end_date);
return $response;
}
/**
* Operation getServiceJobsWithHttpInfo.
*
* @param string[] $marketplace_ids Used to select jobs that were placed in the specified marketplaces. (required)
* @param string[] $service_order_ids List of service order ids for the query you want to perform.Max values supported 20. (optional)
* @param string[] $service_job_status A list of one or more job status by which to filter the list of jobs. (optional)
* @param string $page_token String returned in the response of your previous request. (optional)
* @param int $page_size A non-negative integer that indicates the maximum number of jobs to return in the list, Value must be 1 - 20. Default 20. (optional, default to 20)
* @param string $sort_field Sort fields on which you want to sort the output. (optional)
* @param string $sort_order Sort order for the query you want to perform. (optional)
* @param string $created_after A date used for selecting jobs created after (or at) a specified time must be in ISO 8601 format. Required if LastUpdatedAfter is not specified.Specifying both CreatedAfter and LastUpdatedAfter returns an error. (optional)
* @param string $created_before A date used for selecting jobs created before (or at) a specified time must be in ISO 8601 format. (optional)
* @param string $last_updated_after A date used for selecting jobs updated after (or at) a specified time must be in ISO 8601 format. Required if createdAfter is not specified.Specifying both CreatedAfter and LastUpdatedAfter returns an error. (optional)
* @param string $last_updated_before A date used for selecting jobs updated before (or at) a specified time must be in ISO 8601 format. (optional)
* @param string $schedule_start_date A date used for filtering jobs schedule after (or at) a specified time must be in ISO 8601 format. schedule end date should not be earlier than schedule start date. (optional)
* @param string $schedule_end_date A date used for filtering jobs schedule before (or at) a specified time must be in ISO 8601 format. schedule end date should not be earlier than schedule start date. (optional)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Services\GetServiceJobsResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getServiceJobsWithHttpInfo($marketplace_ids, $service_order_ids = null, $service_job_status = null, $page_token = null, $page_size = '20', $sort_field = null, $sort_order = null, $created_after = null, $created_before = null, $last_updated_after = null, $last_updated_before = null, $schedule_start_date = null, $schedule_end_date = null)
{
$request = $this->getServiceJobsRequest($marketplace_ids, $service_order_ids, $service_job_status, $page_token, $page_size, $sort_field, $sort_order, $created_after, $created_before, $last_updated_after, $last_updated_before, $schedule_start_date, $schedule_end_date);
return $this->sendRequest($request, GetServiceJobsResponse::class);
}
/**
* Operation getServiceJobsAsync.
*
* @param string[] $marketplace_ids Used to select jobs that were placed in the specified marketplaces. (required)
* @param string[] $service_order_ids List of service order ids for the query you want to perform.Max values supported 20. (optional)
* @param string[] $service_job_status A list of one or more job status by which to filter the list of jobs. (optional)
* @param string $page_token String returned in the response of your previous request. (optional)
* @param int $page_size A non-negative integer that indicates the maximum number of jobs to return in the list, Value must be 1 - 20. Default 20. (optional, default to 20)
* @param string $sort_field Sort fields on which you want to sort the output. (optional)
* @param string $sort_order Sort order for the query you want to perform. (optional)
* @param string $created_after A date used for selecting jobs created after (or at) a specified time must be in ISO 8601 format. Required if LastUpdatedAfter is not specified.Specifying both CreatedAfter and LastUpdatedAfter returns an error. (optional)
* @param string $created_before A date used for selecting jobs created before (or at) a specified time must be in ISO 8601 format. (optional)
* @param string $last_updated_after A date used for selecting jobs updated after (or at) a specified time must be in ISO 8601 format. Required if createdAfter is not specified.Specifying both CreatedAfter and LastUpdatedAfter returns an error. (optional)
* @param string $last_updated_before A date used for selecting jobs updated before (or at) a specified time must be in ISO 8601 format. (optional)
* @param string $schedule_start_date A date used for filtering jobs schedule after (or at) a specified time must be in ISO 8601 format. schedule end date should not be earlier than schedule start date. (optional)
* @param string $schedule_end_date A date used for filtering jobs schedule before (or at) a specified time must be in ISO 8601 format. schedule end date should not be earlier than schedule start date. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getServiceJobsAsync($marketplace_ids, $service_order_ids = null, $service_job_status = null, $page_token = null, $page_size = '20', $sort_field = null, $sort_order = null, $created_after = null, $created_before = null, $last_updated_after = null, $last_updated_before = null, $schedule_start_date = null, $schedule_end_date = null)
{
return $this->getServiceJobsAsyncWithHttpInfo($marketplace_ids, $service_order_ids, $service_job_status, $page_token, $page_size, $sort_field, $sort_order, $created_after, $created_before, $last_updated_after, $last_updated_before, $schedule_start_date, $schedule_end_date)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getServiceJobsAsyncWithHttpInfo.
*
* @param string[] $marketplace_ids Used to select jobs that were placed in the specified marketplaces. (required)
* @param string[] $service_order_ids List of service order ids for the query you want to perform.Max values supported 20. (optional)
* @param string[] $service_job_status A list of one or more job status by which to filter the list of jobs. (optional)
* @param string $page_token String returned in the response of your previous request. (optional)
* @param int $page_size A non-negative integer that indicates the maximum number of jobs to return in the list, Value must be 1 - 20. Default 20. (optional, default to 20)
* @param string $sort_field Sort fields on which you want to sort the output. (optional)
* @param string $sort_order Sort order for the query you want to perform. (optional)
* @param string $created_after A date used for selecting jobs created after (or at) a specified time must be in ISO 8601 format. Required if LastUpdatedAfter is not specified.Specifying both CreatedAfter and LastUpdatedAfter returns an error. (optional)
* @param string $created_before A date used for selecting jobs created before (or at) a specified time must be in ISO 8601 format. (optional)
* @param string $last_updated_after A date used for selecting jobs updated after (or at) a specified time must be in ISO 8601 format. Required if createdAfter is not specified.Specifying both CreatedAfter and LastUpdatedAfter returns an error. (optional)
* @param string $last_updated_before A date used for selecting jobs updated before (or at) a specified time must be in ISO 8601 format. (optional)
* @param string $schedule_start_date A date used for filtering jobs schedule after (or at) a specified time must be in ISO 8601 format. schedule end date should not be earlier than schedule start date. (optional)
* @param string $schedule_end_date A date used for filtering jobs schedule before (or at) a specified time must be in ISO 8601 format. schedule end date should not be earlier than schedule start date. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getServiceJobsAsyncWithHttpInfo($marketplace_ids, $service_order_ids = null, $service_job_status = null, $page_token = null, $page_size = '20', $sort_field = null, $sort_order = null, $created_after = null, $created_before = null, $last_updated_after = null, $last_updated_before = null, $schedule_start_date = null, $schedule_end_date = null)
{
$request = $this->getServiceJobsRequest($marketplace_ids, $service_order_ids, $service_job_status, $page_token, $page_size, $sort_field, $sort_order, $created_after, $created_before, $last_updated_after, $last_updated_before, $schedule_start_date, $schedule_end_date);
return $this->sendRequestAsync($request, GetServiceJobsResponse::class);
}
/**
* Create request for operation 'getServiceJobs'.
*
* @param string[] $marketplace_ids Used to select jobs that were placed in the specified marketplaces. (required)
* @param string[] $service_order_ids List of service order ids for the query you want to perform.Max values supported 20. (optional)
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | true |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/SalesApi.php | lib/Api/SalesApi.php | <?php
/**
* SalesApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Sales.
*
* The Selling Partner API for Sales provides APIs related to sales performance.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\Sales\GetOrderMetricsResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Psr7\Request;
/**
* SalesApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class SalesApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation getOrderMetrics.
*
* @param string[] $marketplace_ids A list of marketplace identifiers. Example: ATVPDKIKX0DER indicates the US marketplace. (required)
* @param string $interval A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00--2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone. (required)
* @param string $granularity The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity=Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity=Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date don’t align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone. (required)
* @param string $granularity_time_zone An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone. (optional)
* @param string $buyer_type Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers. (optional, default to All)
* @param string $fulfillment_network Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network. (optional)
* @param string $first_day_of_week Specifies the day that the week starts on when granularity=Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday. (optional, default to Monday)
* @param string $asin Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN. (optional)
* @param string $sku Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU. (optional)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Sales\GetOrderMetricsResponse
*/
public function getOrderMetrics($marketplace_ids, $interval, $granularity, $granularity_time_zone = null, $buyer_type = 'All', $fulfillment_network = null, $first_day_of_week = 'Monday', $asin = null, $sku = null)
{
list($response) = $this->getOrderMetricsWithHttpInfo($marketplace_ids, $interval, $granularity, $granularity_time_zone, $buyer_type, $fulfillment_network, $first_day_of_week, $asin, $sku);
return $response;
}
/**
* Operation getOrderMetricsWithHttpInfo.
*
* @param string[] $marketplace_ids A list of marketplace identifiers. Example: ATVPDKIKX0DER indicates the US marketplace. (required)
* @param string $interval A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00--2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone. (required)
* @param string $granularity The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity=Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity=Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date don’t align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone. (required)
* @param string $granularity_time_zone An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone. (optional)
* @param string $buyer_type Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers. (optional, default to All)
* @param string $fulfillment_network Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network. (optional)
* @param string $first_day_of_week Specifies the day that the week starts on when granularity=Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday. (optional, default to Monday)
* @param string $asin Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN. (optional)
* @param string $sku Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU. (optional)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Sales\GetOrderMetricsResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getOrderMetricsWithHttpInfo($marketplace_ids, $interval, $granularity, $granularity_time_zone = null, $buyer_type = 'All', $fulfillment_network = null, $first_day_of_week = 'Monday', $asin = null, $sku = null)
{
$request = $this->getOrderMetricsRequest($marketplace_ids, $interval, $granularity, $granularity_time_zone, $buyer_type, $fulfillment_network, $first_day_of_week, $asin, $sku);
return $this->sendRequest($request, GetOrderMetricsResponse::class);
}
/**
* Operation getOrderMetricsAsync.
*
* @param string[] $marketplace_ids A list of marketplace identifiers. Example: ATVPDKIKX0DER indicates the US marketplace. (required)
* @param string $interval A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00--2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone. (required)
* @param string $granularity The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity=Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity=Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date don’t align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone. (required)
* @param string $granularity_time_zone An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone. (optional)
* @param string $buyer_type Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers. (optional, default to All)
* @param string $fulfillment_network Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network. (optional)
* @param string $first_day_of_week Specifies the day that the week starts on when granularity=Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday. (optional, default to Monday)
* @param string $asin Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN. (optional)
* @param string $sku Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getOrderMetricsAsync($marketplace_ids, $interval, $granularity, $granularity_time_zone = null, $buyer_type = 'All', $fulfillment_network = null, $first_day_of_week = 'Monday', $asin = null, $sku = null)
{
return $this->getOrderMetricsAsyncWithHttpInfo($marketplace_ids, $interval, $granularity, $granularity_time_zone, $buyer_type, $fulfillment_network, $first_day_of_week, $asin, $sku)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getOrderMetricsAsyncWithHttpInfo.
*
* @param string[] $marketplace_ids A list of marketplace identifiers. Example: ATVPDKIKX0DER indicates the US marketplace. (required)
* @param string $interval A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00--2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone. (required)
* @param string $granularity The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity=Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity=Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date don’t align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone. (required)
* @param string $granularity_time_zone An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone. (optional)
* @param string $buyer_type Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers. (optional, default to All)
* @param string $fulfillment_network Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network. (optional)
* @param string $first_day_of_week Specifies the day that the week starts on when granularity=Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday. (optional, default to Monday)
* @param string $asin Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN. (optional)
* @param string $sku Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getOrderMetricsAsyncWithHttpInfo($marketplace_ids, $interval, $granularity, $granularity_time_zone = null, $buyer_type = 'All', $fulfillment_network = null, $first_day_of_week = 'Monday', $asin = null, $sku = null)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Sales\GetOrderMetricsResponse';
$request = $this->getOrderMetricsRequest($marketplace_ids, $interval, $granularity, $granularity_time_zone, $buyer_type, $fulfillment_network, $first_day_of_week, $asin, $sku);
return $this->sendRequestAsync($request, GetOrderMetricsResponse::class);
}
/**
* Create request for operation 'getOrderMetrics'.
*
* @param string[] $marketplace_ids A list of marketplace identifiers. Example: ATVPDKIKX0DER indicates the US marketplace. (required)
* @param string $interval A time interval used for selecting order metrics. This takes the form of two dates separated by two hyphens (first date is inclusive; second date is exclusive). Dates are in ISO8601 format and must represent absolute time (either Z notation or offset notation). Example: 2018-09-01T00:00:00-07:00--2018-09-04T00:00:00-07:00 requests order metrics for Sept 1st, 2nd and 3rd in the -07:00 zone. (required)
* @param string $granularity The granularity of the grouping of order metrics, based on a unit of time. Specifying granularity=Hour results in a successful request only if the interval specified is less than or equal to 30 days from now. For all other granularities, the interval specified must be less or equal to 2 years from now. Specifying granularity=Total results in order metrics that are aggregated over the entire interval that you specify. If the interval start and end date don’t align with the specified granularity, the head and tail end of the response interval will contain partial data. Example: Day to get a daily breakdown of the request interval, where the day boundary is defined by the granularityTimeZone. (required)
* @param string $granularity_time_zone An IANA-compatible time zone for determining the day boundary. Required when specifying a granularity value greater than Hour. The granularityTimeZone value must align with the offset of the specified interval value. For example, if the interval value uses Z notation, then granularityTimeZone must be UTC. If the interval value uses an offset, then granularityTimeZone must be an IANA-compatible time zone that matches the offset. Example: US/Pacific to compute day boundaries, accounting for daylight time savings, for US/Pacific zone. (optional)
* @param string $buyer_type Filters the results by the buyer type that you specify, B2B (business to business) or B2C (business to customer). Example: B2B, if you want the response to include order metrics for only B2B buyers. (optional, default to All)
* @param string $fulfillment_network Filters the results by the fulfillment network that you specify, MFN (merchant fulfillment network) or AFN (Amazon fulfillment network). Do not include this filter if you want the response to include order metrics for all fulfillment networks. Example: AFN, if you want the response to include order metrics for only Amazon fulfillment network. (optional)
* @param string $first_day_of_week Specifies the day that the week starts on when granularity=Week, either Monday or Sunday. Default: Monday. Example: Sunday, if you want the week to start on a Sunday. (optional, default to Monday)
* @param string $asin Filters the results by the ASIN that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all ASINs. Example: B0792R1RSN, if you want the response to include order metrics for only ASIN B0792R1RSN. (optional)
* @param string $sku Filters the results by the SKU that you specify. Specifying both ASIN and SKU returns an error. Do not include this filter if you want the response to include order metrics for all SKUs. Example: TestSKU, if you want the response to include order metrics for only SKU TestSKU. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getOrderMetricsRequest($marketplace_ids, $interval, $granularity, $granularity_time_zone = null, $buyer_type = 'All', $fulfillment_network = null, $first_day_of_week = 'Monday', $asin = null, $sku = null)
{
// verify the required parameter 'marketplace_ids' is set
if (null === $marketplace_ids || (is_array($marketplace_ids) && 0 === count($marketplace_ids))) {
throw new \InvalidArgumentException('Missing the required parameter $marketplace_ids when calling getOrderMetrics');
}
// verify the required parameter 'interval' is set
if (null === $interval || (is_array($interval) && 0 === count($interval))) {
throw new \InvalidArgumentException('Missing the required parameter $interval when calling getOrderMetrics');
}
// verify the required parameter 'granularity' is set
if (null === $granularity || (is_array($granularity) && 0 === count($granularity))) {
throw new \InvalidArgumentException('Missing the required parameter $granularity when calling getOrderMetrics');
}
$resourcePath = '/sales/v1/orderMetrics';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (is_array($marketplace_ids)) {
$marketplace_ids = ObjectSerializer::serializeCollection($marketplace_ids, 'csv', true);
}
if (null !== $marketplace_ids) {
$queryParams['marketplaceIds'] = ObjectSerializer::toQueryValue($marketplace_ids);
}
// query params
if (null !== $interval) {
$queryParams['interval'] = ObjectSerializer::toQueryValue($interval);
}
// query params
if (null !== $granularity_time_zone) {
$queryParams['granularityTimeZone'] = ObjectSerializer::toQueryValue($granularity_time_zone);
}
// query params
if (null !== $granularity) {
$queryParams['granularity'] = ObjectSerializer::toQueryValue($granularity);
}
// query params
if (null !== $buyer_type) {
$queryParams['buyerType'] = ObjectSerializer::toQueryValue($buyer_type);
}
// query params
if (null !== $fulfillment_network) {
$queryParams['fulfillmentNetwork'] = ObjectSerializer::toQueryValue($fulfillment_network);
}
// query params
if (null !== $first_day_of_week) {
$queryParams['firstDayOfWeek'] = ObjectSerializer::toQueryValue($first_day_of_week);
}
// query params
if (null !== $asin) {
$queryParams['asin'] = ObjectSerializer::toQueryValue($asin);
}
// query params
if (null !== $sku) {
$queryParams['sku'] = ObjectSerializer::toQueryValue($sku);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/AuthorizationApi.php | lib/Api/AuthorizationApi.php | <?php
/**
* AuthorizationApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Authorization.
*
* The Selling Partner API for Authorization helps developers manage authorizations and check the specific permissions associated with a given authorization.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\ApiException;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\Authorization\GetAuthorizationCodeResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use InvalidArgumentException;
/**
* AuthorizationApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class AuthorizationApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation getAuthorizationCode.
*
* Returns the Login with Amazon (LWA) authorization code for an existing Amazon MWS authorization.
*
* @param string $selling_partner_id The seller ID of the seller for whom you are requesting Selling Partner API authorization. This must be the seller ID of the seller who authorized your application on the Marketplace Appstore. (required)
* @param string $developer_id Your developer ID. This must be one of the developer ID values that you provided when you registered your application in Developer Central. (required)
* @param string $mws_auth_token The MWS Auth Token that was generated when the seller authorized your application on the Marketplace Appstore. (required)
*
* @throws InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return GetAuthorizationCodeResponse
*/
public function getAuthorizationCode($selling_partner_id, $developer_id, $mws_auth_token)
{
list($response) = $this->getAuthorizationCodeWithHttpInfo($selling_partner_id, $developer_id, $mws_auth_token);
return $response;
}
/**
* Operation getAuthorizationCodeWithHttpInfo.
*
* Returns the Login with Amazon (LWA) authorization code for an existing Amazon MWS authorization.
*
* @param string $selling_partner_id The seller ID of the seller for whom you are requesting Selling Partner API authorization. This must be the seller ID of the seller who authorized your application on the Marketplace Appstore. (required)
* @param string $developer_id Your developer ID. This must be one of the developer ID values that you provided when you registered your application in Developer Central. (required)
* @param string $mws_auth_token The MWS Auth Token that was generated when the seller authorized your application on the Marketplace Appstore. (required)
*
* @throws InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Authorization\GetAuthorizationCodeResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getAuthorizationCodeWithHttpInfo($selling_partner_id, $developer_id, $mws_auth_token)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Authorization\GetAuthorizationCodeResponse';
$request = $this->getAuthorizationCodeRequest($selling_partner_id, $developer_id, $mws_auth_token);
return $this->sendRequest($request, GetAuthorizationCodeResponse::class);
}
/**
* Operation getAuthorizationCodeAsync.
*
* Returns the Login with Amazon (LWA) authorization code for an existing Amazon MWS authorization.
*
* @param string $selling_partner_id The seller ID of the seller for whom you are requesting Selling Partner API authorization. This must be the seller ID of the seller who authorized your application on the Marketplace Appstore. (required)
* @param string $developer_id Your developer ID. This must be one of the developer ID values that you provided when you registered your application in Developer Central. (required)
* @param string $mws_auth_token The MWS Auth Token that was generated when the seller authorized your application on the Marketplace Appstore. (required)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAuthorizationCodeAsync($selling_partner_id, $developer_id, $mws_auth_token)
{
return $this->getAuthorizationCodeAsyncWithHttpInfo($selling_partner_id, $developer_id, $mws_auth_token)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getAuthorizationCodeAsyncWithHttpInfo.
*
* Returns the Login with Amazon (LWA) authorization code for an existing Amazon MWS authorization.
*
* @param string $selling_partner_id The seller ID of the seller for whom you are requesting Selling Partner API authorization. This must be the seller ID of the seller who authorized your application on the Marketplace Appstore. (required)
* @param string $developer_id Your developer ID. This must be one of the developer ID values that you provided when you registered your application in Developer Central. (required)
* @param string $mws_auth_token The MWS Auth Token that was generated when the seller authorized your application on the Marketplace Appstore. (required)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getAuthorizationCodeAsyncWithHttpInfo($selling_partner_id, $developer_id, $mws_auth_token)
{
$request = $this->getAuthorizationCodeRequest($selling_partner_id, $developer_id, $mws_auth_token);
return $this->sendRequestAsync($request, GetAuthorizationCodeResponse::class);
}
/**
* Create request for operation 'getAuthorizationCode'.
*
* @param string $selling_partner_id The seller ID of the seller for whom you are requesting Selling Partner API authorization. This must be the seller ID of the seller who authorized your application on the Marketplace Appstore. (required)
* @param string $developer_id Your developer ID. This must be one of the developer ID values that you provided when you registered your application in Developer Central. (required)
* @param string $mws_auth_token The MWS Auth Token that was generated when the seller authorized your application on the Marketplace Appstore. (required)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getAuthorizationCodeRequest($selling_partner_id, $developer_id, $mws_auth_token)
{
// verify the required parameter 'selling_partner_id' is set
if (null === $selling_partner_id || (is_array($selling_partner_id) && 0 === count($selling_partner_id))) {
throw new InvalidArgumentException('Missing the required parameter $selling_partner_id when calling getAuthorizationCode');
}
// verify the required parameter 'developer_id' is set
if (null === $developer_id || (is_array($developer_id) && 0 === count($developer_id))) {
throw new InvalidArgumentException('Missing the required parameter $developer_id when calling getAuthorizationCode');
}
// verify the required parameter 'mws_auth_token' is set
if (null === $mws_auth_token || (is_array($mws_auth_token) && 0 === count($mws_auth_token))) {
throw new InvalidArgumentException('Missing the required parameter $mws_auth_token when calling getAuthorizationCode');
}
$resourcePath = '/authorization/v1/authorizationCode';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $selling_partner_id) {
$queryParams['sellingPartnerId'] = ObjectSerializer::toQueryValue($selling_partner_id);
}
// query params
if (null !== $developer_id) {
$queryParams['developerId'] = ObjectSerializer::toQueryValue($developer_id);
}
// query params
if (null !== $mws_auth_token) {
$queryParams['mwsAuthToken'] = ObjectSerializer::toQueryValue($mws_auth_token);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/FbaOutboundApi.php | lib/Api/FbaOutboundApi.php | <?php
/**
* FbaOutboundApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner APIs for Fulfillment Outbound.
*
* The Selling Partner API for Fulfillment Outbound lets you create applications that help a seller fulfill Multi-Channel Fulfillment orders using their inventory in Amazon's fulfillment network. You can get information on both potential and existing fulfillment orders.
*
* OpenAPI spec version: 2020-07-01
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\ApiException;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CancelFulfillmentOrderResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CreateFulfillmentOrderResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CreateFulfillmentReturnResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\GetFeatureInventoryResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\GetFeatureSkuResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\GetFeaturesResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\GetFulfillmentOrderResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\GetFulfillmentPreviewResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\GetPackageTrackingDetailsResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\ListAllFulfillmentOrdersResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\ListReturnReasonCodesResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\UpdateFulfillmentOrderRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\UpdateFulfillmentOrderResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
/**
* FbaOutboundApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class FbaOutboundApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation cancelFulfillmentOrder.
*
* @param string $seller_fulfillment_order_id The identifier assigned to the item by the seller when the fulfillment order was created. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CancelFulfillmentOrderResponse
*/
public function cancelFulfillmentOrder($seller_fulfillment_order_id)
{
list($response) = $this->cancelFulfillmentOrderWithHttpInfo($seller_fulfillment_order_id);
return $response;
}
/**
* Operation cancelFulfillmentOrderWithHttpInfo.
*
* @param string $seller_fulfillment_order_id The identifier assigned to the item by the seller when the fulfillment order was created. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CancelFulfillmentOrderResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function cancelFulfillmentOrderWithHttpInfo($seller_fulfillment_order_id)
{
$request = $this->cancelFulfillmentOrderRequest($seller_fulfillment_order_id);
return $this->sendRequest($request, CancelFulfillmentOrderResponse::class);
}
/**
* Operation cancelFulfillmentOrderAsync.
*
* @param string $seller_fulfillment_order_id The identifier assigned to the item by the seller when the fulfillment order was created. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function cancelFulfillmentOrderAsync($seller_fulfillment_order_id)
{
return $this->cancelFulfillmentOrderAsyncWithHttpInfo($seller_fulfillment_order_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation cancelFulfillmentOrderAsyncWithHttpInfo.
*
* @param string $seller_fulfillment_order_id The identifier assigned to the item by the seller when the fulfillment order was created. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function cancelFulfillmentOrderAsyncWithHttpInfo($seller_fulfillment_order_id)
{
$request = $this->cancelFulfillmentOrderRequest($seller_fulfillment_order_id);
return $this->sendRequestAsync($request, CancelFulfillmentOrderResponse::class);
}
/**
* Create request for operation 'cancelFulfillmentOrder'.
*
* @param string $seller_fulfillment_order_id The identifier assigned to the item by the seller when the fulfillment order was created. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function cancelFulfillmentOrderRequest($seller_fulfillment_order_id)
{
// verify the required parameter 'seller_fulfillment_order_id' is set
if (null === $seller_fulfillment_order_id || (is_array($seller_fulfillment_order_id) && 0 === count($seller_fulfillment_order_id))) {
throw new \InvalidArgumentException('Missing the required parameter $seller_fulfillment_order_id when calling cancelFulfillmentOrder');
}
$resourcePath = '/fba/outbound/2020-07-01/fulfillmentOrders/{sellerFulfillmentOrderId}/cancel';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $seller_fulfillment_order_id) {
$resourcePath = str_replace(
'{'.'sellerFulfillmentOrderId'.'}',
ObjectSerializer::toPathValue($seller_fulfillment_order_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'PUT', $httpBody);
}
/**
* Operation createFulfillmentOrder.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CreateFulfillmentOrderRequest $body body (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CreateFulfillmentOrderResponse
*/
public function createFulfillmentOrder($body)
{
list($response) = $this->createFulfillmentOrderWithHttpInfo($body);
return $response;
}
/**
* Operation createFulfillmentOrderWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CreateFulfillmentOrderRequest $body (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CreateFulfillmentOrderResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function createFulfillmentOrderWithHttpInfo($body)
{
$request = $this->createFulfillmentOrderRequest($body);
return $this->sendRequest($request, CreateFulfillmentOrderResponse::class);
}
/**
* Operation createFulfillmentOrderAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CreateFulfillmentOrderRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createFulfillmentOrderAsync($body)
{
return $this->createFulfillmentOrderAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createFulfillmentOrderAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CreateFulfillmentOrderRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createFulfillmentOrderAsyncWithHttpInfo($body)
{
$request = $this->createFulfillmentOrderRequest($body);
return $this->sendRequestAsync($request, CreateFulfillmentOrderResponse::class);
}
/**
* Create request for operation 'createFulfillmentOrder'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CreateFulfillmentOrderRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function createFulfillmentOrderRequest($body)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling createFulfillmentOrder');
}
$resourcePath = '/fba/outbound/2020-07-01/fulfillmentOrders';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation createFulfillmentReturn.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CreateFulfillmentReturnRequest $body body (required)
* @param string $seller_fulfillment_order_id An identifier assigned by the seller to the fulfillment order at the time it was created. The seller uses their own records to find the correct SellerFulfillmentOrderId value based on the buyer's request to return items. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CreateFulfillmentReturnResponse
*/
public function createFulfillmentReturn($body, $seller_fulfillment_order_id)
{
list($response) = $this->createFulfillmentReturnWithHttpInfo($body, $seller_fulfillment_order_id);
return $response;
}
/**
* Operation createFulfillmentReturnWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CreateFulfillmentReturnRequest $body (required)
* @param string $seller_fulfillment_order_id An identifier assigned by the seller to the fulfillment order at the time it was created. The seller uses their own records to find the correct SellerFulfillmentOrderId value based on the buyer's request to return items. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CreateFulfillmentReturnResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function createFulfillmentReturnWithHttpInfo($body, $seller_fulfillment_order_id)
{
$request = $this->createFulfillmentReturnRequest($body, $seller_fulfillment_order_id);
return $this->sendRequest($request, CreateFulfillmentReturnResponse::class);
}
/**
* Operation createFulfillmentReturnAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CreateFulfillmentReturnRequest $body (required)
* @param string $seller_fulfillment_order_id An identifier assigned by the seller to the fulfillment order at the time it was created. The seller uses their own records to find the correct SellerFulfillmentOrderId value based on the buyer's request to return items. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createFulfillmentReturnAsync($body, $seller_fulfillment_order_id)
{
return $this->createFulfillmentReturnAsyncWithHttpInfo($body, $seller_fulfillment_order_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createFulfillmentReturnAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CreateFulfillmentReturnRequest $body (required)
* @param string $seller_fulfillment_order_id An identifier assigned by the seller to the fulfillment order at the time it was created. The seller uses their own records to find the correct SellerFulfillmentOrderId value based on the buyer's request to return items. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createFulfillmentReturnAsyncWithHttpInfo($body, $seller_fulfillment_order_id)
{
$request = $this->createFulfillmentReturnRequest($body, $seller_fulfillment_order_id);
return $this->sendRequestAsync($request, CreateFulfillmentReturnResponse::class);
}
/**
* Create request for operation 'createFulfillmentReturn'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\CreateFulfillmentReturnRequest $body (required)
* @param string $seller_fulfillment_order_id An identifier assigned by the seller to the fulfillment order at the time it was created. The seller uses their own records to find the correct SellerFulfillmentOrderId value based on the buyer's request to return items. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function createFulfillmentReturnRequest($body, $seller_fulfillment_order_id)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling createFulfillmentReturn');
}
// verify the required parameter 'seller_fulfillment_order_id' is set
if (null === $seller_fulfillment_order_id || (is_array($seller_fulfillment_order_id) && 0 === count($seller_fulfillment_order_id))) {
throw new \InvalidArgumentException('Missing the required parameter $seller_fulfillment_order_id when calling createFulfillmentReturn');
}
$resourcePath = '/fba/outbound/2020-07-01/fulfillmentOrders/{sellerFulfillmentOrderId}/return';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
// path params
if (null !== $seller_fulfillment_order_id) {
$resourcePath = str_replace(
'{'.'sellerFulfillmentOrderId'.'}',
ObjectSerializer::toPathValue($seller_fulfillment_order_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'PUT', $httpBody);
}
/**
* Operation getFeatureInventory.
*
* @param string $marketplace_id The marketplace for which to return a list of the inventory that is eligible for the specified feature. (required)
* @param string $feature_name The name of the feature for which to return a list of eligible inventory. (required)
* @param string $next_token A string token returned in the response to your previous request that is used to return the next response page. A value of null will return the first page. (optional)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\GetFeatureInventoryResponse
*/
public function getFeatureInventory($marketplace_id, $feature_name, $next_token = null)
{
list($response) = $this->getFeatureInventoryWithHttpInfo($marketplace_id, $feature_name, $next_token);
return $response;
}
/**
* Operation getFeatureInventoryWithHttpInfo.
*
* @param string $marketplace_id The marketplace for which to return a list of the inventory that is eligible for the specified feature. (required)
* @param string $feature_name The name of the feature for which to return a list of eligible inventory. (required)
* @param string $next_token A string token returned in the response to your previous request that is used to return the next response page. A value of null will return the first page. (optional)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\GetFeatureInventoryResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getFeatureInventoryWithHttpInfo($marketplace_id, $feature_name, $next_token = null)
{
$request = $this->getFeatureInventoryRequest($marketplace_id, $feature_name, $next_token);
return $this->sendRequest($request, GetFeatureInventoryResponse::class);
}
/**
* Operation getFeatureInventoryAsync.
*
* @param string $marketplace_id The marketplace for which to return a list of the inventory that is eligible for the specified feature. (required)
* @param string $feature_name The name of the feature for which to return a list of eligible inventory. (required)
* @param string $next_token A string token returned in the response to your previous request that is used to return the next response page. A value of null will return the first page. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getFeatureInventoryAsync($marketplace_id, $feature_name, $next_token = null)
{
return $this->getFeatureInventoryAsyncWithHttpInfo($marketplace_id, $feature_name, $next_token)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getFeatureInventoryAsyncWithHttpInfo.
*
* @param string $marketplace_id The marketplace for which to return a list of the inventory that is eligible for the specified feature. (required)
* @param string $feature_name The name of the feature for which to return a list of eligible inventory. (required)
* @param string $next_token A string token returned in the response to your previous request that is used to return the next response page. A value of null will return the first page. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getFeatureInventoryAsyncWithHttpInfo($marketplace_id, $feature_name, $next_token = null)
{
$request = $this->getFeatureInventoryRequest($marketplace_id, $feature_name, $next_token);
return $this->sendRequestAsync($request, GetFeatureInventoryResponse::class);
}
/**
* Create request for operation 'getFeatureInventory'.
*
* @param string $marketplace_id The marketplace for which to return a list of the inventory that is eligible for the specified feature. (required)
* @param string $feature_name The name of the feature for which to return a list of eligible inventory. (required)
* @param string $next_token A string token returned in the response to your previous request that is used to return the next response page. A value of null will return the first page. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getFeatureInventoryRequest($marketplace_id, $feature_name, $next_token = null)
{
// verify the required parameter 'marketplace_id' is set
if (null === $marketplace_id || (is_array($marketplace_id) && 0 === count($marketplace_id))) {
throw new \InvalidArgumentException('Missing the required parameter $marketplace_id when calling getFeatureInventory');
}
// verify the required parameter 'feature_name' is set
if (null === $feature_name || (is_array($feature_name) && 0 === count($feature_name))) {
throw new \InvalidArgumentException('Missing the required parameter $feature_name when calling getFeatureInventory');
}
$resourcePath = '/fba/outbound/2020-07-01/features/inventory/{featureName}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $marketplace_id) {
$queryParams['marketplaceId'] = ObjectSerializer::toQueryValue($marketplace_id);
}
// query params
if (null !== $next_token) {
$queryParams['nextToken'] = ObjectSerializer::toQueryValue($next_token);
}
// path params
if (null !== $feature_name) {
$resourcePath = str_replace(
'{'.'featureName'.'}',
ObjectSerializer::toPathValue($feature_name),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getFeatureSKU.
*
* @param string $marketplace_id The marketplace for which to return the count. (required)
* @param string $feature_name The name of the feature. (required)
* @param string $seller_sku Used to identify an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\GetFeatureSkuResponse
*/
public function getFeatureSKU($marketplace_id, $feature_name, $seller_sku)
{
list($response) = $this->getFeatureSKUWithHttpInfo($marketplace_id, $feature_name, $seller_sku);
return $response;
}
/**
* Operation getFeatureSKUWithHttpInfo.
*
* @param string $marketplace_id The marketplace for which to return the count. (required)
* @param string $feature_name The name of the feature. (required)
* @param string $seller_sku Used to identify an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\GetFeatureSkuResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getFeatureSKUWithHttpInfo($marketplace_id, $feature_name, $seller_sku)
{
$request = $this->getFeatureSKURequest($marketplace_id, $feature_name, $seller_sku);
return $this->sendRequest($request, GetFeatureSkuResponse::class);
}
/**
* Operation getFeatureSKUAsync.
*
* @param string $marketplace_id The marketplace for which to return the count. (required)
* @param string $feature_name The name of the feature. (required)
* @param string $seller_sku Used to identify an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getFeatureSKUAsync($marketplace_id, $feature_name, $seller_sku)
{
return $this->getFeatureSKUAsyncWithHttpInfo($marketplace_id, $feature_name, $seller_sku)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getFeatureSKUAsyncWithHttpInfo.
*
* @param string $marketplace_id The marketplace for which to return the count. (required)
* @param string $feature_name The name of the feature. (required)
* @param string $seller_sku Used to identify an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getFeatureSKUAsyncWithHttpInfo($marketplace_id, $feature_name, $seller_sku)
{
$request = $this->getFeatureSKURequest($marketplace_id, $feature_name, $seller_sku);
return $this->sendRequestAsync($request, GetFeatureSkuResponse::class);
}
/**
* Create request for operation 'getFeatureSKU'.
*
* @param string $marketplace_id The marketplace for which to return the count. (required)
* @param string $feature_name The name of the feature. (required)
* @param string $seller_sku Used to identify an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getFeatureSKURequest($marketplace_id, $feature_name, $seller_sku)
{
// verify the required parameter 'marketplace_id' is set
if (null === $marketplace_id || (is_array($marketplace_id) && 0 === count($marketplace_id))) {
throw new \InvalidArgumentException('Missing the required parameter $marketplace_id when calling getFeatureSKU');
}
// verify the required parameter 'feature_name' is set
if (null === $feature_name || (is_array($feature_name) && 0 === count($feature_name))) {
throw new \InvalidArgumentException('Missing the required parameter $feature_name when calling getFeatureSKU');
}
// verify the required parameter 'seller_sku' is set
if (null === $seller_sku || (is_array($seller_sku) && 0 === count($seller_sku))) {
throw new \InvalidArgumentException('Missing the required parameter $seller_sku when calling getFeatureSKU');
}
$resourcePath = '/fba/outbound/2020-07-01/features/inventory/{featureName}/{sellerSku}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $marketplace_id) {
$queryParams['marketplaceId'] = ObjectSerializer::toQueryValue($marketplace_id);
}
// path params
if (null !== $feature_name) {
$resourcePath = str_replace(
'{'.'featureName'.'}',
ObjectSerializer::toPathValue($feature_name),
$resourcePath
);
}
// path params
if (null !== $seller_sku) {
$resourcePath = str_replace(
'{'.'sellerSku'.'}',
ObjectSerializer::toPathValue($seller_sku),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getFeatures.
*
* @param string $marketplace_id The marketplace for which to return the list of features. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\GetFeaturesResponse
*/
public function getFeatures($marketplace_id)
{
list($response) = $this->getFeaturesWithHttpInfo($marketplace_id);
return $response;
}
/**
* Operation getFeaturesWithHttpInfo.
*
* @param string $marketplace_id The marketplace for which to return the list of features. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentOutbound\GetFeaturesResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getFeaturesWithHttpInfo($marketplace_id)
{
$request = $this->getFeaturesRequest($marketplace_id);
return $this->sendRequest($request, GetFeaturesResponse::class);
}
/**
* Operation getFeaturesAsync.
*
* @param string $marketplace_id The marketplace for which to return the list of features. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getFeaturesAsync($marketplace_id)
{
return $this->getFeaturesAsyncWithHttpInfo($marketplace_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getFeaturesAsyncWithHttpInfo.
*
* @param string $marketplace_id The marketplace for which to return the list of features. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getFeaturesAsyncWithHttpInfo($marketplace_id)
{
$request = $this->getFeaturesRequest($marketplace_id);
return $this->sendRequestAsync($request, GetFeaturesResponse::class);
}
/**
* Create request for operation 'getFeatures'.
*
* @param string $marketplace_id The marketplace for which to return the list of features. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getFeaturesRequest($marketplace_id)
{
// verify the required parameter 'marketplace_id' is set
if (null === $marketplace_id || (is_array($marketplace_id) && 0 === count($marketplace_id))) {
throw new \InvalidArgumentException('Missing the required parameter $marketplace_id when calling getFeatures');
}
$resourcePath = '/fba/outbound/2020-07-01/features';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $marketplace_id) {
$queryParams['marketplaceId'] = ObjectSerializer::toQueryValue($marketplace_id);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getFulfillmentOrder.
*
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | true |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/CatalogApi.php | lib/Api/CatalogApi.php | <?php
/**
* CatalogApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Catalog Items.
*
* The Selling Partner API for Catalog Items helps you programmatically retrieve item details for items in the catalog.
*
* OpenAPI spec version: v0
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\ApiException;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\Catalog\GetCatalogItemResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Catalog\ListCatalogCategoriesResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Catalog\ListCatalogItemsResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Psr7\Request;
use InvalidArgumentException;
/**
* CatalogApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class CatalogApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation getCatalogItem.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for the item. (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Catalog\GetCatalogItemResponse
*/
public function getCatalogItem($marketplace_id, $asin)
{
list($response) = $this->getCatalogItemWithHttpInfo($marketplace_id, $asin);
return $response;
}
/**
* Operation getCatalogItemWithHttpInfo.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for the item. (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (required)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Catalog\GetCatalogItemResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getCatalogItemWithHttpInfo($marketplace_id, $asin)
{
$request = $this->getCatalogItemRequest($marketplace_id, $asin);
return $this->sendRequest($request, GetCatalogItemResponse::class);
}
/**
* Operation getCatalogItemAsync.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for the item. (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (required)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getCatalogItemAsync($marketplace_id, $asin)
{
return $this->getCatalogItemAsyncWithHttpInfo($marketplace_id, $asin)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getCatalogItemAsyncWithHttpInfo.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for the item. (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (required)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getCatalogItemAsyncWithHttpInfo($marketplace_id, $asin)
{
$request = $this->getCatalogItemRequest($marketplace_id, $asin);
return $this->sendRequestAsync($request, GetCatalogItemResponse::class);
}
/**
* Create request for operation 'getCatalogItem'.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for the item. (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (required)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getCatalogItemRequest($marketplace_id, $asin)
{
// verify the required parameter 'marketplace_id' is set
if (null === $marketplace_id || (is_array($marketplace_id) && 0 === count($marketplace_id))) {
throw new InvalidArgumentException('Missing the required parameter $marketplace_id when calling getCatalogItem');
}
// verify the required parameter 'asin' is set
if (null === $asin || (is_array($asin) && 0 === count($asin))) {
throw new InvalidArgumentException('Missing the required parameter $asin when calling getCatalogItem');
}
$resourcePath = '/catalog/v0/items/{asin}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $marketplace_id) {
$queryParams['MarketplaceId'] = ObjectSerializer::toQueryValue($marketplace_id);
}
// path params
if (null !== $asin) {
$resourcePath = str_replace(
'{'.'asin'.'}',
ObjectSerializer::toPathValue($asin),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation listCatalogCategories.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for the item. (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (optional)
* @param string $seller_sku Used to identify items in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (optional)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Catalog\ListCatalogCategoriesResponse
*/
public function listCatalogCategories($marketplace_id, $asin = null, $seller_sku = null)
{
list($response) = $this->listCatalogCategoriesWithHttpInfo($marketplace_id, $asin, $seller_sku);
return $response;
}
/**
* Operation listCatalogCategoriesWithHttpInfo.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for the item. (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (optional)
* @param string $seller_sku Used to identify items in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (optional)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Catalog\ListCatalogCategoriesResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function listCatalogCategoriesWithHttpInfo($marketplace_id, $asin = null, $seller_sku = null)
{
$request = $this->listCatalogCategoriesRequest($marketplace_id, $asin, $seller_sku);
return $this->sendRequest($request, ListCatalogCategoriesResponse::class);
}
/**
* Operation listCatalogCategoriesAsync.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for the item. (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (optional)
* @param string $seller_sku Used to identify items in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (optional)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function listCatalogCategoriesAsync($marketplace_id, $asin = null, $seller_sku = null)
{
return $this->listCatalogCategoriesAsyncWithHttpInfo($marketplace_id, $asin, $seller_sku)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation listCatalogCategoriesAsyncWithHttpInfo.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for the item. (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (optional)
* @param string $seller_sku Used to identify items in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (optional)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function listCatalogCategoriesAsyncWithHttpInfo($marketplace_id, $asin = null, $seller_sku = null)
{
$request = $this->listCatalogCategoriesRequest($marketplace_id, $asin, $seller_sku);
return $this->sendRequestAsync($request, ListCatalogCategoriesResponse::class);
}
/**
* Create request for operation 'listCatalogCategories'.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for the item. (required)
* @param string $asin The Amazon Standard Identification Number (ASIN) of the item. (optional)
* @param string $seller_sku Used to identify items in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (optional)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function listCatalogCategoriesRequest($marketplace_id, $asin = null, $seller_sku = null)
{
// verify the required parameter 'marketplace_id' is set
if (null === $marketplace_id || (is_array($marketplace_id) && 0 === count($marketplace_id))) {
throw new InvalidArgumentException('Missing the required parameter $marketplace_id when calling listCatalogCategories');
}
$resourcePath = '/catalog/v0/categories';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $marketplace_id) {
$queryParams['MarketplaceId'] = ObjectSerializer::toQueryValue($marketplace_id);
}
// query params
if (null !== $asin) {
$queryParams['ASIN'] = ObjectSerializer::toQueryValue($asin);
}
// query params
if (null !== $seller_sku) {
$queryParams['SellerSKU'] = ObjectSerializer::toQueryValue($seller_sku);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation listCatalogItems.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which items are returned. (required)
* @param string $query Keyword(s) to use to search for items in the catalog. Example: 'harry potter books'. (optional)
* @param string $query_context_id An identifier for the context within which the given search will be performed. A marketplace might provide mechanisms for constraining a search to a subset of potential items. For example, the retail marketplace allows queries to be constrained to a specific category. The QueryContextId parameter specifies such a subset. If it is omitted, the search will be performed using the default context for the marketplace, which will typically contain the largest set of items. (optional)
* @param string $seller_sku Used to identify an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (optional)
* @param string $upc A 12-digit bar code used for retail packaging. (optional)
* @param string $ean A European article number that uniquely identifies the catalog item, manufacturer, and its attributes. (optional)
* @param string $isbn The unique commercial book identifier used to identify books internationally. (optional)
* @param string $jan A Japanese article number that uniquely identifies the product, manufacturer, and its attributes. (optional)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Catalog\ListCatalogItemsResponse
*/
public function listCatalogItems($marketplace_id, $query = null, $query_context_id = null, $seller_sku = null, $upc = null, $ean = null, $isbn = null, $jan = null)
{
list($response) = $this->listCatalogItemsWithHttpInfo($marketplace_id, $query, $query_context_id, $seller_sku, $upc, $ean, $isbn, $jan);
return $response;
}
/**
* Operation listCatalogItemsWithHttpInfo.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which items are returned. (required)
* @param string $query Keyword(s) to use to search for items in the catalog. Example: 'harry potter books'. (optional)
* @param string $query_context_id An identifier for the context within which the given search will be performed. A marketplace might provide mechanisms for constraining a search to a subset of potential items. For example, the retail marketplace allows queries to be constrained to a specific category. The QueryContextId parameter specifies such a subset. If it is omitted, the search will be performed using the default context for the marketplace, which will typically contain the largest set of items. (optional)
* @param string $seller_sku Used to identify an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (optional)
* @param string $upc A 12-digit bar code used for retail packaging. (optional)
* @param string $ean A European article number that uniquely identifies the catalog item, manufacturer, and its attributes. (optional)
* @param string $isbn The unique commercial book identifier used to identify books internationally. (optional)
* @param string $jan A Japanese article number that uniquely identifies the product, manufacturer, and its attributes. (optional)
*
* @throws ApiException on non-2xx response
* @throws InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Catalog\ListCatalogItemsResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function listCatalogItemsWithHttpInfo($marketplace_id, $query = null, $query_context_id = null, $seller_sku = null, $upc = null, $ean = null, $isbn = null, $jan = null)
{
$request = $this->listCatalogItemsRequest($marketplace_id, $query, $query_context_id, $seller_sku, $upc, $ean, $isbn, $jan);
return $this->sendRequest($request, ListCatalogItemsResponse::class);
}
/**
* Operation listCatalogItemsAsync.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which items are returned. (required)
* @param string $query Keyword(s) to use to search for items in the catalog. Example: 'harry potter books'. (optional)
* @param string $query_context_id An identifier for the context within which the given search will be performed. A marketplace might provide mechanisms for constraining a search to a subset of potential items. For example, the retail marketplace allows queries to be constrained to a specific category. The QueryContextId parameter specifies such a subset. If it is omitted, the search will be performed using the default context for the marketplace, which will typically contain the largest set of items. (optional)
* @param string $seller_sku Used to identify an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (optional)
* @param string $upc A 12-digit bar code used for retail packaging. (optional)
* @param string $ean A European article number that uniquely identifies the catalog item, manufacturer, and its attributes. (optional)
* @param string $isbn The unique commercial book identifier used to identify books internationally. (optional)
* @param string $jan A Japanese article number that uniquely identifies the product, manufacturer, and its attributes. (optional)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function listCatalogItemsAsync($marketplace_id, $query = null, $query_context_id = null, $seller_sku = null, $upc = null, $ean = null, $isbn = null, $jan = null)
{
return $this->listCatalogItemsAsyncWithHttpInfo($marketplace_id, $query, $query_context_id, $seller_sku, $upc, $ean, $isbn, $jan)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation listCatalogItemsAsyncWithHttpInfo.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which items are returned. (required)
* @param string $query Keyword(s) to use to search for items in the catalog. Example: 'harry potter books'. (optional)
* @param string $query_context_id An identifier for the context within which the given search will be performed. A marketplace might provide mechanisms for constraining a search to a subset of potential items. For example, the retail marketplace allows queries to be constrained to a specific category. The QueryContextId parameter specifies such a subset. If it is omitted, the search will be performed using the default context for the marketplace, which will typically contain the largest set of items. (optional)
* @param string $seller_sku Used to identify an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (optional)
* @param string $upc A 12-digit bar code used for retail packaging. (optional)
* @param string $ean A European article number that uniquely identifies the catalog item, manufacturer, and its attributes. (optional)
* @param string $isbn The unique commercial book identifier used to identify books internationally. (optional)
* @param string $jan A Japanese article number that uniquely identifies the product, manufacturer, and its attributes. (optional)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function listCatalogItemsAsyncWithHttpInfo($marketplace_id, $query = null, $query_context_id = null, $seller_sku = null, $upc = null, $ean = null, $isbn = null, $jan = null)
{
$request = $this->listCatalogItemsRequest($marketplace_id, $query, $query_context_id, $seller_sku, $upc, $ean, $isbn, $jan);
return $this->sendRequestAsync($request, ListCatalogItemsResponse::class);
}
/**
* Create request for operation 'listCatalogItems'.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace for which items are returned. (required)
* @param string $query Keyword(s) to use to search for items in the catalog. Example: 'harry potter books'. (optional)
* @param string $query_context_id An identifier for the context within which the given search will be performed. A marketplace might provide mechanisms for constraining a search to a subset of potential items. For example, the retail marketplace allows queries to be constrained to a specific category. The QueryContextId parameter specifies such a subset. If it is omitted, the search will be performed using the default context for the marketplace, which will typically contain the largest set of items. (optional)
* @param string $seller_sku Used to identify an item in the given marketplace. SellerSKU is qualified by the seller's SellerId, which is included with every operation that you submit. (optional)
* @param string $upc A 12-digit bar code used for retail packaging. (optional)
* @param string $ean A European article number that uniquely identifies the catalog item, manufacturer, and its attributes. (optional)
* @param string $isbn The unique commercial book identifier used to identify books internationally. (optional)
* @param string $jan A Japanese article number that uniquely identifies the product, manufacturer, and its attributes. (optional)
*
* @throws InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function listCatalogItemsRequest($marketplace_id, $query = null, $query_context_id = null, $seller_sku = null, $upc = null, $ean = null, $isbn = null, $jan = null)
{
// verify the required parameter 'marketplace_id' is set
if (null === $marketplace_id || (is_array($marketplace_id) && 0 === count($marketplace_id))) {
throw new InvalidArgumentException('Missing the required parameter $marketplace_id when calling listCatalogItems');
}
$resourcePath = '/catalog/v0/items';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $marketplace_id) {
$queryParams['MarketplaceId'] = ObjectSerializer::toQueryValue($marketplace_id);
}
// query params
if (null !== $query) {
$queryParams['Query'] = ObjectSerializer::toQueryValue($query);
}
// query params
if (null !== $query_context_id) {
$queryParams['QueryContextId'] = ObjectSerializer::toQueryValue($query_context_id);
}
// query params
if (null !== $seller_sku) {
$queryParams['SellerSKU'] = ObjectSerializer::toQueryValue($seller_sku);
}
// query params
if (null !== $upc) {
$queryParams['UPC'] = ObjectSerializer::toQueryValue($upc);
}
// query params
if (null !== $ean) {
$queryParams['EAN'] = ObjectSerializer::toQueryValue($ean);
}
// query params
if (null !== $isbn) {
$queryParams['ISBN'] = ObjectSerializer::toQueryValue($isbn);
}
// query params
if (null !== $jan) {
$queryParams['JAN'] = ObjectSerializer::toQueryValue($jan);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/ReportsApi.php | lib/Api/ReportsApi.php | <?php
/**
* ReportsApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Reports.
*
* The Selling Partner API for Reports lets you retrieve and manage a variety of reports that can help selling partners manage their businesses.
*
* OpenAPI spec version: 2020-09-04
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\ApiException;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\Reports\CancelReportResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Reports\CancelReportScheduleResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Reports\CreateReportResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Reports\CreateReportScheduleResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Reports\CreateReportSpecification;
use ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportDocumentResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportScheduleResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportSchedulesResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportsResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\RequestException;
/**
* ReportsApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class ReportsApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation cancelReport.
*
* @param string $report_id The identifier for the report. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Reports\CancelReportResponse
*/
public function cancelReport($report_id)
{
list($response) = $this->cancelReportWithHttpInfo($report_id);
return $response;
}
/**
* Operation cancelReportWithHttpInfo.
*
* @param string $report_id The identifier for the report. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Reports\CancelReportResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function cancelReportWithHttpInfo($report_id)
{
$request = $this->cancelReportRequest($report_id);
return $this->sendRequest($request, CancelReportResponse::class);
}
/**
* Operation cancelReportAsync.
*
* @param string $report_id The identifier for the report. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function cancelReportAsync($report_id)
{
return $this->cancelReportAsyncWithHttpInfo($report_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation cancelReportAsyncWithHttpInfo.
*
* @param string $report_id The identifier for the report. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function cancelReportAsyncWithHttpInfo($report_id)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Reports\CancelReportResponse';
$request = $this->cancelReportRequest($report_id);
return $this->sendRequestAsync($request, CancelReportResponse::class);
}
/**
* Create request for operation 'cancelReport'.
*
* @param string $report_id The identifier for the report. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function cancelReportRequest($report_id)
{
// verify the required parameter 'report_id' is set
if (null === $report_id || (is_array($report_id) && 0 === count($report_id))) {
throw new \InvalidArgumentException('Missing the required parameter $report_id when calling cancelReport');
}
$resourcePath = '/reports/2020-09-04/reports/{reportId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $report_id) {
$resourcePath = str_replace(
'{'.'reportId'.'}',
ObjectSerializer::toPathValue($report_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'DELETE', $httpBody);
}
/**
* Operation cancelReportSchedule.
*
* @param string $report_schedule_id The identifier for the report schedule. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Reports\CancelReportScheduleResponse
*/
public function cancelReportSchedule($report_schedule_id)
{
list($response) = $this->cancelReportScheduleWithHttpInfo($report_schedule_id);
return $response;
}
/**
* Operation cancelReportScheduleWithHttpInfo.
*
* @param string $report_schedule_id The identifier for the report schedule. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Reports\CancelReportScheduleResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function cancelReportScheduleWithHttpInfo($report_schedule_id)
{
$request = $this->cancelReportScheduleRequest($report_schedule_id);
return $this->sendRequest($request, CancelReportScheduleResponse::class);
}
/**
* Operation cancelReportScheduleAsync.
*
* @param string $report_schedule_id The identifier for the report schedule. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function cancelReportScheduleAsync($report_schedule_id)
{
return $this->cancelReportScheduleAsyncWithHttpInfo($report_schedule_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation cancelReportScheduleAsyncWithHttpInfo.
*
* @param string $report_schedule_id The identifier for the report schedule. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function cancelReportScheduleAsyncWithHttpInfo($report_schedule_id)
{
$request = $this->cancelReportScheduleRequest($report_schedule_id);
return $this->sendRequestAsync($request, CancelReportScheduleResponse::class);
}
/**
* Create request for operation 'cancelReportSchedule'.
*
* @param string $report_schedule_id The identifier for the report schedule. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function cancelReportScheduleRequest($report_schedule_id)
{
// verify the required parameter 'report_schedule_id' is set
if (null === $report_schedule_id || (is_array($report_schedule_id) && 0 === count($report_schedule_id))) {
throw new \InvalidArgumentException('Missing the required parameter $report_schedule_id when calling cancelReportSchedule');
}
$resourcePath = '/reports/2020-09-04/schedules/{reportScheduleId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $report_schedule_id) {
$resourcePath = str_replace(
'{'.'reportScheduleId'.'}',
ObjectSerializer::toPathValue($report_schedule_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'DELETE', $httpBody);
}
/**
* Operation createReport.
*
* @param CreateReportSpecification $body body (required)
*
* @throws ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Reports\CreateReportResponse
*/
public function createReport(CreateReportSpecification $body)
{
list($response) = $this->createReportWithHttpInfo($body);
return $response;
}
/**
* Operation createReportWithHttpInfo.
*
* @param CreateReportSpecification $body (required)
*
* @throws ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Reports\CreateReportResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function createReportWithHttpInfo(CreateReportSpecification $body)
{
$request = $this->createReportRequest($body);
return $this->sendRequest($request, CreateReportResponse::class);
}
/**
* Operation createReportAsync.
*
* @param CreateReportSpecification $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createReportAsync($body)
{
return $this->createReportAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createReportAsyncWithHttpInfo.
*
* @param CreateReportSpecification $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createReportAsyncWithHttpInfo($body)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Reports\CreateReportResponse';
$request = $this->createReportRequest($body);
return $this->sendRequestAsync($request, CreateReportResponse::class);
}
/**
* Create request for operation 'createReport'.
*
* @param CreateReportSpecification $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function createReportRequest(CreateReportSpecification $body)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling createReport');
}
$resourcePath = '/reports/2020-09-04/reports';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation createReportSchedule.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Reports\CreateReportScheduleSpecification $body body (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Reports\CreateReportScheduleResponse
*/
public function createReportSchedule($body)
{
list($response) = $this->createReportScheduleWithHttpInfo($body);
return $response;
}
/**
* Operation createReportScheduleWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Reports\CreateReportScheduleSpecification $body (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Reports\CreateReportScheduleResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function createReportScheduleWithHttpInfo($body)
{
$request = $this->createReportScheduleRequest($body);
return $this->sendRequest($request, CreateReportScheduleResponse::class);
}
/**
* Operation createReportScheduleAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Reports\CreateReportScheduleSpecification $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createReportScheduleAsync($body)
{
return $this->createReportScheduleAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createReportScheduleAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Reports\CreateReportScheduleSpecification $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createReportScheduleAsyncWithHttpInfo($body)
{
$request = $this->createReportScheduleRequest($body);
return $this->sendRequestAsync($request, CreateReportScheduleResponse::class);
}
/**
* Create request for operation 'createReportSchedule'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Reports\CreateReportScheduleSpecification $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function createReportScheduleRequest($body)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling createReportSchedule');
}
$resourcePath = '/reports/2020-09-04/schedules';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation getReport.
*
* @param string $report_id The identifier for the report. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportResponse
*/
public function getReport($report_id)
{
list($response) = $this->getReportWithHttpInfo($report_id);
return $response;
}
/**
* Operation getReportWithHttpInfo.
*
* @param string $report_id The identifier for the report. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getReportWithHttpInfo($report_id)
{
$request = $this->getReportRequest($report_id);
return $this->sendRequest($request, GetReportResponse::class);
}
/**
* Operation getReportAsync.
*
* @param string $report_id The identifier for the report. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getReportAsync($report_id)
{
return $this->getReportAsyncWithHttpInfo($report_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getReportAsyncWithHttpInfo.
*
* @param string $report_id The identifier for the report. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getReportAsyncWithHttpInfo($report_id)
{
$request = $this->getReportRequest($report_id);
return $this->sendRequestAsync($request, GetReportResponse::class);
}
/**
* Create request for operation 'getReport'.
*
* @param string $report_id The identifier for the report. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getReportRequest($report_id)
{
// verify the required parameter 'report_id' is set
if (null === $report_id || (is_array($report_id) && 0 === count($report_id))) {
throw new \InvalidArgumentException('Missing the required parameter $report_id when calling getReport');
}
$resourcePath = '/reports/2020-09-04/reports/{reportId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $report_id) {
$resourcePath = str_replace(
'{'.'reportId'.'}',
ObjectSerializer::toPathValue($report_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getReportDocument.
*
* @param string $report_document_id The identifier for the report document. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportDocumentResponse
*/
public function getReportDocument($report_document_id)
{
list($response) = $this->getReportDocumentWithHttpInfo($report_document_id);
return $response;
}
/**
* Operation getReportDocumentWithHttpInfo.
*
* @param string $report_document_id The identifier for the report document. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportDocumentResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getReportDocumentWithHttpInfo($report_document_id)
{
$request = $this->getReportDocumentRequest($report_document_id);
return $this->sendRequest($request, GetReportDocumentResponse::class);
}
/**
* Operation getReportDocumentAsync.
*
* @param string $report_document_id The identifier for the report document. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getReportDocumentAsync($report_document_id)
{
return $this->getReportDocumentAsyncWithHttpInfo($report_document_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getReportDocumentAsyncWithHttpInfo.
*
* @param string $report_document_id The identifier for the report document. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getReportDocumentAsyncWithHttpInfo($report_document_id)
{
$request = $this->getReportDocumentRequest($report_document_id);
return $this->sendRequestAsync($request, GetReportDocumentResponse::class);
}
/**
* Create request for operation 'getReportDocument'.
*
* @param string $report_document_id The identifier for the report document. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getReportDocumentRequest($report_document_id)
{
// verify the required parameter 'report_document_id' is set
if (null === $report_document_id || (is_array($report_document_id) && 0 === count($report_document_id))) {
throw new \InvalidArgumentException('Missing the required parameter $report_document_id when calling getReportDocument');
}
$resourcePath = '/reports/2020-09-04/documents/{reportDocumentId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $report_document_id) {
$resourcePath = str_replace(
'{'.'reportDocumentId'.'}',
ObjectSerializer::toPathValue($report_document_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getReportSchedule.
*
* @param string $report_schedule_id The identifier for the report schedule. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportScheduleResponse
*/
public function getReportSchedule($report_schedule_id)
{
list($response) = $this->getReportScheduleWithHttpInfo($report_schedule_id);
return $response;
}
/**
* Operation getReportScheduleWithHttpInfo.
*
* @param string $report_schedule_id The identifier for the report schedule. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportScheduleResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getReportScheduleWithHttpInfo($report_schedule_id)
{
$request = $this->getReportScheduleRequest($report_schedule_id);
return $this->sendRequest($request, GetReportScheduleResponse::class);
}
/**
* Operation getReportScheduleAsync.
*
* @param string $report_schedule_id The identifier for the report schedule. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getReportScheduleAsync($report_schedule_id)
{
return $this->getReportScheduleAsyncWithHttpInfo($report_schedule_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getReportScheduleAsyncWithHttpInfo.
*
* @param string $report_schedule_id The identifier for the report schedule. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getReportScheduleAsyncWithHttpInfo($report_schedule_id)
{
$request = $this->getReportScheduleRequest($report_schedule_id);
return $this->sendRequestAsync($request, GetReportScheduleResponse::class);
}
/**
* Create request for operation 'getReportSchedule'.
*
* @param string $report_schedule_id The identifier for the report schedule. This identifier is unique only in combination with a seller ID. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getReportScheduleRequest($report_schedule_id)
{
// verify the required parameter 'report_schedule_id' is set
if (null === $report_schedule_id || (is_array($report_schedule_id) && 0 === count($report_schedule_id))) {
throw new \InvalidArgumentException('Missing the required parameter $report_schedule_id when calling getReportSchedule');
}
$resourcePath = '/reports/2020-09-04/schedules/{reportScheduleId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $report_schedule_id) {
$resourcePath = str_replace(
'{'.'reportScheduleId'.'}',
ObjectSerializer::toPathValue($report_schedule_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getReportSchedules.
*
* @param string[] $report_types A list of report types used to filter report schedules. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportSchedulesResponse
*/
public function getReportSchedules($report_types)
{
list($response) = $this->getReportSchedulesWithHttpInfo($report_types);
return $response;
}
/**
* Operation getReportSchedulesWithHttpInfo.
*
* @param string[] $report_types A list of report types used to filter report schedules. (required)
*
* @throws \InvalidArgumentException
* @throws ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportSchedulesResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getReportSchedulesWithHttpInfo($report_types)
{
$request = $this->getReportSchedulesRequest($report_types);
return $this->sendRequest($request, GetReportSchedulesResponse::class);
try {
$options = $this->createHttpClientOption();
try {
$response = $this->client->send($request, $options);
} catch (RequestException $e) {
throw new ApiException("[{$e->getCode()}] {$e->getMessage()}", $e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null);
}
$statusCode = $response->getStatusCode();
if ($statusCode < 200 || $statusCode > 299) {
throw new ApiException(sprintf('[%d] Error connecting to the API (%s)', $statusCode, $request->getUri()), $statusCode, $response->getHeaders(), $response->getBody());
}
$responseBody = $response->getBody();
if ('\SplFileObject' === $returnType) {
$content = $responseBody; //stream goes to serializer
} else {
$content = $responseBody->getContents();
if (!in_array($returnType, ['string', 'integer', 'bool'])) {
$content = json_decode($content);
}
}
return [
ObjectSerializer::deserialize($content, $returnType, []),
$response->getStatusCode(),
$response->getHeaders(),
];
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportSchedulesResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportSchedulesResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 401:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportSchedulesResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 403:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportSchedulesResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 404:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportSchedulesResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 415:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportSchedulesResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 429:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportSchedulesResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 500:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
'\ClouSale\AmazonSellingPartnerAPI\Models\Reports\GetReportSchedulesResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
case 503:
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | true |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/FbaInboundApi.php | lib/Api/FbaInboundApi.php | <?php
/**
* FbaInboundApi.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Fulfillment Inbound.
*
* The Selling Partner API for Fulfillment Inbound lets you create applications that create and update inbound shipments of inventory to Amazon's fulfillment network.
*
* OpenAPI spec version: v0
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\ConfirmPreorderResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\ConfirmTransportResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\CreateInboundShipmentPlanResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\GetBillOfLadingResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\GetLabelsResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\GetPreorderInfoResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\GetPrepInstructionsResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\GetShipmentItemsResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\GetShipmentsResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\GetTransportDetailsResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\InboundShipmentResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\PutTransportDetailsResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\VoidTransportResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
/**
* FbaInboundApi Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class FbaInboundApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation confirmPreorder.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
* @param \DateTime $need_by_date Date that the shipment must arrive at the Amazon fulfillment center to avoid delivery promise breaks for pre-ordered items. Must be in YYYY-MM-DD format. The response to the getPreorderInfo operation returns this value. (required)
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace the shipment is tied to. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\ConfirmPreorderResponse
*/
public function confirmPreorder($shipment_id, $need_by_date, $marketplace_id)
{
list($response) = $this->confirmPreorderWithHttpInfo($shipment_id, $need_by_date, $marketplace_id);
return $response;
}
/**
* Operation confirmPreorderWithHttpInfo.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
* @param \DateTime $need_by_date Date that the shipment must arrive at the Amazon fulfillment center to avoid delivery promise breaks for pre-ordered items. Must be in YYYY-MM-DD format. The response to the getPreorderInfo operation returns this value. (required)
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace the shipment is tied to. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\ConfirmPreorderResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function confirmPreorderWithHttpInfo($shipment_id, $need_by_date, $marketplace_id)
{
$request = $this->confirmPreorderRequest($shipment_id, $need_by_date, $marketplace_id);
return $this->sendRequest($request, ConfirmPreorderResponse::class);
}
/**
* Operation confirmPreorderAsync.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
* @param \DateTime $need_by_date Date that the shipment must arrive at the Amazon fulfillment center to avoid delivery promise breaks for pre-ordered items. Must be in YYYY-MM-DD format. The response to the getPreorderInfo operation returns this value. (required)
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace the shipment is tied to. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function confirmPreorderAsync($shipment_id, $need_by_date, $marketplace_id)
{
return $this->confirmPreorderAsyncWithHttpInfo($shipment_id, $need_by_date, $marketplace_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation confirmPreorderAsyncWithHttpInfo.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
* @param \DateTime $need_by_date Date that the shipment must arrive at the Amazon fulfillment center to avoid delivery promise breaks for pre-ordered items. Must be in YYYY-MM-DD format. The response to the getPreorderInfo operation returns this value. (required)
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace the shipment is tied to. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function confirmPreorderAsyncWithHttpInfo($shipment_id, $need_by_date, $marketplace_id)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\ConfirmPreorderResponse';
$request = $this->confirmPreorderRequest($shipment_id, $need_by_date, $marketplace_id);
return $this->sendRequestAsync($request, ConfirmPreorderResponse::class);
}
/**
* Create request for operation 'confirmPreorder'.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
* @param \DateTime $need_by_date Date that the shipment must arrive at the Amazon fulfillment center to avoid delivery promise breaks for pre-ordered items. Must be in YYYY-MM-DD format. The response to the getPreorderInfo operation returns this value. (required)
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace the shipment is tied to. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function confirmPreorderRequest($shipment_id, $need_by_date, $marketplace_id)
{
// verify the required parameter 'shipment_id' is set
if (null === $shipment_id || (is_array($shipment_id) && 0 === count($shipment_id))) {
throw new \InvalidArgumentException('Missing the required parameter $shipment_id when calling confirmPreorder');
}
// verify the required parameter 'need_by_date' is set
if (null === $need_by_date || (is_array($need_by_date) && 0 === count($need_by_date))) {
throw new \InvalidArgumentException('Missing the required parameter $need_by_date when calling confirmPreorder');
}
// verify the required parameter 'marketplace_id' is set
if (null === $marketplace_id || (is_array($marketplace_id) && 0 === count($marketplace_id))) {
throw new \InvalidArgumentException('Missing the required parameter $marketplace_id when calling confirmPreorder');
}
$resourcePath = '/fba/inbound/v0/shipments/{shipmentId}/preorder/confirm';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $need_by_date) {
$queryParams['NeedByDate'] = ObjectSerializer::toQueryValue($need_by_date);
}
// query params
if (null !== $marketplace_id) {
$queryParams['MarketplaceId'] = ObjectSerializer::toQueryValue($marketplace_id);
}
// path params
if (null !== $shipment_id) {
$resourcePath = str_replace(
'{'.'shipmentId'.'}',
ObjectSerializer::toPathValue($shipment_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'PUT', $httpBody);
}
/**
* Operation confirmTransport.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\ConfirmTransportResponse
*/
public function confirmTransport($shipment_id)
{
list($response) = $this->confirmTransportWithHttpInfo($shipment_id);
return $response;
}
/**
* Operation confirmTransportWithHttpInfo.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\ConfirmTransportResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function confirmTransportWithHttpInfo($shipment_id)
{
$request = $this->confirmTransportRequest($shipment_id);
return $this->sendRequest($request, ConfirmTransportResponse::class);
}
/**
* Operation confirmTransportAsync.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function confirmTransportAsync($shipment_id)
{
return $this->confirmTransportAsyncWithHttpInfo($shipment_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation confirmTransportAsyncWithHttpInfo.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function confirmTransportAsyncWithHttpInfo($shipment_id)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\ConfirmTransportResponse';
$request = $this->confirmTransportRequest($shipment_id);
return $this->sendRequestAsync($request, ConfirmTransportResponse::class);
}
/**
* Create request for operation 'confirmTransport'.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function confirmTransportRequest($shipment_id)
{
// verify the required parameter 'shipment_id' is set
if (null === $shipment_id || (is_array($shipment_id) && 0 === count($shipment_id))) {
throw new \InvalidArgumentException('Missing the required parameter $shipment_id when calling confirmTransport');
}
$resourcePath = '/fba/inbound/v0/shipments/{shipmentId}/transport/confirm';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $shipment_id) {
$resourcePath = str_replace(
'{'.'shipmentId'.'}',
ObjectSerializer::toPathValue($shipment_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation createInboundShipment.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\InboundShipmentRequest $body body (required)
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\InboundShipmentResponse
*/
public function createInboundShipment($body, $shipment_id)
{
list($response) = $this->createInboundShipmentWithHttpInfo($body, $shipment_id);
return $response;
}
/**
* Operation createInboundShipmentWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\InboundShipmentRequest $body (required)
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\InboundShipmentResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function createInboundShipmentWithHttpInfo($body, $shipment_id)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\InboundShipmentResponse';
$request = $this->createInboundShipmentRequest($body, $shipment_id);
return $this->sendRequest($request, InboundShipmentResponse::class);
}
/**
* Operation createInboundShipmentAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\InboundShipmentRequest $body (required)
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createInboundShipmentAsync($body, $shipment_id)
{
return $this->createInboundShipmentAsyncWithHttpInfo($body, $shipment_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createInboundShipmentAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\InboundShipmentRequest $body (required)
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createInboundShipmentAsyncWithHttpInfo($body, $shipment_id)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\InboundShipmentResponse';
$request = $this->createInboundShipmentRequest($body, $shipment_id);
return $this->sendRequestAsync($request, InboundShipmentResponse::class);
}
/**
* Create request for operation 'createInboundShipment'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\InboundShipmentRequest $body (required)
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function createInboundShipmentRequest($body, $shipment_id)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling createInboundShipment');
}
// verify the required parameter 'shipment_id' is set
if (null === $shipment_id || (is_array($shipment_id) && 0 === count($shipment_id))) {
throw new \InvalidArgumentException('Missing the required parameter $shipment_id when calling createInboundShipment');
}
$resourcePath = '/fba/inbound/v0/shipments/{shipmentId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = $body;
$multipart = false;
// path params
if (null !== $shipment_id) {
$resourcePath = str_replace(
'{'.'shipmentId'.'}',
ObjectSerializer::toPathValue($shipment_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation createInboundShipmentPlan.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\CreateInboundShipmentPlanRequest $body body (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\CreateInboundShipmentPlanResponse
*/
public function createInboundShipmentPlan($body)
{
list($response) = $this->createInboundShipmentPlanWithHttpInfo($body);
return $response;
}
/**
* Operation createInboundShipmentPlanWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\CreateInboundShipmentPlanRequest $body (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\CreateInboundShipmentPlanResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function createInboundShipmentPlanWithHttpInfo($body)
{
$request = $this->createInboundShipmentPlanRequest($body);
return $this->sendRequest($request, CreateInboundShipmentPlanResponse::class);
}
/**
* Operation createInboundShipmentPlanAsync.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\CreateInboundShipmentPlanRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createInboundShipmentPlanAsync($body)
{
return $this->createInboundShipmentPlanAsyncWithHttpInfo($body)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation createInboundShipmentPlanAsyncWithHttpInfo.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\CreateInboundShipmentPlanRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function createInboundShipmentPlanAsyncWithHttpInfo($body)
{
$request = $this->createInboundShipmentPlanRequest($body);
return $this->sendRequestAsync($request, CreateInboundShipmentPlanResponse::class);
}
/**
* Create request for operation 'createInboundShipmentPlan'.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\CreateInboundShipmentPlanRequest $body (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function createInboundShipmentPlanRequest($body)
{
// verify the required parameter 'body' is set
if (null === $body || (is_array($body) && 0 === count($body))) {
throw new \InvalidArgumentException('Missing the required parameter $body when calling createInboundShipmentPlan');
}
$resourcePath = '/fba/inbound/v0/plans';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation estimateTransport.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\EstimateTransportResponse
*/
public function estimateTransport($shipment_id)
{
list($response) = $this->estimateTransportWithHttpInfo($shipment_id);
return $response;
}
/**
* Operation estimateTransportWithHttpInfo.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\EstimateTransportResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function estimateTransportWithHttpInfo($shipment_id)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\EstimateTransportResponse';
$request = $this->estimateTransportRequest($shipment_id);
return $this->sendRequest($request, EstimateTransportResponse::class);
}
/**
* Operation estimateTransportAsync.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function estimateTransportAsync($shipment_id)
{
return $this->estimateTransportAsyncWithHttpInfo($shipment_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation estimateTransportAsyncWithHttpInfo.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function estimateTransportAsyncWithHttpInfo($shipment_id)
{
$request = $this->estimateTransportRequest($shipment_id);
return $this->sendRequestAsync($request, EstimateTransportResponse::class);
}
/**
* Create request for operation 'estimateTransport'.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function estimateTransportRequest($shipment_id)
{
// verify the required parameter 'shipment_id' is set
if (null === $shipment_id || (is_array($shipment_id) && 0 === count($shipment_id))) {
throw new \InvalidArgumentException('Missing the required parameter $shipment_id when calling estimateTransport');
}
$resourcePath = '/fba/inbound/v0/shipments/{shipmentId}/transport/estimate';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $shipment_id) {
$resourcePath = str_replace(
'{'.'shipmentId'.'}',
ObjectSerializer::toPathValue($shipment_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'POST', $httpBody);
}
/**
* Operation getBillOfLading.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\GetBillOfLadingResponse
*/
public function getBillOfLading($shipment_id)
{
list($response) = $this->getBillOfLadingWithHttpInfo($shipment_id);
return $response;
}
/**
* Operation getBillOfLadingWithHttpInfo.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\GetBillOfLadingResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getBillOfLadingWithHttpInfo($shipment_id)
{
$request = $this->getBillOfLadingRequest($shipment_id);
return $this->sendRequest($request, GetBillOfLadingResponse::class);
}
/**
* Operation getBillOfLadingAsync.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getBillOfLadingAsync($shipment_id)
{
return $this->getBillOfLadingAsyncWithHttpInfo($shipment_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getBillOfLadingAsyncWithHttpInfo.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getBillOfLadingAsyncWithHttpInfo($shipment_id)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\GetBillOfLadingResponse';
$request = $this->getBillOfLadingRequest($shipment_id);
return $this->sendRequestAsync($request, GetBillOfLadingResponse::class);
}
/**
* Create request for operation 'getBillOfLading'.
*
* @param string $shipment_id A shipment identifier originally returned by the createInboundShipmentPlan operation. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getBillOfLadingRequest($shipment_id)
{
// verify the required parameter 'shipment_id' is set
if (null === $shipment_id || (is_array($shipment_id) && 0 === count($shipment_id))) {
throw new \InvalidArgumentException('Missing the required parameter $shipment_id when calling getBillOfLading');
}
$resourcePath = '/fba/inbound/v0/shipments/{shipmentId}/billOfLading';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $shipment_id) {
$resourcePath = str_replace(
'{'.'shipmentId'.'}',
ObjectSerializer::toPathValue($shipment_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getInboundGuidance.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace where the product would be stored. (required)
* @param string[] $seller_sku_list A list of SellerSKU values. Used to identify items for which you want inbound guidance for shipment to Amazon's fulfillment network. Note: SellerSKU is qualified by the SellerId, which is included with every Selling Partner API operation that you submit. If you specify a SellerSKU that identifies a variation parent ASIN, this operation returns an error. A variation parent ASIN represents a generic product that cannot be sold. Variation child ASINs represent products that have specific characteristics (such as size and color) and can be sold. (optional)
* @param string[] $asin_list A list of ASIN values. Used to identify items for which you want inbound guidance for shipment to Amazon's fulfillment network. Note: If you specify a ASIN that identifies a variation parent ASIN, this operation returns an error. A variation parent ASIN represents a generic product that cannot be sold. Variation child ASINs represent products that have specific characteristics (such as size and color) and can be sold. (optional)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\FulfillmentInbound\GetInboundGuidanceResponse
*/
public function getInboundGuidance($marketplace_id, $seller_sku_list = null, $asin_list = null)
{
list($response) = $this->getInboundGuidanceWithHttpInfo($marketplace_id, $seller_sku_list, $asin_list);
return $response;
}
/**
* Operation getInboundGuidanceWithHttpInfo.
*
* @param string $marketplace_id A marketplace identifier. Specifies the marketplace where the product would be stored. (required)
* @param string[] $seller_sku_list A list of SellerSKU values. Used to identify items for which you want inbound guidance for shipment to Amazon's fulfillment network. Note: SellerSKU is qualified by the SellerId, which is included with every Selling Partner API operation that you submit. If you specify a SellerSKU that identifies a variation parent ASIN, this operation returns an error. A variation parent ASIN represents a generic product that cannot be sold. Variation child ASINs represent products that have specific characteristics (such as size and color) and can be sold. (optional)
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | true |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Api/OrdersApi.php | lib/Api/OrdersApi.php | <?php
/**
* OrdersV0Api.
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Orders.
*
* The Selling Partner API for Orders helps you programmatically retrieve order information. These APIs let you develop fast, flexible, custom applications in areas like order synchronization, order research, and demand-based decision support tools.
*
* OpenAPI spec version: v0
*/
namespace ClouSale\AmazonSellingPartnerAPI\Api;
use ClouSale\AmazonSellingPartnerAPI\Configuration;
use ClouSale\AmazonSellingPartnerAPI\HeaderSelector;
use ClouSale\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderAddressResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderBuyerInfoResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderItemsBuyerInfoResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderItemsResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderResponse;
use ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrdersResponse;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;
/**
* OrdersV0Api Class Doc Comment.
*
* @author Stefan Neuhaus / ClouSale
*/
class OrdersApi
{
use SellingPartnerApiRequest;
/**
* @var ClientInterface
*/
protected $client;
/**
* @var Configuration
*/
protected $config;
/**
* @var HeaderSelector
*/
protected $headerSelector;
public function __construct(Configuration $config)
{
$this->client = new Client();
$this->config = $config;
$this->headerSelector = new HeaderSelector();
}
/**
* @return Configuration
*/
public function getConfig()
{
return $this->config;
}
/**
* Operation getOrder.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderResponse
*/
public function getOrder($order_id)
{
list($response) = $this->getOrderWithHttpInfo($order_id);
return $response;
}
/**
* Operation getOrderWithHttpInfo.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getOrderWithHttpInfo($order_id)
{
$request = $this->getOrderRequest($order_id);
return $this->sendRequest($request, GetOrderResponse::class);
}
/**
* Operation getOrderAsync.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getOrderAsync($order_id)
{
return $this->getOrderAsyncWithHttpInfo($order_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getOrderAsyncWithHttpInfo.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getOrderAsyncWithHttpInfo($order_id)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderResponse';
$request = $this->getOrderRequest($order_id);
return $this->sendRequestAsync($request, GetOrderResponse::class);
}
/**
* Create request for operation 'getOrder'.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getOrderRequest($order_id)
{
// verify the required parameter 'order_id' is set
if (null === $order_id || (is_array($order_id) && 0 === count($order_id))) {
throw new \InvalidArgumentException('Missing the required parameter $order_id when calling getOrder');
}
$resourcePath = '/orders/v0/orders/{orderId}';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $order_id) {
$resourcePath = str_replace(
'{'.'orderId'.'}',
ObjectSerializer::toPathValue($order_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getOrderAddress.
*
* @param string $order_id An orderId is an Amazon-defined order identifier, in 3-7-7 format. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderAddressResponse
*/
public function getOrderAddress($order_id)
{
list($response) = $this->getOrderAddressWithHttpInfo($order_id);
return $response;
}
/**
* Operation getOrderAddressWithHttpInfo.
*
* @param string $order_id An orderId is an Amazon-defined order identifier, in 3-7-7 format. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderAddressResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getOrderAddressWithHttpInfo($order_id)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderAddressResponse';
$request = $this->getOrderAddressRequest($order_id);
return $this->sendRequest($request, GetOrderAddressResponse::class);
}
/**
* Operation getOrderAddressAsync.
*
* @param string $order_id An orderId is an Amazon-defined order identifier, in 3-7-7 format. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getOrderAddressAsync($order_id)
{
return $this->getOrderAddressAsyncWithHttpInfo($order_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getOrderAddressAsyncWithHttpInfo.
*
* @param string $order_id An orderId is an Amazon-defined order identifier, in 3-7-7 format. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getOrderAddressAsyncWithHttpInfo($order_id)
{
$request = $this->getOrderAddressRequest($order_id);
return $this->sendRequestAsync($request, GetOrderAddressResponse::class);
}
/**
* Create request for operation 'getOrderAddress'.
*
* @param string $order_id An orderId is an Amazon-defined order identifier, in 3-7-7 format. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getOrderAddressRequest($order_id)
{
// verify the required parameter 'order_id' is set
if (null === $order_id || (is_array($order_id) && 0 === count($order_id))) {
throw new \InvalidArgumentException('Missing the required parameter $order_id when calling getOrderAddress');
}
$resourcePath = '/orders/v0/orders/{orderId}/address';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $order_id) {
$resourcePath = str_replace(
'{'.'orderId'.'}',
ObjectSerializer::toPathValue($order_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getOrderBuyerInfo.
*
* @param string $order_id An orderId is an Amazon-defined order identifier, in 3-7-7 format. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderBuyerInfoResponse
*/
public function getOrderBuyerInfo($order_id)
{
list($response) = $this->getOrderBuyerInfoWithHttpInfo($order_id);
return $response;
}
/**
* Operation getOrderBuyerInfoWithHttpInfo.
*
* @param string $order_id An orderId is an Amazon-defined order identifier, in 3-7-7 format. (required)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderBuyerInfoResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getOrderBuyerInfoWithHttpInfo($order_id)
{
$request = $this->getOrderBuyerInfoRequest($order_id);
return $this->sendRequest($request, GetOrderBuyerInfoResponse::class);
}
/**
* Operation getOrderBuyerInfoAsync.
*
* @param string $order_id An orderId is an Amazon-defined order identifier, in 3-7-7 format. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getOrderBuyerInfoAsync($order_id)
{
return $this->getOrderBuyerInfoAsyncWithHttpInfo($order_id)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getOrderBuyerInfoAsyncWithHttpInfo.
*
* @param string $order_id An orderId is an Amazon-defined order identifier, in 3-7-7 format. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getOrderBuyerInfoAsyncWithHttpInfo($order_id)
{
$request = $this->getOrderBuyerInfoRequest($order_id);
return $this->sendRequestAsync($request, GetOrderBuyerInfoResponse::class);
}
/**
* Create request for operation 'getOrderBuyerInfo'.
*
* @param string $order_id An orderId is an Amazon-defined order identifier, in 3-7-7 format. (required)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getOrderBuyerInfoRequest($order_id)
{
// verify the required parameter 'order_id' is set
if (null === $order_id || (is_array($order_id) && 0 === count($order_id))) {
throw new \InvalidArgumentException('Missing the required parameter $order_id when calling getOrderBuyerInfo');
}
$resourcePath = '/orders/v0/orders/{orderId}/buyerInfo';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// path params
if (null !== $order_id) {
$resourcePath = str_replace(
'{'.'orderId'.'}',
ObjectSerializer::toPathValue($order_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getOrderItems.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderItemsResponse
*/
public function getOrderItems($order_id, $next_token = null)
{
list($response) = $this->getOrderItemsWithHttpInfo($order_id, $next_token);
return $response;
}
/**
* Operation getOrderItemsWithHttpInfo.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderItemsResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getOrderItemsWithHttpInfo($order_id, $next_token = null)
{
$request = $this->getOrderItemsRequest($order_id, $next_token);
return $this->sendRequest($request, GetOrderItemsResponse::class);
}
/**
* Operation getOrderItemsAsync.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getOrderItemsAsync($order_id, $next_token = null)
{
return $this->getOrderItemsAsyncWithHttpInfo($order_id, $next_token)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getOrderItemsAsyncWithHttpInfo.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getOrderItemsAsyncWithHttpInfo($order_id, $next_token = null)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderItemsResponse';
$request = $this->getOrderItemsRequest($order_id, $next_token);
return $this->sendRequestAsync($request, GetOrderItemsResponse::class);
}
/**
* Create request for operation 'getOrderItems'.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getOrderItemsRequest($order_id, $next_token = null)
{
// verify the required parameter 'order_id' is set
if (null === $order_id || (is_array($order_id) && 0 === count($order_id))) {
throw new \InvalidArgumentException('Missing the required parameter $order_id when calling getOrderItems');
}
$resourcePath = '/orders/v0/orders/{orderId}/orderItems';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $next_token) {
$queryParams['NextToken'] = ObjectSerializer::toQueryValue($next_token);
}
// path params
if (null !== $order_id) {
$resourcePath = str_replace(
'{'.'orderId'.'}',
ObjectSerializer::toPathValue($order_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getOrderItemsBuyerInfo.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderItemsBuyerInfoResponse
*/
public function getOrderItemsBuyerInfo($order_id, $next_token = null)
{
list($response) = $this->getOrderItemsBuyerInfoWithHttpInfo($order_id, $next_token);
return $response;
}
/**
* Operation getOrderItemsBuyerInfoWithHttpInfo.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderItemsBuyerInfoResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getOrderItemsBuyerInfoWithHttpInfo($order_id, $next_token = null)
{
$request = $this->getOrderItemsBuyerInfoRequest($order_id, $next_token);
return $this->sendRequest($request, GetOrderItemsBuyerInfoResponse::class);
}
/**
* Operation getOrderItemsBuyerInfoAsync.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getOrderItemsBuyerInfoAsync($order_id, $next_token = null)
{
return $this->getOrderItemsBuyerInfoAsyncWithHttpInfo($order_id, $next_token)
->then(
function ($response) {
return $response[0];
}
);
}
/**
* Operation getOrderItemsBuyerInfoAsyncWithHttpInfo.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getOrderItemsBuyerInfoAsyncWithHttpInfo($order_id, $next_token = null)
{
$returnType = '\ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrderItemsBuyerInfoResponse';
$request = $this->getOrderItemsBuyerInfoRequest($order_id, $next_token);
return $this->sendRequestAsync($request, GetOrderItemsBuyerInfoResponse::class);
}
/**
* Create request for operation 'getOrderItemsBuyerInfo'.
*
* @param string $order_id An Amazon-defined order identifier, in 3-7-7 format. (required)
* @param string $next_token A string token returned in the response of your previous request. (optional)
*
* @throws \InvalidArgumentException
*
* @return \GuzzleHttp\Psr7\Request
*/
protected function getOrderItemsBuyerInfoRequest($order_id, $next_token = null)
{
// verify the required parameter 'order_id' is set
if (null === $order_id || (is_array($order_id) && 0 === count($order_id))) {
throw new \InvalidArgumentException('Missing the required parameter $order_id when calling getOrderItemsBuyerInfo');
}
$resourcePath = '/orders/v0/orders/{orderId}/orderItems/buyerInfo';
$formParams = [];
$queryParams = [];
$headerParams = [];
$httpBody = '';
$multipart = false;
// query params
if (null !== $next_token) {
$queryParams['NextToken'] = ObjectSerializer::toQueryValue($next_token);
}
// path params
if (null !== $order_id) {
$resourcePath = str_replace(
'{'.'orderId'.'}',
ObjectSerializer::toPathValue($order_id),
$resourcePath
);
}
return $this->generateRequest($multipart, $formParams, $queryParams, $resourcePath, $headerParams, 'GET', $httpBody);
}
/**
* Operation getOrders.
*
* @param string[] $marketplace_ids A list of MarketplaceId values. Used to select orders that were placed in the specified marketplaces. (required)
* @param string $created_after A date used for selecting orders created after (or at) a specified time. Only orders placed after the specified time are returned. Either the CreatedAfter parameter or the LastUpdatedAfter parameter is required. Both cannot be empty. The date must be in ISO 8601 format. (optional)
* @param string $created_before A date used for selecting orders created before (or at) a specified time. Only orders placed before the specified time are returned. The date must be in ISO 8601 format. (optional)
* @param string $last_updated_after A date used for selecting orders that were last updated after (or at) a specified time. An update is defined as any change in order status, including the creation of a new order. Includes updates made by Amazon and by the seller. The date must be in ISO 8601 format. (optional)
* @param string $last_updated_before A date used for selecting orders that were last updated before (or at) a specified time. An update is defined as any change in order status, including the creation of a new order. Includes updates made by Amazon and by the seller. The date must be in ISO 8601 format. (optional)
* @param string[] $order_statuses A list of OrderStatus values used to filter the results. Possible values: PendingAvailability (This status is available for pre-orders only. The order has been placed, payment has not been authorized, and the release date of the item is in the future.); Pending (The order has been placed but payment has not been authorized); Unshipped (Payment has been authorized and the order is ready for shipment, but no items in the order have been shipped); PartiallyShipped (One or more, but not all, items in the order have been shipped); Shipped (All items in the order have been shipped); InvoiceUnconfirmed (All items in the order have been shipped. The seller has not yet given confirmation to Amazon that the invoice has been shipped to the buyer.); Canceled (The order has been canceled); and Unfulfillable (The order cannot be fulfilled. This state applies only to Multi-Channel Fulfillment orders.). (optional)
* @param string[] $fulfillment_channels A list that indicates how an order was fulfilled. Filters the results by fulfillment channel. Possible values: FBA (Fulfillment by Amazon); SellerFulfilled (Fulfilled by the seller). (optional)
* @param string[] $payment_methods A list of payment method values. Used to select orders paid using the specified payment methods. Possible values: COD (Cash on delivery); CVS (Convenience store payment); Other (Any payment method other than COD or CVS). (optional)
* @param string $buyer_email The email address of a buyer. Used to select orders that contain the specified email address. (optional)
* @param string $seller_order_id An order identifier that is specified by the seller. Used to select only the orders that match the order identifier. If SellerOrderId is specified, then FulfillmentChannels, OrderStatuses, PaymentMethod, LastUpdatedAfter, LastUpdatedBefore, and BuyerEmail cannot be specified. (optional)
* @param int $max_results_per_page A number that indicates the maximum number of orders that can be returned per page. Value must be 1 - 100. Default 100. (optional)
* @param string[] $easy_ship_shipment_statuses A list of EasyShipShipmentStatus values. Used to select Easy Ship orders with statuses that match the specified values. If EasyShipShipmentStatus is specified, only Amazon Easy Ship orders are returned.Possible values: PendingPickUp (Amazon has not yet picked up the package from the seller). LabelCanceled (The seller canceled the pickup). PickedUp (Amazon has picked up the package from the seller). AtOriginFC (The packaged is at the origin fulfillment center). AtDestinationFC (The package is at the destination fulfillment center). OutForDelivery (The package is out for delivery). Damaged (The package was damaged by the carrier). Delivered (The package has been delivered to the buyer). RejectedByBuyer (The package has been rejected by the buyer). Undeliverable (The package cannot be delivered). ReturnedToSeller (The package was not delivered to the buyer and was returned to the seller). ReturningToSeller (The package was not delivered to the buyer and is being returned to the seller). (optional)
* @param string $next_token A string token returned in the response of your previous request. (optional)
* @param string[] $amazon_order_ids A list of AmazonOrderId values. An AmazonOrderId is an Amazon-defined order identifier, in 3-7-7 format. (optional)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrdersResponse
*/
public function getOrders($marketplace_ids, $created_after = null, $created_before = null, $last_updated_after = null, $last_updated_before = null, $order_statuses = null, $fulfillment_channels = null, $payment_methods = null, $buyer_email = null, $seller_order_id = null, $max_results_per_page = null, $easy_ship_shipment_statuses = null, $next_token = null, $amazon_order_ids = null)
{
list($response) = $this->getOrdersWithHttpInfo($marketplace_ids, $created_after, $created_before, $last_updated_after, $last_updated_before, $order_statuses, $fulfillment_channels, $payment_methods, $buyer_email, $seller_order_id, $max_results_per_page, $easy_ship_shipment_statuses, $next_token, $amazon_order_ids);
return $response;
}
/**
* Operation getOrdersWithHttpInfo.
*
* @param string[] $marketplace_ids A list of MarketplaceId values. Used to select orders that were placed in the specified marketplaces. (required)
* @param string $created_after A date used for selecting orders created after (or at) a specified time. Only orders placed after the specified time are returned. Either the CreatedAfter parameter or the LastUpdatedAfter parameter is required. Both cannot be empty. The date must be in ISO 8601 format. (optional)
* @param string $created_before A date used for selecting orders created before (or at) a specified time. Only orders placed before the specified time are returned. The date must be in ISO 8601 format. (optional)
* @param string $last_updated_after A date used for selecting orders that were last updated after (or at) a specified time. An update is defined as any change in order status, including the creation of a new order. Includes updates made by Amazon and by the seller. The date must be in ISO 8601 format. (optional)
* @param string $last_updated_before A date used for selecting orders that were last updated before (or at) a specified time. An update is defined as any change in order status, including the creation of a new order. Includes updates made by Amazon and by the seller. The date must be in ISO 8601 format. (optional)
* @param string[] $order_statuses A list of OrderStatus values used to filter the results. Possible values: PendingAvailability (This status is available for pre-orders only. The order has been placed, payment has not been authorized, and the release date of the item is in the future.); Pending (The order has been placed but payment has not been authorized); Unshipped (Payment has been authorized and the order is ready for shipment, but no items in the order have been shipped); PartiallyShipped (One or more, but not all, items in the order have been shipped); Shipped (All items in the order have been shipped); InvoiceUnconfirmed (All items in the order have been shipped. The seller has not yet given confirmation to Amazon that the invoice has been shipped to the buyer.); Canceled (The order has been canceled); and Unfulfillable (The order cannot be fulfilled. This state applies only to Multi-Channel Fulfillment orders.). (optional)
* @param string[] $fulfillment_channels A list that indicates how an order was fulfilled. Filters the results by fulfillment channel. Possible values: FBA (Fulfillment by Amazon); SellerFulfilled (Fulfilled by the seller). (optional)
* @param string[] $payment_methods A list of payment method values. Used to select orders paid using the specified payment methods. Possible values: COD (Cash on delivery); CVS (Convenience store payment); Other (Any payment method other than COD or CVS). (optional)
* @param string $buyer_email The email address of a buyer. Used to select orders that contain the specified email address. (optional)
* @param string $seller_order_id An order identifier that is specified by the seller. Used to select only the orders that match the order identifier. If SellerOrderId is specified, then FulfillmentChannels, OrderStatuses, PaymentMethod, LastUpdatedAfter, LastUpdatedBefore, and BuyerEmail cannot be specified. (optional)
* @param int $max_results_per_page A number that indicates the maximum number of orders that can be returned per page. Value must be 1 - 100. Default 100. (optional)
* @param string[] $easy_ship_shipment_statuses A list of EasyShipShipmentStatus values. Used to select Easy Ship orders with statuses that match the specified values. If EasyShipShipmentStatus is specified, only Amazon Easy Ship orders are returned.Possible values: PendingPickUp (Amazon has not yet picked up the package from the seller). LabelCanceled (The seller canceled the pickup). PickedUp (Amazon has picked up the package from the seller). AtOriginFC (The packaged is at the origin fulfillment center). AtDestinationFC (The package is at the destination fulfillment center). OutForDelivery (The package is out for delivery). Damaged (The package was damaged by the carrier). Delivered (The package has been delivered to the buyer). RejectedByBuyer (The package has been rejected by the buyer). Undeliverable (The package cannot be delivered). ReturnedToSeller (The package was not delivered to the buyer and was returned to the seller). ReturningToSeller (The package was not delivered to the buyer and is being returned to the seller). (optional)
* @param string $next_token A string token returned in the response of your previous request. (optional)
* @param string[] $amazon_order_ids A list of AmazonOrderId values. An AmazonOrderId is an Amazon-defined order identifier, in 3-7-7 format. (optional)
*
* @throws \ClouSale\AmazonSellingPartnerAPI\ApiException on non-2xx response
* @throws \InvalidArgumentException
*
* @return array of \ClouSale\AmazonSellingPartnerAPI\Models\Orders\GetOrdersResponse, HTTP status code, HTTP response headers (array of strings)
*/
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | true |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/IterableType.php | lib/Models/IterableType.php | <?php
namespace ClouSale\AmazonSellingPartnerAPI\Models;
interface IterableType
{
public function getSubClass();
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/ModelInterface.php | lib/Models/ModelInterface.php | <?php
/**
* ModelInterface.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Services.
*
* With the Services API, you can build applications that help service providers get and modify their service orders.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models;
/**
* Interface abstracting model access.
*
* @author Swagger Codegen team
*/
interface ModelInterface
{
/**
* The original name of the model.
*
* @return string
*/
public function getModelName();
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes();
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats();
/**
* Array of attributes where the key is the local name, and the value is the original name.
*
* @return array
*/
public static function attributeMap();
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters();
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters();
/**
* Show all the invalid properties with reasons.
*
* @return array
*/
public function listInvalidProperties();
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool
*/
public function valid();
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/Account.php | lib/Models/Shipping/Account.php | <?php
/**
* Account.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* Account Class Doc Comment.
*
* @description The account related data.
*
* @author Stefan Neuhaus / ClouSale
*/
class Account implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'Account';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'account_id' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\AccountId', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'account_id' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'account_id' => 'accountId', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'account_id' => 'setAccountId', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'account_id' => 'getAccountId', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['account_id'] = isset($data['account_id']) ? $data['account_id'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if (null === $this->container['account_id']) {
$invalidProperties[] = "'account_id' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets account_id.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\AccountId
*/
public function getAccountId()
{
return $this->container['account_id'];
}
/**
* Sets account_id.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\AccountId $account_id account_id
*
* @return $this
*/
public function setAccountId($account_id)
{
$this->container['account_id'] = $account_id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/ContainerReferenceId.php | lib/Models/Shipping/ContainerReferenceId.php | <?php
/**
* ContainerReferenceId.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* ContainerReferenceId Class Doc Comment.
*
* @description An identifier for the container. This must be unique within all the containers in the same shipment.
*
* @author Stefan Neuhaus / ClouSale
*/
class ContainerReferenceId implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'ContainerReferenceId';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/CreateShipmentResult.php | lib/Models/Shipping/CreateShipmentResult.php | <?php
/**
* CreateShipmentResult.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* CreateShipmentResult Class Doc Comment.
*
* @description The payload schema for the createShipment operation.
*
* @author Stefan Neuhaus / ClouSale
*/
class CreateShipmentResult implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'CreateShipmentResult';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'shipment_id' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ShipmentId',
'eligible_rates' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RateList', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'shipment_id' => null,
'eligible_rates' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'shipment_id' => 'shipmentId',
'eligible_rates' => 'eligibleRates', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'shipment_id' => 'setShipmentId',
'eligible_rates' => 'setEligibleRates', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'shipment_id' => 'getShipmentId',
'eligible_rates' => 'getEligibleRates', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['shipment_id'] = isset($data['shipment_id']) ? $data['shipment_id'] : null;
$this->container['eligible_rates'] = isset($data['eligible_rates']) ? $data['eligible_rates'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if (null === $this->container['shipment_id']) {
$invalidProperties[] = "'shipment_id' can't be null";
}
if (null === $this->container['eligible_rates']) {
$invalidProperties[] = "'eligible_rates' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets shipment_id.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ShipmentId
*/
public function getShipmentId()
{
return $this->container['shipment_id'];
}
/**
* Sets shipment_id.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ShipmentId $shipment_id shipment_id
*
* @return $this
*/
public function setShipmentId($shipment_id)
{
$this->container['shipment_id'] = $shipment_id;
return $this;
}
/**
* Gets eligible_rates.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RateList
*/
public function getEligibleRates()
{
return $this->container['eligible_rates'];
}
/**
* Sets eligible_rates.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RateList $eligible_rates eligible_rates
*
* @return $this
*/
public function setEligibleRates($eligible_rates)
{
$this->container['eligible_rates'] = $eligible_rates;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/Address.php | lib/Models/Shipping/Address.php | <?php
/**
* Address.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* Address Class Doc Comment.
*
* @description The address.
*
* @author Stefan Neuhaus / ClouSale
*/
class Address implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'Address';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'name' => 'string',
'address_line1' => 'string',
'address_line2' => 'string',
'address_line3' => 'string',
'state_or_region' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\StateOrRegion',
'city' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\City',
'country_code' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CountryCode',
'postal_code' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PostalCode',
'email' => 'string',
'copy_emails' => 'string[]',
'phone_number' => 'string', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'name' => null,
'address_line1' => null,
'address_line2' => null,
'address_line3' => null,
'state_or_region' => null,
'city' => null,
'country_code' => null,
'postal_code' => null,
'email' => null,
'copy_emails' => null,
'phone_number' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'name' => 'name',
'address_line1' => 'addressLine1',
'address_line2' => 'addressLine2',
'address_line3' => 'addressLine3',
'state_or_region' => 'stateOrRegion',
'city' => 'city',
'country_code' => 'countryCode',
'postal_code' => 'postalCode',
'email' => 'email',
'copy_emails' => 'copyEmails',
'phone_number' => 'phoneNumber', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'name' => 'setName',
'address_line1' => 'setAddressLine1',
'address_line2' => 'setAddressLine2',
'address_line3' => 'setAddressLine3',
'state_or_region' => 'setStateOrRegion',
'city' => 'setCity',
'country_code' => 'setCountryCode',
'postal_code' => 'setPostalCode',
'email' => 'setEmail',
'copy_emails' => 'setCopyEmails',
'phone_number' => 'setPhoneNumber', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'name' => 'getName',
'address_line1' => 'getAddressLine1',
'address_line2' => 'getAddressLine2',
'address_line3' => 'getAddressLine3',
'state_or_region' => 'getStateOrRegion',
'city' => 'getCity',
'country_code' => 'getCountryCode',
'postal_code' => 'getPostalCode',
'email' => 'getEmail',
'copy_emails' => 'getCopyEmails',
'phone_number' => 'getPhoneNumber', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['name'] = isset($data['name']) ? $data['name'] : null;
$this->container['address_line1'] = isset($data['address_line1']) ? $data['address_line1'] : null;
$this->container['address_line2'] = isset($data['address_line2']) ? $data['address_line2'] : null;
$this->container['address_line3'] = isset($data['address_line3']) ? $data['address_line3'] : null;
$this->container['state_or_region'] = isset($data['state_or_region']) ? $data['state_or_region'] : null;
$this->container['city'] = isset($data['city']) ? $data['city'] : null;
$this->container['country_code'] = isset($data['country_code']) ? $data['country_code'] : null;
$this->container['postal_code'] = isset($data['postal_code']) ? $data['postal_code'] : null;
$this->container['email'] = isset($data['email']) ? $data['email'] : null;
$this->container['copy_emails'] = isset($data['copy_emails']) ? $data['copy_emails'] : null;
$this->container['phone_number'] = isset($data['phone_number']) ? $data['phone_number'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if (null === $this->container['name']) {
$invalidProperties[] = "'name' can't be null";
}
if (null === $this->container['address_line1']) {
$invalidProperties[] = "'address_line1' can't be null";
}
if (null === $this->container['state_or_region']) {
$invalidProperties[] = "'state_or_region' can't be null";
}
if (null === $this->container['city']) {
$invalidProperties[] = "'city' can't be null";
}
if (null === $this->container['country_code']) {
$invalidProperties[] = "'country_code' can't be null";
}
if (null === $this->container['postal_code']) {
$invalidProperties[] = "'postal_code' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets name.
*
* @return string
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name.
*
* @param string $name the name of the person, business or institution at that address
*
* @return $this
*/
public function setName($name)
{
$this->container['name'] = $name;
return $this;
}
/**
* Gets address_line1.
*
* @return string
*/
public function getAddressLine1()
{
return $this->container['address_line1'];
}
/**
* Sets address_line1.
*
* @param string $address_line1 first line of that address
*
* @return $this
*/
public function setAddressLine1($address_line1)
{
$this->container['address_line1'] = $address_line1;
return $this;
}
/**
* Gets address_line2.
*
* @return string
*/
public function getAddressLine2()
{
return $this->container['address_line2'];
}
/**
* Sets address_line2.
*
* @param string $address_line2 additional address information, if required
*
* @return $this
*/
public function setAddressLine2($address_line2)
{
$this->container['address_line2'] = $address_line2;
return $this;
}
/**
* Gets address_line3.
*
* @return string
*/
public function getAddressLine3()
{
return $this->container['address_line3'];
}
/**
* Sets address_line3.
*
* @param string $address_line3 additional address information, if required
*
* @return $this
*/
public function setAddressLine3($address_line3)
{
$this->container['address_line3'] = $address_line3;
return $this;
}
/**
* Gets state_or_region.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\StateOrRegion
*/
public function getStateOrRegion()
{
return $this->container['state_or_region'];
}
/**
* Sets state_or_region.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\StateOrRegion $state_or_region state_or_region
*
* @return $this
*/
public function setStateOrRegion($state_or_region)
{
$this->container['state_or_region'] = $state_or_region;
return $this;
}
/**
* Gets city.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\City
*/
public function getCity()
{
return $this->container['city'];
}
/**
* Sets city.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\City $city city
*
* @return $this
*/
public function setCity($city)
{
$this->container['city'] = $city;
return $this;
}
/**
* Gets country_code.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CountryCode
*/
public function getCountryCode()
{
return $this->container['country_code'];
}
/**
* Sets country_code.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CountryCode $country_code country_code
*
* @return $this
*/
public function setCountryCode($country_code)
{
$this->container['country_code'] = $country_code;
return $this;
}
/**
* Gets postal_code.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PostalCode
*/
public function getPostalCode()
{
return $this->container['postal_code'];
}
/**
* Sets postal_code.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PostalCode $postal_code postal_code
*
* @return $this
*/
public function setPostalCode($postal_code)
{
$this->container['postal_code'] = $postal_code;
return $this;
}
/**
* Gets email.
*
* @return string
*/
public function getEmail()
{
return $this->container['email'];
}
/**
* Sets email.
*
* @param string $email the email address of the contact associated with the address
*
* @return $this
*/
public function setEmail($email)
{
$this->container['email'] = $email;
return $this;
}
/**
* Gets copy_emails.
*
* @return string[]
*/
public function getCopyEmails()
{
return $this->container['copy_emails'];
}
/**
* Sets copy_emails.
*
* @param string[] $copy_emails the email cc addresses of the contact associated with the address
*
* @return $this
*/
public function setCopyEmails($copy_emails)
{
$this->container['copy_emails'] = $copy_emails;
return $this;
}
/**
* Gets phone_number.
*
* @return string
*/
public function getPhoneNumber()
{
return $this->container['phone_number'];
}
/**
* Sets phone_number.
*
* @param string $phone_number the phone number of the person, business or institution located at that address
*
* @return $this
*/
public function setPhoneNumber($phone_number)
{
$this->container['phone_number'] = $phone_number;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/ErrorList.php | lib/Models/Shipping/ErrorList.php | <?php
/**
* ErrorList.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\IterableType;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* ErrorList Class Doc Comment.
*
* @description A list of error responses returned when a request is unsuccessful.
*
* @author Stefan Neuhaus / ClouSale
*/
class ErrorList implements ModelInterface, ArrayAccess, IterableType
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'ErrorList';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = parent::listInvalidProperties();
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
public function getSubClass()
{
return Error::class;
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/Party.php | lib/Models/Shipping/Party.php | <?php
/**
* Party.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* Party Class Doc Comment.
*
* @description The account related with the shipment.
*
* @author Stefan Neuhaus / ClouSale
*/
class Party implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'Party';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'account_id' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\AccountId', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'account_id' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'account_id' => 'accountId', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'account_id' => 'setAccountId', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'account_id' => 'getAccountId', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['account_id'] = isset($data['account_id']) ? $data['account_id'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets account_id.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\AccountId
*/
public function getAccountId()
{
return $this->container['account_id'];
}
/**
* Sets account_id.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\AccountId $account_id account_id
*
* @return $this
*/
public function setAccountId($account_id)
{
$this->container['account_id'] = $account_id;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/PurchaseShipmentResult.php | lib/Models/Shipping/PurchaseShipmentResult.php | <?php
/**
* PurchaseShipmentResult.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* PurchaseShipmentResult Class Doc Comment.
*
* @description The payload schema for the purchaseShipment operation.
*
* @author Stefan Neuhaus / ClouSale
*/
class PurchaseShipmentResult implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'PurchaseShipmentResult';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'shipment_id' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ShipmentId',
'service_rate' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ServiceRate',
'label_results' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelResultList', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'shipment_id' => null,
'service_rate' => null,
'label_results' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'shipment_id' => 'shipmentId',
'service_rate' => 'serviceRate',
'label_results' => 'labelResults', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'shipment_id' => 'setShipmentId',
'service_rate' => 'setServiceRate',
'label_results' => 'setLabelResults', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'shipment_id' => 'getShipmentId',
'service_rate' => 'getServiceRate',
'label_results' => 'getLabelResults', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['shipment_id'] = isset($data['shipment_id']) ? $data['shipment_id'] : null;
$this->container['service_rate'] = isset($data['service_rate']) ? $data['service_rate'] : null;
$this->container['label_results'] = isset($data['label_results']) ? $data['label_results'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if (null === $this->container['shipment_id']) {
$invalidProperties[] = "'shipment_id' can't be null";
}
if (null === $this->container['service_rate']) {
$invalidProperties[] = "'service_rate' can't be null";
}
if (null === $this->container['label_results']) {
$invalidProperties[] = "'label_results' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets shipment_id.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ShipmentId
*/
public function getShipmentId()
{
return $this->container['shipment_id'];
}
/**
* Sets shipment_id.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ShipmentId $shipment_id shipment_id
*
* @return $this
*/
public function setShipmentId($shipment_id)
{
$this->container['shipment_id'] = $shipment_id;
return $this;
}
/**
* Gets service_rate.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ServiceRate
*/
public function getServiceRate()
{
return $this->container['service_rate'];
}
/**
* Sets service_rate.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ServiceRate $service_rate service_rate
*
* @return $this
*/
public function setServiceRate($service_rate)
{
$this->container['service_rate'] = $service_rate;
return $this;
}
/**
* Gets label_results.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelResultList
*/
public function getLabelResults()
{
return $this->container['label_results'];
}
/**
* Sets label_results.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelResultList $label_results label_results
*
* @return $this
*/
public function setLabelResults($label_results)
{
$this->container['label_results'] = $label_results;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/TrackingId.php | lib/Models/Shipping/TrackingId.php | <?php
/**
* TrackingId.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* TrackingId Class Doc Comment.
*
* @description The tracking id generated to each shipment. It contains a series of letters or digits or both.
*
* @author Stefan Neuhaus / ClouSale
*/
class TrackingId implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'TrackingId';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/Dimensions.php | lib/Models/Shipping/Dimensions.php | <?php
/**
* Dimensions.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* Dimensions Class Doc Comment.
*
* @description A set of measurements for a three-dimensional object.
*
* @author Stefan Neuhaus / ClouSale
*/
class Dimensions implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'Dimensions';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'length' => 'float',
'width' => 'float',
'height' => 'float',
'unit' => 'string', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'length' => null,
'width' => null,
'height' => null,
'unit' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'length' => 'length',
'width' => 'width',
'height' => 'height',
'unit' => 'unit', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'length' => 'setLength',
'width' => 'setWidth',
'height' => 'setHeight',
'unit' => 'setUnit', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'length' => 'getLength',
'width' => 'getWidth',
'height' => 'getHeight',
'unit' => 'getUnit', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
const UNIT_IN = 'IN';
const UNIT_CM = 'CM';
/**
* Gets allowable values of the enum.
*
* @return string[]
*/
public function getUnitAllowableValues()
{
return [
self::UNIT_IN,
self::UNIT_CM, ];
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['length'] = isset($data['length']) ? $data['length'] : null;
$this->container['width'] = isset($data['width']) ? $data['width'] : null;
$this->container['height'] = isset($data['height']) ? $data['height'] : null;
$this->container['unit'] = isset($data['unit']) ? $data['unit'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if (null === $this->container['length']) {
$invalidProperties[] = "'length' can't be null";
}
if (null === $this->container['width']) {
$invalidProperties[] = "'width' can't be null";
}
if (null === $this->container['height']) {
$invalidProperties[] = "'height' can't be null";
}
if (null === $this->container['unit']) {
$invalidProperties[] = "'unit' can't be null";
}
$allowedValues = $this->getUnitAllowableValues();
if (!is_null($this->container['unit']) && !in_array($this->container['unit'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value for 'unit', must be one of '%s'",
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets length.
*
* @return float
*/
public function getLength()
{
return $this->container['length'];
}
/**
* Sets length.
*
* @param float $length the length of the container
*
* @return $this
*/
public function setLength($length)
{
$this->container['length'] = $length;
return $this;
}
/**
* Gets width.
*
* @return float
*/
public function getWidth()
{
return $this->container['width'];
}
/**
* Sets width.
*
* @param float $width the width of the container
*
* @return $this
*/
public function setWidth($width)
{
$this->container['width'] = $width;
return $this;
}
/**
* Gets height.
*
* @return float
*/
public function getHeight()
{
return $this->container['height'];
}
/**
* Sets height.
*
* @param float $height the height of the container
*
* @return $this
*/
public function setHeight($height)
{
$this->container['height'] = $height;
return $this;
}
/**
* Gets unit.
*
* @return string
*/
public function getUnit()
{
return $this->container['unit'];
}
/**
* Sets unit.
*
* @param string $unit the unit of these measurements
*
* @return $this
*/
public function setUnit($unit)
{
$allowedValues = $this->getUnitAllowableValues();
if (!in_array($unit, $allowedValues, true)) {
throw new \InvalidArgumentException(sprintf("Invalid value for 'unit', must be one of '%s'", implode("', '", $allowedValues)));
}
$this->container['unit'] = $unit;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/RetrieveShippingLabelResult.php | lib/Models/Shipping/RetrieveShippingLabelResult.php | <?php
/**
* RetrieveShippingLabelResult.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* RetrieveShippingLabelResult Class Doc Comment.
*
* @description The payload schema for the retrieveShippingLabel operation.
*
* @author Stefan Neuhaus / ClouSale
*/
class RetrieveShippingLabelResult implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'RetrieveShippingLabelResult';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'label_stream' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelStream',
'label_specification' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelSpecification', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'label_stream' => null,
'label_specification' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'label_stream' => 'labelStream',
'label_specification' => 'labelSpecification', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'label_stream' => 'setLabelStream',
'label_specification' => 'setLabelSpecification', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'label_stream' => 'getLabelStream',
'label_specification' => 'getLabelSpecification', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['label_stream'] = isset($data['label_stream']) ? $data['label_stream'] : null;
$this->container['label_specification'] = isset($data['label_specification']) ? $data['label_specification'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if (null === $this->container['label_stream']) {
$invalidProperties[] = "'label_stream' can't be null";
}
if (null === $this->container['label_specification']) {
$invalidProperties[] = "'label_specification' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets label_stream.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelStream
*/
public function getLabelStream()
{
return $this->container['label_stream'];
}
/**
* Sets label_stream.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelStream $label_stream label_stream
*
* @return $this
*/
public function setLabelStream($label_stream)
{
$this->container['label_stream'] = $label_stream;
return $this;
}
/**
* Gets label_specification.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelSpecification
*/
public function getLabelSpecification()
{
return $this->container['label_specification'];
}
/**
* Sets label_specification.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelSpecification $label_specification label_specification
*
* @return $this
*/
public function setLabelSpecification($label_specification)
{
$this->container['label_specification'] = $label_specification;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/ShipmentId.php | lib/Models/Shipping/ShipmentId.php | <?php
/**
* ShipmentId.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* ShipmentId Class Doc Comment.
*
* @description The unique shipment identifier.
*
* @author Stefan Neuhaus / ClouSale
*/
class ShipmentId implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'ShipmentId';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/PurchaseShipmentRequest.php | lib/Models/Shipping/PurchaseShipmentRequest.php | <?php
/**
* PurchaseShipmentRequest.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* PurchaseShipmentRequest Class Doc Comment.
*
* @description The payload schema for the purchaseShipment operation.
*
* @author Stefan Neuhaus / ClouSale
*/
class PurchaseShipmentRequest implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'PurchaseShipmentRequest';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'client_reference_id' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ClientReferenceId',
'ship_to' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Address',
'ship_from' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Address',
'ship_date' => '\DateTime',
'service_type' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ServiceType',
'containers' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ContainerList',
'label_specification' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelSpecification', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'client_reference_id' => null,
'ship_to' => null,
'ship_from' => null,
'ship_date' => 'date-time',
'service_type' => null,
'containers' => null,
'label_specification' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'client_reference_id' => 'clientReferenceId',
'ship_to' => 'shipTo',
'ship_from' => 'shipFrom',
'ship_date' => 'shipDate',
'service_type' => 'serviceType',
'containers' => 'containers',
'label_specification' => 'labelSpecification', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'client_reference_id' => 'setClientReferenceId',
'ship_to' => 'setShipTo',
'ship_from' => 'setShipFrom',
'ship_date' => 'setShipDate',
'service_type' => 'setServiceType',
'containers' => 'setContainers',
'label_specification' => 'setLabelSpecification', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'client_reference_id' => 'getClientReferenceId',
'ship_to' => 'getShipTo',
'ship_from' => 'getShipFrom',
'ship_date' => 'getShipDate',
'service_type' => 'getServiceType',
'containers' => 'getContainers',
'label_specification' => 'getLabelSpecification', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['client_reference_id'] = isset($data['client_reference_id']) ? $data['client_reference_id'] : null;
$this->container['ship_to'] = isset($data['ship_to']) ? $data['ship_to'] : null;
$this->container['ship_from'] = isset($data['ship_from']) ? $data['ship_from'] : null;
$this->container['ship_date'] = isset($data['ship_date']) ? $data['ship_date'] : null;
$this->container['service_type'] = isset($data['service_type']) ? $data['service_type'] : null;
$this->container['containers'] = isset($data['containers']) ? $data['containers'] : null;
$this->container['label_specification'] = isset($data['label_specification']) ? $data['label_specification'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if (null === $this->container['client_reference_id']) {
$invalidProperties[] = "'client_reference_id' can't be null";
}
if (null === $this->container['ship_to']) {
$invalidProperties[] = "'ship_to' can't be null";
}
if (null === $this->container['ship_from']) {
$invalidProperties[] = "'ship_from' can't be null";
}
if (null === $this->container['service_type']) {
$invalidProperties[] = "'service_type' can't be null";
}
if (null === $this->container['containers']) {
$invalidProperties[] = "'containers' can't be null";
}
if (null === $this->container['label_specification']) {
$invalidProperties[] = "'label_specification' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets client_reference_id.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ClientReferenceId
*/
public function getClientReferenceId()
{
return $this->container['client_reference_id'];
}
/**
* Sets client_reference_id.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ClientReferenceId $client_reference_id client_reference_id
*
* @return $this
*/
public function setClientReferenceId($client_reference_id)
{
$this->container['client_reference_id'] = $client_reference_id;
return $this;
}
/**
* Gets ship_to.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Address
*/
public function getShipTo()
{
return $this->container['ship_to'];
}
/**
* Sets ship_to.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Address $ship_to ship_to
*
* @return $this
*/
public function setShipTo($ship_to)
{
$this->container['ship_to'] = $ship_to;
return $this;
}
/**
* Gets ship_from.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Address
*/
public function getShipFrom()
{
return $this->container['ship_from'];
}
/**
* Sets ship_from.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Address $ship_from ship_from
*
* @return $this
*/
public function setShipFrom($ship_from)
{
$this->container['ship_from'] = $ship_from;
return $this;
}
/**
* Gets ship_date.
*
* @return \DateTime
*/
public function getShipDate()
{
return $this->container['ship_date'];
}
/**
* Sets ship_date.
*
* @param \DateTime $ship_date The start date and time. This defaults to the current date and time.
*
* @return $this
*/
public function setShipDate($ship_date)
{
$this->container['ship_date'] = $ship_date;
return $this;
}
/**
* Gets service_type.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ServiceType
*/
public function getServiceType()
{
return $this->container['service_type'];
}
/**
* Sets service_type.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ServiceType $service_type service_type
*
* @return $this
*/
public function setServiceType($service_type)
{
$this->container['service_type'] = $service_type;
return $this;
}
/**
* Gets containers.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ContainerList
*/
public function getContainers()
{
return $this->container['containers'];
}
/**
* Sets containers.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ContainerList $containers containers
*
* @return $this
*/
public function setContainers($containers)
{
$this->container['containers'] = $containers;
return $this;
}
/**
* Gets label_specification.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelSpecification
*/
public function getLabelSpecification()
{
return $this->container['label_specification'];
}
/**
* Sets label_specification.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelSpecification $label_specification label_specification
*
* @return $this
*/
public function setLabelSpecification($label_specification)
{
$this->container['label_specification'] = $label_specification;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/TrackingInformation.php | lib/Models/Shipping/TrackingInformation.php | <?php
/**
* TrackingInformation.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* TrackingInformation Class Doc Comment.
*
* @description The payload schema for the getTrackingInformation operation.
*
* @author Stefan Neuhaus / ClouSale
*/
class TrackingInformation implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'TrackingInformation';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'tracking_id' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\TrackingId',
'summary' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\TrackingSummary',
'promised_delivery_date' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PromisedDeliveryDate',
'event_history' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\EventList', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'tracking_id' => null,
'summary' => null,
'promised_delivery_date' => null,
'event_history' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'tracking_id' => 'trackingId',
'summary' => 'summary',
'promised_delivery_date' => 'promisedDeliveryDate',
'event_history' => 'eventHistory', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'tracking_id' => 'setTrackingId',
'summary' => 'setSummary',
'promised_delivery_date' => 'setPromisedDeliveryDate',
'event_history' => 'setEventHistory', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'tracking_id' => 'getTrackingId',
'summary' => 'getSummary',
'promised_delivery_date' => 'getPromisedDeliveryDate',
'event_history' => 'getEventHistory', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['tracking_id'] = isset($data['tracking_id']) ? $data['tracking_id'] : null;
$this->container['summary'] = isset($data['summary']) ? $data['summary'] : null;
$this->container['promised_delivery_date'] = isset($data['promised_delivery_date']) ? $data['promised_delivery_date'] : null;
$this->container['event_history'] = isset($data['event_history']) ? $data['event_history'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if (null === $this->container['tracking_id']) {
$invalidProperties[] = "'tracking_id' can't be null";
}
if (null === $this->container['summary']) {
$invalidProperties[] = "'summary' can't be null";
}
if (null === $this->container['promised_delivery_date']) {
$invalidProperties[] = "'promised_delivery_date' can't be null";
}
if (null === $this->container['event_history']) {
$invalidProperties[] = "'event_history' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets tracking_id.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\TrackingId
*/
public function getTrackingId()
{
return $this->container['tracking_id'];
}
/**
* Sets tracking_id.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\TrackingId $tracking_id tracking_id
*
* @return $this
*/
public function setTrackingId($tracking_id)
{
$this->container['tracking_id'] = $tracking_id;
return $this;
}
/**
* Gets summary.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\TrackingSummary
*/
public function getSummary()
{
return $this->container['summary'];
}
/**
* Sets summary.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\TrackingSummary $summary summary
*
* @return $this
*/
public function setSummary($summary)
{
$this->container['summary'] = $summary;
return $this;
}
/**
* Gets promised_delivery_date.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PromisedDeliveryDate
*/
public function getPromisedDeliveryDate()
{
return $this->container['promised_delivery_date'];
}
/**
* Sets promised_delivery_date.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PromisedDeliveryDate $promised_delivery_date promised_delivery_date
*
* @return $this
*/
public function setPromisedDeliveryDate($promised_delivery_date)
{
$this->container['promised_delivery_date'] = $promised_delivery_date;
return $this;
}
/**
* Gets event_history.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\EventList
*/
public function getEventHistory()
{
return $this->container['event_history'];
}
/**
* Sets event_history.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\EventList $event_history event_history
*
* @return $this
*/
public function setEventHistory($event_history)
{
$this->container['event_history'] = $event_history;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/ServiceTypeList.php | lib/Models/Shipping/ServiceTypeList.php | <?php
/**
* ServiceTypeList.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\IterableType;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* ServiceTypeList Class Doc Comment.
*
* @description A list of service types that can be used to send the shipment.
*
* @author Stefan Neuhaus / ClouSale
*/
class ServiceTypeList implements ModelInterface, ArrayAccess, IterableType
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'ServiceTypeList';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = parent::listInvalidProperties();
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
public function getSubClass()
{
return ServiceType::class;
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/Weight.php | lib/Models/Shipping/Weight.php | <?php
/**
* Weight.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* Weight Class Doc Comment.
*
* @description The weight.
*
* @author Stefan Neuhaus / ClouSale
*/
class Weight implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'Weight';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'unit' => 'string',
'value' => 'float', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'unit' => null,
'value' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'unit' => 'unit',
'value' => 'value', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'unit' => 'setUnit',
'value' => 'setValue', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'unit' => 'getUnit',
'value' => 'getValue', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
const UNIT_G = 'g';
const UNIT_KG = 'kg';
const UNIT_OZ = 'oz';
const UNIT_LB = 'lb';
/**
* Gets allowable values of the enum.
*
* @return string[]
*/
public function getUnitAllowableValues()
{
return [
self::UNIT_G,
self::UNIT_KG,
self::UNIT_OZ,
self::UNIT_LB, ];
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['unit'] = isset($data['unit']) ? $data['unit'] : null;
$this->container['value'] = isset($data['value']) ? $data['value'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if (null === $this->container['unit']) {
$invalidProperties[] = "'unit' can't be null";
}
$allowedValues = $this->getUnitAllowableValues();
if (!is_null($this->container['unit']) && !in_array($this->container['unit'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value for 'unit', must be one of '%s'",
implode("', '", $allowedValues)
);
}
if (null === $this->container['value']) {
$invalidProperties[] = "'value' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets unit.
*
* @return string
*/
public function getUnit()
{
return $this->container['unit'];
}
/**
* Sets unit.
*
* @param string $unit the unit of measurement
*
* @return $this
*/
public function setUnit($unit)
{
$allowedValues = $this->getUnitAllowableValues();
if (!in_array($unit, $allowedValues, true)) {
throw new \InvalidArgumentException(sprintf("Invalid value for 'unit', must be one of '%s'", implode("', '", $allowedValues)));
}
$this->container['unit'] = $unit;
return $this;
}
/**
* Gets value.
*
* @return float
*/
public function getValue()
{
return $this->container['value'];
}
/**
* Sets value.
*
* @param float $value the measurement value
*
* @return $this
*/
public function setValue($value)
{
$this->container['value'] = $value;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/GetAccountResponse.php | lib/Models/Shipping/GetAccountResponse.php | <?php
/**
* GetAccountResponse.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* GetAccountResponse Class Doc Comment.
*
* @description The response schema for the getAccount operation.
*
* @author Stefan Neuhaus / ClouSale
*/
class GetAccountResponse implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'GetAccountResponse';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'payload' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Account',
'errors' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ErrorList', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'payload' => null,
'errors' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'payload' => 'payload',
'errors' => 'errors', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'payload' => 'setPayload',
'errors' => 'setErrors', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'payload' => 'getPayload',
'errors' => 'getErrors', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['payload'] = isset($data['payload']) ? $data['payload'] : null;
$this->container['errors'] = isset($data['errors']) ? $data['errors'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets payload.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Account
*/
public function getPayload()
{
return $this->container['payload'];
}
/**
* Sets payload.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Account $payload payload
*
* @return $this
*/
public function setPayload($payload)
{
$this->container['payload'] = $payload;
return $this;
}
/**
* Gets errors.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ErrorList
*/
public function getErrors()
{
return $this->container['errors'];
}
/**
* Sets errors.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ErrorList $errors errors
*
* @return $this
*/
public function setErrors($errors)
{
$this->container['errors'] = $errors;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/Container.php | lib/Models/Shipping/Container.php | <?php
/**
* Container.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* Container Class Doc Comment.
*
* @description Container in the shipment.
*
* @author Stefan Neuhaus / ClouSale
*/
class Container implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'Container';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'container_type' => 'string',
'container_reference_id' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ContainerReferenceId',
'value' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Currency',
'dimensions' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Dimensions',
'items' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ContainerItem[]',
'weight' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Weight', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'container_type' => null,
'container_reference_id' => null,
'value' => null,
'dimensions' => null,
'items' => null,
'weight' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'container_type' => 'containerType',
'container_reference_id' => 'containerReferenceId',
'value' => 'value',
'dimensions' => 'dimensions',
'items' => 'items',
'weight' => 'weight', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'container_type' => 'setContainerType',
'container_reference_id' => 'setContainerReferenceId',
'value' => 'setValue',
'dimensions' => 'setDimensions',
'items' => 'setItems',
'weight' => 'setWeight', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'container_type' => 'getContainerType',
'container_reference_id' => 'getContainerReferenceId',
'value' => 'getValue',
'dimensions' => 'getDimensions',
'items' => 'getItems',
'weight' => 'getWeight', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
const CONTAINER_TYPE_PACKAGE = 'PACKAGE';
/**
* Gets allowable values of the enum.
*
* @return string[]
*/
public function getContainerTypeAllowableValues()
{
return [
self::CONTAINER_TYPE_PACKAGE, ];
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['container_type'] = isset($data['container_type']) ? $data['container_type'] : null;
$this->container['container_reference_id'] = isset($data['container_reference_id']) ? $data['container_reference_id'] : null;
$this->container['value'] = isset($data['value']) ? $data['value'] : null;
$this->container['dimensions'] = isset($data['dimensions']) ? $data['dimensions'] : null;
$this->container['items'] = isset($data['items']) ? $data['items'] : null;
$this->container['weight'] = isset($data['weight']) ? $data['weight'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
$allowedValues = $this->getContainerTypeAllowableValues();
if (!is_null($this->container['container_type']) && !in_array($this->container['container_type'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value for 'container_type', must be one of '%s'",
implode("', '", $allowedValues)
);
}
if (null === $this->container['container_reference_id']) {
$invalidProperties[] = "'container_reference_id' can't be null";
}
if (null === $this->container['value']) {
$invalidProperties[] = "'value' can't be null";
}
if (null === $this->container['dimensions']) {
$invalidProperties[] = "'dimensions' can't be null";
}
if (null === $this->container['items']) {
$invalidProperties[] = "'items' can't be null";
}
if (null === $this->container['weight']) {
$invalidProperties[] = "'weight' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets container_type.
*
* @return string
*/
public function getContainerType()
{
return $this->container['container_type'];
}
/**
* Sets container_type.
*
* @param string $container_type The type of physical container being used. (always 'PACKAGE')
*
* @return $this
*/
public function setContainerType($container_type)
{
$allowedValues = $this->getContainerTypeAllowableValues();
if (!is_null($container_type) && !in_array($container_type, $allowedValues, true)) {
throw new \InvalidArgumentException(sprintf("Invalid value for 'container_type', must be one of '%s'", implode("', '", $allowedValues)));
}
$this->container['container_type'] = $container_type;
return $this;
}
/**
* Gets container_reference_id.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ContainerReferenceId
*/
public function getContainerReferenceId()
{
return $this->container['container_reference_id'];
}
/**
* Sets container_reference_id.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ContainerReferenceId $container_reference_id container_reference_id
*
* @return $this
*/
public function setContainerReferenceId($container_reference_id)
{
$this->container['container_reference_id'] = $container_reference_id;
return $this;
}
/**
* Gets value.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Currency
*/
public function getValue()
{
return $this->container['value'];
}
/**
* Sets value.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Currency $value value
*
* @return $this
*/
public function setValue($value)
{
$this->container['value'] = $value;
return $this;
}
/**
* Gets dimensions.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Dimensions
*/
public function getDimensions()
{
return $this->container['dimensions'];
}
/**
* Sets dimensions.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Dimensions $dimensions dimensions
*
* @return $this
*/
public function setDimensions($dimensions)
{
$this->container['dimensions'] = $dimensions;
return $this;
}
/**
* Gets items.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ContainerItem[]
*/
public function getItems()
{
return $this->container['items'];
}
/**
* Sets items.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ContainerItem[] $items a list of the items in the container
*
* @return $this
*/
public function setItems($items)
{
$this->container['items'] = $items;
return $this;
}
/**
* Gets weight.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Weight
*/
public function getWeight()
{
return $this->container['weight'];
}
/**
* Sets weight.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Weight $weight weight
*
* @return $this
*/
public function setWeight($weight)
{
$this->container['weight'] = $weight;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/PostalCode.php | lib/Models/Shipping/PostalCode.php | <?php
/**
* PostalCode.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* PostalCode Class Doc Comment.
*
* @description The postal code of that address. It contains a series of letters or digits or both, sometimes including spaces or punctuation.
*
* @author Stefan Neuhaus / ClouSale
*/
class PostalCode implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'PostalCode';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/CreateShipmentResponse.php | lib/Models/Shipping/CreateShipmentResponse.php | <?php
/**
* CreateShipmentResponse.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* CreateShipmentResponse Class Doc Comment.
*
* @description The response schema for the createShipment operation.
*
* @author Stefan Neuhaus / ClouSale
*/
class CreateShipmentResponse implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'CreateShipmentResponse';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'payload' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CreateShipmentResult',
'errors' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ErrorList', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'payload' => null,
'errors' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'payload' => 'payload',
'errors' => 'errors', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'payload' => 'setPayload',
'errors' => 'setErrors', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'payload' => 'getPayload',
'errors' => 'getErrors', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['payload'] = isset($data['payload']) ? $data['payload'] : null;
$this->container['errors'] = isset($data['errors']) ? $data['errors'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets payload.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CreateShipmentResult
*/
public function getPayload()
{
return $this->container['payload'];
}
/**
* Sets payload.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\CreateShipmentResult $payload payload
*
* @return $this
*/
public function setPayload($payload)
{
$this->container['payload'] = $payload;
return $this;
}
/**
* Gets errors.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ErrorList
*/
public function getErrors()
{
return $this->container['errors'];
}
/**
* Sets errors.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ErrorList $errors errors
*
* @return $this
*/
public function setErrors($errors)
{
$this->container['errors'] = $errors;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/RetrieveShippingLabelResponse.php | lib/Models/Shipping/RetrieveShippingLabelResponse.php | <?php
/**
* RetrieveShippingLabelResponse.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* RetrieveShippingLabelResponse Class Doc Comment.
*
* @description The response schema for the retrieveShippingLabel operation.
*
* @author Stefan Neuhaus / ClouSale
*/
class RetrieveShippingLabelResponse implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'RetrieveShippingLabelResponse';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'payload' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RetrieveShippingLabelResult',
'errors' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ErrorList', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'payload' => null,
'errors' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'payload' => 'payload',
'errors' => 'errors', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'payload' => 'setPayload',
'errors' => 'setErrors', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'payload' => 'getPayload',
'errors' => 'getErrors', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['payload'] = isset($data['payload']) ? $data['payload'] : null;
$this->container['errors'] = isset($data['errors']) ? $data['errors'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets payload.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RetrieveShippingLabelResult
*/
public function getPayload()
{
return $this->container['payload'];
}
/**
* Sets payload.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RetrieveShippingLabelResult $payload payload
*
* @return $this
*/
public function setPayload($payload)
{
$this->container['payload'] = $payload;
return $this;
}
/**
* Gets errors.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ErrorList
*/
public function getErrors()
{
return $this->container['errors'];
}
/**
* Sets errors.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ErrorList $errors errors
*
* @return $this
*/
public function setErrors($errors)
{
$this->container['errors'] = $errors;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/TrackingSummary.php | lib/Models/Shipping/TrackingSummary.php | <?php
/**
* TrackingSummary.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* TrackingSummary Class Doc Comment.
*
* @description The tracking summary.
*
* @author Stefan Neuhaus / ClouSale
*/
class TrackingSummary implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'TrackingSummary';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'status' => 'string', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'status' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'status' => 'status', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'status' => 'setStatus', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'status' => 'getStatus', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['status'] = isset($data['status']) ? $data['status'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets status.
*
* @return string
*/
public function getStatus()
{
return $this->container['status'];
}
/**
* Sets status.
*
* @param string $status the derived status based on the events in the eventHistory
*
* @return $this
*/
public function setStatus($status)
{
$this->container['status'] = $status;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/Currency.php | lib/Models/Shipping/Currency.php | <?php
/**
* Currency.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* Currency Class Doc Comment.
*
* @description The total value of all items in the container.
*
* @author Stefan Neuhaus / ClouSale
*/
class Currency implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'Currency';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'value' => 'float',
'unit' => 'string', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'value' => null,
'unit' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'value' => 'value',
'unit' => 'unit', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'value' => 'setValue',
'unit' => 'setUnit', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'value' => 'getValue',
'unit' => 'getUnit', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['value'] = isset($data['value']) ? $data['value'] : null;
$this->container['unit'] = isset($data['unit']) ? $data['unit'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if (null === $this->container['value']) {
$invalidProperties[] = "'value' can't be null";
}
if (null === $this->container['unit']) {
$invalidProperties[] = "'unit' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets value.
*
* @return float
*/
public function getValue()
{
return $this->container['value'];
}
/**
* Sets value.
*
* @param float $value the amount of currency
*
* @return $this
*/
public function setValue($value)
{
$this->container['value'] = $value;
return $this;
}
/**
* Gets unit.
*
* @return string
*/
public function getUnit()
{
return $this->container['unit'];
}
/**
* Sets unit.
*
* @param string $unit a 3-character currency code
*
* @return $this
*/
public function setUnit($unit)
{
$this->container['unit'] = $unit;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/ClientReferenceId.php | lib/Models/Shipping/ClientReferenceId.php | <?php
/**
* ClientReferenceId.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* ClientReferenceId Class Doc Comment.
*
* @description Client reference id.
*
* @author Stefan Neuhaus / ClouSale
*/
class ClientReferenceId implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'ClientReferenceId';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/LabelResult.php | lib/Models/Shipping/LabelResult.php | <?php
/**
* LabelResult.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* LabelResult Class Doc Comment.
*
* @description Label details including label stream, format, size.
*
* @author Stefan Neuhaus / ClouSale
*/
class LabelResult implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'LabelResult';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'container_reference_id' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ContainerReferenceId',
'tracking_id' => 'string',
'label' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Label', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'container_reference_id' => null,
'tracking_id' => null,
'label' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'container_reference_id' => 'containerReferenceId',
'tracking_id' => 'trackingId',
'label' => 'label', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'container_reference_id' => 'setContainerReferenceId',
'tracking_id' => 'setTrackingId',
'label' => 'setLabel', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'container_reference_id' => 'getContainerReferenceId',
'tracking_id' => 'getTrackingId',
'label' => 'getLabel', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['container_reference_id'] = isset($data['container_reference_id']) ? $data['container_reference_id'] : null;
$this->container['tracking_id'] = isset($data['tracking_id']) ? $data['tracking_id'] : null;
$this->container['label'] = isset($data['label']) ? $data['label'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets container_reference_id.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ContainerReferenceId
*/
public function getContainerReferenceId()
{
return $this->container['container_reference_id'];
}
/**
* Sets container_reference_id.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ContainerReferenceId $container_reference_id container_reference_id
*
* @return $this
*/
public function setContainerReferenceId($container_reference_id)
{
$this->container['container_reference_id'] = $container_reference_id;
return $this;
}
/**
* Gets tracking_id.
*
* @return string
*/
public function getTrackingId()
{
return $this->container['tracking_id'];
}
/**
* Sets tracking_id.
*
* @param string $tracking_id the tracking identifier assigned to the container
*
* @return $this
*/
public function setTrackingId($tracking_id)
{
$this->container['tracking_id'] = $tracking_id;
return $this;
}
/**
* Gets label.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Label
*/
public function getLabel()
{
return $this->container['label'];
}
/**
* Sets label.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Label $label label
*
* @return $this
*/
public function setLabel($label)
{
$this->container['label'] = $label;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/StateOrRegion.php | lib/Models/Shipping/StateOrRegion.php | <?php
/**
* StateOrRegion.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* StateOrRegion Class Doc Comment.
*
* @description The state or region where the person, business or institution is located.
*
* @author Stefan Neuhaus / ClouSale
*/
class StateOrRegion implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'StateOrRegion';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/PurchaseShipmentResponse.php | lib/Models/Shipping/PurchaseShipmentResponse.php | <?php
/**
* PurchaseShipmentResponse.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* PurchaseShipmentResponse Class Doc Comment.
*
* @description The response schema for the purchaseShipment operation.
*
* @author Stefan Neuhaus / ClouSale
*/
class PurchaseShipmentResponse implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'PurchaseShipmentResponse';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'payload' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseShipmentResult',
'errors' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ErrorList', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'payload' => null,
'errors' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'payload' => 'payload',
'errors' => 'errors', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'payload' => 'setPayload',
'errors' => 'setErrors', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'payload' => 'getPayload',
'errors' => 'getErrors', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['payload'] = isset($data['payload']) ? $data['payload'] : null;
$this->container['errors'] = isset($data['errors']) ? $data['errors'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets payload.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseShipmentResult
*/
public function getPayload()
{
return $this->container['payload'];
}
/**
* Sets payload.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\PurchaseShipmentResult $payload payload
*
* @return $this
*/
public function setPayload($payload)
{
$this->container['payload'] = $payload;
return $this;
}
/**
* Gets errors.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ErrorList
*/
public function getErrors()
{
return $this->container['errors'];
}
/**
* Sets errors.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\ErrorList $errors errors
*
* @return $this
*/
public function setErrors($errors)
{
$this->container['errors'] = $errors;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/Label.php | lib/Models/Shipping/Label.php | <?php
/**
* Label.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* Label Class Doc Comment.
*
* @description The label details of the container.
*
* @author Stefan Neuhaus / ClouSale
*/
class Label implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'Label';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'label_stream' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelStream',
'label_specification' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelSpecification', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'label_stream' => null,
'label_specification' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'label_stream' => 'labelStream',
'label_specification' => 'labelSpecification', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'label_stream' => 'setLabelStream',
'label_specification' => 'setLabelSpecification', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'label_stream' => 'getLabelStream',
'label_specification' => 'getLabelSpecification', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['label_stream'] = isset($data['label_stream']) ? $data['label_stream'] : null;
$this->container['label_specification'] = isset($data['label_specification']) ? $data['label_specification'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets label_stream.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelStream
*/
public function getLabelStream()
{
return $this->container['label_stream'];
}
/**
* Sets label_stream.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelStream $label_stream label_stream
*
* @return $this
*/
public function setLabelStream($label_stream)
{
$this->container['label_stream'] = $label_stream;
return $this;
}
/**
* Gets label_specification.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelSpecification
*/
public function getLabelSpecification()
{
return $this->container['label_specification'];
}
/**
* Sets label_specification.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelSpecification $label_specification label_specification
*
* @return $this
*/
public function setLabelSpecification($label_specification)
{
$this->container['label_specification'] = $label_specification;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/ContainerItem.php | lib/Models/Shipping/ContainerItem.php | <?php
/**
* ContainerItem.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* ContainerItem Class Doc Comment.
*
* @description Item in the container.
*
* @author Stefan Neuhaus / ClouSale
*/
class ContainerItem implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'ContainerItem';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'quantity' => 'float',
'unit_price' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Currency',
'unit_weight' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Weight',
'title' => 'string', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'quantity' => null,
'unit_price' => null,
'unit_weight' => null,
'title' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'quantity' => 'quantity',
'unit_price' => 'unitPrice',
'unit_weight' => 'unitWeight',
'title' => 'title', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'quantity' => 'setQuantity',
'unit_price' => 'setUnitPrice',
'unit_weight' => 'setUnitWeight',
'title' => 'setTitle', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'quantity' => 'getQuantity',
'unit_price' => 'getUnitPrice',
'unit_weight' => 'getUnitWeight',
'title' => 'getTitle', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['quantity'] = isset($data['quantity']) ? $data['quantity'] : null;
$this->container['unit_price'] = isset($data['unit_price']) ? $data['unit_price'] : null;
$this->container['unit_weight'] = isset($data['unit_weight']) ? $data['unit_weight'] : null;
$this->container['title'] = isset($data['title']) ? $data['title'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if (null === $this->container['quantity']) {
$invalidProperties[] = "'quantity' can't be null";
}
if (null === $this->container['unit_price']) {
$invalidProperties[] = "'unit_price' can't be null";
}
if (null === $this->container['unit_weight']) {
$invalidProperties[] = "'unit_weight' can't be null";
}
if (null === $this->container['title']) {
$invalidProperties[] = "'title' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets quantity.
*
* @return float
*/
public function getQuantity()
{
return $this->container['quantity'];
}
/**
* Sets quantity.
*
* @param float $quantity the quantity of the items of this type in the container
*
* @return $this
*/
public function setQuantity($quantity)
{
$this->container['quantity'] = $quantity;
return $this;
}
/**
* Gets unit_price.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Currency
*/
public function getUnitPrice()
{
return $this->container['unit_price'];
}
/**
* Sets unit_price.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Currency $unit_price unit_price
*
* @return $this
*/
public function setUnitPrice($unit_price)
{
$this->container['unit_price'] = $unit_price;
return $this;
}
/**
* Gets unit_weight.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Weight
*/
public function getUnitWeight()
{
return $this->container['unit_weight'];
}
/**
* Sets unit_weight.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\Weight $unit_weight unit_weight
*
* @return $this
*/
public function setUnitWeight($unit_weight)
{
$this->container['unit_weight'] = $unit_weight;
return $this;
}
/**
* Gets title.
*
* @return string
*/
public function getTitle()
{
return $this->container['title'];
}
/**
* Sets title.
*
* @param string $title a descriptive title of the item
*
* @return $this
*/
public function setTitle($title)
{
$this->container['title'] = $title;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/RateId.php | lib/Models/Shipping/RateId.php | <?php
/**
* RateId.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* RateId Class Doc Comment.
*
* @description An identifier for the rating.
*
* @author Stefan Neuhaus / ClouSale
*/
class RateId implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'RateId';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/PurchaseLabelsRequest.php | lib/Models/Shipping/PurchaseLabelsRequest.php | <?php
/**
* PurchaseLabelsRequest.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* PurchaseLabelsRequest Class Doc Comment.
*
* @description The request schema for the purchaseLabels operation.
*
* @author Stefan Neuhaus / ClouSale
*/
class PurchaseLabelsRequest implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'PurchaseLabelsRequest';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
'rate_id' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RateId',
'label_specification' => '\ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelSpecification', ];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
'rate_id' => null,
'label_specification' => null, ];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
'rate_id' => 'rateId',
'label_specification' => 'labelSpecification', ];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
'rate_id' => 'setRateId',
'label_specification' => 'setLabelSpecification', ];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
'rate_id' => 'getRateId',
'label_specification' => 'getLabelSpecification', ];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['rate_id'] = isset($data['rate_id']) ? $data['rate_id'] : null;
$this->container['label_specification'] = isset($data['label_specification']) ? $data['label_specification'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if (null === $this->container['rate_id']) {
$invalidProperties[] = "'rate_id' can't be null";
}
if (null === $this->container['label_specification']) {
$invalidProperties[] = "'label_specification' can't be null";
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Gets rate_id.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RateId
*/
public function getRateId()
{
return $this->container['rate_id'];
}
/**
* Sets rate_id.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\RateId $rate_id rate_id
*
* @return $this
*/
public function setRateId($rate_id)
{
$this->container['rate_id'] = $rate_id;
return $this;
}
/**
* Gets label_specification.
*
* @return \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelSpecification
*/
public function getLabelSpecification()
{
return $this->container['label_specification'];
}
/**
* Sets label_specification.
*
* @param \ClouSale\AmazonSellingPartnerAPI\Models\Shipping\LabelSpecification $label_specification label_specification
*
* @return $this
*/
public function setLabelSpecification($label_specification)
{
$this->container['label_specification'] = $label_specification;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/PromisedDeliveryDate.php | lib/Models/Shipping/PromisedDeliveryDate.php | <?php
/**
* PromisedDeliveryDate.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* PromisedDeliveryDate Class Doc Comment.
*
* @description The promised delivery date and time of a shipment.
*
* @author Stefan Neuhaus / ClouSale
*/
class PromisedDeliveryDate implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'PromisedDeliveryDate';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
clousale/amazon-sp-api-php | https://github.com/clousale/amazon-sp-api-php/blob/3d04a42cf19c01693b52b3902bdb8090687f317c/lib/Models/Shipping/EventList.php | lib/Models/Shipping/EventList.php | <?php
/**
* EventList.
*
* PHP version 5
*
* @author Stefan Neuhaus / ClouSale
*/
/**
* Selling Partner API for Shipping.
*
* Provides programmatic access to Amazon Shipping APIs.
*
* OpenAPI spec version: v1
*/
namespace ClouSale\AmazonSellingPartnerAPI\Models\Shipping;
use ArrayAccess;
use ClouSale\AmazonSellingPartnerAPI\Models\IterableType;
use ClouSale\AmazonSellingPartnerAPI\Models\ModelInterface;
use ClouSale\AmazonSellingPartnerAPI\ObjectSerializer;
/**
* EventList Class Doc Comment.
*
* @description A list of events of a shipment.
*
* @author Stefan Neuhaus / ClouSale
*/
class EventList implements ModelInterface, ArrayAccess, IterableType
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'EventList';
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerTypes = [
];
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @var string[]
*/
protected static $swaggerFormats = [
];
/**
* Array of property to type mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization.
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @var string[]
*/
protected static $attributeMap = [
];
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @var string[]
*/
protected static $setters = [
];
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @var string[]
*/
protected static $getters = [
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name.
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses).
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests).
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Associative array for storing property values.
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor.
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = parent::listInvalidProperties();
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed.
*
* @return bool True if all properties are valid
*/
public function valid()
{
return 0 === count($this->listInvalidProperties());
}
/**
* Returns true if offset exists. False otherwise.
*
* @param int $offset Offset
*
* @return bool
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param int $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param int $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param int $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object.
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
public function getSubClass()
{
return Event::class;
}
}
| php | MIT | 3d04a42cf19c01693b52b3902bdb8090687f317c | 2026-01-05T04:43:57.707350Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.