Skip to content

Commit 4789cd5

Browse files
committed
Added a list_datastore_category action
1 parent 7f25537 commit 4789cd5

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

shuffle-ai/1.1.0/api.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ actions:
3737
description: Input ANY kind of data in the format you want, and the format you want it in. Default is a business-y email. Uses ShuffleGPT, which is based on OpenAI and our own model.
3838
parameters:
3939
- name: apikey
40-
description: Your https://shuffler.io apikey
40+
description: Your https://shuffler.io/settings apikey
4141
required: true
4242
multiline: false
4343
example: ""

shuffle-tools/1.2.0/api.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,32 @@ actions:
8181
returns:
8282
schema:
8383
type: string
84+
85+
- name: list_datastore_category
86+
description: Lists data in the datastore category specified.
87+
parameters:
88+
- name: category
89+
description: The category to list
90+
required: true
91+
multiline: false
92+
example: "shuffle-security_incidents"
93+
schema:
94+
type: string
95+
- name: output_type
96+
description: The output type to get
97+
required: false
98+
options:
99+
- values
100+
- keys
101+
- ndjson
102+
- csv
103+
- meta
104+
example: "values"
105+
schema:
106+
type: string
107+
returns:
108+
schema:
109+
type: string
84110
- name: set_datastore_value
85111
description: Set a value to be saved to your organization in Shuffle.
86112
parameters:

shuffle-tools/1.2.0/src/app.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2222,6 +2222,26 @@ def change_cache_subkey(self, key, subkey, value, overwrite, category=""):
22222222
self.logger.info("Value couldn't be parsed")
22232223
return response.text
22242224

2225+
def list_datastore_category(self, category, output_type=""):
2226+
category = category.lower().replace(" ", "_")
2227+
if not output_type:
2228+
output_type = "values"
2229+
2230+
org_id = self.full_execution["workflow"]["execution_org"]["id"]
2231+
url = "%s/api/v2/datastore/category/%s?top=10000&type=%s&execution_id=%s&authorization=%s&org_id=%s" % (self.url, category, output_type, self.current_execution_id, self.authorization, org_id)
2232+
2233+
parsed_headers = {}
2234+
data = requests.get(url, headers=parsed_headers, verify=False)
2235+
try:
2236+
allvalues = data.json()
2237+
return json.dumps(allvalues)
2238+
except Exception as e:
2239+
return {
2240+
"success": False,
2241+
"reason": f"Failed to parse datastore category list response: {e}",
2242+
"response": data.text,
2243+
}
2244+
22252245
def delete_datastore_value(self, key, category=""):
22262246
return self.delete_cache(key, category=category)
22272247

0 commit comments

Comments
 (0)