Giter VIP home page Giter VIP logo

kaltura / clients-generator Goto Github PK

View Code? Open in Web Editor NEW
19.0 52.0 39.0 28.47 MB

Kaltura API Client Libraries Generator - PHP source code introspection based automation for API native SDKs generation for various programming languages and API platforms

Home Page: https://developer.kaltura.com/api-docs/Client_Libraries/

License: GNU Affero General Public License v3.0

PHP 13.15% Java 15.28% ActionScript 1.39% Shell 0.13% C# 45.67% Erlang 0.10% JavaScript 3.92% Objective-C 8.90% Python 1.14% Ruby 0.98% CSS 0.21% HTML 0.48% Batchfile 0.01% Swift 2.04% TypeScript 6.12% C 0.02% Go 0.47%
api kaltura client libraries api-client api-management sdk php

clients-generator's People

Contributors

amirch1 avatar arthurvaverko-kaltura avatar atarsh avatar blitzkrig1o1 avatar ccorbacho avatar chausov avatar danbar0kal avatar erankor avatar eransakal avatar esakal avatar flipmcf avatar gilgaldi avatar gonenradai avatar gotlieb avatar hilak avatar inbal-ben-david avatar jessp011 avatar moshemaorkaltura avatar muli avatar noam-arad avatar noamtamim avatar ravitshalem avatar rkreich avatar shirbruchim avatar srivkas avatar tehilar avatar vstatkevich avatar x-nr-x avatar yossipapi avatar zoharbabin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clients-generator's Issues

AttributeError: 'PluginServicesProxy' object has no attribute 'add'

Running a python-script on a Debian 9 server. Have tested on several servers. Also tested on MacOS. Same result.

I keep getting this error:

Traceback (most recent call last):
  File "test.py", line 20, in <module>
    result = client.bulkUpload.add(conversion_profile_id, csv_file_data, bulk_upload_type, uploaded_by, file_name)
AttributeError: 'PluginServicesProxy' object has no attribute 'add'
  • Python 3.8.1 (it works on some Python 2.7 installs - others not)
  • pip install KalturaApiClient (connecting to Kaltura SaaS)
  • Funny thing is: It always works when using sudo eg. "sudo python test.py"
  • Python is installed correctly and all other Kaltura API functionality seems to be working.
from KalturaClient import *
from KalturaClient.Plugins.Core import *

config = KalturaConfiguration()
config.serviceUrl = "https://www.kaltura.com/"
client = KalturaClient(config)
ks = client.session.start(
      "",
      "",
      KalturaSessionType.ADMIN,
     )
client.setKs(ks)

conversion_profile_id = -1
csv_file_data = open('tvmidtvest-16621f84-d85c-4e9a-a420-76c6eb3a7b7e.xml', 'rb')
bulk_upload_type = KalturaBulkUploadType.XML
uploaded_by = ""
file_name = "tvmidtvest-16621f84-d85c-4e9a-a420-76c6eb3a7b7e.xml"

result = client.bulkUpload.add(conversion_profile_id, csv_file_data, bulk_upload_type, uploaded_by, file_name)
print(result)

captionAsset.serve and captionAsset.serveAsJson do not exist as a function

We are using the node js version of this package in our company to interact with kaltura and we wanted to obtain the captions of specific videos(using captionAsset.list as an intermediate step).
From what we've seen in the api docs there are 2 different endpoints that do this:

  1. https://developer.kaltura.com/api-docs/service/captionAsset/action/serveAsJson
  2. https://developer.kaltura.com/api-docs/service/captionAsset/action/serve

But when we used them it said that they do not exist as a function. I looked at the kalturaServices.js in the node modules and indeed this functions do not exists, we can use the getUrl to get a download link but if possible we would prefer a more direct action, specially since they appear in the api docs.

Kaltura PHP5 API Client uses curl_exec without proper validation.

Security scans indicate that the code snippet is vulnerable for XSS attack without sanitization of data for the cURL request.

KalturaClient/KalturaClientBase.php -- line 588, 643


