Skip to content

Commit

Permalink
feat(openapi)!: v3
Browse files Browse the repository at this point in the history
  • Loading branch information
bencromwell committed Jan 18, 2024
1 parent e941dc0 commit b9f90bf
Show file tree
Hide file tree
Showing 2,355 changed files with 190,752 additions and 1,829 deletions.
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2023 Krystal Hosting Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 changes: 0 additions & 21 deletions LICENSE.md

This file was deleted.

82 changes: 1 addition & 81 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ A PHP library for integrating with [Katapult](https://katapult.io/)
## Version constraints
* V1.x supports PHP 5.6
* V2.x supports PHP 7.4
* V3.x supports PHP 8.1

## Installation

Expand All @@ -18,84 +19,3 @@ You can install the package via Composer:
```bash
composer require krystal/katapult
```

## Usage

```php
use Krystal\Katapult\API\RestfulKatapultApiV1 as KatapultApi;
use Krystal\Katapult\Katapult;
use Krystal\Katapult\Resources\DataCenter;
use Krystal\Katapult\Resources\Organization;
use Krystal\Katapult\Resources\VirtualMachinePackage;

$katapult = Katapult::make(new KatapultApi(
'your-katapult-api-token'
));

$dataCenters = $katapult->resource(DataCenter::class)->all();
$organization = $katapult->resource(Organization::class)->first();
$virtualMachinePackages = $katapult->resource(VirtualMachinePackage::class)->all();
$virtualMachines = $katapult->resource(Organization\VirtualMachine::class, $organization)->all();
```

### Guzzle handler stack
You can inject your own handler stack for Guzzle, which is usually done for adding middleware, such as logging requests.

```php
use Krystal\Katapult\API\RestfulKatapultApiV1 as KatapultApi;
use Krystal\Katapult\Katapult;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Middleware;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;

// Create a handler stack
$handlerStack = HandlerStack::create();

// Add some middleware
$handlerStack->push(Middleware::mapRequest(function(RequestInterface $request) {
return $request;
}));

// And some more
$handlerStack->push(Middleware::mapResponse(function(ResponseInterface $response) {
return $response;
}));

// Use the handler stack directly on the constructor
$katapult = Katapult::make(
new KatapultApi('your-katapult-api-token', true, $handlerStack)
);

// Or by rebuilding the Guzzle client
$katapult = Katapult::make(
(new KatapultApi('your-katapult-api-token'))
->rebuildClient($handlerStack)
);
```

## Testing

``` bash
KATAPULT_API_TOKEN=<your-token-here> composer test
```

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

If you discover any security related issues, please email contact@krystal.uk instead of using the issue tracker.

## Credits

- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

## PHP Package Boilerplate

This package was generated using the [PHP Package Boilerplate](https://laravelpackageboilerplate.com).
60 changes: 20 additions & 40 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,24 @@
{
"name": "krystal/katapult",
"description": "API library for Katapult cloud platform",
"keywords": [
"krystal",
"katapult"
],
"homepage": "https://github.com/krystal/katapult",
"license": "MIT",
"type": "library",
"authors": [
{
"name": "Josh Bonfield",
"email": "josh@grizzlyware.com",
"role": "Developer"
}
],
"require": {
"php": "^7.4",
"guzzlehttp/guzzle": "^7.2"
"name": "krystal/katapult",
"type": "library",
"license": "MIT",
"require": {
"php": "^8.1",
"jane-php/open-api-runtime": "^7.5"
},
"require-dev": {
"jane-php/open-api-3": "^7.5"
},
"config": {
"preferred-install": {
"*": "dist"
},
"require-dev": {
"pestphp/pest": "^1.0",
"phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": {
"Krystal\\Katapult\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Krystal\\Katapult\\Tests\\": "tests"
}
},
"scripts": {
"test": "php vendor/bin/pest",
"test-coverage": "php vendor/bin/pest --coverage"

},
"config": {
"sort-packages": true
"sort-packages": true
},
"autoload": {
"psr-4": {
"Krystal\\Katapult\\KatapultAPI\\": "src/"
}
},
"prefer-stable": true
}
18 changes: 0 additions & 18 deletions phpunit.xml

This file was deleted.

7 changes: 0 additions & 7 deletions src/API/AbstractKatapultApi.php

This file was deleted.

8 changes: 0 additions & 8 deletions src/API/KatapultApiInterface.php

This file was deleted.

11 changes: 0 additions & 11 deletions src/API/ResourceControllerInterface.php

This file was deleted.

100 changes: 0 additions & 100 deletions src/API/RestfulKatapultApiV1.php

This file was deleted.

15 changes: 0 additions & 15 deletions src/API/RestfulKatapultApiV1/Helper.php

This file was deleted.

Loading

0 comments on commit b9f90bf

Please sign in to comment.