Skip to content

Commit d525ef7

Browse files
authored
Merge pull request #916 from php-api-clients/GitHubEnterpriseCloud/from-1.1.4-2bcd6ecb48b7f1793882aa1e317a8385-from-1.1.4-2bcd6ecb48b7f1793882aa1e317a8385
2 parents 720439a + 5d491e3 commit d525ef7

File tree

17 files changed

+254
-61
lines changed

17 files changed

+254
-61
lines changed

clients/GitHubEnterpriseCloud/README.md

+20
Original file line numberDiff line numberDiff line change
@@ -3426,6 +3426,26 @@ $client->operations()->activity()->getThread( thread_id: 9,
34263426
You can find more about this operation over at the [API method documentation](https://docs.github.com/enterprise-cloud@latest//rest/activity/notifications#get-a-thread).
34273427

34283428

3429+
### activity/mark-thread-as-done
3430+
3431+
Mark a thread as done
3432+
3433+
Using the `call` method:
3434+
```php
3435+
$client->call('DELETE /notifications/threads/{thread_id}', [
3436+
'thread_id' => 9,
3437+
]);
3438+
```
3439+
3440+
Operations method:
3441+
```php
3442+
$client->operations()->activity()->markThreadAsDone( thread_id: 9,
3443+
);
3444+
```
3445+
3446+
You can find more about this operation over at the [API method documentation](https://docs.github.com/enterprise-cloud@latest//rest/activity/notifications#mark-a-thread-as-done).
3447+
3448+
34293449
### activity/mark-thread-as-read
34303450

34313451
Mark a thread as read

clients/GitHubEnterpriseCloud/etc/openapi-client-generator.state

+21-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"specHash": "a7294f495113d13ce3b2a7e9be36e697",
2+
"specHash": "2bcd6ecb48b7f1793882aa1e317a8385",
33
"generatedFiles": {
44
"files": [
55
{
@@ -6132,7 +6132,7 @@
61326132
},
61336133
{
61346134
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/Activity.php",
6135-
"hash": "f7b7752f8a6dd4fe52fe373831c6f574"
6135+
"hash": "67ae324c1b0a9b9a53c7a798e19d8083"
61366136
},
61376137
{
61386138
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/Gists.php",
@@ -6188,7 +6188,7 @@
61886188
},
61896189
{
61906190
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/Repos.php",
6191-
"hash": "ac07f486d557f81cb0de2dae502de11c"
6191+
"hash": "113462ef4644855d5b0c1d767ef311c6"
61926192
},
61936193
{
61946194
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Operation\/Reactions.php",
@@ -24356,11 +24356,11 @@
2435624356
},
2435724357
{
2435824358
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operation\/Repos\/GetRelease.php",
24359-
"hash": "38ec6b535c1f101e8f21fcd1c8dfe12e"
24359+
"hash": "852dce3f1eb41717ece8158b1fb2b527"
2436024360
},
2436124361
{
2436224362
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Repos\/GetRelease.php",
24363-
"hash": "5f76bdde9bd1fbf99c6dbb1f49f9be6e"
24363+
"hash": "46fb9403c3b3d75b2de1bf9c3a360cb1"
2436424364
},
2436524365
{
2436624366
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Internal\/Operation\/Repos\/GetReleaseTest.php",
@@ -28052,7 +28052,7 @@
2805228052
},
2805328053
{
2805428054
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Repos.php",
28055-
"hash": "438197c7cbd889ea1790eac0fb3849bd"
28055+
"hash": "1260d8e4ea22f725b2e5b1139fec4525"
2805628056
},
2805728057
{
2805828058
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Users.php",
@@ -28444,7 +28444,7 @@
2844428444
},
2844528445
{
2844628446
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Delete\/Activity.php",
28447-
"hash": "c54c2f2f86ec4053b1cd6f52c1c0be3d"
28447+
"hash": "02b923866acfede5b136837373c9df91"
2844828448
},
2844928449
{
2845028450
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Delete\/Orgs.php",
@@ -28608,7 +28608,7 @@
2860828608
},
2860928609
{
2861028610
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Six.php",
28611-
"hash": "0c73fff643784943f9f446280775e530"
28611+
"hash": "ebcafe32fac32fdb6ca404177432cf9d"
2861228612
},
2861328613
{
2861428614
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Get\/Seven.php",
@@ -28732,7 +28732,7 @@
2873228732
},
2873328733
{
2873428734
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Delete\/Four.php",
28735-
"hash": "e5b830d6f53c19b244739007e5695f59"
28735+
"hash": "ff2f3a765ba13405e97dc0eaa717d622"
2873628736
},
2873728737
{
2873828738
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Router\/Delete\/Five.php",
@@ -28808,11 +28808,11 @@
2880828808
},
2880928809
{
2881028810
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Routers.php",
28811-
"hash": "aed3bb397669291356e1f71e66eec7b6"
28811+
"hash": "929339a64131a8384c2edcda6d7b1d7c"
2881228812
},
2881328813
{
2881428814
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operators.php",
28815-
"hash": "587a45e0bdff3d53e6096df8d38cca78"
28815+
"hash": "2837135815266356f6f97ee7f6d27404"
2881628816
},
2881728817
{
2881828818
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Hydrator\/Operation\/Root.php",
@@ -31896,11 +31896,11 @@
3189631896
},
3189731897
{
3189831898
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/PHPStan\/ClientCallReturnTypes.php",
31899-
"hash": "8cae8d928e7411880994cba41859f17d"
31899+
"hash": "ed4a169d7256b38ab60124abcd55e2cf"
3190031900
},
3190131901
{
3190231902
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/tests\/\/Types\/ClientCallReturnTypes.php",
31903-
"hash": "e8dc3343ecf5f1ddc83e45708318f490"
31903+
"hash": "452debe8db02e63ae3f2df6a8aec901c"
3190431904
},
3190531905
{
3190631906
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/..\/etc\/phpstan-extension.neon",
@@ -32761,6 +32761,14 @@
3276132761
{
3276232762
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Schema\/AliasAbstract\/Tiet1558BE01\/Tiet18FBFF80\/Tiet13044ADE\/TietAA645731.php",
3276332763
"hash": "96cca06410a34549f8e60a16849ab87d"
32764+
},
32765+
{
32766+
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operation\/Activity\/MarkThreadAsDone.php",
32767+
"hash": "37730b6dac8dcf28830f72d42f36531d"
32768+
},
32769+
{
32770+
"name": ".\/clients\/GitHubEnterpriseCloud\/etc\/..\/\/src\/\/Internal\/Operator\/Activity\/MarkThreadAsDone.php",
32771+
"hash": "781634f13ed18d7c6e5b495c6e627a80"
3276432772
}
3276532773
]
3276632774
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ApiClients\Client\GitHubEnterpriseCloud\Internal\Operation\Activity;
6+
7+
use ApiClients\Tools\OpenApiClient\Utils\Response\WithoutBody;
8+
use Psr\Http\Message\RequestInterface;
9+
use Psr\Http\Message\ResponseInterface;
10+
use RingCentral\Psr7\Request;
11+
use RuntimeException;
12+
13+
use function str_replace;
14+
15+
final class MarkThreadAsDone
16+
{
17+
public const OPERATION_ID = 'activity/mark-thread-as-done';
18+
public const OPERATION_MATCH = 'DELETE /notifications/threads/{thread_id}';
19+
/**The unique identifier of the notification thread. This corresponds to the value returned in the `id` field when you retrieve notifications (for example with the [`GET /notifications` operation](https://docs.github.com/enterprise-cloud@latest//rest/activity/notifications#list-notifications-for-the-authenticated-user)). **/
20+
private int $threadId;
21+
22+
public function __construct(int $threadId)
23+
{
24+
$this->threadId = $threadId;
25+
}
26+
27+
public function createRequest(): RequestInterface
28+
{
29+
return new Request('DELETE', str_replace(['{thread_id}'], [$this->threadId], '/notifications/threads/{thread_id}'));
30+
}
31+
32+
public function createResponse(ResponseInterface $response): WithoutBody
33+
{
34+
$code = $response->getStatusCode();
35+
switch ($code) {
36+
/**
37+
* No content
38+
**/
39+
case 204:
40+
return new WithoutBody(204, []);
41+
}
42+
43+
throw new RuntimeException('Unable to find matching response code and content type');
44+
}
45+
}

clients/GitHubEnterpriseCloud/src/Internal/Operation/Repos/GetRelease.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function createResponse(ResponseInterface $response): Schema\Release|With
5050
$body = json_decode($response->getBody()->getContents(), true);
5151
switch ($code) {
5252
/**
53-
* **Note:** This returns an `upload_url` key corresponding to the endpoint for uploading release assets. This key is a [hypermedia resource](https://docs.github.com/enterprise-cloud@latest//rest/overview/resources-in-the-rest-api#hypermedia).
53+
* **Note:** This returns an `upload_url` key corresponding to the endpoint for uploading release assets. This key is a hypermedia resource. For more information, see "[Getting started with the REST API](https://docs.github.com/enterprise-cloud@latest//rest/using-the-rest-api/getting-started-with-the-rest-api#hypermedia)."
5454
**/
5555
case 200:
5656
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\Release::SCHEMA_JSON, \cebe\openapi\spec\Schema::class));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ApiClients\Client\GitHubEnterpriseCloud\Internal\Operator\Activity;
6+
7+
use ApiClients\Contracts\HTTP\Headers\AuthenticationInterface;
8+
use ApiClients\Tools\OpenApiClient\Utils\Response\WithoutBody;
9+
use Psr\Http\Message\ResponseInterface;
10+
use React\Http\Browser;
11+
use Rx\Observable;
12+
13+
use function React\Async\await;
14+
use function WyriHaximus\React\awaitObservable;
15+
16+
final readonly class MarkThreadAsDone
17+
{
18+
public const OPERATION_ID = 'activity/mark-thread-as-done';
19+
public const OPERATION_MATCH = 'DELETE /notifications/threads/{thread_id}';
20+
21+
public function __construct(private Browser $browser, private AuthenticationInterface $authentication)
22+
{
23+
}
24+
25+
public function call(int $threadId): WithoutBody
26+
{
27+
$operation = new \ApiClients\Client\GitHubEnterpriseCloud\Internal\Operation\Activity\MarkThreadAsDone($threadId);
28+
$request = $operation->createRequest();
29+
$result = await($this->browser->request($request->getMethod(), (string) $request->getUri(), $request->withHeader('Authorization', $this->authentication->authHeader())->getHeaders(), (string) $request->getBody())->then(static function (ResponseInterface $response) use ($operation): WithoutBody {
30+
return $operation->createResponse($response);
31+
}));
32+
if ($result instanceof Observable) {
33+
$result = awaitObservable($result);
34+
}
35+
36+
return $result;
37+
}
38+
}

clients/GitHubEnterpriseCloud/src/Internal/Operator/Repos/GetRelease.php

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public function __construct(private Browser $browser, private AuthenticationInte
2525
{
2626
}
2727

28-
/** @return */
2928
public function call(string $owner, string $repo, int $releaseId): Release|WithoutBody
3029
{
3130
$operation = new \ApiClients\Client\GitHubEnterpriseCloud\Internal\Operation\Repos\GetRelease($this->responseSchemaValidator, $this->hydrator, $owner, $repo, $releaseId);

clients/GitHubEnterpriseCloud/src/Internal/Operators.php

+10
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ final class Operators
160160
private Internal\Operator\Activity\ListNotificationsForAuthenticatedUserListing|null $activity👷ListNotificationsForAuthenticatedUserListing = null;
161161
private Internal\Operator\Activity\MarkNotificationsAsRead|null $activity👷MarkNotificationsAsRead = null;
162162
private Internal\Operator\Activity\GetThread|null $activity👷GetThread = null;
163+
private Internal\Operator\Activity\MarkThreadAsDone|null $activity👷MarkThreadAsDone = null;
163164
private Internal\Operator\Activity\MarkThreadAsRead|null $activity👷MarkThreadAsRead = null;
164165
private Internal\Operator\Activity\GetThreadSubscriptionForAuthenticatedUser|null $activity👷GetThreadSubscriptionForAuthenticatedUser = null;
165166
private Internal\Operator\Activity\SetThreadSubscription|null $activity👷SetThreadSubscription = null;
@@ -2572,6 +2573,15 @@ public function activity👷GetThread(): Internal\Operator\Activity\GetThread
25722573
return $this->activity👷GetThread;
25732574
}
25742575

2576+
public function activity👷MarkThreadAsDone(): Internal\Operator\Activity\MarkThreadAsDone
2577+
{
2578+
if ($this->activity👷MarkThreadAsDone instanceof Internal\Operator\Activity\MarkThreadAsDone === false) {
2579+
$this->activity👷MarkThreadAsDone = new Internal\Operator\Activity\MarkThreadAsDone($this->browser, $this->authentication);
2580+
}
2581+
2582+
return $this->activity👷MarkThreadAsDone;
2583+
}
2584+
25752585
public function activity👷MarkThreadAsRead(): Internal\Operator\Activity\MarkThreadAsRead
25762586
{
25772587
if ($this->activity👷MarkThreadAsRead instanceof Internal\Operator\Activity\MarkThreadAsRead === false) {

clients/GitHubEnterpriseCloud/src/Internal/Router/Delete/Activity.php

+14
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ public function __construct(private SchemaValidator $requestSchemaValidator, pri
1919
{
2020
}
2121

22+
public function markThreadAsDone(array $params): WithoutBody
23+
{
24+
$arguments = [];
25+
if (array_key_exists('thread_id', $params) === false) {
26+
throw new InvalidArgumentException('Missing mandatory field: thread_id');
27+
}
28+
29+
$arguments['thread_id'] = $params['thread_id'];
30+
unset($params['thread_id']);
31+
$operator = new Internal\Operator\Activity\MarkThreadAsDone($this->browser, $this->authentication);
32+
33+
return $operator->call($arguments['thread_id']);
34+
}
35+
2236
/** @return */
2337
public function deleteThreadSubscription(array $params): WithoutBody
2438
{

clients/GitHubEnterpriseCloud/src/Internal/Router/Delete/Four.php

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public function __construct(private Routers $routers)
1616
{
1717
}
1818

19+
/** @return |\ApiClients\Tools\OpenApiClient\Utils\Response\WithoutBody */
1920
public function call(string $call, array $params, array $pathChunks): WithoutBody|BasicError|Json
2021
{
2122
if ($pathChunks[0] === '') {
@@ -55,6 +56,14 @@ public function call(string $call, array $params, array $pathChunks): WithoutBod
5556
}
5657
}
5758
}
59+
} elseif ($pathChunks[1] === 'notifications') {
60+
if ($pathChunks[2] === 'threads') {
61+
if ($pathChunks[3] === '{thread_id}') {
62+
if ($call === 'DELETE /notifications/threads/{thread_id}') {
63+
return $this->routers->internal🔀Router🔀Delete🔀Activity()->markThreadAsDone($params);
64+
}
65+
}
66+
}
5867
} elseif ($pathChunks[1] === 'orgs') {
5968
if ($pathChunks[2] === '{org}') {
6069
if ($pathChunks[3] === 'announcement') {

clients/GitHubEnterpriseCloud/src/Internal/Router/Get/Repos.php

-1
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,6 @@ public function getLatestRelease(array $params): Release
17301730
return $operator->call($arguments['owner'], $arguments['repo']);
17311731
}
17321732

1733-
/** @return */
17341733
public function getRelease(array $params): Release|WithoutBody
17351734
{
17361735
$arguments = [];

0 commit comments

Comments
 (0)