Skip to content

Commit

Permalink
🐛 bug fixes and support for single result
Browse files Browse the repository at this point in the history
  • Loading branch information
acidjazz committed Feb 4, 2023
1 parent e4ff1a6 commit 76978b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Actions/GenerateCliOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ public function __invoke(Collection $models, bool $global = false): string
$plural = Str::plural($name);
$entry .= "{$this->indent}export type $plural = {$name}[]\n";
$entry .= "{$this->indent}export interface {$name}Results extends api.MetApiResults { data: $plural }\n";
$entry .= "{$this->indent}export interface {$name}Result extends api.MetApiResults { data: $name }\n";
$entry .= "{$this->indent}export interface {$name}MetApiData extends api.MetApiData { data: $name }\n";
$entry .= "{$this->indent}export interface {$name}Response extends MetApiResponse { data: {$name}MetApiData }\n\n";
$entry .= "{$this->indent}export interface {$name}Response extends api.MetApiResponse { data: {$name}MetApiData }\n\n";

$this->output .= $entry;
});
Expand Down
3 changes: 2 additions & 1 deletion src/ModelInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,9 @@ private function getCode(TypescriptInterface $interface): string
$plural = Str::plural($interface->name);
$code .= "{$this->space}export type $plural = {$interface->name}[]\n";
$code .= "{$this->space}export interface {$interface->name}Results extends api.MetApiResults { data: $plural }\n";
$code .= "{$this->space}export interface {$interface->name}Result extends api.MetApiResults { data: {$interface->name} }\n";
$code .= "{$this->space}export interface {$interface->name}MetApiData extends api.MetApiData { data: {$interface->name} }\n";
$code .= "{$this->space}export interface {$interface->name}Response extends MetApiResponse { data: {$interface->name}MetApiData }\n\n";
$code .= "{$this->space}export interface {$interface->name}Response extends api.MetApiResponse { data: {$interface->name}MetApiData }\n\n";

return $code;
}
Expand Down

0 comments on commit 76978b6

Please sign in to comment.