Skip to content

Commit

Permalink
Regenerated using newer version of swagger-codegen
Browse files Browse the repository at this point in the history
Moved models to Models
Mapped BigDecimal to Float manually in gen config
Documented generation process
  • Loading branch information
Caffe1neAdd1ct committed Oct 20, 2021
1 parent 30191c0 commit 2ae523c
Show file tree
Hide file tree
Showing 94 changed files with 1,918 additions and 1,148 deletions.
33 changes: 19 additions & 14 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
<?php

return Symfony\CS\Config::create()
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
return PhpCsFixer\Config::create()
->setUsingCache(true)
->fixers(
[
'ordered_use',
'phpdoc_order',
'short_array_syntax',
'strict',
'strict_param'
]
)
->finder(
Symfony\CS\Finder\DefaultFinder::create()
->in(__DIR__)
->setRules([
'@PSR2' => true,
'ordered_imports' => true,
'phpdoc_order' => true,
'array_syntax' => [ 'syntax' => 'short' ],
'strict_comparison' => true,
'strict_param' => true,
'no_trailing_whitespace' => false,
'no_trailing_whitespace_in_comment' => false,
'braces' => false,
'single_blank_line_at_eof' => false,
'blank_line_after_namespace' => false,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('test')
->exclude('tests')
->in(__DIR__)
);
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Import your orders, retrieve your orders and generate labels.
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:

- API version: 1.0.0
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen
- Build package: io.swagger.codegen.languages.PhpClientCodegen

## Requirements

Expand Down Expand Up @@ -78,12 +78,13 @@ try {
} catch (Exception $e) {
echo 'Exception when calling LabelsApi->getOrdersLabelAsync: ', $e->getMessage(), PHP_EOL;
}

?>
```

## Documentation for API Endpoints

All URIs are relative to *///api/v1*
All URIs are relative to *https://api.parcel.royalmail.com/api/v1*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
Expand All @@ -93,6 +94,7 @@ Class | Method | HTTP request | Description
*OrdersApi* | [**getOrdersWithDetailsAsync**](docs/Api/OrdersApi.md#getorderswithdetailsasync) | **GET** /orders/{orderIdentifiers}/full | Retrieve orders details
*VersionApi* | [**getVersionAsync**](docs/Api/VersionApi.md#getversionasync) | **GET** /version | Get API version details.


## Documentation For Models

- [AddressRequest](docs/Model/AddressRequest.md)
Expand Down Expand Up @@ -121,6 +123,7 @@ Class | Method | HTTP request | Description
- [ShipmentPackageRequest](docs/Model/ShipmentPackageRequest.md)
- [TagRequest](docs/Model/TagRequest.md)


## Documentation For Authorization


Expand All @@ -135,3 +138,4 @@ Class | Method | HTTP request | Description




2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"require-dev": {
"phpunit/phpunit": "^4.8",
"squizlabs/php_codesniffer": "~2.6",
"friendsofphp/php-cs-fixer": "~1.12"
"friendsofphp/php-cs-fixer": "~2.12"
},
"autoload": {
"psr-4": { "RoyalMail\\ClickAndDrop\\Rest\\Api\\" : "lib/" }
Expand Down
24 changes: 24 additions & 0 deletions config/gen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Clone and build swagger-codegen standalone jar

git clone https://github.com/swagger-api/swagger-codegen.git
cd swagger-codegen
JAVA_HOME=/usr/lib/jvm/java-8-openjdk mvn clean package
cp modules/swagger-codegen-cli/target/swagger-codegen-cli.jar ~/Software/

# Regenerate to new folder

/usr/lib/jvm/java-8-openjdk/bin/java -jar ~/Software/swagger-codegen-cli.jar generate \
-i royal-mail-click-drop-rest-api-client/config/click-and-drop-api-v1.yaml \
-l php -c royal-mail-click-drop-rest-api-client/config/config.json \
--type-mappings BigDecimal=float \
-o royal-mail-click-drop-rest-api-client-regen

# Copy results in and fix up any manual changes to namespaces/urls etc

cp -r royal-mail-click-drop-rest-api-client-regen/SwaggerClient-php/. royal-mail-click-drop-rest-api-client/


models to Models
RoyalMail\ClickAndDrop\Rest\Api\RoyalMail\ClickAndDrop\Rest\Api to RoyalMail\ClickAndDrop\Rest\Api
All URIs are relative to *https://localhost/api/v1* to https://api.parcel.royalmail.com/api/v1
Revert changes in composer.json as needed
10 changes: 6 additions & 4 deletions docs/Api/LabelsApi.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# RoyalMail\ClickAndDrop\Rest\Api\LabelsApi

All URIs are relative to *///api/v1*
https://api.parcel.royalmail.com/api/v1

Method | HTTP request | Description
------------- | ------------- | -------------
[**getOrdersLabelAsync**](LabelsApi.md#getOrdersLabelAsync) | **GET** /orders/{orderIdentifiers}/label | Return a single PDF file with generated label and/or associated document(s)


# **getOrdersLabelAsync**
> \SplFileObject getOrdersLabelAsync($orderIdentifiers, $documentType, $includeReturnsLabel, $includeCN)
Expand All @@ -17,12 +18,13 @@ Return a single PDF file with generated label and/or associated document(s)
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: Bearer
$config = RoyalMail\ClickAndDrop\Rest\Api\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RoyalMail\ClickAndDrop\Rest\Api\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new RoyalMail\ClickAndDrop\Rest\Api\LabelsApi(
$apiInstance = new RoyalMail\ClickAndDrop\Rest\Api\Api\LabelsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
Expand All @@ -48,7 +50,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orderIdentifiers** | **string**| Order Identifier or several Order Identifiers separated by semicolon |
**documentType** | **string**| Document generation mode. When documentType is set to \&quot;postageLabel\&quot; the additional parameters below must be used. These additional parameters will be ignored when documentType is not set to \&quot;postageLabel\&quot; |
**includeReturnsLabel** | **bool**| Include returns label. Required when documentType is set to &#x27;postageLabel&#x27; | [optional]
**includeReturnsLabel** | **bool**| Include returns label. Required when documentType is set to &#39;postageLabel&#39; | [optional]
**includeCN** | **bool**| Include CN22/CN23 with label. Optional parameter. If this parameter is used the setting will override the default account behaviour specified in the \&quot;Label format\&quot; setting \&quot;Generate customs declarations with orders\&quot; | [optional]

### Return type
Expand All @@ -61,7 +63,7 @@ Name | Type | Description | Notes

### HTTP request headers

- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/pdf, application/json

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
Expand Down
34 changes: 19 additions & 15 deletions docs/Api/OrdersApi.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
# RoyalMail\ClickAndDrop\Rest\Api\OrdersApi

All URIs are relative to *///api/v1*
https://api.parcel.royalmail.com/api/v1

Method | HTTP request | Description
------------- | ------------- | -------------
[**createOrdersAsync**](OrdersApi.md#createOrdersAsync) | **POST** /orders | Create orders
[**getOrdersAsync**](OrdersApi.md#getOrdersAsync) | **GET** /orders/{orderIdentifiers} | Retrieve orders
[**getOrdersWithDetailsAsync**](OrdersApi.md#getOrdersWithDetailsAsync) | **GET** /orders/{orderIdentifiers}/full | Retrieve orders details


# **createOrdersAsync**
> \RoyalMail\ClickAndDrop\Rest\Api\models\CreateOrdersResponse createOrdersAsync($body)
> \RoyalMail\ClickAndDrop\Rest\Api\Models\CreateOrdersResponse createOrdersAsync($request)
Create orders

### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: Bearer
$config = RoyalMail\ClickAndDrop\Rest\Api\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RoyalMail\ClickAndDrop\Rest\Api\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new RoyalMail\ClickAndDrop\Rest\Api\OrdersApi(
$apiInstance = new RoyalMail\ClickAndDrop\Rest\Api\Api\OrdersApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$body = new \RoyalMail\ClickAndDrop\Rest\Api\models\CreateOrdersRequest(); // \RoyalMail\ClickAndDrop\Rest\Api\models\CreateOrdersRequest |
$request = new \RoyalMail\ClickAndDrop\Rest\Api\Models\CreateOrdersRequest(); // \RoyalMail\ClickAndDrop\Rest\Api\Models\CreateOrdersRequest |

try {
$result = $apiInstance->createOrdersAsync($body);
$result = $apiInstance->createOrdersAsync($request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling OrdersApi->createOrdersAsync: ', $e->getMessage(), PHP_EOL;
Expand All @@ -43,11 +45,11 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**\RoyalMail\ClickAndDrop\Rest\Api\models\CreateOrdersRequest**](../Model/CreateOrdersRequest.md)| |
**request** | [**\RoyalMail\ClickAndDrop\Rest\Api\Models\CreateOrdersRequest**](../Model/CreateOrdersRequest.md)| |

### Return type

[**\RoyalMail\ClickAndDrop\Rest\Api\models\CreateOrdersResponse**](../Model/CreateOrdersResponse.md)
[**\RoyalMail\ClickAndDrop\Rest\Api\Models\CreateOrdersResponse**](../Model/CreateOrdersResponse.md)

### Authorization

Expand All @@ -61,20 +63,21 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)

# **getOrdersAsync**
> \RoyalMail\ClickAndDrop\Rest\Api\models\GetOrderInfoResource[] getOrdersAsync($orderIdentifiers)
> \RoyalMail\ClickAndDrop\Rest\Api\Models\GetOrderInfoResource[] getOrdersAsync($orderIdentifiers)
Retrieve orders

### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: Bearer
$config = RoyalMail\ClickAndDrop\Rest\Api\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RoyalMail\ClickAndDrop\Rest\Api\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new RoyalMail\ClickAndDrop\Rest\Api\OrdersApi(
$apiInstance = new RoyalMail\ClickAndDrop\Rest\Api\Api\OrdersApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
Expand All @@ -99,21 +102,21 @@ Name | Type | Description | Notes

### Return type

[**\RoyalMail\ClickAndDrop\Rest\Api\models\GetOrderInfoResource[]**](../Model/GetOrderInfoResource.md)
[**\RoyalMail\ClickAndDrop\Rest\Api\Models\GetOrderInfoResource[]**](../Model/GetOrderInfoResource.md)

### Authorization

[Bearer](../../README.md#Bearer)

### HTTP request headers

- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)

# **getOrdersWithDetailsAsync**
> \RoyalMail\ClickAndDrop\Rest\Api\models\GetOrderDetailsResource[] getOrdersWithDetailsAsync($orderIdentifiers)
> \RoyalMail\ClickAndDrop\Rest\Api\Models\GetOrderDetailsResource[] getOrdersWithDetailsAsync($orderIdentifiers)
Retrieve orders details

Expand All @@ -123,12 +126,13 @@ Retrieve orders details
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: Bearer
$config = RoyalMail\ClickAndDrop\Rest\Api\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = RoyalMail\ClickAndDrop\Rest\Api\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new RoyalMail\ClickAndDrop\Rest\Api\OrdersApi(
$apiInstance = new RoyalMail\ClickAndDrop\Rest\Api\Api\OrdersApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
Expand All @@ -153,15 +157,15 @@ Name | Type | Description | Notes

### Return type

[**\RoyalMail\ClickAndDrop\Rest\Api\models\GetOrderDetailsResource[]**](../Model/GetOrderDetailsResource.md)
[**\RoyalMail\ClickAndDrop\Rest\Api\Models\GetOrderDetailsResource[]**](../Model/GetOrderDetailsResource.md)

### Authorization

[Bearer](../../README.md#Bearer)

### HTTP request headers

- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
Expand Down
11 changes: 6 additions & 5 deletions docs/Api/VersionApi.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# RoyalMail\ClickAndDrop\Rest\Api\VersionApi

All URIs are relative to *///api/v1*
https://api.parcel.royalmail.com/api/v1

Method | HTTP request | Description
------------- | ------------- | -------------
[**getVersionAsync**](VersionApi.md#getVersionAsync) | **GET** /version | Get API version details.


# **getVersionAsync**
> \RoyalMail\ClickAndDrop\Rest\Api\models\GetVersionResource getVersionAsync()
> \RoyalMail\ClickAndDrop\Rest\Api\Models\GetVersionResource getVersionAsync()
Get API version details.

Expand All @@ -16,7 +17,7 @@ Get API version details.
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$apiInstance = new RoyalMail\ClickAndDrop\Rest\Api\VersionApi(
$apiInstance = new RoyalMail\ClickAndDrop\Rest\Api\Api\VersionApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
Expand All @@ -36,15 +37,15 @@ This endpoint does not need any parameter.

### Return type

[**\RoyalMail\ClickAndDrop\Rest\Api\models\GetVersionResource**](../Model/GetVersionResource.md)
[**\RoyalMail\ClickAndDrop\Rest\Api\Models\GetVersionResource**](../Model/GetVersionResource.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
Expand Down
1 change: 1 addition & 0 deletions docs/Model/AddressRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ Name | Type | Description | Notes

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


3 changes: 2 additions & 1 deletion docs/Model/BillingDetailsRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**address** | [**\RoyalMail\ClickAndDrop\Rest\Api\models\AddressRequest**](AddressRequest.md) | |
**address** | [**\RoyalMail\ClickAndDrop\Rest\Api\Models\AddressRequest**](AddressRequest.md) | |
**phoneNumber** | **string** | | [optional]
**emailAddress** | **string** | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


3 changes: 2 additions & 1 deletion docs/Model/CreateOrderErrorResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**errorCode** | **int** | | [optional]
**errorMessage** | **string** | | [optional]
**fields** | [**\RoyalMail\ClickAndDrop\Rest\Api\models\OrderFieldResponse[]**](OrderFieldResponse.md) | | [optional]
**fields** | [**\RoyalMail\ClickAndDrop\Rest\Api\Models\OrderFieldResponse[]**](OrderFieldResponse.md) | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


Loading

0 comments on commit 2ae523c

Please sign in to comment.