-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 fix(TextToSpeechController.php): fix incorrect parameter name in in…
…dex method ✨ feat(TextToSpeechController.php): add support for retrieving ATIS audio file by ID and ICAO code in index method 🔧 chore(TextToSpeechController.php): refactor generate method to use request parameters instead of method parameters 🔧 chore(TextToSpeechController.php): refactor delete method to remove unused parameter ✨ feat(GetTextToSpeechParameters.php): add GetTextToSpeechParameters class to handle query parameters for retrieving ATIS audio file ✨ feat(GetTextToSpeechRequestBody.php): add GetTextToSpeechRequestBody class to handle request body for retrieving ATIS audio file ✨ feat(ErrorGetTextToSpeechResponse.php): add ErrorGetTextToSpeechResponse class to handle error response for retrieving ATIS audio file ✨ feat(SuccessResponse.php): add SuccessResponse class to handle success response for retrieving ATIS audio file 🐛 fix(redbeard.js): add missing semicolons to improve code readability and prevent potential issues ✨ feat(redbeard.js): refactor API routes to use a prefix for better organization and readability ✨ feat(redbeard.js): add support for generating ATIS audio file using Text-to-Speech (TTS) functionality ✨ feat(redbeard.js): add support for deleting ATIS audio file generated using TTS functionality
- Loading branch information
Vahn Gomes
authored and
Vahn Gomes
committed
Jul 21, 2023
1 parent
e33b5ce
commit d31c99a
Showing
7 changed files
with
264 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace App\OpenApi\Parameters; | ||
|
||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Parameter; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Schema; | ||
use Vyuldashev\LaravelOpenApi\Factories\ParametersFactory; | ||
|
||
class GetTextToSpeechParameters extends ParametersFactory | ||
{ | ||
/** | ||
* @return Parameter[] | ||
*/ | ||
public function build(): array | ||
{ | ||
return [ | ||
|
||
Parameter::query() | ||
->name('icao') | ||
->description('ICAO code of the airport') | ||
->required(true) | ||
->schema(Schema::string()) | ||
->example('KJAX'), | ||
Parameter::query() | ||
->name('id') | ||
->description('ID of the ATIS audio file') | ||
->required(true) | ||
->schema(Schema::string()) | ||
->example('1'), | ||
|
||
]; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/app/OpenApi/RequestBodies/TTS/GetTextToSpeechRequestBody.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace App\OpenApi\RequestBodies\TTS; | ||
|
||
use GoldSpecDigital\ObjectOrientedOAS\Objects\MediaType; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\RequestBody; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Schema; | ||
use Vyuldashev\LaravelOpenApi\Factories\RequestBodyFactory; | ||
|
||
class GetTextToSpeechRequestBody extends RequestBodyFactory | ||
{ | ||
public function build(): RequestBody | ||
{ | ||
$response = Schema::object()->properties( | ||
Schema::string('id') | ||
->example('1') | ||
->description('The ID of the ATIS audio file.') | ||
->required(), | ||
Schema::string('icao') | ||
->example('KJAX') | ||
->description('The ICAO code of the airport.') | ||
->required(), | ||
); | ||
|
||
return RequestBody::create('GetTextToSpeech') | ||
->description('Get TTS file for an airport.') | ||
->content( | ||
MediaType::json()->schema($response) | ||
); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/app/OpenApi/Responses/TTS/GetTextToSpeech/ErrorGetTextToSpeechResponse.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\OpenApi\Responses\TTS\GetTextToSpeech; | ||
|
||
use GoldSpecDigital\ObjectOrientedOAS\Objects\MediaType; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Response; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Schema; | ||
use Vyuldashev\LaravelOpenApi\Factories\ResponseFactory; | ||
use Vyuldashev\LaravelOpenApi\Contracts\Reusable; | ||
|
||
class ErrorGetTextToSpeechResponse extends ResponseFactory implements Reusable | ||
{ | ||
public function build(): Response | ||
{ | ||
$response = Schema::object()->properties( | ||
Schema::string('status')->example('error'), | ||
Schema::string('message')->example('ATIS audio file not found.'), | ||
Schema::integer('code')->example(404), | ||
Schema::object('data')->nullable() | ||
); | ||
|
||
return Response::create('TTSError', 'Error getting TTS file.') | ||
->description('Error getting TTS file.') | ||
->content(MediaType::json()->schema($response)); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/app/OpenApi/Responses/TTS/GetTextToSpeech/SuccessResponse.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace App\OpenApi\Responses\TTS\GetTextToSpeech; | ||
|
||
use GoldSpecDigital\ObjectOrientedOAS\Objects\MediaType; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Response; | ||
use GoldSpecDigital\ObjectOrientedOAS\Objects\Schema; | ||
use Vyuldashev\LaravelOpenApi\Factories\ResponseFactory; | ||
use Vyuldashev\LaravelOpenApi\Contracts\Reusable; | ||
|
||
class SuccessResponse extends ResponseFactory implements Reusable | ||
{ | ||
public function build(): Response | ||
{ | ||
$response = Schema::object()->properties( | ||
Schema::string('status')->example('success'), | ||
Schema::string('message')->example('ATIS audio file found.'), | ||
Schema::integer('code')->example(200), | ||
Schema::object('data')->properties( | ||
Schema::string('id')->example('1'), | ||
Schema::string('name')->example('KJAX_ATIS_A_261700Z.mp3'), | ||
Schema::string('url')->example('/storage/atis/1/KJAX_ATIS_A_261700Z.mp3'), | ||
Schema::string('expires_at')->example('2021-01-01 00:00:00'), | ||
) | ||
); | ||
|
||
return Response::create('GetTextToSpeechSuccess') | ||
->description('Get TTS file for an airport.') | ||
->content( | ||
MediaType::json()->schema($response) | ||
); | ||
} | ||
} |
Oops, something went wrong.