Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit c2472bc

Browse files
committed
Added Sources and Stocks API mappings
1 parent 4c629ce commit c2472bc

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

src/Api/Sources.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace Grayloon\Magento\Api;
4+
5+
class Sources extends AbstractApi
6+
{
7+
/**
8+
* inventoryApiSourcesRepositoryV1
9+
* All of paginated source items.
10+
*
11+
* @param int $pageSize
12+
* @param int $currentPage
13+
* @param array $filters
14+
*
15+
* @return array
16+
*/
17+
public function all($pageSize = 50, $currentPage = 1, $filters = [])
18+
{
19+
return $this->get('/inventory/sources', array_merge($filters, [
20+
'searchCriteria[pageSize]' => $pageSize,
21+
'searchCriteria[currentPage]' => $currentPage,
22+
]));
23+
}
24+
25+
public function bySourceName(String $name = 'default')
26+
{
27+
return $this->get('/inventory/sources/'.$name);
28+
}
29+
}

src/Api/Stocks.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Grayloon\Magento\Api;
4+
5+
class Stocks extends AbstractApi
6+
{
7+
/**
8+
* inventoryApiStocksRepositoryV1
9+
* All of paginated source items.
10+
*
11+
* @param int $pageSize
12+
* @param int $currentPage
13+
* @param array $filters
14+
*
15+
* @return array
16+
*/
17+
public function all($pageSize = 50, $currentPage = 1, $filters = [])
18+
{
19+
return $this->get('/inventory/stocks', array_merge($filters, [
20+
'searchCriteria[pageSize]' => $pageSize,
21+
'searchCriteria[currentPage]' => $currentPage,
22+
]));
23+
}
24+
25+
}

0 commit comments

Comments
 (0)