// Set custom headers
curl_setopt($ch, CURLOPT_HTTPHEADER, $requestHeaders);

// Save response headers
curl_setopt($ch, CURLOPT_HEADERFUNCTION, array($this, 'readHeader') );

$destinationResource = null;
if($this->destinationPath)
{
	$destinationResource = fopen($this->destinationPath, "wb");
	curl_setopt($ch, CURLOPT_FILE, $destinationResource);
}
else
{
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
}

$result = curl_exec($ch);

if($destinationResource)
	fclose($destinationResource);

$curlError = curl_error($ch);
curl_close($ch);
return array($result, $curlError);

License of generated code

Under which license would the generated client lib fall. Would this also be GPL 3 or a different one?

Error in node type for deliveryProfileIds in client.accessControlProfile.list

When calling client.accessControlProfile.list() I get an error saying KalturaClientException: Unexpected object type 'KalturaStringValue' (-7)

Checking the code, in KalturaClient.Plugins.Core L30974 there's this:

    PROPERTY_LOADERS = {
        'deliveryProfileIds': (KalturaObjectFactory.createArray, KalturaIntegerValue), 
    }

but the API response looks like this:

              <conditions>
...
                <deliveryProfileIds>
                  <item>
                    <objectType>KalturaStringValue</objectType>
                    <value>6002</value>
                    <description/>
                    <relatedObjects/>
                  </item>
                  <item>
                    <objectType>KalturaStringValue</objectType>
                    <value>6132</value>
                    <description/>
                    <relatedObjects/>
                  </item>
                </deliveryProfileIds>
...
              </conditions>

We're using the Kaltura SaaS, the API client version is the git version, latest master branch as of this date (commit 1ae5dfa)

'KalturaClient' object has no attribute 'elasticsearch'

Issue

Running the eSearch example from the API Console in Python 3.7.3 (and any Python 3 env) I get the error

'KalturaClient' object has no attribute 'elasticsearch'

form the line

client.elasticsearch.eSearch.searchEntry(search_params, pager)

Example Code

Below is the example code, running without issue, from the API Console

from KalturaClient import *
from KalturaClient.Plugins.Core import *
from KalturaClient.Plugins.ElasticSearch import *

config = KalturaConfiguration()
config.serviceUrl = "https://www.kaltura.com/"
client = KalturaClient(config)
ks = client.session.start(
      "YOUR_KALTURA_SECRET",
      "YOUR_USER_ID",
      KalturaSessionType.ADMIN,
      YOUR_PARTNER_ID)
client.setKs(ks)

search_params = KalturaESearchEntryParams()
search_params.searchOperator = KalturaESearchEntryOperator()
search_params.searchOperator.searchItems = []
search_params.searchOperator.searchItems[0] = KalturaESearchEntryItem()
search_params.searchOperator.searchItems[0].fieldName = KalturaESearchEntryFieldName.NAME
search_params.searchOperator.searchItems[0].itemType = KalturaESearchItemType.PARTIAL
search_params.searchOperator.searchItems[0].searchTerm = "SEARCH TERM"
pager = KalturaPager()

result = client.elasticsearch.eSearch.searchEntry(search_params, pager)
print(result)

NB:

This section from the API docs

search_params.searchOperator.searchItems = []
search_params.searchOperator.searchItems[0] = KalturaESearchEntryItem()

also fails with:

    search_params.searchOperator.searchItems[0] = KalturaESearchEntryItem()
IndexError: list assignment index out of range

Though the solution is trivial, it is maybe worth clearing this up.

PHP 8.1+ compatibility

I recently updated our project to php 8.1
We use composer require kaltura/api-client-library in our project, so we use https://github.com/kaltura/KalturaGeneratedAPIClientsPHP53 by extension. However that repository is autogenerated by this one as I understand, so filing a PR there is not going to be a solution, instead we should do something at the source.
Unfortunately I don't understand enough how the autogeneration is working in order to create a PR for it.

So instead I file an issue here to at least track this.

The issue is we get a lot of deprecation warnings even for the most simple media query.
Most of them are:

