kwent/syno

How to control the version in the request?

Opened this issue · 4 comments

First of all - thanks for implementing - that saved me a lot of work and its usage is really straight forward.

But I do have a question about the control of the request version (not that of the API). I am trying to enable/disable a camera based on an event. I know that the surveillance api has the possibility to since v3 (based on your _full.json)

By default it looks to me that it is always using v1 - because of this:
version = 'minVersion' in definitions[api] ? definitions[api].minVersion : 1;

So I changed the min version to 8, which actually helps me with this problem but opens up another one :) getInfoCamera changed its response data between those versions 1 and 8.

So what I am trying is to control the version on each request. So that I can go with v1 on getInfoCamera and with v8 on enableCamera/disableCamera.

Is that possible?
And what is the recommended way to enable a specific version - I don't think changing the minor version in the _full.json is the recommended one ;-)

Thanks and have a happy new year!
m.

kwent commented

Very interesting. It's true it's not possible for now.

I should be able to implement a flag to be able to control this version.

I also think it should be maxVersion by default and not minVersion.

Maybe an options array containing meta data for the request makes sense. Not sure if there will be ever more than a version to control...

Thanks.

kwent commented

What about ?

In JS

# For a call with API version 2
syno.api(2).method(params, callback);
# Call with last API version
syno.api.method(params, callback);

In CLI

# For a call with API version 2
syno api --version 2 method;
# For a call with las API version
syno api method;

wow - yeah that looks pretty cool and intuitive.
I vote +1 for that!