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 2
2
use ApiClients \Client \Github \AsyncClient ;
3
3
use ApiClients \Client \Github \Resource \Async \Repository ;
4
4
use ApiClients \Client \Github \Resource \Async \User ;
5
+ use ApiClients \Client \Github \Resource \Repository \Commit ;
5
6
use function ApiClients \Foundation \resource_pretty_print ;
6
7
use React \EventLoop \Factory ;
7
8
17
18
return $ user ->repository ($ argv [2 ] ?? 'github ' );
18
19
})->then (function (Repository $ repository ) {
19
20
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
+ });
22
25
}, 'display_throwable ' );
23
26
})->done (null , 'display_throwable ' );
24
27
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 14
14
15
15
/**
16
16
* @Collection(
17
- * parents="Tree"
17
+ * parents="Tree",
18
+ * files="Repository\Commit\File"
18
19
* )
19
20
* @Nested(
20
21
* commit="Git\Commit",
@@ -60,6 +61,11 @@ abstract class Commit extends AbstractResource implements CommitInterface
60
61
*/
61
62
protected $ parents ;
62
63
64
+ /**
65
+ * @var Commit\File[]
66
+ */
67
+ protected $ files ;
68
+
63
69
/**
64
70
* @return string
65
71
*/
@@ -115,4 +121,12 @@ public function parents(): array
115
121
{
116
122
return $ this ->parents ;
117
123
}
124
+
125
+ /**
126
+ * @return Commit\File[]
127
+ */
128
+ public function files (): array
129
+ {
130
+ return $ this ->files ;
131
+ }
118
132
}
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 2
2
3
3
namespace ApiClients \Client \Github \Resource \Repository ;
4
4
5
- use ApiClients \Client \Github \Resource \Git \CommitInterface as GitCommitInterface ;
6
- use ApiClients \Client \Github \Resource \TreeInterface ;
7
- use ApiClients \Client \Github \Resource \UserInterface ;
8
5
use ApiClients \Foundation \Resource \EmptyResourceInterface ;
9
6
10
7
abstract class EmptyCommit implements CommitInterface, EmptyResourceInterface
@@ -34,33 +31,41 @@ public function htmlUrl(): string
34
31
}
35
32
36
33
/**
37
- * @return GitCommitInterface
34
+ * @return Git\Commit
38
35
*/
39
- public function commit (): GitCommitInterface
36
+ public function commit (): Git \ Commit
40
37
{
41
38
return null ;
42
39
}
43
40
44
41
/**
45
- * @return UserInterface
42
+ * @return User
46
43
*/
47
- public function author (): UserInterface
44
+ public function author (): User
48
45
{
49
46
return null ;
50
47
}
51
48
52
49
/**
53
- * @return UserInterface
50
+ * @return User
54
51
*/
55
- public function comitter (): UserInterface
52
+ public function comitter (): User
56
53
{
57
54
return null ;
58
55
}
59
56
60
57
/**
61
- * @return TreeInterface
58
+ * @return Tree
62
59
*/
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
64
69
{
65
70
return null ;
66
71
}
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