-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDeleteAssignment.php
68 lines (58 loc) · 1.83 KB
/
DeleteAssignment.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/*
* This file is part of JoliCode's Forecast PHP API project.
*
* (c) JoliCode <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace JoliCode\Forecast\Api\Endpoint;
class DeleteAssignment extends \JoliCode\Forecast\Api\Runtime\Client\BaseEndpoint implements \JoliCode\Forecast\Api\Runtime\Client\Endpoint
{
use \JoliCode\Forecast\Api\Runtime\Client\EndpointTrait;
protected $id;
/**
* Delete an Assignment.
*
* @param int $id Id of the Assignment
*/
public function __construct(int $id)
{
$this->id = $id;
}
public function getMethod(): string
{
return 'DELETE';
}
public function getUri(): string
{
return str_replace(['{id}'], [$this->id], '/assignments/{id}');
}
public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
{
return [[], null];
}
public function getExtraHeaders(): array
{
return ['Accept' => ['application/json']];
}
public function getAuthenticationScopes(): array
{
return ['BearerAuth', 'AccountAuth'];
}
/**
* @return \JoliCode\Forecast\Api\Model\Error|null
*/
protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
{
$status = $response->getStatusCode();
$body = (string) $response->getBody();
if (204 === $status) {
return null;
}
if (false !== mb_strpos($contentType, 'application/json')) {
return $serializer->deserialize($body, 'JoliCode\\Forecast\\Api\\Model\\Error', 'json');
}
}
}