# {{bundleName}}
{{#appDescriptionWithNewLines}}
{{{.}}}
{{/appDescriptionWithNewLines}}

This [Symfony](https://symfony.com/) bundle is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: {{appVersion}}
{{#artifactVersion}}
- Package version: {{.}}
{{/artifactVersion}}
{{^hideGenerationTimestamp}}
- Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
- Generator version: {{generatorVersion}}
- Build package: {{generatorClass}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}}

## Requirements

PHP 8.0 and later

## Installation & Usage

To install the dependencies via [Composer](http://getcomposer.org/), add the following repository to `composer.json` of your Symfony project:

```json
{
    "repositories": [{
        "type": "path",
        "url": "//Path to your generated openapi bundle"
    }],
}
```

Then run:

```
composer require {{gitUserId}}/{{gitRepoId}}:dev-master
```

to add the generated openapi bundle as a dependency.

## Tests

To run the unit tests for the generated bundle, first navigate to the directory containing the code, then run the following commands:

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


## Getting Started

Step 1: Please follow the [installation procedure](#installation--usage) first.

Step 2: Enable the bundle in the bundle configuration:

```php
// app/config/bundles.php
return [
    // ...
    {{invokerPackage}}\{{bundleClassName}}::class => ['all' => true],
];
```

Step 3: Register the routes:

```yaml
# app/config/routes.yaml
{{bundleAlias}}:
    resource: "@{{bundleName}}Bundle/Resources/config/routing.yaml"
```

Step 4: Implement the API calls:

```php
<?php{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}
// src/Acme/MyBundle/Api/{{baseName}}Api.php

namespace Acme\MyBundle\Api;

use {{apiPackage}}\{{classname}};

class {{baseName}}Api implements {{classname}} // An interface is autogenerated
{
{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isApiKey}}
    /**
     * Configure API key authorization: {{{name}}}
     */
    public function set{{name}}($apiKey)
    {
        // Retrieve logged in user from $apiKey ...
    }
    {{/isApiKey}}{{#isOAuth}}
    /**
     * Configure OAuth2 access token for authorization: {{{name}}}
     */
    public function set{{name}}($oauthToken)
    {
        // Retrieve logged in user from $oauthToken ...
    }
    {{/isOAuth}}{{/authMethods}}
    /**
     * Implementation of {{classname}}#{{operationId}}
     */
    public function {{operationId}}({{#allParams}}{{#vendorExtensions.x-parameter-type}}{{vendorExtensions.x-parameter-type}} {{/vendorExtensions.x-parameter-type}}${{paramName}}{{^required}} = {{#defaultValue}}'{{{.}}}'{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}, int &$responseCode, array &$responseHeaders): {{{vendorExtensions.x-return-type}}}
    {
        // Implement the operation ...
    }
{{/hasAuthMethods}}
{{/-first}}{{/operation}}
    // Other operation methods ...
}
```

Step 5: Tag your API implementation:

```yaml
# config/services.yaml
services:
    # ...
    Acme\MyBundle\Api\{{baseName}}Api:
        tags:
            - { name: "{{bundleAlias}}.api", api: "{{pathPrefix}}" }
    # ...
```
{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
Now you can start using the bundle!


## Documentation for API Endpoints

All URIs are relative to *{{basePath}}*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}

## Documentation For Models

{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md)
{{/model}}{{/models}}

## Documentation For Authorization

{{^authMethods}}Endpoints do not require authorization.{{/authMethods}}
{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}}
{{#authMethods}}
### {{{name}}}

{{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{{keyParamName}}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasicBasic}}- **Type**: HTTP basic authentication
{{/isBasicBasic}}
{{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{#isHttpSignature}}- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{{flow}}}
- **Authorization URL**: {{{authorizationUrl}}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - **{{{scope}}}**: {{{description}}}
{{/scopes}}
{{/isOAuth}}

{{/authMethods}}

## Author

{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}}
{{/-last}}{{/apis}}{{/apiInfo}}
