8000 Openapi based client proof of concept by WyriHaximus · Pull Request #78 · php-api-clients/github · GitHub
[go: up one dir, main page]

Skip to content

Openapi based client proof of concept #78

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

Open
wants to merge 108 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
a7a879e
Openapi based client proof of concept
WyriHaximus Apr 28, 2021
799858f
Drop dependancies for now
WyriHaximus Apr 30, 2021
6fe9bde
Ignore some things
WyriHaximus May 1, 2021
8c0ad54
Add all avialable API version
WyriHaximus May 1, 2021
21f3fb9
Prefix versions with v
WyriHaximus May 1, 2021
ca0fb8a
Add mocked webhooks (It's crappy but it's a start)
WyriHaximus May 1, 2021
481f1bb
Adding type hinting to arrays
WyriHaximus May 3, 2021
d6f1a75
Typed properties :D
WyriHaximus May 3, 2021
43a122b
Nullable all the thigns!
WyriHaximus May 3, 2021
5cb409f
Simplefied webhooks for now
WyriHaximus May 3, 2021
a18a296
Gah
WyriHaximus May 3, 2021
1c5439f
wafefaeafew
WyriHaximus May 3, 2021
bf7c125
asdfads
WyriHaximus May 3, 2021
42d5d22
Deal with weird property naming
WyriHaximus May 3, 2021
06d504d
Plus and minus signs...
WyriHaximus May 3, 2021
38599e4
Dashes in class names
WyriHaximus May 3, 2021
2c8476c
Annotations!
WyriHaximus May 8, 2021
ea235f7
object => array
WyriHaximus May 9, 2021
2434152
GHES 3.1
WyriHaximus May 27, 2021
2333e9a
Drop double \ in some namespaces
WyriHaximus May 27, 2021
a2d23ed
Add "official" webhooks
WyriHaximus May 29, 2021
bbfa1f0
Applied code style rules
WyriHaximus May 29, 2021
2f6ce40
Update QA config
WyriHaximus May 29, 2021
4de94b6
Better object detection
WyriHaximus May 29, 2021
18efccd
Added nested schema objects
WyriHaximus May 29, 2021
ec9e725
Several improvements
WyriHaximus May 29, 2021
e930c5e
No nullables
WyriHaximus May 29, 2021
ee08ad3
Correctly set no default value for non-array objects
WyriHaximus May 29, 2021
4b1632a
Fixed certain annotations and dropped GHE as a test
WyriHaximus May 30, 2021
08ab22d
Fixes! And dropped code style for now because it seem to have some we…
WyriHaximus May 30, 2021
de9805e
Keeping it slim for now
WyriHaximus May 30, 2021
f267946
Handle null values better
WyriHaximus Jun 6, 2021
429fbb1
Better webhooks support
WyriHaximus Jun 8, 2021
fba8b3e
Keeping it slim for now
WyriHaximus Jun 8, 2021
3539ea9
Webhook Interface
WyriHaximus Jun 9, 2021
1486257
Ensure we have the webhook interface as return types for from WebHook…
WyriHaximus Jun 9, 2021
7e01de2
updated dependencies
WyriHaximus Jun 12, 2021
d50cfb6
Limited allOf support
WyriHaximus Jun 13, 2021
e5d0760
Temporary new CS rules applied until the fixes stop breaking the code
WyriHaximus Jun 13, 2021
f01aca7
Some fixes
WyriHaximus Jun 13, 2021
f1414c7
Testing something
WyriHaximus Jun 13, 2021
e55ee42
Nope
WyriHaximus Jun 13, 2021
d574f3e
Debug
WyriHaximus Jun 13, 2021
bdb5d82
Trying something else
WyriHaximus Jun 13, 2021
4e089d1
Another thing
WyriHaximus Jun 13, 2021
565756e
Undid debug changes
WyriHaximus Jun 13, 2021
0dc825e
Fix schema references
WyriHaximus Jun 13, 2021
0bd8bc5
Testing something
WyriHaximus Jun 13, 2021
d68b87e
Nullable
WyriHaximus Jun 13, 2021
c440f03
More improvements!
WyriHaximus Jun 14, 2021
25499e9
Merge remote-tracking branch 'origin/openapi-based-client-proof-of-co…
WyriHaximus Jun 14, 2021
f161e69
Phew
WyriHaximus Jun 14, 2021
56b24dd
Improvements!
WyriHaximus Jun 14, 2021
ead61d3
Support nullable flag
WyriHaximus Jun 14, 2021
258c31a
Make merged nullable for now by hand due to schema inaccuracy
WyriHaximus Jun 27, 2021
0f991df
Make mergeable_state nullable for now by hand due to schame inacuracy
WyriHaximus Jun 27, 2021
7c7b907
Updated generated code
WyriHaximus Jul 18, 2021
7cb11e7
TEst
WyriHaximus Jul 18, 2021
cbd9fd4
test
WyriHaximus Jul 18, 2021
e5d61fa
Node code
WyriHaximus Jul 18, 2021
9943d57
Test
WyriHaximus Jul 18, 2021
6483228
Test
WyriHaximus Jul 18, 2021
74fb551
Test
WyriHaximus Jul 18, 2021
327ff34
Ugh
WyriHaximus Jul 22, 2021
0ae4ff2
Oops
WyriHaximus Jul 22, 2021
27af82c
Grrr
WyriHaximus Jul 22, 2021
89a859f
Improved webhook handling
WyriHaximus Aug 7, 2021
d9ce079
Added missing single use webhooks
WyriHaximus Aug 8, 2021
cb586ea
Unlock PHP 8
WyriHaximus Sep 11, 2021
a0f652f
Update dependencies
WyriHaximus Sep 11, 2021
3aa1741
New WebHooks schema from cebe/openapi
WyriHaximus Feb 7, 2022
50a4696
Abd composer.json changes
WyriHaximus Feb 7, 2022
81acb34
MVP support for oneOf schema's
WyriHaximus Feb 10, 2022
60b206e
Translate number to int
WyriHaximus Feb 10, 2022
0f2934b
WebHooks have names again :tada: !
WyriHaximus Feb 10, 2022
43ac5de
Ship new client wiring update
WyriHaximus Jun 3, 2022
da6c01f
Removed trailing ? from URL's without a query
WyriHaximus Jun 4, 2022
e8455ea
Update to new webvsocket including OpenAPI spec
WyriHaximus Dec 11, 2022
0682150
Update to latest generated client bringing all schemas and making req…
WyriHaximus Dec 24, 2022
eb292aa
More predictable naming
WyriHaximus Jan 4, 2023
56cd733
Drop CHE and CHAE and in time put them in their own packages
WyriHaximus Jan 4, 2023
cd49a14
Added nested unknown schemas
WyriHaximus Jan 4, 2023
3f3c394
Better nullable types
WyriHaximus Jan 4, 2023
d05bed8
Better naming conventions
WyriHaximus Jan 4, 2023
358343c
Make the browser required
WyriHaximus Jan 5, 2023
54030ef
Add authentication
WyriHaximus Jan 5, 2023
fb03405
Better naming for all classes
WyriHaximus Jan 6, 2023
8000 3a4d5dd
Several upgrades
WyriHaximus Jan 12, 2023
2a35781
Handle empry response bodies a little bit better
WyriHaximus Jan 13, 2023
fc29f2f
Reserved keywords fix
WyriHaximus Jan 17, 2023
588c6d2
Fix webhook key issues
WyriHaximus Jan 17, 2023
ccd87dd
Use eventsauce/object-hydrator for object hydration
WyriHaximus Jan 29, 2023
bd9d138
Hydrate WebHooks
WyriHaximus Jan 30, 2023
fb7bf78
Small fixes
WyriHaximus Jan 30, 2023
6aee035
Add ClientIntface
WyriHaximus Jan 30, 2023
6829fe2
Fibers
WyriHaximus Feb 1, 2023
8d0b426
PHPStan understands these return conditionals
WyriHaximus Feb 2, 2023
479aa3c
Hydrator templates
WyriHaximus Feb 3, 2023
5929af2
Hydrator rename so it's easier to used externally
WyriHaximus Feb 3, 2023
ddfd693
Hydrator template fixes
WyriHaximus Feb 4, 2023
93352c3
Re-fixed nested schemas
WyriHaximus Feb 5, 2023
bf29b8b
Correct constructor types
WyriHaximus Feb 5, 2023
abd4b48
Add example values to schema
WyriHaximus Feb 6, 2023
b1f9b51
Next gen generated client
WyriHaximus Feb 18, 2023
ca00ff0
Getting there :D!
WyriHaximus Feb 22, 2023
23cff8d
Contracts
WyriHaximus Feb 22, 2023
d1dc962
Getting there
WyriHaximus Feb 23, 2023
9451e3e
Hydrator shizzle
WyriHaximus Feb 25, 2023
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
  •  
  •  
  •  
