Skip to content

Commit fe0e6f2

Browse files
committed
Release asset resource
1 parent c1fe30f commit fe0e6f2

10 files changed

Lines changed: 425 additions & 2 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace ApiClients\Client\Github\Resource\Async\Repository\Release;
4+
5+
use ApiClients\Client\Github\Resource\Repository\Release\Asset as BaseAsset;
6+
7+
class Asset extends BaseAsset
8+
{
9+
public function refresh(): Asset
10+
{
11+
throw new \Exception('TODO: create refresh method!');
12+
}
13+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace ApiClients\Client\Github\Resource\Async\Repository\Release;
4+
5+
use ApiClients\Client\Github\Resource\Repository\Release\EmptyAsset as BaseEmptyAsset;
6+
7+
class EmptyAsset extends BaseEmptyAsset
8+
{
9+
}

‎src/Resource/Repository/Release.php‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
namespace ApiClients\Client\Github\Resource\Repository;
44

5+
use ApiClients\Foundation\Hydrator\Annotation\Collection;
56
use ApiClients\Foundation\Hydrator\Annotation\EmptyResource;
67
use ApiClients\Foundation\Hydrator\Annotation\Nested;
78
use ApiClients\Foundation\Resource\AbstractResource;
89
use DateTimeInterface;
910

1011
/**
12+
* @Collection(
13+
* assets="Repository\Release\Asset"
14+
* )
1115
* @Nested(
1216
* author="User"
1317
* )
@@ -66,7 +70,7 @@ abstract class Release extends AbstractResource implements ReleaseInterface
6670
protected $author;
6771

6872
/**
69-
* @var array
73+
* @var Repository\Release\Asset
7074
*/
7175
protected $assets;
7276

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace ApiClients\Client\Github\Resource\Repository\Release;
4+
5+
use ApiClients\Foundation\Hydrator\Annotation\EmptyResource;
6+
use ApiClients\Foundation\Hydrator\Annotation\Nested;
7+
use ApiClients\Foundation\Resource\AbstractResource;
8+
use DateTimeInterface;
9+
10+
/**
11+
* @Nested(
12+
* uploader="User"
13+
* )
14+
* @EmptyResource("Repository\Release\EmptyAsset")
15+
*/
16+
abstract class Asset extends AbstractResource implements AssetInterface
17+
{
18+
/**
19+
* @var string
20+
*/
21+
protected $url;
22+
23+
/**
24+
* @var string
25+
*/
26+
protected $browser_download_url;
27+
28+
/**
29+
* @var int
30+
*/
31+
protected $id;
32+
33+
/**
34+
* @var string
35+
*/
36+
protected $name;
37+
38+
/**
39+
* @var string
40+
*/
41+
protected $label;
42+
43+
/**
44+
* @var string
45+
*/
46+
protected $state;
47+
48+
/**
49+
* @var string
50+
*/
51+
protected $content_type;
52+
53+
/**
54+
* @var int
55+
*/
56+
protected $size;
57+
58+
/**
59+
* @var int
60+
*/
61+
protected $download_count;
62+
63+
/**
64+
* @var DateTimeInterface
65+
*/
66+
protected $created_at;
67+
68+
/**
69+
* @var DateTimeInterface
70+
*/
71+
protected $updated_at;
72+
73+
/**
74+
* @var User
75+
*/
76+
protected $uploader;
77+
78+
/**
79+
* @return string
80+
*/
81+
public function url(): string
82+
{
83+
return $this->url;
84+
}
85+
86+
/**
87+
* @return string
88+
*/
89+
public function browserDownloadUrl(): string
90+
{
91+
return $this->browser_download_url;
92+
}
93+
94+
/**
95+
* @return int
96+
*/
97+
public function id(): int
98+
{
99+
return $this->id;
100+
}
101+
102+
/**
103+
* @return string
104+
*/
105+
public function name(): string
106+
{
107+
return $this->name;
108+
}
109+
110+
/**
111+
* @return string
112+
*/
113+
public function label(): string
114+
{
115+
return $this->label;
116+
}
117+
118+
/**
119+
* @return string
120+
*/
121+
public function state(): string
122+
{
123+
return $this->state;
124+
}
125+
126+
/**
127+
* @return string
128+
*/
129+
public function contentType(): string
130+
{
131+
return $this->content_type;
132+
}
133+
134+
/**
135+
* @return int
136+
*/
137+
public function size(): int
138+
{
139+
return $this->size;
140+
}
141+
142+
/**
143+
* @return int
144+
*/
145+
public function downloadCount(): int
146+
{
147+
return $this->download_count;
148+
}
149+
150+
/**
151+
* @return DateTimeInterface
152+
*/
153+
public function createdAt(): DateTimeInterface
154+
{
155+
return $this->created_at;
156+
}
157+
158+
/**
159+
* @return DateTimeInterface
160+
*/
161+
public function updatedAt(): DateTimeInterface
162+
{
163+
return $this->updated_at;
164+
}
165+
166+
/**
167+
* @return User
168+
*/
169+
public function uploader(): User
170+
{
171+
return $this->uploader;
172+
}
173+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace ApiClients\Client\Github\Resource\Repository\Release;
4+
5+
use ApiClients\Foundation\Resource\ResourceInterface;
6+
use DateTimeInterface;
7+
8+
interface AssetInterface extends ResourceInterface
9+
{
10+
const HYDRATE_CLASS = 'Repository\\Release\\Asset';
11+
12+
/**
13+
* @return string
14+
*/
15+
public function url(): string;
16+
17+
/**
18+
* @return string
19+
*/
20+
public function browserDownloadUrl(): string;
21+
22+
/**
23+
* @return int
24+
*/
25+
public function id(): int;
26+
27+
/**
28+
* @return string
29+
*/
30+
public function name(): string;
31+
32+
/**
33+
* @return string
34+
*/
35+
public function label(): string;
36+
37+
/**
38+
* @return string
39+
*/
40+
public function state(): string;
41+
42+
/**
43+
* @return string
44+
*/
45+
public function contentType(): string;
46+
47+
/**
48+
* @return int
49+
*/
50+
public function size(): int;
51+
52+
/**
53+
* @return int
54+
*/
55+
public function downloadCount(): int;
56+
57+
/**
58+
* @return DateTimeInterface
59+
*/
60+
public function createdAt(): DateTimeInterface;
61+
62+
/**
63+
* @return DateTimeInterface
64+
*/
65+
public function updatedAt(): DateTimeInterface;
66+
67+
/**
68+
* @return User
69+
*/
70+
public function uploader(): User;
71+
}

0 commit comments

Comments
 (0)