<?php

/**
 * This code was generated by
 * ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
 *  |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
 *  |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \
 *
 * Twilio API definition for public-api voice
 * Powers Twilio public-api voice
 *
 * NOTE: This class is auto generated by OpenAPI Generator.
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace Twilio\Rest\Voice\V3;

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 TranscriptionList extends ListResource
    {
    /**
     * Construct the TranscriptionList
     *
     * @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 CreateV3TranscriptionsRequest $createV3TranscriptionsRequest
     
     * @param array|Options $options Optional Arguments
     * @return Response Created Response
     * @throws TwilioException When an HTTP error occurs.
     */
    private function _create(CreateV3TranscriptionsRequest $createV3TranscriptionsRequest, array $options = []): Response
    {
        
        $uri = '/Transcriptions';
        
        $options = new Values($options);

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

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

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


    /**
     * Constructs a TranscriptionContext
     *
     * @param string $transcriptionId The unique identifier of the transcription to fetch
     */
    public function getContext(
        string $transcriptionId
        
    ): TranscriptionContext
    {
        return new TranscriptionContext(
            $this->version,
            $transcriptionId
        );
    }

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