Prev Previous commit
Next Next commit
More predictable naming
  • Loading branch information
WyriHaximus committed Jan 4, 2023
commit eb292aa9d81e57eaceb1110062fe85c70a710c3d
218 changes: 109 additions & 109 deletions composer.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/OpenAPI/ApiGitHubCom/Schema/ActionsBillingUsage.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ final class ActionsBillingUsage
*/
private int $included_minutes;
/**
* @\WyriHaximus\Hydrator\Attribute\Hydrate(\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\Unknown\C585073601042Bb09034Df0Cfd5E1D9A6::class)
* @\WyriHaximus\Hydrator\Attribute\Hydrate(\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\ActionsBillingUsage\MinutesUsedBreakdown::class)
*/
private \ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\Unknown\C585073601042Bb09034Df0Cfd5E1D9A6 $minutes_used_breakdown;
private \ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\ActionsBillingUsage\MinutesUsedBreakdown $minutes_used_breakdown;
/**
* The sum of the free and paid GitHub Actions minutes used.
*/
Expand All @@ -44,7 +44,7 @@ public function included_minutes() : int
{
return $this->included_minutes;
}
public function minutes_used_breakdown() : \ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\Unknown\C585073601042Bb09034Df0Cfd5E1D9A6
public function minutes_used_breakdown() : \ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\ActionsBillingUsage\MinutesUsedBreakdown
{
return $this->minutes_used_breakdown;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
<?php

namespace ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\ActionsBillingUsage;

final class MinutesUsedBreakdown
{
public const SCHEMA_JSON = '{"type":"object","properties":{"UBUNTU":{"type":"integer","description":"Total minutes used on Ubuntu runner machines."},"MACOS":{"type":"integer","description":"Total minutes used on macOS runner machines."},"WINDOWS":{"type":"integer","description":"Total minutes used on Windows runner machines."},"ubuntu_4_core":{"type":"integer","description":"Total minutes used on Ubuntu 4 core runner machines."},"ubuntu_8_core":{"type":"integer","description":"Total minutes used on Ubuntu 8 core runner machines."},"ubuntu_16_core":{"type":"integer","description":"Total minutes used on Ubuntu 16 core runner machines."},"ubuntu_32_core":{"type":"integer","description":"Total minutes used on Ubuntu 32 core runner machines."},"ubuntu_64_core":{"type":"integer","description":"Total minutes used on Ubuntu 64 core runner machines."},"windows_4_core":{"type":"integer","description":"Total minutes used on Windows 4 core runner machines."},"windows_8_core":{"type":"integer","description":"Total minutes used on Windows 8 core runner machines."},"windows_16_core":{"type":"integer","description":"Total minutes used on Windows 16 core runner machines."},"windows_32_core":{"type":"integer","description":"Total minutes used on Windows 32 core runner machines."},"windows_64_core":{"type":"integer","description":"Total minutes used on Windows 64 core runner machines."},"macos_12_core":{"type":"integer","description":"Total minutes used on macOS 12 core runner machines."},"total":{"type":"integer","description":"Total minutes used on all runner machines."}}}';
public const SCHEMA_TITLE = 'ActionsBillingUsage\\MinutesUsedBreakdown';
public const SCHEMA_DESCRIPTION = '';
/**
* Total minutes used on Ubuntu runner machines.
*/
private int $UBUNTU;
/**
* Total minutes used on macOS runner machines.
*/
private int $MACOS;
/**
* Total minutes used on Windows runner machines.
*/
private int $WINDOWS;
/**
* Total minutes used on Ubuntu 4 core runner machines.
*/
private int $ubuntu_4_core;
/**
* Total minutes used on Ubuntu 8 core runner machines.
*/
private int $ubuntu_8_core;
/**
* Total minutes used on Ubuntu 16 core runner machines.
*/
private int $ubuntu_16_core;
/**
* Total minutes used on Ubuntu 32 core runner machines.
*/
private int $ubuntu_32_core;
/**
* Total minutes used on Ubuntu 64 core runner machines.
ED4F */
private int $ubuntu_64_core;
/**
* Total minutes used on Windows 4 core runner machines.
*/
private int $windows_4_core;
/**
* Total minutes used on Windows 8 core runner machines.
*/
private int $windows_8_core;
/**
* Total minutes used on Windows 16 core runner machines.
*/
private int $windows_16_core;
/**
* Total minutes used on Windows 32 core runner machines.
*/
private int $windows_32_core;
/**
* Total minutes used on Windows 64 core runner machines.
*/
private int $windows_64_core;
/**
* Total minutes used on macOS 12 core runner machines.
*/
private int $macos_12_core;
/**
* Total minutes used on all runner machines.
*/
private int $total;
/**
* Total minutes used on Ubuntu runner machines.
*/
public function UBUNTU() : int
{
return $this->UBUNTU;
}
/**
* Total minutes used on macOS runner machines.
*/
public function MACOS() : int
{
return $this->MACOS;
}
/**
* Total minutes used on Windows runner machines.
*/
public function WINDOWS() : int
{
return $this->WINDOWS;
}
/**
* Total minutes used on Ubuntu 4 core runner machines.
*/
public function ubuntu_4_core() : int
{
return $this->ubuntu_4_core;
}
/**
* Total minutes used on Ubuntu 8 core runner machines.
*/
public function ubuntu_8_core() : int
{
return $this->ubuntu_8_core;
}
/**
* Total minutes used on Ubuntu 16 core runner machines.
*/
public function ubuntu_16_core() : int
{
return $this->ubuntu_16_core;
}
/**
* Total minutes used on Ubuntu 32 core runner machines.
*/
public function ubuntu_32_core() : int
{
return $this->ubuntu_32_core;
}
/**
* Total minutes used on Ubuntu 64 core runner machines.
*/
public function ubuntu_64_core() : int
{
return $this->ubuntu_64_core;
}
/**
* Total minutes used on Windows 4 core runner machines.
*/
public function windows_4_core() : int
{
return $this->windows_4_core;
}
/**
* Total minutes used on Windows 8 core runner machines.
*/
public function windows_8_core() : int
{
return $this->windows_8_core;
}
/**
* Total minutes used on Windows 16 core runner machines.
*/
public function windows_16_core() : int
{
return $this->windows_16_core;
}
/**
* Total minutes used on Windows 32 core runner machines.
*/
public function windows_32_core() : int
{
return $this->windows_32_core;
}
/**
* Total minutes used on Windows 64 core runner machines.
*/
public function windows_64_core() : int
{
return $this->windows_64_core;
}
/**
* Total minutes used on macOS 12 core runner machines.
*/
public function macos_12_core() : int
{
return $this->macos_12_core;
}
/**
* Total minutes used on all runner machines.
*/
public function total() : int
{
return $this->total;
}
}
6 changes: 3 additions & 3 deletions src/OpenAPI/ApiGitHubCom/Schema/ActionsCacheList.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ final class ActionsCacheList
private int $total_count;
/**
* Array of caches
* @var array<\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\Unknown\C480B5Bdc17827754C1Cd26D66Aed1426>
* @\WyriHaximus\Hydrator\Attribute\HydrateArray(\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\Unknown\C480B5Bdc17827754C1Cd26D66Aed1426::class)
* @var array<\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\ActionsCacheList\ActionsCaches>
* @\WyriHaximus\Hydrator\Attribute\HydrateArray(\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\ActionsCacheList\ActionsCaches::class)
*/
private array $actions_caches = array();
/**
Expand All @@ -26,7 +26,7 @@ public function total_count() : int
}
/**
* Array of caches
* @return array<\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\Unknown\C480B5Bdc17827754C1Cd26D66Aed1426>
* @return array<\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\ActionsCacheList\ActionsCaches>
*/
public function actions_caches() : array
{
Expand Down
45 changes: 45 additions & 0 deletions src/OpenAPI/ApiGitHubCom/Schema/ActionsCacheList/ActionsCaches.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\ActionsCacheList;

final class ActionsCaches
{
public const SCHEMA_JSON = '{"type":"object","properties":{"id":{"type":"integer","examples":[2]},"ref":{"type":"string","examples":["refs\\/heads\\/main"]},"key":{"type":"string","examples":["Linux-node-958aff96db2d75d67787d1e634ae70b659de937b"]},"version":{"type":"string","examples":["73885106f58cc52a7df9ec4d4a5622a5614813162cb516c759a30af6bf56e6f0"]},"last_accessed_at":{"type":"string","format":"date-time","examples":["2019-01-24T22:45:36.000Z"]},"created_at":{"type":"string","format":"date-time","examples":["2019-01-24T22:45:36.000Z"]},"size_in_bytes":{"type":"integer","examples":[1024]}}}';
public const SCHEMA_TITLE = 'ActionsCacheList\\ActionsCaches';
public const SCHEMA_DESCRIPTION = '';
private int $id;
private string $ref;
private string $key;
private string $version;
private string $last_accessed_at;
private string $created_at;
private int $size_in_bytes;
public function id() : int
{
return $this->id;
}
public function ref() : string
{
return $this->ref;
}
public function key() : string
{
return $this->key;
}
public function version() : string
{
return $this->version;
}
public function last_accessed_at() : string
{
return $this->last_accessed_at;
}
public function created_at() : string
{
return $this->created_at;
}
public function size_in_bytes() : int
{
return $this->size_in_bytes;
}
}
12 changes: 6 additions & 6 deletions src/OpenAPI/ApiGitHubCom/Schema/AddedToProjectIssueEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ final class AddedToProjectIssueEvent
private $commit_url;
private string $created_at;
/**
* @\WyriHaximus\Hydrator\Attribute\Hydrate(\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\Unknown\C4D5B98B02A5Afea165Db4Daaee5D7217::class)
* @\WyriHaximus\Hydrator\Attribute\Hydrate(\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\AddedToProjectIssueEvent\PerformedViaGithubApp::class)
*/
private \ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\Unknown\C4D5B98B02A5Afea165Db4Daaee5D7217 $performed_via_github_app;
private \ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\AddedToProjectIssueEvent\PerformedViaGithubApp $performed_via_github_app;
/**
* @\WyriHaximus\Hydrator\Attribute\Hydrate(\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\Unknown\C209D04E127A5F89885Df3848973B280A::class)
* @\WyriHaximus\Hydrator\Attribute\Hydrate(\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\AddedToProjectIssueEvent\ProjectCard::class)
*/
private ?\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\Unknown\C209D04E127A5F89885Df3848973B280A $project_card = null;
private ?\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\AddedToProjectIssueEvent\ProjectCard $project_card = null;
public function id() : int
{
return $this->id;
Expand Down Expand Up @@ -62,11 +62,11 @@ public function created_at() : string
{
return $this->created_at;
}
public function performed_via_github_app() : \ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\Unknown\C4D5B98B02A5Afea165Db4Daaee5D7217
public function performed_via_github_app() : \ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\AddedToProjectIssueEvent\PerformedViaGithubApp
{
return $this->performed_via_github_app;
}
public function project_card() : ?\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\Unknown\C209D04E127A5F89885Df3848973B280A
public function project_card() : ?\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\AddedToProjectIssueEvent\ProjectCard
{
return $this->project_card;
}
Expand Down
D893
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\AddedToProjectIssueEvent;

final class PerformedViaGithubApp
{
public const SCHEMA_JSON = '{"type":"null"}';
public const SCHEMA_TITLE = 'AddedToProjectIssueEvent\\PerformedViaGithubApp';
public const SCHEMA_DESCRIPTION = '';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\AddedToProjectIssueEvent;

final class ProjectCard
{
public const SCHEMA_JSON = '{"required":["id","url","project_id","project_url","column_name"],"type":"object","properties":{"id":{"type":"integer"},"url":{"type":"string","format":"uri"},"project_id":{"type":"integer"},"project_url":{"type":"string","format":"uri"},"column_name":{"type":"string"},"previous_column_name":{"type":"string"}}}';
public const SCHEMA_TITLE = 'AddedToProjectIssueEvent\\ProjectCard';
public const SCHEMA_DESCRIPTION = '';
private int $id;
private string $url;
private int $project_id;
private string $project_url;
private string $column_name;
private ?string $previous_column_name = null;
public function id() : int
{
return $this->id;
}
public function url() : string
{
return $this->url;
}
public function project_id() : int
{
return $this->project_id;
}
public function project_url() : string
{
return $this->project_url;
}
public function column_name() : string
{
return $this->column_name;
}
public function previous_column_name() : ?string
{
return $this->previous_column_name;
}
}
Loading
0