Add Contact

@param array $payload

@return mixed|ResponseInterface
772251
public function addContact(array $payload)
    {
        $query = [];
        $query['action_by'] = 'ACTION_BY_OWNER';

        $options = [
            'json'  => $payload,
            'query' => $query,
        ];

        return $response = $this->request('POST', 'contacts', $options);
    }
287934
public static function create(array $payload): self
    {
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $timestamp = $payload['timestamp'];
        $checkoutUpdate = CheckoutUpdate::create($payload['checkout_update']);

        return new static($senderId, $recipientId, $timestamp, $checkoutUpdate);
    }
744467
public static function create(array $payload): self
    {
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $timestamp = $payload['timestamp'];
        $payment = PreCheckout::create($payload['pre_checkout']);

        return new static($senderId, $recipientId, $timestamp, $payment);
    }
889460
public static function create(array $payload): self
    {
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        unset($payload['sender'], $payload['recipient']);

        return new static($senderId, $recipientId, $payload);
    }
419309
public static function create(array $payload): AbstractEvent
    {
        foreach (array_keys($payload) as $key) {
            if (\array_key_exists($key, self::EVENTS)) {
                $className = self::EVENTS[$key];
                if (isset($payload['message']['is_echo'])) {
                    $className = MessageEchoEvent::class;
                }

                return $className::create($payload);
            }
        }

        return RawEvent::create($payload);
    }
1018549
private function createRequest($method, array $payload)
    {
        $request = new Request(
            'POST',
            self::API_BASE_URL . $method,
            ['Content-Type' => 'application/x-www-form-urlencoded'],
            http_build_query($payload)
        );

        return $request;
    }
266278
public function update(int $vehicleId, array $payload): Response
    {
        $this->requiresAccessToken();

        return $this->sendJson(
            'PATCH', "vehicles/{$vehicleId}", $this->getApiHeaders(), $payload
        );
    }
438009
public static function create(array $payload): self
    {
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $delivery = Delivery::create($payload['delivery']);

        return new static($senderId, $recipientId, $delivery);
    }
1262829
public function setPayload($payload)
    {
        $this->payload = $payload;

        $this->setPayloadType(gettype($payload));

        if ($payload instanceof EntityDataModel) {
            $this->setPayloadType("EntityDataModel");
        }

        if ($payload instanceof EntityCollection) {
            $this->setPayloadType("EntityCollection");
            if ($payload->isPaginated()) {
                $this->setPayloadMeta([
                    'total' => $payload->getOriginalCount(),
                    'returned' => $payload->getCount(),
                    'page' => $payload->getPage(),
                    'perPage' => $payload->getPerPage()
                ]);
            }
        }

        return $this;
    }
265808
public static function createAuthenticationEvent(array $payload)
    {
        $optin = Optin::create($payload['optin']);
        $senderId = $payload['sender']['id'];
        $recipientId = $payload['recipient']['id'];
        $timestamp = $payload['timestamp'];

        return new AuthenticationEvent($senderId, $recipientId, $timestamp, $optin);
    }
481521
protected function addRequestInformation(&$payload)
    {
        if ($this->container->bound('request')) {
            $payload = array_merge($payload, [
                'ip_address' => $this->ipAddress(),
                'user_agent' => $this->userAgent(),
            ]);
        }

        return $this;
    }
214059
public function fillBlanks($payload)
    {
        $fields = ['doi', 'url', 'message', 'verbosemessage', 'responsecode', 'app_id'];
        foreach ($fields as $field) {
            if (!array_key_exists($field, $payload)) {
                $payload[$field] = "";
            }
        }
        return $payload;
    }
299397
protected function push($url, array $payload, array $headers)
    {
        $request = [
            'headers' => array_merge(
                ['Content-Type' => 'application/json'],
                $headers
            ),
            'json'       => $payload,
            'exceptions' => false,
        ];

        $this->request('put', $url, $request);
    }
1187023
public function pushRaw($payload, $queue = null, array $options = [])
	{
		$response = $this->sqs->sendMessage(['QueueUrl' => $this->getQueue($queue), 'MessageBody' => $payload]);

		return $response->get('MessageId');
	}
652531
public function add(array $data)
    {
        $data = $this->resolverFactory->createNotificationResolver()->resolve($data);

        return $this->api->request('POST', '/notifications', [
            'Authorization' => 'Basic '.$this->api->getConfig()->getApplicationAuthKey(),
        ], json_encode($data));
    }
1053459
protected function handlePayload($payload)
    {
        if(is_null($payload)) {
            return $this->buildEmptyResponse();
        }

        if(is_bool($payload)) {
            return $this->buildEmptyResponse();
        }

        if(is_string($payload)) {
            return $this->buildStringResponse($payload);
        }

        return $this->isIlluminateResource($payload)
            ? $this->buildResponse($payload) 
            : $this->buildResponse($this->intoResource($payload));
    }
1367864
public function respond($payload = [])
    {
        if ($meta = $this->getMeta()) {
            $payload = array_merge(
                $payload,
                ['meta' => $meta]
            );
        }

        if (config('api.convert')) {
            $payload = PayloadConverter::run($payload);
        }

        $statusCode = (config('api.suppress_response_code') === true)
            ? StatusCode::OK : $this->getStatusCode();

        return (! $callback = $this->request->input('callback'))
            ? $this->response->json(
                $payload,
                $statusCode,
                $this->getHeaders(),
                config('api.jsonEncodeOption')
            )
            : $this->response->jsonp(
                $callback,
                $payload,
                $statusCode,
                $this->getHeaders()
            );
    }