File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ class Tag
21
21
22
22
public TagAttributes $ attributes ;
23
23
private string $ groupId ;
24
+ private string $ tagGroupId ;
24
25
25
26
public static function make (string $ clientId , string $ clientSecret ): Tag
26
27
{
@@ -38,6 +39,13 @@ public function forGroupId(string $groupId): static
38
39
return $ this ;
39
40
}
40
41
42
+ public function forTagGroupId (string $ tagGroupId ): static
43
+ {
44
+ $ this ->tagGroupId = $ tagGroupId ;
45
+
46
+ return $ this ;
47
+ }
48
+
41
49
public function get (array $ query = []): ClientResponse
42
50
{
43
51
$ http = $ this ->client ()
@@ -54,6 +62,14 @@ public function groups(array $query = []): ClientResponse
54
62
return $ this ->processResponse ($ http );
55
63
}
56
64
65
+ public function tagGroup (array $ query = []): ClientResponse
66
+ {
67
+ $ http = $ this ->client ()
68
+ ->get ($ this ->hostname () . TagGroup::TAG_GROUP_ENDPOINT . "/ {$ this ->tagGroupId }/tags " , $ query );
69
+
70
+ return $ this ->processResponse ($ http );
71
+ }
72
+
57
73
protected function mapFromPco (ClientResponse $ clientResponse ): void
58
74
{
59
75
$ records = objectify ($ clientResponse ->meta ->response ->json ("data " , []));
@@ -73,4 +89,4 @@ protected function mapFromPco(ClientResponse $clientResponse): void
73
89
$ clientResponse ->data ->add ($ this );
74
90
}
75
91
}
76
- }
92
+ }
Original file line number Diff line number Diff line change @@ -47,10 +47,9 @@ public function all(array $query = []): ClientResponse
47
47
48
48
public function tags (array $ query = []): ClientResponse
49
49
{
50
- $ http = $ this ->client ()
51
- ->get ($ this ->hostname () . self ::TAG_GROUP_ENDPOINT . "/ " . $ this ->attributes ->tagGroupId . "/tags " , $ query );
52
-
53
- return $ this ->processResponse ($ http );
50
+ return Tag::make ($ this ->clientId , $ this ->clientSecret )
51
+ ->forTagGroupId ($ this ->attributes ->tagGroupId )
52
+ ->tagGroup ($ query );
54
53
}
55
54
56
55
protected function mapFromPco (ClientResponse $ clientResponse ): void
@@ -75,4 +74,4 @@ protected function mapFromPco(ClientResponse $clientResponse): void
75
74
$ clientResponse ->data ->add ($ this );
76
75
}
77
76
}
78
- }
77
+ }
You can’t perform that action at this time.
0 commit comments