File tree Expand file tree Collapse file tree 16 files changed +424
-14
lines changed Expand file tree Collapse file tree 16 files changed +424
-14
lines changed Original file line number Diff line number Diff line change 22use ApiClients \Client \Github \AsyncClient ;
33use ApiClients \Client \Github \Resource \Async \Repository ;
44use ApiClients \Client \Github \Resource \Async \User ;
5+ use ApiClients \Client \Github \Resource \Repository \Commit ;
56use function ApiClients \Foundation \resource_pretty_print ;
67use React \EventLoop \Factory ;
78
1718 return $ user ->repository ($ argv [2 ] ?? 'github ' );
1819})->then (function (Repository $ repository ) {
1920 resource_pretty_print ($ repository , 1 , true );
20- $ repository ->commits ()->subscribe (function ($ commit ) {
21- resource_pretty_print ($ commit , 2 , true );
21+ $ repository ->commits ()->take (1 )->subscribe (function (Repository \Commit $ commit ) {
22+ $ commit ->refresh ()->then (function (Commit $ commit ) {
23+ resource_pretty_print ($ commit , 2 , true );
24+ });
2225 }, 'display_throwable ' );
2326})->done (null , 'display_throwable ' );
2427
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace ApiClients \Client \Github \Resource \Async \Repository \Commit ;
4+
5+ use ApiClients \Client \Github \Resource \Repository \Commit \EmptyFile as BaseEmptyFile ;
6+
7+ class EmptyFile extends BaseEmptyFile
8+ {
9+ }
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace ApiClients \Client \Github \Resource \Async \Repository \Commit ;
4+
5+ use ApiClients \Client \Github \Resource \Repository \Commit \File as BaseFile ;
6+
7+ class File extends BaseFile
8+ {
9+ public function refresh (): File
10+ {
11+ throw new \Exception ('TODO: create refresh method! ' );
12+ }
13+ }
Original file line number Diff line number Diff line change 1414
1515/**
1616 * @Collection(
17- * parents="Tree"
17+ * parents="Tree",
18+ * files="Repository\Commit\File"
1819 * )
1920 * @Nested(
2021 * commit="Git\Commit",
@@ -60,6 +61,11 @@ abstract class Commit extends AbstractResource implements CommitInterface
6061 */
6162 protected $ parents ;
6263
64+ /**
65+ * @var Commit\File[]
66+ */
67+ protected $ files ;
68+
6369 /**
6470 * @return string
6571 */
@@ -115,4 +121,12 @@ public function parents(): array
115121 {
116122 return $ this ->parents ;
117123 }
124+
125+ /**
126+ * @return Commit\File[]
127+ */
128+ public function files (): array
129+ {
130+ return $ this ->files ;
131+ }
118132}
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace ApiClients \Client \Github \Resource \Repository \Commit ;
4+
5+ use ApiClients \Foundation \Resource \EmptyResourceInterface ;
6+
7+ abstract class EmptyFile implements FileInterface, EmptyResourceInterface
8+ {
9+ /**
10+ * @return string
11+ */
12+ public function filename (): string
13+ {
14+ return null ;
15+ }
16+
17+ /**
18+ * @return int
19+ */
20+ public function additions (): int
21+ {
22+ return null ;
23+ }
24+
25+ /**
26+ * @return int
27+ */
28+ public function deletions (): int
29+ {
30+ return null ;
31+ }
32+
33+ /**
34+ * @return int
35+ */
36+ public function changes (): int
37+ {
38+ return null ;
39+ }
40+
41+ /**
42+ * @return string
43+ */
44+ public function status (): string
45+ {
46+ return null ;
47+ }
48+
49+ /**
50+ * @return string
51+ */
52+ public function rawUrl (): string
53+ {
54+ return null ;
55+ }
56+
57+ /**
58+ * @return string
59+ */
60+ public function blobUrl (): string
61+ {
62+ return null ;
63+ }
64+
65+ /**
66+ * @return string
67+ */
68+ public function patch (): string
69+ {
70+ return null ;
71+ }
72+ }
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace ApiClients \Client \Github \Resource \Repository \Commit ;
4+
5+ use ApiClients \Foundation \Hydrator \Annotation \EmptyResource ;
6+ use ApiClients \Foundation \Resource \AbstractResource ;
7+
8+ /**
9+ * @EmptyResource("Repository\Commit\EmptyFile")
10+ */
11+ abstract class File extends AbstractResource implements FileInterface
12+ {
13+ /**
14+ * @var string
15+ */
16+ protected $ filename ;
17+
18+ /**
19+ * @var int
20+ */
21+ protected $ additions ;
22+
23+ /**
24+ * @var int
25+ */
26+ protected $ deletions ;
27+
28+ /**
29+ * @var int
30+ */
31+ protected $ changes ;
32+
33+ /**
34+ * @var string
35+ */
36+ protected $ status ;
37+
38+ /**
39+ * @var string
40+ */
41+ protected $ raw_url ;
42+
43+ /**
44+ * @var string
45+ */
46+ protected $ blob_url ;
47+
48+ /**
49+ * @var string
50+ */
51+ protected $ patch ;
52+
53+ /**
54+ * @return string
55+ */
56+ public function filename (): string
57+ {
58+ return $ this ->filename ;
59+ }
60+
61+ /**
62+ * @return int
63+ */
64+ public function additions (): int
65+ {
66+ return $ this ->additions ;
67+ }
68+
69+ /**
70+ * @return int
71+ */
72+ public function deletions (): int
73+ {
74+ return $ this ->deletions ;
75+ }
76+
77+ /**
78+ * @return int
79+ */
80+ public function changes (): int
81+ {
82+ return $ this ->changes ;
83+ }
84+
85+ /**
86+ * @return string
87+ */
88+ public function status (): string
89+ {
90+ return $ this ->status ;
91+ }
92+
93+ /**
94+ * @return string
95+ */
96+ public function rawUrl (): string
97+ {
98+ return $ this ->raw_url ;
99+ }
100+
101+ /**
102+ * @return string
103+ */
104+ public function blobUrl (): string
105+ {
106+ return $ this ->blob_url ;
107+ }
108+
109+ /**
110+ * @return string
111+ */
112+ public function patch (): string
113+ {
114+ return $ this ->patch ;
115+ }
116+ }
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace ApiClients \Client \Github \Resource \Repository \Commit ;
4+
5+ use ApiClients \Foundation \Resource \ResourceInterface ;
6+
7+ interface FileInterface extends ResourceInterface
8+ {
9+ const HYDRATE_CLASS = 'Repository \\Commit \\File ' ;
10+
11+ /**
12+ * @return string
13+ */
14+ public function filename (): string ;
15+
16+ /**
17+ * @return int
18+ */
19+ public function additions (): int ;
20+
21+ /**
22+ * @return int
23+ */
24+ public function deletions (): int ;
25+
26+ /**
27+ * @return int
28+ */
29+ public function changes (): int ;
30+
31+ /**
32+ * @return string
33+ */
34+ public function status (): string ;
35+
36+ /**
37+ * @return string
38+ */
39+ public function rawUrl (): string ;
40+
41+ /**
42+ * @return string
43+ */
44+ public function blobUrl (): string ;
45+
46+ /**
47+ * @return string
48+ */
49+ public function patch (): string ;
50+ }
Original file line number Diff line number Diff line change 22
33namespace ApiClients \Client \Github \Resource \Repository ;
44
5- use ApiClients \Client \Github \Resource \Git \CommitInterface as GitCommitInterface ;
6- use ApiClients \Client \Github \Resource \TreeInterface ;
7- use ApiClients \Client \Github \Resource \UserInterface ;
85use ApiClients \Foundation \Resource \EmptyResourceInterface ;
96
107abstract class EmptyCommit implements CommitInterface, EmptyResourceInterface
@@ -34,33 +31,41 @@ public function htmlUrl(): string
3431 }
3532
3633 /**
37- * @return GitCommitInterface
34+ * @return Git\Commit
3835 */
39- public function commit (): GitCommitInterface
36+ public function commit (): Git \ Commit
4037 {
4138 return null ;
4239 }
4340
4441 /**
45- * @return UserInterface
42+ * @return User
4643 */
47- public function author (): UserInterface
44+ public function author (): User
4845 {
4946 return null ;
5047 }
5148
5249 /**
53- * @return UserInterface
50+ * @return User
5451 */
55- public function comitter (): UserInterface
52+ public function comitter (): User
5653 {
5754 return null ;
5855 }
5956
6057 /**
61- * @return TreeInterface
58+ * @return Tree
6259 */
63- public function parents (): TreeInterface
60+ public function parents (): Tree
61+ {
62+ return null ;
63+ }
64+
65+ /**
66+ * @return Repository\Commit\File
67+ */
68+ public function files (): Repository \Commit \File
6469 {
6570 return null ;
6671 }
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace ApiClients \Client \Github \Resource \Sync \Repository \Commit ;
4+
5+ use ApiClients \Client \Github \Resource \Repository \Commit \EmptyFile as BaseEmptyFile ;
6+
7+ class EmptyFile extends BaseEmptyFile
8+ {
9+ }
You can’t perform that action at this time.
0 commit comments