Deprecated function: ksort(): Passing null to parameter #2 ($flags) of type int is deprecated in Kaltura\Client\Base->ksortRecursive() (line 270 of /var/www/html/vendor/kaltura/api-client-library/library/Kaltura/Client/Base.php). 
Deprecated function: reset(): Calling reset() on an object is deprecated in Kaltura\Client\ParseUtils::unmarshalObject() (line 48 of /var/www/html/vendor/kaltura/api-client-library/library/Kaltura/Client/ParseUtils.php). 

Feature request - action execution callbacks

Hi there!

I'd like to contribute an enhancement to php client libraries - add callback arguments to service action methods that will be executed only when the response comes from the server (also in the case of the multi-request). It will allow to write a code that is agnostic to the multi-request mode (works the same way inside and outside of a multi-request).

Before starting to work on the pull request, I wonder if there are some concerns about adding this functionality.

Technical details:

  • add $onSuccess and $onError optional arguments to service action methods that support multi-requests (so, for instance, function update($entryId, \Kaltura\Client\Type\BaseEntry $baseEntry) will become function update($entryId, \Kaltura\Client\Type\BaseEntry $baseEntry, $onSuccess = null, $onError = null))
  • these new arguments will receive callbacks that will be executed by the client library when the response comes from the server:
    • when executing a single API request, the callback will be called immediately after the request execution
    • when adding an API request to a multi-request queue, the callback will be executed only after performing the multi-request and will receive the result of the relevant multi-request item as an argument
  • when callbacks are not specified or empty, the client library will work exactly as it did before

So, that way, service action method will become a kind of a promise, and the code will be written in the following way:

$someService->someAction(
    $anArgument, $anotherArgument,
    function(ActionResponseType $response) {
        doSomethingWithResponse($response);
    }
)

and this code will behave exactly the same way when executing it inside or outside of a multi-request.

Thanks,
Yura.

NameError: name 'KalturaBulkUploadXmlJobData' is not defined

I'm getting an error when I'm trying to upload an xml to Kaltura Saas via API. See code below.

Note: If I use KalturaBulkUploadJobData() instead of KalturaBulkUploadXmlJobData() the xml-file is imported (I can see it in the KMS), but it interprets it as a csv, so that obviously doesn't work. The code example from https://developer.kaltura.com/api-docs/service/media/action/bulkUploadAdd

If I upload the xml-file manually via KMS or via https://developer.kaltura.com/api-docs/service/media/action/bulkUploadAdd it works fine.

Python versions: 3.5.9, 3.7.6, 3.8.1 (also tested on Python 2)
OS: Debian 9, Debian 8, MacOS (have tested on several different servers)
Client API version: KalturaApiClient-15.14.0

test.py:

from KalturaClient import *
from KalturaClient.Plugins.Core import *

config = KalturaConfiguration([removed])
config.serviceUrl = "https://www.kaltura.com/"
client = KalturaClient(config)
ks = client.session.start(
      "[removed]",
      "[removed]",
      KalturaSessionType.ADMIN,
     [removed])
client.setKs(ks)

file_name = "tvmidtvest-d472d2f9-a004-4ae1-8795-1885674a63d7.xml"

file_data = open(file_name, 'rb')

bulk_upload_data = KalturaBulkUploadXmlJobData()
bulk_upload_entry_data = KalturaBulkUploadEntryData()

result = client.media.bulkUploadAdd(file_data)

print(result)

Error:

Traceback (most recent call last):
  File "test.py", line 18, in <module>
    bulk_upload_data = KalturaBulkUploadXmlJobData()
NameError: name 'KalturaBulkUploadXmlJobData' is not defined

Python KalturaClient throws a SyntaxError during initialization

