Skip to content

Commit

Permalink
Merge pull request #100 from simensen/item-search
Browse files Browse the repository at this point in the history
Add ItemSearches endpoint, deprecate SearchResults
  • Loading branch information
IsraelOrtuno authored Jan 12, 2021
2 parents 6fd959a + b072eae commit a661261
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Pipedrive.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Devio\Pipedrive\Resources\Filters;
use Devio\Pipedrive\Resources\GlobalMessages;
use Devio\Pipedrive\Resources\Goals;
use Devio\Pipedrive\Resources\ItemSearches;
use Devio\Pipedrive\Resources\Leads;
use Devio\Pipedrive\Resources\NoteFields;
use Devio\Pipedrive\Resources\Notes;
Expand Down Expand Up @@ -56,6 +57,7 @@
* @method Filters filters()
* @method GlobalMessages globalMessages()
* @method Goals goals()
* @method ItemSearches itemSearches()
* @method Leads leads()
* @method NoteFields noteFields()
* @method Notes notes()
Expand Down Expand Up @@ -90,6 +92,7 @@
* @property-read Filters $filters
* @property-read GlobalMessages $globalMessages
* @property-read Goals $goals
* @property-read ItemSearches $itemSearches
* @property-read Leads $leads
* @property-read NoteFields $noteFields
* @property-read Notes $notes
Expand Down
2 changes: 2 additions & 0 deletions src/PipedriveFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* @method static Resources\Filters filters()
* @method static Resources\GlobalMessages globalMessages()
* @method static Resources\Goals goals()
* @method static Resources\ItemSearches itemSearches()
* @method static Resources\Leads leads()
* @method static Resources\NoteFields noteFields()
* @method static Resources\Notes notes()
Expand Down Expand Up @@ -51,6 +52,7 @@
* @property-read Resources\Filters $filters
* @property-read Resources\GlobalMessages $globalMessages
* @property-read Resources\Goals $goals
* @property-read Resources\ItemSearches $itemSearches
* @property-read Resources\Leads $leads
* @property-read Resources\NoteFields $noteFields
* @property-read Resources\Notes $notes
Expand Down
46 changes: 46 additions & 0 deletions src/Resources/ItemSearches.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace Devio\Pipedrive\Resources;

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

class ItemSearches extends Resource
{
/**
* Enabled abstract methods.
*
* @var array
*/
protected $enabled = [];

/**
* Search.
*
* @param $term
* @param array $options
* @return Response
*/
public function search($term, $options = [])
{
array_set($options, 'term', $term);

return $this->request->get('', $options);
}

/**
* Search from a specific field.
*
* @param $term
* @param $field_type
* @param $field_key
* @param array $options
* @return Response
*/
public function searchFromField($term, $field_type, $field_key, $options = [])
{
$options = array_merge(compact('term', 'field_type', 'field_key'), $options);

return $this->request->get('field', $options);
}
}
4 changes: 3 additions & 1 deletion src/Resources/SearchResults.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

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

/**
* @deprecated
*/
class SearchResults extends Resource
{
/**
Expand Down

0 comments on commit a661261

Please sign in to comment.