Skip to content

Commit db27d6b

Browse files
authored
SDK-2206 Add method to request client session completed notification (#311)
1 parent c467f46 commit db27d6b

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/DocScan/Session/Create/NotificationConfigBuilder.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class NotificationConfigBuilder
1212
private const TASK_COMPLETION = 'TASK_COMPLETION';
1313
private const CHECK_COMPLETION = 'CHECK_COMPLETION';
1414
private const SESSION_COMPLETION = 'SESSION_COMPLETION';
15+
private const CLIENT_SESSION_TOKEN_DELETED = 'CLIENT_SESSION_TOKEN_DELETED';
1516

1617
/**
1718
* @var string
@@ -113,6 +114,14 @@ public function forSessionCompletion(): self
113114
return $this->withTopic(self::SESSION_COMPLETION);
114115
}
115116

117+
/**
118+
* @return $this
119+
*/
120+
public function forClientSessionCompletion(): self
121+
{
122+
return $this->withTopic(self::CLIENT_SESSION_TOKEN_DELETED);
123+
}
124+
116125
/**
117126
* @return NotificationConfig
118127
*/

tests/DocScan/Session/Create/NotificationConfigBuilderTest.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,28 @@ public function shouldUseCorrectValueForSessionCompletion(): void
103103
$this->assertContains('SESSION_COMPLETION', $result->getTopics());
104104
}
105105

106+
/**
107+
* @test
108+
* @covers ::forClientSessionCompletion
109+
*/
110+
public function shouldUseCorrectValueForClientSessionCompletion(): void
111+
{
112+
$result = (new NotificationConfigBuilder())
113+
->withAuthToken(self::SOME_AUTH_TOKEN)
114+
->withEndpoint(self::SOME_ENDPOINT)
115+
->forClientSessionCompletion()
116+
->build();
117+
118+
$this->assertContains('CLIENT_SESSION_TOKEN_DELETED', $result->getTopics());
119+
}
120+
106121
/**
107122
* @test
108123
* @covers ::forResourceUpdate
109124
* @covers ::forTaskCompletion
110125
* @covers ::forCheckCompletion
111126
* @covers ::forSessionCompletion
127+
* @covers ::forClientSessionCompletion
112128
* @covers ::withTopic
113129
*/
114130
public function shouldAllowAllNotificationTypes(): void
@@ -120,13 +136,15 @@ public function shouldAllowAllNotificationTypes(): void
120136
->forTaskCompletion()
121137
->forCheckCompletion()
122138
->forSessionCompletion()
139+
->forClientSessionCompletion()
123140
->build();
124141

125-
$this->assertCount(4, $result->getTopics());
142+
$this->assertCount(5, $result->getTopics());
126143
$this->assertContains('RESOURCE_UPDATE', $result->getTopics());
127144
$this->assertContains('TASK_COMPLETION', $result->getTopics());
128145
$this->assertContains('CHECK_COMPLETION', $result->getTopics());
129146
$this->assertContains('SESSION_COMPLETION', $result->getTopics());
147+
$this->assertContains('CLIENT_SESSION_TOKEN_DELETED', $result->getTopics());
130148
}
131149

132150
/**

0 commit comments

Comments
 (0)