-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathNews.php
54 lines (47 loc) · 1.85 KB
/
News.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
<?php
declare(strict_types=1);
namespace Dakword\WBSeller\API\Endpoint\Subpoint;
use Dakword\WBSeller\API\Endpoint\Common;
class News
{
private Common $Common;
public function __construct(Common $Common)
{
$this->Common = $Common;
}
/**
* Новости портала продавцов
*
* Метод позволяет получать новости с портала продавцов в формате HTML.
* За один запрос можно получить не более 100 новостей.
* @link https://openapi.wildberries.ru/general/sellers_portal_news/ru/#/paths/~1api~1communications~1v1~1news/get
*
* @param \DateTime $date Дата, от которой необходимо выдать новости
*
* @return array [object, object, ...]
*/
public function fromDate(\DateTime $date): array
{
return $this->Common->getRequest('/api/communications/v1/news', [
'from' => $date->format('Y-m-d'),
])->data;
}
/**
* Новости портала продавцов
*
* Метод позволяет получать новости с портала продавцов в формате HTML.
* За один запрос можно получить не более 100 новостей.
* Допускается 1 запрос в 10 минут.
* @link https://openapi.wildberries.ru/general/sellers_portal_news/ru/#/paths/~1api~1communications~1v1~1news/get
*
* @param int $id ID новости, от которой необходимо выдать новости
*
* @return array [object, object, ...]
*/
public function fromId(int $id): array
{
return $this->Common->getRequest('/api/communications/v1/news', [
'fromID' => $id,
])->data;
}
}