@seamapi/nextlove-sdk-generator
Advanced tools
Comparing version 1.6.1 to 1.6.2
@@ -46,17 +46,20 @@ export class ClassFile { | ||
: []) | ||
.map(({ method_name, parameters }) => [ | ||
"", | ||
"", | ||
`@abc.abstractmethod`, | ||
`def ${method_name}(self, ${parameters | ||
.sort((a, b) => (a.position ?? a.required ? 1000 : 9999) - | ||
(b.position ?? b.required ? 1000 : 9999)) | ||
.map(({ name, type, required, default_value }) => required | ||
? `${name}: ${type}` | ||
: `${name}: Optional[${type}] = ${default_value ?? "None"}`) | ||
.join(", ")}):`, | ||
` raise NotImplementedError()`, | ||
] | ||
.map((s) => ` ${s}`) | ||
.join("\n")), | ||
.map(({ method_name, parameters, return_resource }) => { | ||
const has_params = parameters.length > 0; | ||
return [ | ||
"", | ||
"", | ||
`@abc.abstractmethod`, | ||
`def ${method_name}(self,${has_params ? " *," : ""} ${parameters | ||
.sort((a, b) => (a.position ?? a.required ? 1000 : 9999) - | ||
(b.position ?? b.required ? 1000 : 9999)) | ||
.map(({ name, type, required, default_value }) => required | ||
? `${name}: ${type}` | ||
: `${name}: Optional[${type}] = ${default_value ?? "None"}`) | ||
.join(", ")}) -> ${return_resource}:`, | ||
` raise NotImplementedError()`, | ||
] | ||
.map((s) => ` ${s}`) | ||
.join("\n"); | ||
}), | ||
].join("\n"); | ||
@@ -111,6 +114,7 @@ } | ||
const is_none_return_type = return_resource_item === "None"; | ||
const has_params = parameters.length > 0; | ||
return [ | ||
"", | ||
"", | ||
`def ${method_name}(self, ${parameters | ||
`def ${method_name}(self,${has_params ? " *," : ""} ${parameters | ||
.sort((a, b) => (a.position ?? a.required ? 1000 : 9999) - | ||
@@ -141,3 +145,3 @@ (b.position ?? b.required ? 1000 : 9999)) | ||
` updated_action_attempt = self.seam.action_attempts.poll_until_ready(`, | ||
" res['action_attempt']['action_attempt_id'],", | ||
" action_attempt_id=res['action_attempt']['action_attempt_id'],", | ||
" timeout=wait_for_action_attempt.get('timeout', None),", | ||
@@ -148,3 +152,3 @@ " polling_interval=wait_for_action_attempt.get('polling_interval', None),", | ||
` updated_action_attempt = self.seam.action_attempts.poll_until_ready(`, | ||
" res['action_attempt']['action_attempt_id']", | ||
" action_attempt_id=res['action_attempt']['action_attempt_id']", | ||
" )", | ||
@@ -172,7 +176,7 @@ " else:", | ||
"", | ||
" def poll_until_ready(self, action_attempt_id: str, timeout: Optional[float] = 5.0, polling_interval: Optional[float] = 0.5) -> ActionAttempt:", | ||
" def poll_until_ready(self, *, action_attempt_id: str, timeout: Optional[float] = 5.0, polling_interval: Optional[float] = 0.5) -> ActionAttempt:", | ||
" seam = self.seam", | ||
" time_waiting = 0.0", | ||
"", | ||
" action_attempt = seam.action_attempts.get(action_attempt_id, wait_for_action_attempt=False)", | ||
" action_attempt = seam.action_attempts.get(action_attempt_id=action_attempt_id, wait_for_action_attempt=False)", | ||
"", | ||
@@ -187,3 +191,3 @@ " while action_attempt.status == 'pending':", | ||
" action_attempt = seam.action_attempts.get(", | ||
" action_attempt.action_attempt_id, wait_for_action_attempt=False", | ||
" action_attempt_id=action_attempt.action_attempt_id, wait_for_action_attempt=False", | ||
" )", | ||
@@ -190,0 +194,0 @@ "", |
@@ -23,3 +23,3 @@ export default () => `# Seam for Python | ||
seam.locks.lock_door(some_lock) | ||
seam.locks.lock_door(device_id=some_lock.device_id) | ||
\`\`\` | ||
@@ -26,0 +26,0 @@ |
@@ -22,4 +22,6 @@ export default () => `import os | ||
API key (default None) | ||
api_url : str | ||
API url (default None) | ||
api_url : str | ||
API url (default "https://connect.getseam.com") | ||
lts_version : str | ||
LTS version | ||
workspaces : Workspaces | ||
@@ -45,2 +47,3 @@ Workspaces class | ||
api_url: str = "https://connect.getseam.com" | ||
lts_version: str = '1.0.0' | ||
@@ -50,2 +53,3 @@ def __init__( | ||
api_key: Optional[str] = None, | ||
*, | ||
workspace_id: Optional[str] = None, | ||
@@ -79,2 +83,3 @@ api_url: Optional[str] = None, | ||
self.workspace_id = workspace_id | ||
self.lts_version = Seam.lts_version | ||
@@ -127,2 +132,3 @@ if os.environ.get("SEAM_API_URL", None) is not None: | ||
"seam-sdk-version": sdk_version, | ||
"seam-lts-version": self.lts_version, | ||
} | ||
@@ -129,0 +135,0 @@ if self.workspace_id is not None: |
@@ -6,2 +6,3 @@ export default () => `@dataclass | ||
api_url: str | ||
lts_version: str | ||
@@ -8,0 +9,0 @@ @abc.abstractmethod |
{ | ||
"name": "@seamapi/nextlove-sdk-generator", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"description": "Utilities for building NextLove SDK Generators", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -93,8 +93,10 @@ export type ClassFileMethodBase = { | ||
) | ||
.map(({ method_name, parameters }) => | ||
[ | ||
.map(({ method_name, parameters, return_resource }) => { | ||
const has_params = parameters.length > 0 | ||
return [ | ||
"", | ||
"", | ||
`@abc.abstractmethod`, | ||
`def ${method_name}(self, ${parameters | ||
`def ${method_name}(self,${has_params ? " *," : ""} ${parameters | ||
.sort( | ||
@@ -110,3 +112,3 @@ (a, b) => | ||
) | ||
.join(", ")}):`, | ||
.join(", ")}) -> ${return_resource}:`, | ||
` raise NotImplementedError()`, | ||
@@ -116,3 +118,3 @@ ] | ||
.join("\n") | ||
), | ||
}), | ||
].join("\n") | ||
@@ -194,2 +196,3 @@ } | ||
const is_none_return_type = return_resource_item === "None" | ||
const has_params = parameters.length > 0 | ||
@@ -199,3 +202,3 @@ return [ | ||
"", | ||
`def ${method_name}(self, ${parameters | ||
`def ${method_name}(self,${has_params ? " *," : ""} ${parameters | ||
.sort( | ||
@@ -240,3 +243,3 @@ (a, b) => | ||
` updated_action_attempt = self.seam.action_attempts.poll_until_ready(`, | ||
" res['action_attempt']['action_attempt_id'],", | ||
" action_attempt_id=res['action_attempt']['action_attempt_id'],", | ||
" timeout=wait_for_action_attempt.get('timeout', None),", | ||
@@ -247,3 +250,3 @@ " polling_interval=wait_for_action_attempt.get('polling_interval', None),", | ||
` updated_action_attempt = self.seam.action_attempts.poll_until_ready(`, | ||
" res['action_attempt']['action_attempt_id']", | ||
" action_attempt_id=res['action_attempt']['action_attempt_id']", | ||
" )", | ||
@@ -279,7 +282,7 @@ " else:", | ||
"", | ||
" def poll_until_ready(self, action_attempt_id: str, timeout: Optional[float] = 5.0, polling_interval: Optional[float] = 0.5) -> ActionAttempt:", | ||
" def poll_until_ready(self, *, action_attempt_id: str, timeout: Optional[float] = 5.0, polling_interval: Optional[float] = 0.5) -> ActionAttempt:", | ||
" seam = self.seam", | ||
" time_waiting = 0.0", | ||
"", | ||
" action_attempt = seam.action_attempts.get(action_attempt_id, wait_for_action_attempt=False)", | ||
" action_attempt = seam.action_attempts.get(action_attempt_id=action_attempt_id, wait_for_action_attempt=False)", | ||
"", | ||
@@ -294,3 +297,3 @@ " while action_attempt.status == 'pending':", | ||
" action_attempt = seam.action_attempts.get(", | ||
" action_attempt.action_attempt_id, wait_for_action_attempt=False", | ||
" action_attempt_id=action_attempt.action_attempt_id, wait_for_action_attempt=False", | ||
" )", | ||
@@ -297,0 +300,0 @@ "", |
@@ -23,3 +23,3 @@ export default () => `# Seam for Python | ||
seam.locks.lock_door(some_lock) | ||
seam.locks.lock_door(device_id=some_lock.device_id) | ||
\`\`\` | ||
@@ -26,0 +26,0 @@ |
@@ -22,4 +22,6 @@ export default () => `import os | ||
API key (default None) | ||
api_url : str | ||
API url (default None) | ||
api_url : str | ||
API url (default "https://connect.getseam.com") | ||
lts_version : str | ||
LTS version | ||
workspaces : Workspaces | ||
@@ -45,2 +47,3 @@ Workspaces class | ||
api_url: str = "https://connect.getseam.com" | ||
lts_version: str = '1.0.0' | ||
@@ -50,2 +53,3 @@ def __init__( | ||
api_key: Optional[str] = None, | ||
*, | ||
workspace_id: Optional[str] = None, | ||
@@ -79,2 +83,3 @@ api_url: Optional[str] = None, | ||
self.workspace_id = workspace_id | ||
self.lts_version = Seam.lts_version | ||
@@ -127,2 +132,3 @@ if os.environ.get("SEAM_API_URL", None) is not None: | ||
"seam-sdk-version": sdk_version, | ||
"seam-lts-version": self.lts_version, | ||
} | ||
@@ -129,0 +135,0 @@ if self.workspace_id is not None: |
@@ -6,2 +6,3 @@ export default () => `@dataclass | ||
api_url: str | ||
lts_version: str | ||
@@ -8,0 +9,0 @@ @abc.abstractmethod |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
712408
9681