Skip to content

Commit

Permalink
Merge pull request #91 from IsraelOrtuno/develop
Browse files Browse the repository at this point in the history
Add leads endpoint #86
  • Loading branch information
IsraelOrtuno authored Oct 20, 2020
2 parents fcf273e + 796d973 commit d28a868
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions src/Resources/Leads.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?php

namespace Devio\Pipedrive\Resources;

use Devio\Pipedrive\Http\Response;
use Devio\Pipedrive\Resources\Basics\Resource;

class Leads extends Resource
{
/**
* Disabled abstract methods.
*
* @var array
*/
protected $disabled = ['deleteBulk'];

/**
* Get all labels.
*
* @return Response
*/
public function labels()
{
$this->request->setResource('/');
$result = $this->request->get('leadLabels');

$this->request->setResource($this->getName());

return $result;
}

/**
* Add a label.
*
* @return Response
*/
public function addLabel(array $values = [])
{
$this->request->setResource('/');
$result = $this->request->post('leadLabels', $values);

$this->request->setResource($this->getName());

return $result;
}

/**
* Delete a label.
*
* @return Response
*/
public function deleteLabel($id)
{
$this->request->setResource('/');
$result = $this->request->delete('leadLabels/' . $id);

$this->request->setResource($this->getName());

return $result;
}

/**
* @param $id
* @param array $values
* @return Response
*/
public function update($id, array $values = [])
{
$this->request->setResource('/');
$result = $this->request->put('leadLabels/' . $id, $values);

$this->request->setResource($this->getName());

return $result;
}

/**
* Get all sources.
*
* @return Response
*/
public function sources()
{
$this->request->setResource('/');
$result = $this->request->get('leadSources');

$this->request->setResource($this->getName());

return $result;
}
}

0 comments on commit d28a868

Please sign in to comment.