jamseyp /
live-person
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Created by PhpStorm. |
||
| 4 | * User: james |
||
| 5 | * Date: 20/07/2018 |
||
| 6 | * Time: 11:38 |
||
| 7 | */ |
||
| 8 | |||
| 9 | namespace CwsOps\LivePerson\Services; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Class EngagementService |
||
| 13 | * |
||
| 14 | * @package CwsOps\LivePerson\Services |
||
| 15 | */ |
||
| 16 | class EngagementService extends AbstractService |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * Gets the interaction history. |
||
| 20 | * |
||
| 21 | * @see https://developers.liveperson.com/data-engagement-history-methods.html |
||
| 22 | * |
||
| 23 | * @param \DateTime $start the start time of the request |
||
| 24 | * @param \DateTime $end the end time of the request |
||
| 25 | * @param array $skillIds an array of skills |
||
| 26 | * @param int $limit the limit to set. default is 50 max is 100 |
||
| 27 | * @param int $offset the offset of the query. |
||
| 28 | * |
||
| 29 | * @throws \CwsOps\LivePerson\Rest\BuilderLockedException |
||
| 30 | * @throws \CwsOps\LivePerson\Rest\URLNotBuiltException |
||
| 31 | */ |
||
| 32 | public function interactionHistory(\DateTime $start, \DateTime $end, array $skillIds = [], int $limit = 50, int $offset = 0) |
||
| 33 | { |
||
| 34 | if ($limit < 0 || $limit > 100) { |
||
| 35 | throw new \InvalidArgumentException(sprintf('$limit can only be value between 0 and 100')); |
||
| 36 | } |
||
| 37 | |||
| 38 | $this->urlBuilder = $this->request->buildUrl($this->getDomain()) |
||
|
0 ignored issues
–
show
|
|||
| 39 | ->setService($this->getService()) |
||
| 40 | ->setAccount($this->config->getAccountId()) |
||
| 41 | ->setAction('interactions/search') |
||
| 42 | ->hasQueryParam(true) |
||
| 43 | ->addQueryParam('limit', $limit) |
||
| 44 | ->addQueryParam('offset', $offset) |
||
| 45 | ->build() |
||
| 46 | ->getUrl(); |
||
| 47 | |||
| 48 | $payload = [ |
||
| 49 | 'interactive' => false, |
||
| 50 | 'ended' => false, |
||
| 51 | 'start' => [ |
||
| 52 | 'from' => $this->dateTimeToMilliseconds($start), |
||
| 53 | 'to' => $this->dateTimeToMilliseconds($end), |
||
| 54 | ], |
||
| 55 | 'skillIds' => $skillIds |
||
| 56 | ]; |
||
| 57 | |||
| 58 | $this->handle($payload); |
||
| 59 | } |
||
| 60 | |||
| 61 | |||
| 62 | /** |
||
| 63 | * @codeCoverageIgnore |
||
| 64 | * |
||
| 65 | * Should provide the Live person service, this service will query against |
||
| 66 | * |
||
| 67 | * @return string |
||
| 68 | */ |
||
| 69 | protected function getDomain(): string |
||
| 70 | { |
||
| 71 | return 'engHistDomain'; |
||
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Should provide the Live Person service the service will query against. |
||
| 76 | * |
||
| 77 | * @return string |
||
| 78 | */ |
||
| 79 | protected function getService(): string |
||
| 80 | { |
||
| 81 | return 'interaction_history'; |
||
| 82 | } |
||
| 83 | } |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..