This appears to be an issue with the version 17.5.0. When initializing the KalturaClient the following SyntaxError is raised:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/KalturaClient/Client.py", line 132, in __init__
    self.loadPlugins()
  File "/usr/local/lib/python3.9/site-packages/KalturaClient/Client.py", line 165, in loadPlugins
    self.loadPlugin(pluginFile)
  File "/usr/local/lib/python3.9/site-packages/KalturaClient/Client.py", line 169, in loadPlugin
    pluginModule = __import__('.'.join(moduleHierarchy))
  File "/usr/local/lib/python3.9/site-packages/KalturaClient/Plugins/Reach.py", line 2536
    def __init__(self,
    ^
SyntaxError: duplicate argument 'expectedFinishTimeGreaterThanOrEqual' in function definition

Looking at the source it appears that expectedFinishTimeGreaterThanOrEqual and expectedFinishTimeLessThanOrEqual are both being defined twice: https://github.com/kaltura/KalturaGeneratedAPIClientsPython/blob/39a9a04b212da02389241fbdf5a28a330dbe9060/KalturaClient/Plugins/Reach.py#L2561-L2565

I was able to reproduce the error in a clean python docker image:

$ docker run --entrypoint='/bin/bash' -it python:latest
$ pip install kalturaapiclient==17.5.0
$ python
>>> from KalturaClient import KalturaClient, KalturaConfiguration
>>> config = KalturaConfiguration(12345)
>>> client = KalturaClient(config)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/KalturaClient/Client.py", line 132, in __init__
    self.loadPlugins()
  File "/usr/local/lib/python3.9/site-packages/KalturaClient/Client.py", line 165, in loadPlugins
    self.loadPlugin(pluginFile)
  File "/usr/local/lib/python3.9/site-packages/KalturaClient/Client.py", line 169, in loadPlugin
    pluginModule = __import__('.'.join(moduleHierarchy))
  File "/usr/local/lib/python3.9/site-packages/KalturaClient/Plugins/Reach.py", line 2536
    def __init__(self,
    ^
SyntaxError: duplicate argument 'expectedFinishTimeGreaterThanOrEqual' in function definition

DotNet Core Support

I am wanting to use the .NET client on a dotnetcore 2.0 app. However the library available on the Native Client libraries page does not appear to support it. The posted libraries are in fact over a year old (http://cdnbakmi.kaltura.com/content/clientlibs/csharp_02-10-2017.tar.gz). I see netstandard 2.0 was merged back in Feb 2018. I understand that I can install the whole Kaltura server stack and run client-generator, however that seems like quite a task. When will the the posted libraries be updated.

Regarding the Errors of "clients-generator"

Hi there,

I just download the "clients-generator" and have it a try. I ran into a error after compiling this project. I list out the error as following:

image

does anyone have any ideas on it.?? and what is the MASTER_DEVICE_BRAND = @MASTER_DEVICE_BRAND@;
IMPERSONATION_TEST_USER_ID = @IMPERSONATION_TEST_USER_ID@;
Thanks

Support for Python3

KalturaClient for Python doesn't support Python3 at the moment. The typical problems are:

  1. Relative imports: from Core import *. It can be replaced with from .Core import *
  2. Calling some_dict.has_key(key) for dictionaries. This can be replaced with key in some_dict
  3. except AttributeError, e syntax it try/except blocks. This can be replaced with except AttributeError as e
  4. Using map to produce a list. map returns a generator object in Python3. If it's necessary to have a list, list comprehensions can be used instead: [func(item) for item in iterable]
  5. Using print statement. This can be replaced with print("foo") (works in both Python 2 and 3)

Exception when adding streams to KalturaMediaEntry

Using python==3.6
KalturaClientApi==15.20

I want to define audio tracks to the uploaded video by adding streams in KalturaMediaEntry.streams, but i got
exception: 'dict' object has no attribute 'toParams' in addObjectIfDefined function in KalturaClient/Base.py at line 113
Here is the used snipt:

media_entry = KalturaMediaEntry()
media_entry.mediaType = KalturaMediaType.VIDEO
media_entry.name = video.name
media_entry.description = video.description
media_entry.categories = ",".join(map(str, video.categories))
media_entry.tags = ",".join(map(str, video.tags))
media_entry.accessControlId = video.access_control_id
media_entry.streams = [{"type": "audio", "trackIndex": 1, "language": "kor"}]
result = sesion.media.addFromUrl(media_entry, video.url)

Although we are using this code to upload single video to Kaltura without any problems (without defining the streams property).

csharp client does not build

Trying to build the latest KalturaClient that supports 14.10 and higher and it does not build in Visual Studio 2012. Or probably any other Visual Studio version.

The issues seems to be that Kaltura.Types.ObjectBase.ParseEnum() is missing a parameter as many locations in the code seem to want to pass it an int where it expects a string.

You should be able to reproduce by just trying to build it.

Thanks

PHP String could not be parsed as XML

Hi,

We are using "kaltura/api-client-library": "^v18.1.0",
and found this error

String could not be parsed as XML

#0 /vendor/kaltura/api-client-library/library/Kaltura/Client/Service/SearchService.php(106): SimpleXMLElement->__construct()
#1 Kaltura\Client\Service\SearchService->search()

it happens when we call
$searchResults = $this->initializeClient()->getSearchService()->search($search, $pager);
the initializeClient method returns instance of vendor/kaltura/api-client-library/library/Kaltura/Client/Client.php

$this->client->doQueue(); returns something that can't be handled by new \SimpleXMLElement constructor.

image

Would it be too difficult to add some verification?

Unguarded use of JSON.parse in node client

Hi there!

We're on the older, crustier, client: https://www.npmjs.com/package/kaltura. However, we believe this bug might exist in the modern client, too: https://www.npmjs.com/package/kaltura-client.

We're getting runtime errors when the Kaltura server returns HTML instead of JSON. The JSON.parse calls in e.g. KalturaClientBase cause exceptions like (note that these are coming from the old client):

SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at IncomingMessage.<anonymous> (/home/backend/node_modules/kaltura/KalturaClientBase.js:394:20)
    at IncomingMessage.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1085:12)
    at process._tickCallback (internal/process/next_tick.js:63:19

We are planning to patch our systems with try/catches - just a heads-up in case you're unaware!

Gson Reflection in Java 17 Compatibility

Hi guys, I encountered a compatibility issue when recently migrating to Java 17. There is an exception related to the use of the Gson library when it tries to parse exception

com.google.gson.JsonIOException: Failed making field 'java.lang.Throwable#detailMessage' accessible; either change its visibility or write a custom TypeAdapter for its declaring type at com.google.gson.internal.reflect.ReflectionHelper.makeAccessible(ReflectionHelper.java:23) ~[gson-2.9.1.jar:na] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:203) ~[gson-2.9.1.jar:na] at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:112) ~[gson-2.9.1.jar:na] at com.google.gson.Gson.getAdapter(Gson.java:531) ~[gson-2.9.1.jar:na] at com.google.gson.Gson.fromJson(Gson.java:1057) ~[gson-2.9.1.jar:na] at com.google.gson.Gson.fromJson(Gson.java:1129) ~[gson-2.9.1.jar:na] at com.google.gson.Gson.fromJson(Gson.java:1101) ~[gson-2.9.1.jar:na] at com.kaltura.client.utils.GsonParser.parseException(GsonParser.java:283) ~[kalturaApiClient-19.3.0.jar:na]

As java 17's strengthened encapsulation model that restricts reflective access to internal APIs, impacting Gson's ability to serialize and deserialize exception details.

Regarding the Error Of "Clients-Generator"

@kaltura-hooks

I just download the "clients-generator" and have it a try. I ran into a error after compiling this project. I list out the error as following:

image

does anyone have any ideas on it.?? and what is the MASTER_DEVICE_BRAND = @MASTER_DEVICE_BRAND@;
IMPERSONATION_TEST_USER_ID = @IMPERSONATION_TEST_USER_ID@; Thanks


@kaltura-hooks

your question:

Is the issue you're experiencing consistent and across platforms? or does it only happens on certain conditions? please provide as much details as possible.
Ans: I am a new player on Kaltura Product. so I just want to download this project to try how to upload the videos into the Kaltura.

Which Kaltura deployment you're using: Kaltura SaaS, or self-hosted?
Ans: It should be a SaaS. because I apply new account to have it a try today morning.

If self hosted, are you using the RPM or deb install?
Ans: I have no idea.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.