forked from imper86/php-allegro-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAttachments.php
More file actions
27 lines (20 loc) · 843 Bytes
/
Attachments.php
File metadata and controls
27 lines (20 loc) · 843 Bytes
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
<?php
namespace Imper86\PhpAllegroApi\Resource\AfterSalesServiceConditions;
use Imper86\PhpAllegroApi\Resource\AbstractResource;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
class Attachments extends AbstractResource
{
public function post(string $fileName): ResponseInterface
{
return $this->apiPost('/after-sales-service-conditions/attachments', ['name' => $fileName]);
}
public function put(string $url, StreamInterface $fileStream, string $contentType = 'application/pdf'): ResponseInterface
{
$uri = $this->uriFactory->createUri($url);
$request = $this->requestFactory->createRequest('PUT', $uri)
->withBody($fileStream)
->withHeader('Content-Type', $contentType);
return $this->httpClient->sendRequest($request);
}
}