Skip to content

Commit

Permalink
feat: update API endpoint and add projectEnvironment field
Browse files Browse the repository at this point in the history
- Changed the file upload endpoint from '/internal-v2/conversations/' to '/v2/conversations/'.
- Added a new optional field 'projectEnvironment' to the AppInstallationInternal schema, including its getter and methods for setting/removing it.
  • Loading branch information
mittwald-machine committed Sep 10, 2024
1 parent 24c1aa4 commit 3395659
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function buildUrl(): string
{
$mapped = $this->toJson();
$conversationId = urlencode($mapped['conversationId']);
return '/internal-v2/conversations/' . $conversationId . '/files';
return '/v2/conversations/' . $conversationId . '/files';
}

/**
Expand Down
40 changes: 40 additions & 0 deletions src/Generated/V2/Schemas/App/AppInstallationInternal.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ class AppInstallationInternal
],
'type' => 'array',
],
'projectEnvironment' => [
'type' => 'string',
],
'projectId' => [
'format' => 'uuid',
'type' => 'string',
Expand Down Expand Up @@ -137,6 +140,8 @@ class AppInstallationInternal
*/
private ?array $processes = null;

private ?string $projectEnvironment = null;

private ?string $projectId = null;

private ?string $screenshotId = null;
Expand Down Expand Up @@ -223,6 +228,11 @@ public function getProcesses(): ?array
return $this->processes ?? null;
}

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

public function getProjectId(): ?string
{
return $this->projectId ?? null;
Expand Down Expand Up @@ -425,6 +435,28 @@ public function withoutProcesses(): self
return $clone;
}

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

$clone = clone $this;
$clone->projectEnvironment = $projectEnvironment;

return $clone;
}

public function withoutProjectEnvironment(): self
{
$clone = clone $this;
unset($clone->projectEnvironment);

return $clone;
}

public function withProjectId(string $projectId): self
{
$validator = new Validator();
Expand Down Expand Up @@ -599,6 +631,10 @@ public static function buildFromInput(array|object $input, bool $validate = true
if (isset($input->{'processes'})) {
$processes = $input->{'processes'};
}
$projectEnvironment = null;
if (isset($input->{'projectEnvironment'})) {
$projectEnvironment = $input->{'projectEnvironment'};
}
$projectId = null;
if (isset($input->{'projectId'})) {
$projectId = $input->{'projectId'};
Expand Down Expand Up @@ -631,6 +667,7 @@ public static function buildFromInput(array|object $input, bool $validate = true
$obj->linkedDatabases = $linkedDatabases;
$obj->processRunningSince = $processRunningSince;
$obj->processes = $processes;
$obj->projectEnvironment = $projectEnvironment;
$obj->projectId = $projectId;
$obj->screenshotId = $screenshotId;
$obj->screenshotRef = $screenshotRef;
Expand Down Expand Up @@ -666,6 +703,9 @@ public function toJson(): array
if (isset($this->processes)) {
$output['processes'] = $this->processes;
}
if (isset($this->projectEnvironment)) {
$output['projectEnvironment'] = $this->projectEnvironment;
}
if (isset($this->projectId)) {
$output['projectId'] = $this->projectId;
}
Expand Down

0 comments on commit 3395659

Please sign in to comment.