selling-partner-api-models/clients/sellingpartner-api-frp-help.../README.md

116 lines
4.8 KiB
Markdown

## Selling Partner API for Feeds, Uploads and Reports Java Helper
This library provides helper classes for use with the Selling Partner APIs for Feeds, Uploads and Reports. It is intended for use with the Selling Partner API Client Libraries generated by [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) using the OkHttp library.
Use this library to encrypt files to be uploaded (Feeds and Uploads), or decrypt files after downloading (Reports)
## Resources
To use this library you will need to integrate it with one or more of the following packages:
##### Selling Partner API Authentication/Authorization Library
This package is required because it handles the Selling Partner API credentials required by the APIs. You can find it on our GitHub Repository [here](https://github.com/amzn/selling-partner-api-models/tree/main/clients/sellingpartner-api-aa-java).
##### Selling Partner API for Feeds
The JSON file can be obtained [here](https://github.com/amzn/selling-partner-api-models/blob/main/models/feeds-api-model/feedsV0.json).
##### Selling Partner API for Uploads
The JSON file can be obtained [here](https://github.com/amzn/selling-partner-api-models/blob/main/models/uploads-api-model/uploads.json).
##### Selling Partner API for Reports
The JSON file can be obtained [here](https://github.com/amzn/selling-partner-api-models/blob/main/models/reports-api-model/reportsV0.json).
## Building
#### Building the Client Libraries
- Build the client library for each of the API model JSON files using Swagger Codegen. For each file:
*For example:*
java -jar C:\SwaggerToCL\swagger-codegen-cli.jar generate -i C:\SwaggerToCL\Feeds.json -l java -t [path to clients\sellingpartner-apiaa-java directory]/resources/swagger-codegen/templates/ -o C:\SwaggerToCL\Feeds_JavaCL
#### Integrating the AA Library to the Helper via Maven
1. Build the AA Library and add it as a dependency of the SDKs:
Navigate to the **clients/sellingpartner-api-aa-java** folder and run:
mvn package
This generates a folder named "target". In this folder is a JAR file named **sellingpartnerapi-aa-java-1.0-jar-with-dependencies.jar** (or something similar) and all of the required dependencies.
2. Install the JAR file in your local Maven repository:
*For example:*
mvn install:install-file -Dfile=[path to JAR file in "target" folder] -DgroupId=com.amazon.sellingpartnerapi -DartifactId=sellingpartnerapi-aajava -Dversion=1.0 -Dpackaging=jar
Keep track of the *groupId*, *artifactId*, and *version* values (which can also be found near the top of the **pom.xml** file in the **clients/sellingpartner-api-aa-java** folder) because you will use them in the steps to follow.
3. Add a dependency on the AA library in the **pom.xml** of each client library.
*For example:*
```
<dependency>
<groupId>com.amazon.sellingpartnerapi</groupId>
<artifactId>sellingpartnerapi-aa-java</artifactId>
<version>1.0</version>
</dependency>
```
4. Build each client library with:
```
mvn package
```
5. Install the Feeds, Uploads and Reports client libraries in your local Maven repository.
*For example:*
mvn install:install-file -Dfile=[path to JAR file in "target" folder] -DgroupId=com.amazon.sellingpartnerapi -DartifactId=sellingpartnerapi-feeds-java -Dversion=1.0 -Dpackaging=jar
6. Confirm that the *artifactId* of the Feeds, Uploads and Reports libraries in the **pom.xml** of the Helper matches the ones used when installing each library.
*For example:*
```
<dependency>
<groupId>com.amazon.sellingpartnerapi</groupId>
<artifactId>sellingpartnerapi-feeds-java</artifactId>
<version>1.0</version>
</dependency>
```
7. Navigate to the **SellingPartnerApiFeedsUploadsReportsJavaHelper** folder and run:
```
mvn package
```
*The Feeds, Uploads and Reports Java Helper SDK comes with two building options: Maven and Gradle, however, we only detail how to complete the Maven build above.*
## License
Swagger Codegen templates are subject to the [Swagger Codegen License](https://github.com/swagger-api/swagger-codegen#license).
All other work licensed as follows:
Copyright Amazon.com Inc. or its affiliates.
All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this library except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.