Skip to content

Commit

Permalink
Merge pull request #149 from Catrobat/create-pull-request/patch-17248…
Browse files Browse the repository at this point in the history
…62425

Bump autogenerated OpenAPI code
  • Loading branch information
dmetzner authored Aug 28, 2024
2 parents 5c9db2f + bcfa03f commit b3a7212
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 14 deletions.
12 changes: 6 additions & 6 deletions Api/StudioApiInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@ public function setBearerAuth(?string $value): void;
* @param string $id (required)
* @param string $accept_language (optional, default to 'en')
* @param string|null $name The name of the studio (optional)
* @param string $description A small description about the Studio (optional, default to '')
* @param string|null $description A small description about the Studio (optional)
* @param bool $is_public This flag sets the studios' visibility to public or private (optional, default to true)
* @param bool $enable_comments This flag enables or disabled the possibility to add comments to the studio (optional, default to true)
* @param UploadedFile|null $image_file (optional)
* @param UploadedFile|null $image_file Cover image; Size limit 1MB; Supported extensions are jpeg, png, webp; (optional)
* @param int &$responseCode The HTTP Response Code
* @param array $responseHeaders Additional HTTP headers to return with the response ()
*/
public function studioIdPut(
string $id,
string $accept_language,
?string $name,
string $description,
?string $description,
bool $is_public,
bool $enable_comments,
?UploadedFile $image_file,
Expand All @@ -83,17 +83,17 @@ public function studioIdPut(
*
* @param string $accept_language (optional, default to 'en')
* @param string|null $name The name of the studio (optional)
* @param string $description A small description about the Studio (optional, default to '')
* @param string|null $description A small description about the Studio (optional)
* @param bool $is_public This flag sets the studios' visibility to public or private (optional, default to true)
* @param bool $enable_comments This flag enables or disabled the possibility to add comments to the studio (optional, default to true)
* @param UploadedFile|null $image_file (optional)
* @param UploadedFile|null $image_file Cover image; Size limit 1MB; Supported extensions are jpeg, png, webp; (optional)
* @param int &$responseCode The HTTP Response Code
* @param array $responseHeaders Additional HTTP headers to return with the response ()
*/
public function studioPost(
string $accept_language,
?string $name,
string $description,
?string $description,
bool $is_public,
bool $enable_comments,
?UploadedFile $image_file,
Expand Down
28 changes: 26 additions & 2 deletions Controller/StudioController.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function studioIdPutAction(Request $request, $id)
// Read out all input parameter values into variables
$accept_language = $request->headers->get('Accept-Language', 'en');
$name = $request->request->get('name');
$description = $request->request->get('description', '');
$description = $request->request->get('description');
$is_public = $request->request->get('is_public', true);
$enable_comments = $request->request->get('enable_comments', true);
$image_file = $request->files->get('image_file');
Expand Down Expand Up @@ -110,12 +110,24 @@ public function studioIdPutAction(Request $request, $id)
}
$asserts = [];
$asserts[] = new Assert\Type('string');
$asserts[] = new Assert\Length([
'max' => 180,
]);
$asserts[] = new Assert\Length([
'min' => 3,
]);
$response = $this->validate($name, $asserts);
if ($response instanceof Response) {
return $response;
}
$asserts = [];
$asserts[] = new Assert\Type('string');
$asserts[] = new Assert\Length([
'max' => 3000,
]);
$asserts[] = new Assert\Length([
'min' => 1,
]);
$response = $this->validate($description, $asserts);
if ($response instanceof Response) {
return $response;
Expand Down Expand Up @@ -204,7 +216,7 @@ public function studioPostAction(Request $request)
// Read out all input parameter values into variables
$accept_language = $request->headers->get('Accept-Language', 'en');
$name = $request->request->get('name');
$description = $request->request->get('description', '');
$description = $request->request->get('description');
$is_public = $request->request->get('is_public', true);
$enable_comments = $request->request->get('enable_comments', true);
$image_file = $request->files->get('image_file');
Expand All @@ -231,12 +243,24 @@ public function studioPostAction(Request $request)
}
$asserts = [];
$asserts[] = new Assert\Type('string');
$asserts[] = new Assert\Length([
'max' => 180,
]);
$asserts[] = new Assert\Length([
'min' => 3,
]);
$response = $this->validate($name, $asserts);
if ($response instanceof Response) {
return $response;
}
$asserts = [];
$asserts[] = new Assert\Type('string');
$asserts[] = new Assert\Length([
'max' => 3000,
]);
$asserts[] = new Assert\Length([
'min' => 1,
]);
$response = $this->validate($description, $asserts);
if ($response instanceof Response) {
return $response;
Expand Down
32 changes: 32 additions & 0 deletions Model/CreateStudioErrorResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ class CreateStudioErrorResponse
*/
protected ?string $description = null;

/**
* @SerializedName("image_file")
*
* @Assert\Choice({ "Image size too large", "Image type not supported", "Image invalid" })
*
* @Assert\Type("string")
*
* @Type("string")
*/
protected ?string $image_file = null;

/**
* Constructor.
*
Expand All @@ -72,6 +83,7 @@ public function __construct(?array $data = null)
if (is_array($data)) {
$this->name = array_key_exists('name', $data) ? $data['name'] : $this->name;
$this->description = array_key_exists('description', $data) ? $data['description'] : $this->description;
$this->image_file = array_key_exists('image_file', $data) ? $data['image_file'] : $this->image_file;
}
}

Expand Down Expand Up @@ -114,4 +126,24 @@ public function setDescription(?string $description = null): self

return $this;
}

/**
* Gets image_file.
*/
public function getImageFile(): ?string
{
return $this->image_file;
}

/**
* Sets image_file.
*
* @return $this
*/
public function setImageFile(?string $image_file = null): self
{
$this->image_file = $image_file;

return $this;
}
}
12 changes: 12 additions & 0 deletions Tests/Model/CreateStudioErrorResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,16 @@ public function testPropertyDescription(): void
{
$this->markTestSkipped('Test for property description not implemented');
}

/**
* Test attribute "image_file".
*
* @group unit
*
* @small
*/
public function testPropertyImageFile(): void
{
$this->markTestSkipped('Test for property image_file not implemented');
}
}
12 changes: 6 additions & 6 deletions docs/Api/StudioApiInterface.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class StudioApi implements StudioApiInterface
/**
* Implementation of StudioApiInterface#studioIdPut
*/
public function studioIdPut(string $id, string $accept_language, ?string $name, string $description, bool $is_public, bool $enable_comments, ?UploadedFile $image_file, int &$responseCode, array &$responseHeaders): array|object|null
public function studioIdPut(string $id, string $accept_language, ?string $name, ?string $description, bool $is_public, bool $enable_comments, ?UploadedFile $image_file, int &$responseCode, array &$responseHeaders): array|object|null
{
// Implement the operation ...
}
Expand All @@ -57,10 +57,10 @@ Name | Type | Description | Notes
**id** | **string**| |
**accept_language** | **string**| | [optional] [default to 'en']
**name** | **string**| The name of the studio | [optional]
**description** | **string**| A small description about the Studio | [optional] [default to '']
**description** | **string**| A small description about the Studio | [optional]
**is_public** | **bool**| This flag sets the studios' visibility to public or private | [optional] [default to true]
**enable_comments** | **bool**| This flag enables or disabled the possibility to add comments to the studio | [optional] [default to true]
**image_file** | **UploadedFile****UploadedFile**| | [optional]
**image_file** | **UploadedFile****UploadedFile**| Cover image; Size limit 1MB; Supported extensions are jpeg, png, webp; | [optional]

### Return type

Expand Down Expand Up @@ -99,7 +99,7 @@ class StudioApi implements StudioApiInterface
/**
* Implementation of StudioApiInterface#studioPost
*/
public function studioPost(string $accept_language, ?string $name, string $description, bool $is_public, bool $enable_comments, ?UploadedFile $image_file, int &$responseCode, array &$responseHeaders): array|object|null
public function studioPost(string $accept_language, ?string $name, ?string $description, bool $is_public, bool $enable_comments, ?UploadedFile $image_file, int &$responseCode, array &$responseHeaders): array|object|null
{
// Implement the operation ...
}
Expand All @@ -114,10 +114,10 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**accept_language** | **string**| | [optional] [default to 'en']
**name** | **string**| The name of the studio | [optional]
**description** | **string**| A small description about the Studio | [optional] [default to '']
**description** | **string**| A small description about the Studio | [optional]
**is_public** | **bool**| This flag sets the studios' visibility to public or private | [optional] [default to true]
**enable_comments** | **bool**| This flag enables or disabled the possibility to add comments to the studio | [optional] [default to true]
**image_file** | **UploadedFile****UploadedFile**| | [optional]
**image_file** | **UploadedFile****UploadedFile**| Cover image; Size limit 1MB; Supported extensions are jpeg, png, webp; | [optional]

### Return type

Expand Down
1 change: 1 addition & 0 deletions docs/Model/CreateStudioErrorResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **string** | | [optional]
**description** | **string** | | [optional]
**image_file** | **string** | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down

0 comments on commit b3a7212

Please sign in to comment.