# {{bundleName}}
{{#appDescription}}
{{{appDescription}}}
{{/appDescription}}

This [Symfony](https://symfony.com/) bundle is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:

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

## Requirements

PHP 5.4.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 swagger bundle"
    }],
}
```

Then run:

```
composer require {{#composerVendorName}}{{.}}{{/composerVendorName}}{{^composerVendorName}}{{gitUserId}}{{/composerVendorName}}/{{#composerProjectName}}{{.}}{{/composerProjectName}}{{^composerProjectName}}{{gitRepoId}}{{/composerProjectName}}:dev-master
```

to add the generated swagger 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 kernel:

```php
<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new {{invokerPackage}}\{{bundleClassName}}(),
        // ...
    );
}
```

Step 3: Register the routes:

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

Step 4: Implement the API calls:

```php
<?php{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}
// src/Acme/MyBundle/Api/{{classname}}.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-parameterType}}{{vendorExtensions.x-parameterType}} {{/vendorExtensions.x-parameterType}}${{paramName}}{{^required}} = {{#defaultValue}}'{{{.}}}'{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
    {
        // Implement the operation ...
    }
{{/hasAuthMethods}}
{{/-first}}{{/operation}}
    // Other operation methods ...
}
```

Step 5: Tag your API implementation:

```yaml
# src/Acme/MyBundle/Resources/services.yml
services:
    # ...
    acme.my_bundle.api.{{pathPrefix}}:
        class: 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}}{{summary}}{{/summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}

## Documentation For Models

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

## Documentation For Authorization

{{^authMethods}} All endpoints do not require authorization.
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
{{#authMethods}}## {{{name}}}

{{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{{keyParamName}}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication
{{/isBasic}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{{flow}}}
- **Authorization URL**: {{{authorizationUrl}}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - **{{{scope}}}**: {{{description}}}
{{/scopes}}
{{/isOAuth}}

{{/authMethods}}

## Author

{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
{{/hasMore}}{{/apis}}{{/apiInfo}}

