Skip to content

Commit 33affb8

Browse files
authored
Merge pull request #8 from keboola/odin-PS-2489-b
feat: add unique id
2 parents eba156e + aee80fc commit 33affb8

4 files changed

Lines changed: 33 additions & 0 deletions

File tree

src/Requests/PostEvent/JobData.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,9 @@ public function jsonSerialize()
6767
}
6868
return $result;
6969
}
70+
71+
public function getJobId(): string
72+
{
73+
return $this->jobId;
74+
}
7075
}

src/Requests/PostEvent/JobProcessingLongEventData.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function jsonSerialize(): array
4242
'id' => $this->projectId,
4343
'name' => $this->projectName,
4444
],
45+
'uniqueId' => $this->jobData->getJobId(),
4546
];
4647
}
4748

tests/EventsClientFunctionalTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Keboola\NotificationClient\Requests\Event;
1010
use Keboola\NotificationClient\Requests\PostEvent\JobData;
1111
use Keboola\NotificationClient\Requests\PostEvent\JobFailedEventData;
12+
use Keboola\NotificationClient\Requests\PostEvent\JobProcessingLongEventData;
1213
use PHPUnit\Framework\TestCase;
1314

1415
class EventsClientFunctionalTest extends TestCase
@@ -43,4 +44,29 @@ public function testPostEvent(): void
4344
));
4445
self::assertTrue(true);
4546
}
47+
48+
public function testPostEventUniqueId(): void
49+
{
50+
$client = $this->getClient();
51+
$client->postEvent(new Event(
52+
new JobProcessingLongEventData(
53+
'1234',
54+
'My project',
55+
12.5,
56+
102.2,
57+
120,
58+
new JobData(
59+
'23456',
60+
'http://someUrl',
61+
new DateTimeImmutable('2020-01-01T11:11:00+00:00'),
62+
null,
63+
'keboola.orchestrator',
64+
'Orchestrator',
65+
'my-configuration',
66+
'My configuration'
67+
)
68+
)
69+
));
70+
self::assertTrue(true);
71+
}
4672
}

tests/Requests/PostEvent/JobProcessingLongEventDataTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public function testJsonSerialize(): void
4949
'id' => '1234',
5050
'name' => 'My project',
5151
],
52+
'uniqueId' => '23456',
5253
],
5354
$failedEventData->jsonSerialize()
5455
);

0 commit comments

Comments
 (0)