From 2e7055aaa373c6331378cc696eba7fbaf0cbf02c Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Fri, 25 Nov 2022 14:00:18 -0800 Subject: [PATCH] sdk: update --- sdk/package-lock.json | 4 +- sdk/package.json | 2 +- sdk/types/package-lock.json | 4 +- sdk/types/package.json | 2 +- .../scrypted_python/scrypted_sdk/types.py | 24 +++-- sdk/types/src/types.input.ts | 99 ++++++++++++------- 6 files changed, 87 insertions(+), 48 deletions(-) diff --git a/sdk/package-lock.json b/sdk/package-lock.json index 0f5bea291..d3045f939 100644 --- a/sdk/package-lock.json +++ b/sdk/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/sdk", - "version": "0.2.12", + "version": "0.2.14", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/sdk", - "version": "0.2.12", + "version": "0.2.14", "license": "ISC", "dependencies": { "@babel/preset-typescript": "^7.16.7", diff --git a/sdk/package.json b/sdk/package.json index 27ebddfd2..3896d62db 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/sdk", - "version": "0.2.12", + "version": "0.2.14", "description": "", "main": "dist/src/index.js", "exports": { diff --git a/sdk/types/package-lock.json b/sdk/types/package-lock.json index e06d22786..945e9b485 100644 --- a/sdk/types/package-lock.json +++ b/sdk/types/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/types", - "version": "0.2.10", + "version": "0.2.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/types", - "version": "0.2.10", + "version": "0.2.11", "license": "ISC", "devDependencies": { "@types/rimraf": "^3.0.2", diff --git a/sdk/types/package.json b/sdk/types/package.json index b28563e86..663795ee3 100644 --- a/sdk/types/package.json +++ b/sdk/types/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/types", - "version": "0.2.10", + "version": "0.2.11", "description": "", "main": "dist/index.js", "author": "", diff --git a/sdk/types/scrypted_python/scrypted_sdk/types.py b/sdk/types/scrypted_python/scrypted_sdk/types.py index 7d1a5b5bf..66e27df7f 100644 --- a/sdk/types/scrypted_python/scrypted_sdk/types.py +++ b/sdk/types/scrypted_python/scrypted_sdk/types.py @@ -1145,17 +1145,29 @@ class MediaManager: pass class EndpointManager: - async def deliverPush(self, endpoint: str, request: HttpRequest) -> None: + async def deliverPush(self, id: str, request: HttpRequest) -> None: pass - async def getAuthenticatedPath(self) -> str: + async def getAuthenticatedPath(self, nativeId: str = None) -> str: pass - async def getInsecurePublicLocalEndpoint(self) -> str: + async def getCloudEndpoint(self, nativeId: str = None, options: Any = None) -> str: pass - async def getPublicCloudEndpoint(self) -> str: + async def getCloudPushEndpoint(self, nativeId: str = None) -> str: pass - async def getPublicLocalEndpoint(self) -> str: + async def getInsecurePublicLocalEndpoint(self, nativeId: str = None) -> str: pass - async def getPublicPushEndpoint(self) -> str: + def getLocalAddresses(self) -> list[str]: + pass + async def getLocalEndpoint(self, nativeId: str = None, options: Any = None) -> str: + pass + async def getPath(self, nativeId: str = None, options: Any = None) -> str: + pass + async def getPublicCloudEndpoint(self, nativeId: str = None) -> str: + pass + async def getPublicLocalEndpoint(self, nativeId: str = None) -> str: + pass + async def getPublicPushEndpoint(self, nativeId: str = None) -> str: + pass + async def setLocalAddresses(self, addresses: list[str]) -> None: pass pass diff --git a/sdk/types/src/types.input.ts b/sdk/types/src/types.input.ts index 831d4b6c3..7eb5e5b9c 100644 --- a/sdk/types/src/types.input.ts +++ b/sdk/types/src/types.input.ts @@ -511,7 +511,7 @@ export interface RequestMediaStreamOptions extends MediaStreamOptions { * Request an adaptive bitrate stream, if available. The destination * will need to report packet loss indication. */ - adaptive?: boolean; + adaptive?: boolean; } export interface MediaStreamPacketLoss { @@ -1329,60 +1329,87 @@ export interface Device { */ export interface EndpointManager { /** - * Get an URL pathname that can be accessed on your local network or cloud while authenticated. This is an absolute path that requires cookie authentication, and generally used only in browser contexts. - */ - getAuthenticatedPath(): Promise; - - /** - * Get an URL pathname that can be accessed on your local network or cloud while authenticated. This is an absolute path that requires cookie authentication, and generally used only in browser contexts. + * Get an URL pathname for a device that can be accessed with authentication. This is a relative path that can be used in browser sessions. + * @deprecated */ getAuthenticatedPath(nativeId?: ScryptedNativeId): Promise; /** - * Get an URL that can only be accessed on your local network by anyone with the link. HTTP requests and responses are without any encryption. Plugin implementation is responsible for authentication. - */ - getInsecurePublicLocalEndpoint(): Promise; - - /** - * Get an URL that can only be accessed on your local network by anyone with the link. HTTP requests and responses are without any encryption. Plugin implementation is responsible for authentication. - */ + * Get an URL that can only be accessed on your local network by anyone with the link. HTTP requests and responses are without any encryption. Plugin implementation is responsible for authentication. + * @deprecated + */ getInsecurePublicLocalEndpoint(nativeId?: ScryptedNativeId): Promise; - /** - * Get an URL that can be externally accessed by anyone with the link. Plugin implementation is responsible for authentication. - */ - getPublicCloudEndpoint(): Promise; - - /** - * Get an URL that can be externally accessed by anyone with the link. Plugin implementation is responsible for authentication. - */ - getPublicCloudEndpoint(nativeId?: ScryptedNativeId): Promise; - - /** - * Get an URL that can only be accessed on your local network by anyone with the link. HTTP requests and responses are over SSL with a self signed certificate. Plugin implementation is responsible for authentication. - */ - getPublicLocalEndpoint(): Promise; - /** * Get an URL that can only be accessed on your local network by anyone with the link. HTTP requests and responses are over SSL with a self signed certificate. Plugin implementation is responsible for authentication. + * @deprecated */ getPublicLocalEndpoint(nativeId?: ScryptedNativeId): Promise; /** * Get an URL that can be used to send a push message to the client. This differs from a cloud endpoint, in that, the Plugin does not send a response back. Plugin implementation is responsible for authentication. - */ - getPublicPushEndpoint(): Promise; - - /** - * Get an URL that can be used to send a push message to the client. This differs from a cloud endpoint, in that, the Plugin does not send a response back. Plugin implementation is responsible for authentication. + * @deprecated */ getPublicPushEndpoint(nativeId?: ScryptedNativeId): Promise; /** - * Deliver a push notification to the system. + * Get an URL that can be externally accessed by anyone with the link. Plugin implementation is responsible for authentication. + * @deprecated */ - deliverPush(endpoint: string, request: HttpRequest): Promise; + getPublicCloudEndpoint(nativeId?: ScryptedNativeId): Promise; + /** + * Get an URL pathname for a device that can be accessed without authentication. This is a relative path that can be used in browser sessions. + */ + getPath(nativeId?: ScryptedNativeId, options?: { + public?: boolean, + }): Promise; + + /** + * Get an URL that can only be accessed on your local network by anyone with the link. + */ + getLocalEndpoint(nativeId?: string, options?: { + /** + * A public endpoint that does not require authentication with the local Scrypted server. + */ + public?: boolean, + /** + * An insecure endpoint served by http, not https. + */ + insecure?: boolean, + }): Promise; + + /** + * Get an URL that can be externally accessed by anyone with the link. Plugin implementation is responsible for authentication. + * @deprecated + */ + getCloudEndpoint(nativeId?: ScryptedNativeId, options?: { + /** + * A public endpoint that does not require authentication with the local Scrypted server. + */ + public?: boolean, + }): Promise; + + /** + * Get an URL that can be used to send a push message to the client. This differs from a cloud endpoint, in that, the Plugin does not send a response back. + */ + getCloudPushEndpoint(nativeId?: ScryptedNativeId): Promise; + + /** + * Deliver a push notification to a device. Used by push providers. + */ + deliverPush(id: string, request: HttpRequest): Promise; + + /** + * Set the recommended local addresses used by Scrypted plugins that listen for incoming connections. + * @param addresses + */ + setLocalAddresses(...addresses: string[]): Promise; + + /** + * Get the recommended local addresess used by Scrypted plugins that listen for incoming connections. + */ + getLocalAddresses(): Promise[]; } /** * SystemManager is used by scripts to query device state and access devices.