<?php

/**
 * This code was generated by
 * ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
 *  |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
 *  |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
 *
 * Twilio Memory API
 * APIs for managing memory stores, profiles, events, and conversational intelligence capabilities.
 *
 * NOTE: This class is auto generated by OpenAPI Generator.
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace Twilio\Rest\Memory\V1;

use Twilio\Exceptions\TwilioException;
use Twilio\ListResource;
use Twilio\Options;
use Twilio\Values;
use Twilio\Version;
use Twilio\ApiV1Version;
use Twilio\Http\Response;
use Twilio\Metadata\ResourceMetadata;


class RecallList extends ListResource
    {
    /**
     * Construct the RecallList
     *
     * @param Version $version Version that contains the resource
     */
    public function __construct(
        Version $version
    ) {
        $apiV1Version = new ApiV1Version($version->getDomain(), $version->version);
        parent::__construct($apiV1Version);

        // Path Solution
        $this->solution = [
        ];
    }

    /**
     * Helper function for Create
     *
     
     
     * @param MemoryRetrievalRequest $memoryRetrievalRequest
     
     * @param array|Options $options Optional Arguments
     * @return Response Created Response
     * @throws TwilioException When an HTTP error occurs.
     */
    private function _create(string $storeId, string $profileId, MemoryRetrievalRequest $memoryRetrievalRequest, array $options = []): Response
    {
        
        $uri = '/Stores/' . \rawurlencode($storeId)
        .'/Profiles/' . \rawurlencode($profileId)
        .'/Recall';
        
        $options = new Values($options);

        $headers = Values::of(['Content-Type' => 'application/json', 'Accept' => 'application/json' , 'Accept-Encoding' => $options['acceptEncoding'], 'Content-Encoding' => $options['contentEncoding']]);
        $data = $memoryRetrievalRequest->toArray();
        return $this->version->handleRequest('POST', $uri, [], $data, $headers, "create");
    }

    /**
     * Create the MemoryRetrievalResponseInstance
     *
     
     
     * @param MemoryRetrievalRequest $memoryRetrievalRequest
     
     * @param array|Options $options Optional Arguments
     * @return MemoryRetrievalResponseInstance Created MemoryRetrievalResponseInstance
     * @throws TwilioException When an HTTP error occurs.
     */
    public function create(string $storeId, string $profileId, MemoryRetrievalRequest $memoryRetrievalRequest, array $options = []): MemoryRetrievalResponseInstance
    {
        $response = $this->_create($storeId, $profileId,  $memoryRetrievalRequest, $options);
        return new MemoryRetrievalResponseInstance(
            $this->version,
            $response->getContent(),
            $storeId,
            $profileId
        );
        
    }

    /**
     * Create the MemoryRetrievalResponseInstance with Metadata
     *
     
     
     * @param MemoryRetrievalRequest $memoryRetrievalRequest
     
     * @param array|Options $options Optional Arguments
     * @return ResourceMetadata The Created Resource with Metadata
     * @throws TwilioException When an HTTP error occurs.
     */
    public function createWithMetadata(string $storeId, string $profileId, MemoryRetrievalRequest $memoryRetrievalRequest, array $options = []): ResourceMetadata
    {
        $response = $this->_create($storeId, $profileId,  $memoryRetrievalRequest, $options);
        $resource = new MemoryRetrievalResponseInstance(
                        $this->version,
                        $response->getContent(),
                        $storeId,
                        $profileId
                    );
        
        return new ResourceMetadata(
            $resource,
            $response->getStatusCode(),
            $response->getHeaders()
        );
    }


    /**
     * Provide a friendly representation
     *
     * @return string Machine friendly representation
     */
    public function __toString(): string
    {
        return '[Twilio.Memory.V1.RecallList]';
    }
}
