Automattic\Wistia\Client::create_media PHP Method

create_media() public method

The API endpoint is different and the parameters are completely different. We need a new Client to handle this kind of requests.
public create_media ( string $file, array $query = [] ) : object
$file string
$query array
return object
    public function create_media($file, $query = [])
    {
        if (empty($file) || !file_exists($file)) {
            throw new WistiaException('Client error: A valid file path is required to create a media.');
        }
        $params = ['headers' => ['User-Agent' => 'Wistia PHP Wrapper/' . self::VERSION], 'multipart' => [['name' => 'api_password', 'contents' => $this->_token], ['name' => 'file', 'contents' => fopen($file, 'r')]]];
        if (!empty($query)) {
            foreach ($query as $name => $value) {
                $data = ['name' => $name, 'contents' => $value];
                if (!in_array($data, $params['multipart'])) {
                    array_push($params['multipart'], $data);
                }
            }
        }
        try {
            $response = $this->upload_client->request('POST', '', $params);
            $this->last_response_code = $response->getStatusCode();
            if ($response->getStatusCode() === 200 || $response->getStatusCode() === 400) {
                return json_decode($response->getBody()->getContents());
            } else {
                // Error 401 - API password probably wrong. Returns text/html
                return $response->getBody()->getContents();
            }
        } catch (TransferException $e) {
            return $e->getCode();
        }
    }