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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ php:
- 7.4
- 8.0
before_install: "composer install"
script: "vendor/bin/phpunit"
script: "vendor/bin/behat"
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test:
vendor/bin/behat .
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ API for persisting [budget data](https://github.com/forevermatt/budget-data)
This PHP package is automatically generated by the
[Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:

- API version: 0.1.3
- Package version: 0.1.1
- API version: 0.2.0
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen

## Requirements
Expand Down Expand Up @@ -36,7 +35,7 @@ To run the unit tests:

```
composer install
./vendor/bin/phpunit
vendor/bin/behat .
```

## Getting Started
Expand All @@ -52,25 +51,25 @@ $apiInstance = new BudgetData\ApiClient\Api\DefaultApi(
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$body = new \BudgetData\ApiClient\Model\Account(); // \BudgetData\ApiClient\Model\Account |

try {
$result = $apiInstance->accountsGet();
print_r($result);
$apiInstance->accountPost($body);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->accountsGet: ', $e->getMessage(), PHP_EOL;
echo 'Exception when calling DefaultApi->accountPost: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new BudgetData\ApiClient\Api\DefaultApi(
// 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()
);
$body = new \BudgetData\ApiClient\Model\Account(); // \BudgetData\ApiClient\Model\Account |

try {
$apiInstance->accountsPost($body);
$result = $apiInstance->accountsGet();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->accountsPost: ', $e->getMessage(), PHP_EOL;
echo 'Exception when calling DefaultApi->accountsGet: ', $e->getMessage(), PHP_EOL;
}
?>
```
Expand All @@ -81,8 +80,8 @@ All URIs are relative to *https://virtserver.swaggerhub.com/forevermatt/budget-d

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**accountPost**](docs/Api/DefaultApi.md#accountpost) | **POST** /account | Add an account
*DefaultApi* | [**accountsGet**](docs/Api/DefaultApi.md#accountsget) | **GET** /accounts | List the current user's (financial) Accounts
*DefaultApi* | [**accountsPost**](docs/Api/DefaultApi.md#accountspost) | **POST** /accounts | Add an account

## Documentation For Models

Expand Down
9 changes: 3 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@
"guzzlehttp/guzzle": "^6.2"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.5",
"friendsofphp/php-cs-fixer": "^2.18"
"behat/behat": "^3.8",
"friendsofphp/php-cs-fixer": "^2.18",
"squizlabs/php_codesniffer": "^3.5"
},
"autoload": {
"psr-4": { "BudgetData\\ApiClient\\" : "lib/" }
},
"autoload-dev": {
"psr-4": { "BudgetData\\ApiClient\\" : "test/" }
}
}
48 changes: 24 additions & 24 deletions docs/Api/DefaultApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ All URIs are relative to *https://virtserver.swaggerhub.com/forevermatt/budget-d

Method | HTTP request | Description
------------- | ------------- | -------------
[**accountPost**](DefaultApi.md#accountpost) | **POST** /account | Add an account
[**accountsGet**](DefaultApi.md#accountsget) | **GET** /accounts | List the current user's (financial) Accounts
[**accountsPost**](DefaultApi.md#accountspost) | **POST** /accounts | Add an account

# **accountsGet**
> \BudgetData\ApiClient\Model\Account[] accountsGet()
# **accountPost**
> accountPost($body)

List the current user's (financial) Accounts
Add an account

### Example
```php
Expand All @@ -22,38 +22,41 @@ $apiInstance = new BudgetData\ApiClient\Api\DefaultApi(
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$body = new \BudgetData\ApiClient\Model\Account(); // \BudgetData\ApiClient\Model\Account |

try {
$result = $apiInstance->accountsGet();
print_r($result);
$apiInstance->accountPost($body);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->accountsGet: ', $e->getMessage(), PHP_EOL;
echo 'Exception when calling DefaultApi->accountPost: ', $e->getMessage(), PHP_EOL;
}
?>
```

### Parameters
This endpoint does not need any parameter.

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**\BudgetData\ApiClient\Model\Account**](../Model/Account.md)| |

### Return type

[**\BudgetData\ApiClient\Model\Account[]**](../Model/Account.md)
void (empty response body)

### Authorization

No authorization required

### HTTP request headers

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

[[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)

# **accountsPost**
> accountsPost($body)
# **accountsGet**
> \BudgetData\ApiClient\Model\Account[] accountsGet()

Add an account
List the current user's (financial) Accounts

### Example
```php
Expand All @@ -65,34 +68,31 @@ $apiInstance = new BudgetData\ApiClient\Api\DefaultApi(
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$body = new \BudgetData\ApiClient\Model\Account(); // \BudgetData\ApiClient\Model\Account |

try {
$apiInstance->accountsPost($body);
$result = $apiInstance->accountsGet();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->accountsPost: ', $e->getMessage(), PHP_EOL;
echo 'Exception when calling DefaultApi->accountsGet: ', $e->getMessage(), PHP_EOL;
}
?>
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**\BudgetData\ApiClient\Model\Account**](../Model/Account.md)| |
This endpoint does not need any parameter.

### Return type

void (empty response body)
[**\BudgetData\ApiClient\Model\Account[]**](../Model/Account.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: Not defined
- **Content-Type**: Not defined
- **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)

49 changes: 49 additions & 0 deletions features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

use Behat\Behat\Context\Context;
use BudgetData\ApiClient\BudgetDataApiClient;
use BudgetData\ApiClient\Model\Account;

/**
* Defines application features from the specific context.
*/
class FeatureContext implements Context
{
/** @var BudgetDataApiClient */
private $client;

/**
* @Given I have a Budget Data API Client
*/
public function iHaveABudgetDataApiClient()
{
$this->client = new BudgetDataApiClient('http://httpbin.org/anything');
}

/**
* @When I use it to list accounts
*/
public function iUseItToListAccounts()
{
$this->result = $this->client->accountsGet();
}

/**
* @Then no exception will have been thrown
*/
public function noExceptionWillHaveBeenThrown()
{
echo 'Result: ' . json_encode($this->result, JSON_PRETTY_PRINT);
}

/**
* @When I use it to add an account
*/
public function iUseItToAddAnAccount()
{
$this->result = $this->client->accountPost(new Account([
'name' => 'Test Card',
'uuid' => 'c0dc4d95-7d99-4cff-81ba-44b8a4c55815',
]));
}
}
11 changes: 11 additions & 0 deletions features/client.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Feature: PHP client for Budget Data API

Scenario Outline: Calling the various methods
Given I have a Budget Data API Client
When I use it to <doSomething> <toSomething>
Then no exception will have been thrown

Examples:
| doSomething | toSomething |
| list | accounts |
| add | an account |
Loading
Loading