Skip to content

[GitHubEnterprise-3.3] Update to 1.1.4-1e26e0dd1e96061fd9e8934a7a019705 from 1.1.4-1e26e0dd1e96061fd9e8934a7a019705 #571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4,542 changes: 4,074 additions & 468 deletions clients/GitHubEnterprise-3.3/README.md

Large diffs are not rendered by default.

2,488 changes: 2,094 additions & 394 deletions clients/GitHubEnterprise-3.3/etc/openapi-client-generator.state

Large diffs are not rendered by default.

67 changes: 66 additions & 1 deletion clients/GitHubEnterprise-3.3/src/Client.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion clients/GitHubEnterprise-3.3/src/ClientInterface.php

Large diffs are not rendered by default.

135 changes: 135 additions & 0 deletions clients/GitHubEnterprise-3.3/src/Operation/Activity.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php

declare(strict_types=1);

namespace ApiClients\Client\GitHubEnterprise\Operation\Activity;

use ApiClients\Client\GitHubEnterprise\Hydrator;
use ApiClients\Client\GitHubEnterprise\Schema;
use cebe\openapi\Reader;
use League\OpenAPIValidation\Schema\SchemaValidator;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use RingCentral\Psr7\Request;
use RuntimeException;
use Rx\Observable;
use Rx\Scheduler\ImmediateScheduler;
use Throwable;

use function explode;
use function json_decode;
use function str_replace;

final class ListEventsForAuthenticatedUserListing
{
public const OPERATION_ID = 'activity/list-events-for-authenticated-user';
public const OPERATION_MATCH = 'LIST /users/{username}/events';
private const METHOD = 'GET';
private const PATH = '/users/{username}/events';
/**The handle for the GitHub user account. **/
private string $username;
/**The number of results per page (max 100). **/
private int $perPage;
/**Page number of the results to fetch. **/
private int $page;

public function __construct(private readonly SchemaValidator $responseSchemaValidator, private readonly Hydrator\Operation\Users\Username\Events $hydrator, string $username, int $perPage = 30, int $page = 1)
{
$this->username = $username;
$this->perPage = $perPage;
$this->page = $page;
}

public function createRequest(): RequestInterface
{
return new Request(self::METHOD, str_replace(['{username}', '{per_page}', '{page}'], [$this->username, $this->perPage, $this->page], self::PATH . '?per_page={per_page}&page={page}'));
}

/** @return Observable<Schema\Event> */
public function createResponse(ResponseInterface $response): Observable
{
$code = $response->getStatusCode();
[$contentType] = explode(';', $response->getHeaderLine('Content-Type'));
switch ($contentType) {
case 'application/json':
$body = json_decode($response->getBody()->getContents(), true);
switch ($code) {
/**
* Response
**/
case 200:
return Observable::fromArray($body, new ImmediateScheduler())->map(function (array $body): Schema\Event {
$error = new RuntimeException();
try {
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\Event::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema'));

return $this->hydrator->hydrateObject(Schema\Event::class, $body);
} catch (Throwable $error) {
goto items_application_json_two_hundred_aaaaa;
}

items_application_json_two_hundred_aaaaa:
throw $error;
});
}

break;
}

throw new RuntimeException('Unable to find matching response code and content type');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?php

declare(strict_types=1);

namespace ApiClients\Client\GitHubEnterprise\Operation\Activity;

use ApiClients\Client\GitHubEnterprise\Error as ErrorSchemas;
use ApiClients\Client\GitHubEnterprise\Hydrator;
use ApiClients\Client\GitHubEnterprise\Schema;
use cebe\openapi\Reader;
use League\OpenAPIValidation\Schema\SchemaValidator;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use RingCentral\Psr7\Request;
use RuntimeException;
use Rx\Observable;
use Rx\Scheduler\ImmediateScheduler;
use Throwable;

use function explode;
use function json_decode;
use function str_replace;

final class ListNotificationsForAuthenticatedUserListing
{
public const OPERATION_ID = 'activity/list-notifications-for-authenticated-user';
public const OPERATION_MATCH = 'LIST /notifications';
private const METHOD = 'GET';
private const PATH = '/notifications';
/**Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. **/
private string $since;
/**Only show notifications updated before the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. **/
private string $before;
/**If `true`, show notifications marked as read. **/
private bool $all;
/**If `true`, only shows notifications in which the user is directly participating or mentioned. **/
private bool $participating;
/**Page number of the results to fetch. **/
private int $page;
/**The number of results per page (max 50). **/
private int $perPage;

public function __construct(private readonly SchemaValidator $responseSchemaValidator, private readonly Hydrator\Operation\Notifications $hydrator, string $since, string $before, bool $all = false, bool $participating = false, int $page = 1, int $perPage = 50)
{
$this->since = $since;
$this->before = $before;
$this->all = $all;
$this->participating = $participating;
$this->page = $page;
$this->perPage = $perPage;
}

public function createRequest(): RequestInterface
{
return new Request(self::METHOD, str_replace(['{since}', '{before}', '{all}', '{participating}', '{page}', '{per_page}'], [$this->since, $this->before, $this->all, $this->participating, $this->page, $this->perPage], self::PATH . '?since={since}&before={before}&all={all}&participating={participating}&page={page}&per_page={per_page}'));
}

/** @return Observable<Schema\Thread>|array{code: int} */
public function createResponse(ResponseInterface $response): Observable|array
{
$code = $response->getStatusCode();
[$contentType] = explode(';', $response->getHeaderLine('Content-Type'));
switch ($contentType) {
case 'application/json':
$body = json_decode($response->getBody()->getContents(), true);
switch ($code) {
/**
* Response
**/
case 200:
return Observable::fromArray($body, new ImmediateScheduler())->map(function (array $body): Schema\Thread {
$error = new RuntimeException();
try {
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\Thread::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema'));

return $this->hydrator->hydrateObject(Schema\Thread::class, $body);
} catch (Throwable $error) {
goto items_application_json_two_hundred_aaaaa;
}

items_application_json_two_hundred_aaaaa:
throw $error;
});
/**
* Forbidden
**/

case 403:
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class));

throw new ErrorSchemas\BasicError(403, $this->hydrator->hydrateObject(Schema\BasicError::class, $body));
/**
* Requires authentication
**/

case 401:
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\BasicError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class));

throw new ErrorSchemas\BasicError(401, $this->hydrator->hydrateObject(Schema\BasicError::class, $body));
/**
* Validation failed, or the endpoint has been spammed.
**/

case 422:
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\ValidationError::SCHEMA_JSON, \cebe\openapi\spec\Schema::class));

