Updated SammiApi
Made Button ID optional in insert_array() and delete_array() Fixed dictionary to use index, instead of position for the name of the field for insert_array() and delete_array()
This commit is contained in:
parent
4f949a7239
commit
90e9f1f496
1 changed files with 13 additions and 7 deletions
|
|
@ -106,15 +106,18 @@ func delete_variable(name: String, button_id: String = "") -> bool:
|
|||
last_error_description = response.error_message
|
||||
return false
|
||||
|
||||
func insert_array(name: String, position: int, value: Variant, button_id: String) -> bool:
|
||||
func insert_array(name: String, position: int, value: Variant, button_id: String = "") -> bool:
|
||||
var api_path: String = "/api"
|
||||
var req: Dictionary = {
|
||||
"request": "insertArray",
|
||||
"name": name,
|
||||
"position": position,
|
||||
"value": value,
|
||||
"buttonID": button_id
|
||||
"index": position,
|
||||
"value": value
|
||||
}
|
||||
|
||||
if button_id != "":
|
||||
req["buttonID"] = button_id
|
||||
|
||||
client.request(SammiClient.Method.POST, api_path, JSON.stringify(req))
|
||||
var response: SammiClient.SammiResponse = await client.request_completed
|
||||
if response.code == 200:
|
||||
|
|
@ -137,14 +140,17 @@ func insert_array(name: String, position: int, value: Variant, button_id: String
|
|||
last_error_description = response.error_message
|
||||
return false
|
||||
|
||||
func delete_array(name: String, position: int, button_id: String) -> bool:
|
||||
func delete_array(name: String, position: int, button_id: String = "") -> bool:
|
||||
var api_path: String = "/api"
|
||||
var req: Dictionary = {
|
||||
"request": "deleteArray",
|
||||
"name": name,
|
||||
"position": position,
|
||||
"buttonID": button_id
|
||||
"index": position
|
||||
}
|
||||
|
||||
if button_id != "":
|
||||
req["buttonID"] = button_id
|
||||
|
||||
client.request(SammiClient.Method.POST, api_path, JSON.stringify(req))
|
||||
var response: SammiClient.SammiResponse = await client.request_completed
|
||||
if response.code == 200:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue