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
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,74 @@ paths:
description: file to upload
type: string
format: binary
'/pet/{petId}/downloadImage':
get:
tags:
- pet
summary: downloads an image
description: response may be an image
operationId: downloadFile
parameters:
- name: petId
in: path
description: ID of pet to download an image from
required: true
schema:
type: integer
format: int64
responses:
'200':
description: successful operation
content:
image/png:
schema:
type: string
format: binary
'/pet/{petId}/age':
get:
tags:
- pet
summary: Get the age of the pet
description: response may be an int
operationId: petAge
parameters:
- name: petId
in: path
description: ID of pet
required: true
schema:
type: integer
format: int64
responses:
'200':
description: successful operation
content:
text/plain:
schema:
type: integer
format: int64
'/pet/{petId}/available-for-sale':
get:
tags:
- pet
summary: Whether the pet can currently be bought
description: response may be a boolean
operationId: petAvailableForSale
parameters:
- name: petId
in: path
description: ID of pet
required: true
schema:
type: integer
format: int64
responses:
'200':
description: successful operation
content:
text/plain:
schema:
type: boolean
/store/inventory:
get:
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,23 @@ public function deletePet(
array &$responseHeaders
): void;

/**
* Operation downloadFile
*
* downloads an image
*
* @param int $petId ID of pet to download an image from (required)
* @param int &$responseCode The HTTP Response Code
* @param array $responseHeaders Additional HTTP headers to return with the response ()
*
* @return mixed
*/
public function downloadFile(
int $petId,
int &$responseCode,
array &$responseHeaders
): mixed;

/**
* Operation findPetsByStatus
*
Expand Down Expand Up @@ -150,6 +167,40 @@ public function getPetById(
array &$responseHeaders
): array|object|null;

/**
* Operation petAge
*
* Get the age of the pet
*
* @param int $petId ID of pet (required)
* @param int &$responseCode The HTTP Response Code
* @param array $responseHeaders Additional HTTP headers to return with the response ()
*
* @return int
*/
public function petAge(
int $petId,
int &$responseCode,
array &$responseHeaders
): int;

/**
* Operation petAvailableForSale
*
* Whether the pet can currently be bought
*
* @param int $petId ID of pet (required)
* @param int &$responseCode The HTTP Response Code
* @param array $responseHeaders Additional HTTP headers to return with the response ()
*
* @return bool
*/
public function petAvailableForSale(
int $petId,
int &$responseCode,
array &$responseHeaders
): bool;

/**
* Operation updatePet
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,79 @@ public function deletePetAction(Request $request, $petId)
}
}

/**
* Operation downloadFile
*
* downloads an image
*
* @param Request $request The Symfony request to handle.
* @return Response The Symfony response.
*/
public function downloadFileAction(Request $request, $petId)
{
// Figure out what data format to return to the client
$produces = ['image/png'];
// Figure out what the client accepts
$clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*';
$responseFormat = $this->getOutputFormat($clientAccepts, $produces);
if ($responseFormat === null) {
return new Response('', 406);
}

// Handle authentication

// Read out all input parameter values into variables

// Use the default value if no value was provided

// Deserialize the input values that needs it
try {
$petId = $this->deserialize($petId, 'int', 'string');
} catch (SerializerRuntimeException $exception) {
return $this->createBadRequestResponse($exception->getMessage());
}

// Validate the input values
$asserts = [];
$asserts[] = new Assert\NotNull();
$asserts[] = new Assert\Type("int");
$response = $this->validate($petId, $asserts);
if ($response instanceof Response) {
return $response;
}


try {
$handler = $this->getApiHandler();


// Make the call to the business logic
$responseCode = 200;
$responseHeaders = [];

$result = $handler->downloadFile($petId, $responseCode, $responseHeaders);

$message = match($responseCode) {
200 => 'successful operation',
default => '',
};

return new Response(
$result !== null ?$this->serialize($result, $responseFormat):'',
$responseCode,
array_merge(
$responseHeaders,
[
'Content-Type' => $responseFormat,
'X-OpenAPI-Message' => $message
]
)
);
} catch (\Throwable $fallthrough) {
return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough));
}
}

/**
* Operation findPetsByStatus
*
Expand Down Expand Up @@ -465,6 +538,152 @@ public function getPetByIdAction(Request $request, $petId)
}
}

/**
* Operation petAge
*
* Get the age of the pet
*
* @param Request $request The Symfony request to handle.
* @return Response The Symfony response.
*/
public function petAgeAction(Request $request, $petId)
{
// Figure out what data format to return to the client
$produces = ['text/plain'];
// Figure out what the client accepts
$clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*';
$responseFormat = $this->getOutputFormat($clientAccepts, $produces);
if ($responseFormat === null) {
return new Response('', 406);
}

// Handle authentication

// Read out all input parameter values into variables

// Use the default value if no value was provided

// Deserialize the input values that needs it
try {
$petId = $this->deserialize($petId, 'int', 'string');
} catch (SerializerRuntimeException $exception) {
return $this->createBadRequestResponse($exception->getMessage());
}

// Validate the input values
$asserts = [];
$asserts[] = new Assert\NotNull();
$asserts[] = new Assert\Type("int");
$response = $this->validate($petId, $asserts);
if ($response instanceof Response) {
return $response;
}


try {
$handler = $this->getApiHandler();


// Make the call to the business logic
$responseCode = 200;
$responseHeaders = [];

$result = $handler->petAge($petId, $responseCode, $responseHeaders);

$message = match($responseCode) {
200 => 'successful operation',
default => '',
};

return new Response(
$result !== null ?$this->serialize($result, $responseFormat):'',
$responseCode,
array_merge(
$responseHeaders,
[
'Content-Type' => $responseFormat,
'X-OpenAPI-Message' => $message
]
)
);
} catch (\Throwable $fallthrough) {
return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough));
}
}

/**
* Operation petAvailableForSale
*
* Whether the pet can currently be bought
*
* @param Request $request The Symfony request to handle.
* @return Response The Symfony response.
*/
public function petAvailableForSaleAction(Request $request, $petId)
{
// Figure out what data format to return to the client
$produces = ['text/plain'];
// Figure out what the client accepts
$clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*';
$responseFormat = $this->getOutputFormat($clientAccepts, $produces);
if ($responseFormat === null) {
return new Response('', 406);
}

// Handle authentication

// Read out all input parameter values into variables

// Use the default value if no value was provided

// Deserialize the input values that needs it
try {
$petId = $this->deserialize($petId, 'int', 'string');
} catch (SerializerRuntimeException $exception) {
return $this->createBadRequestResponse($exception->getMessage());
}

// Validate the input values
$asserts = [];
$asserts[] = new Assert\NotNull();
$asserts[] = new Assert\Type("int");
$response = $this->validate($petId, $asserts);
if ($response instanceof Response) {
return $response;
}


try {
$handler = $this->getApiHandler();


// Make the call to the business logic
$responseCode = 200;
$responseHeaders = [];

$result = $handler->petAvailableForSale($petId, $responseCode, $responseHeaders);

$message = match($responseCode) {
200 => 'successful operation',
default => '',
};

return new Response(
$result !== null ?$this->serialize($result, $responseFormat):'',
$responseCode,
array_merge(
$responseHeaders,
[
'Content-Type' => $responseFormat,
'X-OpenAPI-Message' => $message
]
)
);
} catch (\Throwable $fallthrough) {
return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough));
}
}

/**
* Operation updatePet
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,12 @@ Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*PetApiInterface* | [**addPet**](docs/Api/PetApiInterface.md#addpet) | **POST** /pet | Add a new pet to the store
*PetApiInterface* | [**deletePet**](docs/Api/PetApiInterface.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApiInterface* | [**downloadFile**](docs/Api/PetApiInterface.md#downloadfile) | **GET** /pet/{petId}/downloadImage | downloads an image
*PetApiInterface* | [**findPetsByStatus**](docs/Api/PetApiInterface.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
*PetApiInterface* | [**findPetsByTags**](docs/Api/PetApiInterface.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApiInterface* | [**getPetById**](docs/Api/PetApiInterface.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
*PetApiInterface* | [**petAge**](docs/Api/PetApiInterface.md#petage) | **GET** /pet/{petId}/age | Get the age of the pet
*PetApiInterface* | [**petAvailableForSale**](docs/Api/PetApiInterface.md#petavailableforsale) | **GET** /pet/{petId}/available-for-sale | Whether the pet can currently be bought
*PetApiInterface* | [**updatePet**](docs/Api/PetApiInterface.md#updatepet) | **PUT** /pet | Update an existing pet
*PetApiInterface* | [**updatePetWithForm**](docs/Api/PetApiInterface.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApiInterface* | [**uploadFile**](docs/Api/PetApiInterface.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
Expand Down
Loading
Loading