qual enhance rest

This commit is contained in:
pascal 2024-01-17 20:52:32 +01:00
parent 1d00d90872
commit b052e1b4cc

View file

@ -61,7 +61,9 @@ class Boms extends DolibarrApi
* @return Object Object with cleaned properties
*
* @url GET {id}
* @throws RestException
*
* @throws RestException 401 Access denied
* @throws RestException 404 BOM not found
*/
public function get($id)
{
@ -95,7 +97,9 @@ class Boms extends DolibarrApi
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
* @return array Array of order objects
*
* @throws RestException
* @throws RestException 400 Bad sqlfilters
* @throws RestException 401 Access denied
* @throws RestException 503 Error retrieving list of boms
*/
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '')
{
@ -176,6 +180,9 @@ class Boms extends DolibarrApi
*
* @param array $request_data Request datas
* @return int ID of bom
*
* @throws RestException 401 Access denied
* @throws RestException 500 Error retrieving list of boms
*/
public function post($request_data = null)
{
@ -210,6 +217,10 @@ class Boms extends DolibarrApi
* @param array $request_data Datas
*
* @return int
*
* @throws RestException 401 Access denied
* @throws RestException 404 BOM not found
* @throws RestException 500 Error updating bom
*/
public function put($id, $request_data = null)
{
@ -253,6 +264,10 @@ class Boms extends DolibarrApi
*
* @param int $id BOM ID
* @return array
*
* @throws RestException 401 Access denied
* @throws RestException 404 BOM not found
* @throws RestException 500 Error deleting bom
*/
public function delete($id)
{
@ -288,6 +303,9 @@ class Boms extends DolibarrApi
* @url GET {id}/lines
*
* @return array
*
* @throws RestException 401 Access denied
* @throws RestException 404 BOM not found
*/
public function getLines($id)
{
@ -320,6 +338,10 @@ class Boms extends DolibarrApi
* @url POST {id}/lines
*
* @return int
*
* @throws RestException 401 Access denied
* @throws RestException 404 BOM not found
* @throws RestException 500 Error adding bom line
*/
public function postLine($id, $request_data = null)
{
@ -353,7 +375,7 @@ class Boms extends DolibarrApi
if ($updateRes > 0) {
return $updateRes;
} else {
throw new RestException(400, $this->bom->error);
throw new RestException(500, $this->bom->error);
}
}
@ -367,6 +389,9 @@ class Boms extends DolibarrApi
* @url PUT {id}/lines/{lineid}
*
* @return object|bool
*
* @throws RestException 401 Access denied
* @throws RestException 404 BOM not found
*/
public function putLine($id, $lineid, $request_data = null)
{
@ -415,9 +440,9 @@ class Boms extends DolibarrApi
*
* @return int
*
* @throws RestException 401
* @throws RestException 404
* @throws RestException 500
* @throws RestException 401 Access denied
* @throws RestException 404 BOM not found
* @throws RestException 500 Error deleting bom line
*/
public function deleteLine($id, $lineid)
{
@ -450,7 +475,7 @@ class Boms extends DolibarrApi
if ($updateRes > 0) {
return $this->get($id);
} else {
throw new RestException(405, $this->bom->error);
throw new RestException(500, $this->bom->error);
}
}