throw new ErrorSchemas\ValidationError(422, $this->hydrator->hydrateObject(Schema\ValidationError::class, $body));
}

break;
}

switch ($code) {
/**
* Not modified
**/
case 304:
return ['code' => 304];
}

throw new RuntimeException('Unable to find matching response code and content type');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php

declare(strict_types=1);

namespace ApiClients\Client\GitHubEnterprise\Operation\Activity;

use ApiClients\Client\GitHubEnterprise\Hydrator;
use ApiClients\Client\GitHubEnterprise\Schema;
use cebe\openapi\Reader;
use League\OpenAPIValidation\Schema\SchemaValidator;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use RingCentral\Psr7\Request;
use RuntimeException;
use Rx\Observable;
use Rx\Scheduler\ImmediateScheduler;
use Throwable;

use function explode;
use function json_decode;
use function str_replace;

final class ListOrgEventsForAuthenticatedUserListing
{
public const OPERATION_ID = 'activity/list-org-events-for-authenticated-user';
public const OPERATION_MATCH = 'LIST /users/{username}/events/orgs/{org}';
private const METHOD = 'GET';
private const PATH = '/users/{username}/events/orgs/{org}';
/**The handle for the GitHub user account. **/
private string $username;
/**The organization name. The name is not case sensitive. **/
private string $org;
/**The number of results per page (max 100). **/
private int $perPage;
/**Page number of the results to fetch. **/
private int $page;

public function __construct(private readonly SchemaValidator $responseSchemaValidator, private readonly Hydrator\Operation\Users\Username\Events\Orgs\Org $hydrator, string $username, string $org, int $perPage = 30, int $page = 1)
{
$this->username = $username;
$this->org = $org;
$this->perPage = $perPage;
$this->page = $page;
}

public function createRequest(): RequestInterface
{
return new Request(self::METHOD, str_replace(['{username}', '{org}', '{per_page}', '{page}'], [$this->username, $this->org, $this->perPage, $this->page], self::PATH . '?per_page={per_page}&page={page}'));
}

/** @return Observable<Schema\Event> */
public function createResponse(ResponseInterface $response): Observable
{
$code = $response->getStatusCode();
[$contentType] = explode(';', $response->getHeaderLine('Content-Type'));
switch ($contentType) {
case 'application/json':
$body = json_decode($response->getBody()->getContents(), true);
switch ($code) {
/**
* Response
**/
case 200:
return Observable::fromArray($body, new ImmediateScheduler())->map(function (array $body): Schema\Event {
$error = new RuntimeException();
try {
$this->responseSchemaValidator->validate($body, Reader::readFromJson(Schema\Event::SCHEMA_JSON, '\\cebe\\openapi\\spec\\Schema'));

return $this->hydrator->hydrateObject(Schema\Event::class, $body);
} catch (Throwable $error) {
goto items_application_json_two_hundred_aaaaa;
}

items_application_json_two_hundred_aaaaa:
throw $error;
});
}

break;
}

throw new RuntimeException('Unable to find matching response code and content type');
}
}
Loading