... | ... |
@@ -13,6 +13,8 @@ declare(strict_types=1); |
13 | 13 |
namespace vossmedien\DacoreBundle\API; |
14 | 14 |
|
15 | 15 |
use Contao\System; |
16 |
+use Symfony\Component\Mime\Part\DataPart; |
|
17 |
+use Symfony\Component\Mime\Part\Multipart\FormDataPart; |
|
16 | 18 |
use Symfony\Component\Serializer\SerializerInterface; |
17 | 19 |
use Symfony\Contracts\HttpClient\HttpClientInterface; |
18 | 20 |
use vossmedien\DacoreBundle\Model\KatalogModel; |
... | ... |
@@ -232,114 +234,119 @@ class Softgarden |
232 | 234 |
return false; |
233 | 235 |
} |
234 | 236 |
|
235 |
- public function getUserAccessToken($username, $password) |
|
237 |
+ public function addApplicationInfo(array $data, string $applicationId, $token_type, $access_token) |
|
236 | 238 |
{ |
237 |
- // bewerber@dacore.api / Aebekai2ail4coum |
|
238 | 239 |
$options = [ |
239 |
- 'auth_basic' => $this->getBasicAuthorization(), |
|
240 |
- 'body' => [ |
|
241 |
- 'grant_type' => 'password', |
|
242 |
- 'username' => $username, |
|
243 |
- 'password' => $password |
|
244 |
- ] |
|
240 |
+ 'headers' => [ |
|
241 |
+ 'Authorization: ' . $token_type . ' ' . $access_token, |
|
242 |
+ 'Content-Type: application/json' |
|
243 |
+ ], |
|
244 |
+ 'body' => json_encode($data) |
|
245 | 245 |
]; |
246 | 246 |
|
247 |
- $response = $this->sendRequest('https://api.softgarden.io/api/rest/oauth/frontend/token',$options,'POST',true); |
|
247 |
+ $response = $this->sendRequest('applications/' . $applicationId,$options,'POST'); |
|
248 | 248 |
|
249 |
- if ($response->getStatusCode() == 200) |
|
249 |
+ if ($response->getStatusCode() == 204) |
|
250 | 250 |
{ |
251 |
- $content = $response->getContent(); |
|
252 |
- |
|
253 |
- return json_decode($content); |
|
251 |
+ return true; |
|
254 | 252 |
} |
255 | 253 |
|
256 |
- return null; |
|
254 |
+ return false; |
|
257 | 255 |
} |
258 | 256 |
|
259 |
- public function getStellenFiltered(array $params=[]): ?StellenModel |
|
257 |
+ public function addApplicationFileCV(string $path, string $filename, string $mimetype, string $applicationId, $token_type, $access_token) |
|
260 | 258 |
{ |
259 |
+ $fields = [ |
|
260 |
+ 'file' => DataPart::fromPath($path,$filename,$mimetype) |
|
261 |
+ ]; |
|
262 |
+ $formData = new FormDataPart($fields); |
|
263 |
+ |
|
261 | 264 |
$options = [ |
262 |
- 'headers' => $this->getAuthorizeRequestHeader() |
|
265 |
+ 'headers' => array_merge([ |
|
266 |
+ 'Authorization: ' . $token_type . ' ' . $access_token |
|
267 |
+ ], |
|
268 |
+ $formData->getPreparedHeaders()->toArray() |
|
269 |
+ ), |
|
270 |
+ 'body' => $formData->bodyToString() |
|
263 | 271 |
]; |
264 | 272 |
|
265 |
- if (count($params)) |
|
273 |
+ $response = $this->sendRequest('attachments/cv?applicationId=' . $applicationId,$options,'POST'); |
|
274 |
+ |
|
275 |
+ if ($response->getStatusCode() == 200) |
|
266 | 276 |
{ |
267 |
- $options['query'] = $params; |
|
277 |
+ return true; |
|
268 | 278 |
} |
269 | 279 |
|
270 |
- $response = $this->sendRequest('Stelle/GetStellenFiltered',$options); |
|
280 |
+ return false; |
|
281 |
+ } |
|
282 |
+ |
|
283 |
+ public function addApplicationFile(string $path, string $filename, string $mimetype, string $applicationId, $token_type, $access_token) |
|
284 |
+ { |
|
285 |
+ $fields = [ |
|
286 |
+ 'file' => DataPart::fromPath($path,$filename,$mimetype) |
|
287 |
+ ]; |
|
288 |
+ $formData = new FormDataPart($fields); |
|
271 | 289 |
|
290 |
+ $options = [ |
|
291 |
+ 'headers' => array_merge([ |
|
292 |
+ 'Authorization: ' . $token_type . ' ' . $access_token |
|
293 |
+ ], |
|
294 |
+ $formData->getPreparedHeaders()->toArray() |
|
295 |
+ ), |
|
296 |
+ 'body' => $formData->bodyToString() |
|
297 |
+ ]; |
|
272 | 298 |
|
299 |
+ $response = $this->sendRequest('attachments/?applicationId=' . $applicationId,$options,'POST'); |
|
273 | 300 |
|
274 | 301 |
if ($response->getStatusCode() == 200) |
275 | 302 |
{ |
276 |
- $content = $response->getContent(); |
|
277 |
- |
|
278 |
- /** @var StellenModel $collection */ |
|
279 |
- $collection = $this->serializer->deserialize($content,StellenModel::class,'json'); |
|
280 |
- |
|
281 |
- return $collection; |
|
303 |
+ return true; |
|
282 | 304 |
} |
283 | 305 |
|
284 |
- return null; |
|
306 |
+ return false; |
|
285 | 307 |
} |
286 | 308 |
|
287 |
- public function getStelleById(string $uuid, array $params=[]): ?StelleModel |
|
309 |
+ public function getUserAccessToken($username, $password) |
|
288 | 310 |
{ |
311 |
+ // bewerber@dacore.api / Aebekai2ail4coum |
|
289 | 312 |
$options = [ |
290 |
- 'headers' => $this->getAuthorizeRequestHeader(), |
|
291 |
- 'query' => [ |
|
292 |
- 'stelleUuid' => $uuid |
|
313 |
+ 'auth_basic' => $this->getBasicAuthorization(), |
|
314 |
+ 'body' => [ |
|
315 |
+ 'grant_type' => 'password', |
|
316 |
+ 'username' => $username, |
|
317 |
+ 'password' => $password |
|
293 | 318 |
] |
294 | 319 |
]; |
295 | 320 |
|
296 |
- if (count($params)) |
|
297 |
- { |
|
298 |
- $options['query'] = array_merge($options['query'],$params); |
|
299 |
- } |
|
300 |
- |
|
301 |
- $response = $this->sendRequest('Stelle/GetStelleById',$options); |
|
302 |
- |
|
303 |
- |
|
321 |
+ $response = $this->sendRequest('https://api.softgarden.io/api/rest/oauth/frontend/token',$options,'POST',true); |
|
304 | 322 |
|
305 | 323 |
if ($response->getStatusCode() == 200) |
306 | 324 |
{ |
307 | 325 |
$content = $response->getContent(); |
308 | 326 |
|
309 |
- /** @var StelleModel $model */ |
|
310 |
- $model = $this->serializer->deserialize($content,StelleModel::class,'json'); |
|
311 |
- |
|
312 |
- return $model; |
|
327 |
+ return json_decode($content); |
|
313 | 328 |
} |
314 | 329 |
|
315 | 330 |
return null; |
316 | 331 |
} |
317 | 332 |
|
318 |
- public function getKatalogByRelationName(string $entityName, string $relationName): ?KatalogModel |
|
333 |
+ public function finalizeApplication(string $applicationId, $token_type, $access_token) |
|
319 | 334 |
{ |
320 | 335 |
$options = [ |
321 |
- 'headers' => $this->getAuthorizeRequestHeader(), |
|
322 |
- 'query' => [ |
|
323 |
- 'entityName' => $entityName, |
|
324 |
- 'relationName' => $relationName |
|
336 |
+ 'headers' => [ |
|
337 |
+ 'Authorization: ' . $token_type . ' ' . $access_token, |
|
338 |
+ 'Content-Type: application/json' |
|
325 | 339 |
] |
326 | 340 |
]; |
327 | 341 |
|
328 |
- $response = $this->sendRequest('Katalog/GetByRelationName',$options); |
|
329 |
- |
|
330 |
- |
|
342 |
+ $response = $this->sendRequest('applications/' . $applicationId . '/submit',$options,'POST'); |
|
331 | 343 |
|
332 |
- if ($response->getStatusCode() == 200) |
|
344 |
+ if ($response->getStatusCode() == 204) |
|
333 | 345 |
{ |
334 |
- $content = $response->getContent(); |
|
335 |
- |
|
336 |
- /** @var KatalogModel $collection */ |
|
337 |
- $collection = $this->serializer->deserialize($content,KatalogModel::class,'json'); |
|
338 |
- |
|
339 |
- return $collection; |
|
346 |
+ return true; |
|
340 | 347 |
} |
341 | 348 |
|
342 |
- return null; |
|
349 |
+ return false; |
|
343 | 350 |
} |
344 | 351 |
|
345 | 352 |
} |
... | ... |
@@ -122,7 +122,7 @@ class Softgarden |
122 | 122 |
] |
123 | 123 |
]; |
124 | 124 |
|
125 |
- $response = $this->sendRequest('jobs/' . $jobId . '/application',$options, 'POST'); |
|
125 |
+ $response = $this->sendRequest('jobs/' . $jobId . '/application',$options); |
|
126 | 126 |
|
127 | 127 |
if ($response->getStatusCode() == 200) |
128 | 128 |
{ |
... | ... |
@@ -156,7 +156,7 @@ class Softgarden |
156 | 156 |
return null; |
157 | 157 |
} |
158 | 158 |
|
159 |
- public function getApplication($applicationId, $token_type, $access_token) |
|
159 |
+ public function getApplication(string $applicationId, $token_type, $access_token) |
|
160 | 160 |
{ |
161 | 161 |
// bewerber@dacore.api / Aebekai2ail4coum |
162 | 162 |
$options = [ |
... | ... |
@@ -172,12 +172,66 @@ class Softgarden |
172 | 172 |
{ |
173 | 173 |
$content = json_decode($response->getContent()); |
174 | 174 |
|
175 |
- return count($content) < 2 ? array_shift($content) : $content; |
|
175 |
+ return $content; |
|
176 | 176 |
} |
177 | 177 |
|
178 | 178 |
return null; |
179 | 179 |
} |
180 | 180 |
|
181 |
+ public function deleteApplication(string $applicationId, $token_type, $access_token) |
|
182 |
+ { |
|
183 |
+ // bewerber@dacore.api / Aebekai2ail4coum |
|
184 |
+ $options = [ |
|
185 |
+ 'headers' => [ |
|
186 |
+ 'Authorization: ' . $token_type . ' ' . $access_token, |
|
187 |
+ 'Content-Type: application/json' |
|
188 |
+ ] |
|
189 |
+ ]; |
|
190 |
+ |
|
191 |
+ $response = $this->sendRequest('applications/' . $applicationId,$options,'DELETE'); |
|
192 |
+ |
|
193 |
+ if ($response->getStatusCode() == 204) |
|
194 |
+ { |
|
195 |
+ return true; |
|
196 |
+ } |
|
197 |
+ |
|
198 |
+ return false; |
|
199 |
+ } |
|
200 |
+ |
|
201 |
+ public function createApplicantUser(string $username,string $password,?string $email=null) |
|
202 |
+ { |
|
203 |
+ if ($email === null) |
|
204 |
+ { |
|
205 |
+ $email = $username; |
|
206 |
+ } |
|
207 |
+ |
|
208 |
+ $options = [ |
|
209 |
+ 'auth_basic' => $this->getBasicAuthorization(), |
|
210 |
+ 'headers' => [ |
|
211 |
+ 'Content-Type: application/json' |
|
212 |
+ ], |
|
213 |
+ 'body' => json_encode([ |
|
214 |
+ 'salutation' => 0, |
|
215 |
+ 'firstname' => 'Dacore', |
|
216 |
+ 'lastname' => 'Bewerber', |
|
217 |
+ 'username' => $username, |
|
218 |
+ 'password' => $password, |
|
219 |
+ 'email' => $email, |
|
220 |
+ 'locale' => 'de', |
|
221 |
+ 'dataPrivacyAccepted' => true |
|
222 |
+ ]) |
|
223 |
+ ]; |
|
224 |
+ |
|
225 |
+ $response = $this->sendRequest('applicants',$options,'POST'); |
|
226 |
+ |
|
227 |
+ if ($response->getStatusCode() == 204) |
|
228 |
+ { |
|
229 |
+ return true; |
|
230 |
+ } |
|
231 |
+ |
|
232 |
+ return false; |
|
233 |
+ } |
|
234 |
+ |
|
181 | 235 |
public function getUserAccessToken($username, $password) |
182 | 236 |
{ |
183 | 237 |
// bewerber@dacore.api / Aebekai2ail4coum |
... | ... |
@@ -59,8 +59,13 @@ class Softgarden |
59 | 59 |
return [$this->getClientId(),'']; |
60 | 60 |
} |
61 | 61 |
|
62 |
- protected function sendRequest(string $relEndpoint, array $options, string $method = 'GET') |
|
62 |
+ protected function sendRequest(string $relEndpoint, array $options, string $method = 'GET',bool $blnFQDNEndpoint=false) |
|
63 | 63 |
{ |
64 |
+ if ($blnFQDNEndpoint) |
|
65 |
+ { |
|
66 |
+ return $this->httpClient->request($method,$relEndpoint,$options); |
|
67 |
+ } |
|
68 |
+ |
|
64 | 69 |
$relEndpoint = '/' . ltrim($relEndpoint,'/'); |
65 | 70 |
|
66 | 71 |
return $this->httpClient->request($method,$this->getApiDomain().$relEndpoint,$options); |
... | ... |
@@ -68,6 +73,7 @@ class Softgarden |
68 | 73 |
|
69 | 74 |
public function testApiRequest() |
70 | 75 |
{ |
76 |
+ // bewerber@dacore.api / Aebekai2ail4coum |
|
71 | 77 |
$options = [ |
72 | 78 |
'auth_basic' => $this->getBasicAuthorization(), |
73 | 79 |
'headers' => ['Content-Type: application/json'] |
... | ... |
@@ -85,6 +91,117 @@ class Softgarden |
85 | 91 |
return null; |
86 | 92 |
} |
87 | 93 |
|
94 |
+ public function hasApplied(int $jobId, $token_type, $access_token) |
|
95 |
+ { |
|
96 |
+ // bewerber@dacore.api / Aebekai2ail4coum |
|
97 |
+ $options = [ |
|
98 |
+ 'headers' => [ |
|
99 |
+ 'Authorization: ' . $token_type . ' ' . $access_token |
|
100 |
+ ] |
|
101 |
+ ]; |
|
102 |
+ |
|
103 |
+ $response = $this->sendRequest('jobs/' . $jobId . '/applied',$options); |
|
104 |
+ |
|
105 |
+ if ($response->getStatusCode() == 200) |
|
106 |
+ { |
|
107 |
+ $content = $response->getContent(); |
|
108 |
+ |
|
109 |
+ return $content == 'true'; |
|
110 |
+ } |
|
111 |
+ |
|
112 |
+ return false; |
|
113 |
+ } |
|
114 |
+ |
|
115 |
+ public function getApplicationId(int $jobId, $token_type, $access_token) |
|
116 |
+ { |
|
117 |
+ // bewerber@dacore.api / Aebekai2ail4coum |
|
118 |
+ $options = [ |
|
119 |
+ 'headers' => [ |
|
120 |
+ 'Authorization: ' . $token_type . ' ' . $access_token, |
|
121 |
+ 'Content-Type: application/json' |
|
122 |
+ ] |
|
123 |
+ ]; |
|
124 |
+ |
|
125 |
+ $response = $this->sendRequest('jobs/' . $jobId . '/application',$options, 'POST'); |
|
126 |
+ |
|
127 |
+ if ($response->getStatusCode() == 200) |
|
128 |
+ { |
|
129 |
+ $content = $response->getContent(); |
|
130 |
+ |
|
131 |
+ return $content; |
|
132 |
+ } |
|
133 |
+ |
|
134 |
+ return null; |
|
135 |
+ } |
|
136 |
+ |
|
137 |
+ public function startApplication(int $jobId, $token_type, $access_token) |
|
138 |
+ { |
|
139 |
+ // bewerber@dacore.api / Aebekai2ail4coum |
|
140 |
+ $options = [ |
|
141 |
+ 'headers' => [ |
|
142 |
+ 'Authorization: ' . $token_type . ' ' . $access_token, |
|
143 |
+ 'Content-Type: application/json' |
|
144 |
+ ] |
|
145 |
+ ]; |
|
146 |
+ |
|
147 |
+ $response = $this->sendRequest('applications?jobId='.$jobId,$options, 'POST'); |
|
148 |
+ |
|
149 |
+ if ($response->getStatusCode() == 200) |
|
150 |
+ { |
|
151 |
+ $content = $response->getContent(); |
|
152 |
+ |
|
153 |
+ return $content; |
|
154 |
+ } |
|
155 |
+ |
|
156 |
+ return null; |
|
157 |
+ } |
|
158 |
+ |
|
159 |
+ public function getApplication($applicationId, $token_type, $access_token) |
|
160 |
+ { |
|
161 |
+ // bewerber@dacore.api / Aebekai2ail4coum |
|
162 |
+ $options = [ |
|
163 |
+ 'headers' => [ |
|
164 |
+ 'Authorization: ' . $token_type . ' ' . $access_token, |
|
165 |
+ 'Content-Type: application/json' |
|
166 |
+ ] |
|
167 |
+ ]; |
|
168 |
+ |
|
169 |
+ $response = $this->sendRequest('applications/' . $applicationId . '?fields=*',$options); |
|
170 |
+ |
|
171 |
+ if ($response->getStatusCode() == 200) |
|
172 |
+ { |
|
173 |
+ $content = json_decode($response->getContent()); |
|
174 |
+ |
|
175 |
+ return count($content) < 2 ? array_shift($content) : $content; |
|
176 |
+ } |
|
177 |
+ |
|
178 |
+ return null; |
|
179 |
+ } |
|
180 |
+ |
|
181 |
+ public function getUserAccessToken($username, $password) |
|
182 |
+ { |
|
183 |
+ // bewerber@dacore.api / Aebekai2ail4coum |
|
184 |
+ $options = [ |
|
185 |
+ 'auth_basic' => $this->getBasicAuthorization(), |
|
186 |
+ 'body' => [ |
|
187 |
+ 'grant_type' => 'password', |
|
188 |
+ 'username' => $username, |
|
189 |
+ 'password' => $password |
|
190 |
+ ] |
|
191 |
+ ]; |
|
192 |
+ |
|
193 |
+ $response = $this->sendRequest('https://api.softgarden.io/api/rest/oauth/frontend/token',$options,'POST',true); |
|
194 |
+ |
|
195 |
+ if ($response->getStatusCode() == 200) |
|
196 |
+ { |
|
197 |
+ $content = $response->getContent(); |
|
198 |
+ |
|
199 |
+ return json_decode($content); |
|
200 |
+ } |
|
201 |
+ |
|
202 |
+ return null; |
|
203 |
+ } |
|
204 |
+ |
|
88 | 205 |
public function getStellenFiltered(array $params=[]): ?StellenModel |
89 | 206 |
{ |
90 | 207 |
$options = [ |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,174 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+declare(strict_types=1); |
|
4 |
+ |
|
5 |
+/* |
|
6 |
+ * This file is part of dacore bundle for Contao. |
|
7 |
+ * |
|
8 |
+ * (c) Benjamin Roth |
|
9 |
+ * |
|
10 |
+ * @license commercial |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+namespace vossmedien\DacoreBundle\API; |
|
14 |
+ |
|
15 |
+use Contao\System; |
|
16 |
+use Symfony\Component\Serializer\SerializerInterface; |
|
17 |
+use Symfony\Contracts\HttpClient\HttpClientInterface; |
|
18 |
+use vossmedien\DacoreBundle\Model\KatalogModel; |
|
19 |
+use vossmedien\DacoreBundle\Model\StelleModel; |
|
20 |
+use vossmedien\DacoreBundle\Model\StellenModel; |
|
21 |
+ |
|
22 |
+class Softgarden |
|
23 |
+{ |
|
24 |
+ /** |
|
25 |
+ * @var SerializerInterface |
|
26 |
+ */ |
|
27 |
+ protected $serializer; |
|
28 |
+ |
|
29 |
+ /** |
|
30 |
+ * @var HttpClientInterface |
|
31 |
+ */ |
|
32 |
+ protected $httpClient; |
|
33 |
+ |
|
34 |
+ protected $clientId; |
|
35 |
+ |
|
36 |
+ protected $apiDomain; |
|
37 |
+ |
|
38 |
+ public function __construct(SerializerInterface $serializer, HttpClientInterface $httpClient) |
|
39 |
+ { |
|
40 |
+ $this->serializer = $serializer; |
|
41 |
+ $this->httpClient = $httpClient; |
|
42 |
+ |
|
43 |
+ $this->clientId = System::getContainer()->getParameter('vossmedien_dacore.softgarden.client_id'); |
|
44 |
+ $this->apiDomain = System::getContainer()->getParameter('vossmedien_dacore.softgarden.api_domain'); |
|
45 |
+ } |
|
46 |
+ |
|
47 |
+ protected function getClientId() |
|
48 |
+ { |
|
49 |
+ return $this->clientId; |
|
50 |
+ } |
|
51 |
+ |
|
52 |
+ protected function getApiDomain() |
|
53 |
+ { |
|
54 |
+ return rtrim($this->apiDomain,'/'); |
|
55 |
+ } |
|
56 |
+ |
|
57 |
+ protected function getBasicAuthorization() |
|
58 |
+ { |
|
59 |
+ return [$this->getClientId(),'']; |
|
60 |
+ } |
|
61 |
+ |
|
62 |
+ protected function sendRequest(string $relEndpoint, array $options, string $method = 'GET') |
|
63 |
+ { |
|
64 |
+ $relEndpoint = '/' . ltrim($relEndpoint,'/'); |
|
65 |
+ |
|
66 |
+ return $this->httpClient->request($method,$this->getApiDomain().$relEndpoint,$options); |
|
67 |
+ } |
|
68 |
+ |
|
69 |
+ public function testApiRequest() |
|
70 |
+ { |
|
71 |
+ $options = [ |
|
72 |
+ 'auth_basic' => $this->getBasicAuthorization(), |
|
73 |
+ 'headers' => ['Content-Type: application/json'] |
|
74 |
+ ]; |
|
75 |
+ |
|
76 |
+ $response = $this->sendRequest('jobslist/102581_extern',$options); |
|
77 |
+ |
|
78 |
+ if ($response->getStatusCode() == 200) |
|
79 |
+ { |
|
80 |
+ $content = $response->getContent(); |
|
81 |
+ |
|
82 |
+ return json_decode($content); |
|
83 |
+ } |
|
84 |
+ |
|
85 |
+ return null; |
|
86 |
+ } |
|
87 |
+ |
|
88 |
+ public function getStellenFiltered(array $params=[]): ?StellenModel |
|
89 |
+ { |
|
90 |
+ $options = [ |
|
91 |
+ 'headers' => $this->getAuthorizeRequestHeader() |
|
92 |
+ ]; |
|
93 |
+ |
|
94 |
+ if (count($params)) |
|
95 |
+ { |
|
96 |
+ $options['query'] = $params; |
|
97 |
+ } |
|
98 |
+ |
|
99 |
+ $response = $this->sendRequest('Stelle/GetStellenFiltered',$options); |
|
100 |
+ |
|
101 |
+ |
|
102 |
+ |
|
103 |
+ if ($response->getStatusCode() == 200) |
|
104 |
+ { |
|
105 |
+ $content = $response->getContent(); |
|
106 |
+ |
|
107 |
+ /** @var StellenModel $collection */ |
|
108 |
+ $collection = $this->serializer->deserialize($content,StellenModel::class,'json'); |
|
109 |
+ |
|
110 |
+ return $collection; |
|
111 |
+ } |
|
112 |
+ |
|
113 |
+ return null; |
|
114 |
+ } |
|
115 |
+ |
|
116 |
+ public function getStelleById(string $uuid, array $params=[]): ?StelleModel |
|
117 |
+ { |
|
118 |
+ $options = [ |
|
119 |
+ 'headers' => $this->getAuthorizeRequestHeader(), |
|
120 |
+ 'query' => [ |
|
121 |
+ 'stelleUuid' => $uuid |
|
122 |
+ ] |
|
123 |
+ ]; |
|
124 |
+ |
|
125 |
+ if (count($params)) |
|
126 |
+ { |
|
127 |
+ $options['query'] = array_merge($options['query'],$params); |
|
128 |
+ } |
|
129 |
+ |
|
130 |
+ $response = $this->sendRequest('Stelle/GetStelleById',$options); |
|
131 |
+ |
|
132 |
+ |
|
133 |
+ |
|
134 |
+ if ($response->getStatusCode() == 200) |
|
135 |
+ { |
|
136 |
+ $content = $response->getContent(); |
|
137 |
+ |
|
138 |
+ /** @var StelleModel $model */ |
|
139 |
+ $model = $this->serializer->deserialize($content,StelleModel::class,'json'); |
|
140 |
+ |
|
141 |
+ return $model; |
|
142 |
+ } |
|
143 |
+ |
|
144 |
+ return null; |
|
145 |
+ } |
|
146 |
+ |
|
147 |
+ public function getKatalogByRelationName(string $entityName, string $relationName): ?KatalogModel |
|
148 |
+ { |
|
149 |
+ $options = [ |
|
150 |
+ 'headers' => $this->getAuthorizeRequestHeader(), |
|
151 |
+ 'query' => [ |
|
152 |
+ 'entityName' => $entityName, |
|
153 |
+ 'relationName' => $relationName |
|
154 |
+ ] |
|
155 |
+ ]; |
|
156 |
+ |
|
157 |
+ $response = $this->sendRequest('Katalog/GetByRelationName',$options); |
|
158 |
+ |
|
159 |
+ |
|
160 |
+ |
|
161 |
+ if ($response->getStatusCode() == 200) |
|
162 |
+ { |
|
163 |
+ $content = $response->getContent(); |
|
164 |
+ |
|
165 |
+ /** @var KatalogModel $collection */ |
|
166 |
+ $collection = $this->serializer->deserialize($content,KatalogModel::class,'json'); |
|
167 |
+ |
|
168 |
+ return $collection; |
|
169 |
+ } |
|
170 |
+ |
|
171 |
+ return null; |
|
172 |
+ } |
|
173 |
+ |
|
174 |
+} |