Skip to content

Commit 71dcf96

Browse files
authored
First upload
0 parents  commit 71dcf96

File tree

98 files changed

+31050
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+31050
-0
lines changed

composer.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "sanjayojha/laravel-amazon-paapi5",
3+
"description": "Laravel package for Amazon Product advertising API v5 using Official PHP SDK",
4+
"type": "library",
5+
"license": "Apache-2.0",
6+
"authors": [
7+
{
8+
"name": "Sanjay Ojha",
9+
"email": "sanjay.ojha@mail.com"
10+
}
11+
],
12+
"minimum-stability": "stable",
13+
"autoload": {
14+
"psr-4": {
15+
"Sanjayojha\\LaravelAmazonPaapi5\\" : "src/"
16+
}
17+
},
18+
"extra": {
19+
"laravel": {
20+
"providers": [
21+
"Sanjayojha\\LaravelAmazonPaapi5\\LaravelAmazonPaapi5ServiceProvider"
22+
],
23+
"aliases": {
24+
"AmazonPaapi5": "Sanjayojha\\LaravelAmazonPaapi5\\Facades\\AmazonAPI"
25+
}
26+
}
27+
},
28+
"require": {
29+
"php" : ">=7.2",
30+
"guzzlehttp/guzzle" : "^6.5"
31+
}
32+
}

config/amazon-api-key.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
return [
3+
'access_key' => env('AMAZON_PRODUCTS_ACCESS_KEY'),
4+
'secret_key' => env('AMAZON_PRODUCTS_SECRET_KEY'),
5+
'host' => env('AMAZON_PAAPI5_HOST', 'webservices.amazon.com'),
6+
'region' => env('AMAZON_PAAPI5_HOST', 'us-east-1'),
7+
];

src/ApiException.php

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<?php
2+
/**
3+
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License").
6+
* You may not use this file except in compliance with the License.
7+
* A copy of the License is located at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* or in the "license" file accompanying this file. This file is distributed
12+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13+
* express or implied. See the License for the specific language governing
14+
* permissions and limitations under the License.
15+
*/
16+
namespace Amazon\ProductAdvertisingAPI\v1;
17+
18+
use \Exception;
19+
20+
/**
21+
* ApiException Class Doc Comment
22+
*
23+
* @category Class
24+
* @package Amazon\ProductAdvertisingAPI\v1
25+
* @author Product Advertising API team
26+
*/
27+
class ApiException extends Exception
28+
{
29+
30+
/**
31+
* The HTTP body of the server response either as Json or string.
32+
*
33+
* @var mixed
34+
*/
35+
protected $responseBody;
36+
37+
/**
38+
* The HTTP header of the server response.
39+
*
40+
* @var string[]|null
41+
*/
42+
protected $responseHeaders;
43+
44+
/**
45+
* The deserialized response object
46+
*
47+
* @var $responseObject;
48+
*/
49+
protected $responseObject;
50+
51+
/**
52+
* Constructor
53+
*
54+
* @param string $message Error message
55+
* @param int $code HTTP status code
56+
* @param string[]|null $responseHeaders HTTP response header
57+
* @param mixed $responseBody HTTP decoded body of the server response either as \stdClass or string
58+
*/
59+
public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null)
60+
{
61+
parent::__construct($message, $code);
62+
$this->responseHeaders = $responseHeaders;
63+
$this->responseBody = $responseBody;
64+
}
65+
66+
/**
67+
* Gets the HTTP response header
68+
*
69+
* @return string[]|null HTTP response header
70+
*/
71+
public function getResponseHeaders()
72+
{
73+
return $this->responseHeaders;
74+
}
75+
76+
/**
77+
* Gets the HTTP body of the server response either as Json or string
78+
*
79+
* @return mixed HTTP body of the server response either as \stdClass or string
80+
*/
81+
public function getResponseBody()
82+
{
83+
return $this->responseBody;
84+
}
85+
86+
/**
87+
* Sets the deseralized response object (during deserialization)
88+
*
89+
* @param mixed $obj Deserialized response object
90+
*
91+
* @return void
92+
*/
93+
public function setResponseObject($obj)
94+
{
95+
$this->responseObject = $obj;
96+
}
97+
98+
/**
99+
* Gets the deseralized response object (during deserialization)
100+
*
101+
* @return mixed the deserialized response object
102+
*/
103+
public function getResponseObject()
104+
{
105+
return $this->responseObject;
106+
}
107+
}

0 commit comments

Comments
 (0)