Skip to content

Commit

Permalink
feat: add logo reference ID to Marketplace Extension schema
Browse files Browse the repository at this point in the history
- Introduced `logoRefId` property to the Extension class with corresponding validation and serialization methods.
- Updated the class constructor and data mapping to include `logoRefId`.
- Added `getLogoRefId`, `withLogoRefId`, and `withoutLogoRefId` methods for managing the logo reference ID.
  • Loading branch information
mittwald-machine committed Nov 20, 2024
1 parent 6774178 commit 7afa5fe
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/Generated/V2/Schemas/Marketplace/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ class Extension
'format' => 'uuid',
'type' => 'string',
],
'logoRefId' => [
'description' => 'This is the FileId of the Logo. Retrieve the file with this id on `/v2/files/{logoRefId}`.',
'format' => 'uuid',
'type' => 'string',
],
'name' => [
'type' => 'string',
],
Expand Down Expand Up @@ -156,6 +161,11 @@ class Extension

private string $id;

/**
* This is the FileId of the Logo. Retrieve the file with this id on `/v2/files/{logoRefId}`.
*/
private ?string $logoRefId = null;

private string $name;

/**
Expand Down Expand Up @@ -266,6 +276,11 @@ public function getId(): string
return $this->id;
}

public function getLogoRefId(): ?string
{
return $this->logoRefId ?? null;
}

public function getName(): string
{
return $this->name;
Expand Down Expand Up @@ -462,6 +477,28 @@ public function withId(string $id): self
return $clone;
}

public function withLogoRefId(string $logoRefId): self
{
$validator = new Validator();
$validator->validate($logoRefId, static::$schema['properties']['logoRefId']);
if (!$validator->isValid()) {
throw new InvalidArgumentException($validator->getErrors()[0]['message']);
}

$clone = clone $this;
$clone->logoRefId = $logoRefId;

return $clone;
}

public function withoutLogoRefId(): self
{
$clone = clone $this;
unset($clone->logoRefId);

return $clone;
}

public function withName(string $name): self
{
$validator = new Validator();
Expand Down Expand Up @@ -580,6 +617,10 @@ public static function buildFromInput(array|object $input, bool $validate = true
$frontendFragments = (array)$input->{'frontendFragments'};
}
$id = $input->{'id'};
$logoRefId = null;
if (isset($input->{'logoRefId'})) {
$logoRefId = $input->{'logoRefId'};
}
$name = $input->{'name'};
$published = (bool)($input->{'published'});
$scopes = $input->{'scopes'};
Expand All @@ -592,6 +633,7 @@ public static function buildFromInput(array|object $input, bool $validate = true
$obj->detailedDescriptions = $detailedDescriptions;
$obj->frontendComponents = $frontendComponents;
$obj->frontendFragments = $frontendFragments;
$obj->logoRefId = $logoRefId;
return $obj;
}

Expand Down Expand Up @@ -621,6 +663,9 @@ public function toJson(): array
$output['frontendFragments'] = $this->frontendFragments;
}
$output['id'] = $this->id;
if (isset($this->logoRefId)) {
$output['logoRefId'] = $this->logoRefId;
}
$output['name'] = $this->name;
$output['published'] = $this->published;
$output['scopes'] = $this->scopes;
Expand Down

0 comments on commit 7afa5fe

Please sign in to comment.