Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added methods for new comment endpoint #44

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@ public function deleteCustomerTag($idcustomer, $idtag)
return $this->sendRequest('/customers/' . $idcustomer . '/tags/' . $idtag, [], self::METHOD_DELETE);
}

public function addCustomerComment($idcustomer, $params)
{
return $this->sendRequest('/customers/' . $idcustomer . '/comments', $params, self::METHOD_POST);
}

public function getCustomerComments($idcustomer)
{
return $this->sendRequest('/customers/' . $idcustomer . '/comments');
}

/*
* Products
*/
Expand Down Expand Up @@ -273,6 +283,16 @@ public function unlinkProductFromLocation($idproduct, $idlocation)
return $this->sendRequest('/products/' . $idproduct . '/locations/' . $idlocation, array(), self::METHOD_DELETE);
}

public function addProductComment($idproduct, $params)
{
return $this->sendRequest('/products/' . $idproduct . '/comments', $params, self::METHOD_POST);
}

public function getProductComments($idproduct)
{
return $this->sendRequest('/products/' . $idproduct . '/comments');
}

/*
* Stock history
*/
Expand Down Expand Up @@ -366,6 +386,16 @@ public function addOrderNote($idorder, $note)
return $this->sendRequest('/orders/' . $idorder . '/notes', ['note' => $note], self::METHOD_POST);
}

public function addOrderComment($idorder, $params)
{
return $this->sendRequest('/orders/' . $idorder . '/comments', $params, self::METHOD_POST);
}

public function getOrderComments($idorder)
{
return $this->sendRequest('/orders/' . $idorder . '/comments');
}

public function getOrderTags($idorder)
{
return $this->sendRequest('/orders/' . $idorder . '/tags');
Expand Down Expand Up @@ -536,6 +566,16 @@ public function getPackinglistPdf($idpicklist)
return $this->sendRequest('/picklists/' . $idpicklist . '/packinglistpdf');
}

public function addPicklistComment($idpicklist, $params)
{
return $this->sendRequest('/picklists/' . $idpicklist . '/comments', $params, self::METHOD_POST);
}

public function getPicklistComments($idpicklist)
{
return $this->sendRequest('/picklists/' . $idpicklist . '/comments');
}

/*
* Picklist batches
*/
Expand Down Expand Up @@ -582,6 +622,16 @@ public function updateSupplier($idsupplier, $params)
return $this->sendRequest('/suppliers/' . $idsupplier, $params, self::METHOD_PUT);
}

public function addSupplierComment($idsupplier, $params)
{
return $this->sendRequest('/suppliers/' . $idsupplier . '/comments', $params, self::METHOD_POST);
}

public function getSupplierComments($idsupplier)
{
return $this->sendRequest('/suppliers/' . $idsupplier . '/comments');
}

/*
* Purchase orders
*/
Expand Down Expand Up @@ -663,6 +713,30 @@ public function updatePurchaseorder($idpurchaseorder, $params)
return $this->sendRequest('/purchaseorders/' . $idpurchaseorder, $params, self::METHOD_PUT);
}

public function addPurchaseorderComment($idpurchaseorder, $params)
{
return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/comments', $params, self::METHOD_POST);
}

public function getPurchaseorderComments($idpurchaseorder)
{
return $this->sendRequest('/purchaseorders/' . $idpurchaseorder . '/comments');
}

/**
* New receipt endpoints have not added yet, so added it below purchase orders for now
*/

public function addReceiptComment($idreceipt, $params)
{
return $this->sendRequest('/receipts/' . $idreceipt . '/comments', $params, self::METHOD_POST);
}

public function getReceiptComments($idreceipt)
{
return $this->sendRequest('/receipts/' . $idreceipt . '/comments');
}

/*
* Returns
*/
Expand Down Expand Up @@ -723,6 +797,16 @@ public function getAllReturnReasons($filters = [])
return $this->getAllResults('returnReason');
}

public function addReturnComment($idreturn, $params)
{
return $this->sendRequest('/returns/' . $idreturn . '/comments', $params, self::METHOD_POST);
}

public function getReturnComments($idreturn)
{
return $this->sendRequest('/returns/' . $idreturn . '/comments');
}

/*
* Returned Products
*/
Expand Down Expand Up @@ -1008,6 +1092,25 @@ public function getStat($key)
return $this->sendRequest('/stats/' . $key);
}

/*
* Comments
*/

public function getComments($filters = [])
{
return $this->sendRequest('/comments', [], self::METHOD_GET, $filters);
}

public function getComment($idcomment)
{
return $this->sendRequest('/comments/' . $idcomment, [], self::METHOD_GET);
}

public function deleteComment($idcomment)
{
return $this->sendRequest('/comments/' . $idcomment, [], self::METHOD_DELETE);
}

/*
* General
*/
Expand Down