Skip to content

Commit 1971dc8

Browse files
committed
Config resource example
1 parent 6cd26f8 commit 1971dc8

File tree

5 files changed

+124
-0
lines changed

5 files changed

+124
-0
lines changed
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 Example\Client\Resource\Async\Project;
4+
5+
use Example\Client\Resource\Project\Config as BaseConfig;
6+
7+
class Config extends BaseConfig
8+
{
9+
public function refresh() : Config
10+
{
11+
return $this->wait($this->callAsync('refresh'));
12+
}
13+
}

tests/resources/Project/Config.php

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Example\Client\Resource\Project;
4+
5+
use WyriHaximus\ApiClient\Annotations\Nested;
6+
use WyriHaximus\ApiClient\Resource\TransportAwareTrait;
7+
8+
abstract class Config implements ConfigInterface
9+
{
10+
use TransportAwareTrait;
11+
12+
/**
13+
* @var string
14+
*/
15+
protected $a;
16+
17+
/**
18+
* @var string
19+
*/
20+
protected $b;
21+
22+
/**
23+
* @var string
24+
*/
25+
protected $c;
26+
27+
/**
28+
* @var string
29+
*/
30+
protected $d;
31+
32+
/**
33+
* @return string
34+
*/
35+
public function a() : string
36+
{
37+
return $this->a;
38+
}
39+
40+
/**
41+
* @return string
42+
*/
43+
public function b() : string
44+
{
45+
return $this->b;
46+
}
47+
48+
/**
49+
* @return string
50+
*/
51+
public function c() : string
52+
{
53+
return $this->c;
54+
}
55+
56+
/**
57+
* @return string
58+
*/
59+
public function d() : string
60+
{
61+
return $this->d;
62+
}
63+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Example\Client\Resource\Project;
4+
5+
use WyriHaximus\ApiClient\Resource\ResourceInterface;
6+
7+
interface ConfigInterface extends ResourceInterface
8+
{
9+
/**
10+
* @return string
11+
*/
12+
public function a() : string;
13+
14+
/**
15+
* @return string
16+
*/
17+
public function b() : string;
18+
19+
/**
20+
* @return string
21+
*/
22+
public function c() : string;
23+
24+
/**
25+
* @return string
26+
*/
27+
public function d() : string;
28+
}
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 Example\Client\Resource\Sync\Project;
4+
5+
use Example\Client\Resource\Project\Config as BaseConfig;
6+
7+
class Config extends BaseConfig
8+
{
9+
public function refresh() : Config
10+
{
11+
return $this->wait($this->callAsync('refresh'));
12+
}
13+
}

tests/yaml/project-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace: Example\Client\Resource
2+
class: Project\Config
3+
properties:
4+
a: string
5+
b: string
6+
c: string
7+
d: string

0 commit comments

Comments
 (0)