Skip to content

Commit

Permalink
Some improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuscardosodeveloper committed Oct 8, 2024
1 parent 43abec4 commit fb45f03
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
34 changes: 14 additions & 20 deletions docs/source/Resources/Analysis/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Retrieves a list with all analyses from the account
from tagoio_sdk import Resources
resources = Resources()
resources.analysis.list();
resources.analysis.list()
=======
Expand All @@ -60,11 +60,10 @@ Create a new analysis
resources = Resources()
resources.analysis.create({
"label": "My Analysis",
"arrangement": [],
"tags": [],
"visible": True,
});
"name": "My Analysis",
"runtime": "python",
"active": True,
})
=======
Expand All @@ -91,12 +90,7 @@ Modify any property of the analyze
from tagoio_sdk import Resources
resources = Resources()
resources.analysis.edit("analysisID", {
"label": "My Analysis",
"arrangement": [],
"tags": [],
"visible": True,
});
resources.analysis.edit("analysisID", { "name": "My Analysis Edited" })
=======
Expand All @@ -120,7 +114,7 @@ Deletes an analysis from the account
from tagoio_sdk import Resources
resources = Resources()
resources.analysis.delete("analysisID");
resources.analysis.delete("analysisID")
=======
Expand All @@ -144,7 +138,7 @@ Gets information about an analysis
from tagoio_sdk import Resources
resources = Resources()
resources.analysis.info("analysisID");
resources.analysis.info("analysisID")
=======
Expand All @@ -168,7 +162,7 @@ Run an analysis
from tagoio_sdk import Resources
resources = Resources()
resources.analysis.run("analysisID");
resources.analysis.run("analysisID")
=======
Expand All @@ -192,7 +186,7 @@ Generate a new token for the analysis
from tagoio_sdk import Resources
resources = Resources()
resources.analysis.tokenGenerate("analysisID");
resources.analysis.tokenGenerate("analysisID")
=======
Expand All @@ -219,15 +213,15 @@ Upload a file (base64) to Analysis. Automatically erase the old one
from tagoio_sdk import Resources
import base64
data = "print(Hello, World!);"
encoded_bytes = base64.b64encode(data.encode('utf-8'))
data = "print(Hello, World!)"
encoded_bytes = base64.b64encode(data.encode('utf-8')).decode('utf-8')
resources = Resources()
resources.analysis.uploadScript("analysisID", {
"name": "My Script",
"content": encoded_bytes,
"language": "python",
});
})
=======
Expand All @@ -254,4 +248,4 @@ Get a url to download the analysis. If `version` is specified in `options`, down
from tagoio_sdk import Resources
resources = Resources()
resources.analysis.downloadScript("analysisID");
resources.analysis.downloadScript("analysisID")
3 changes: 3 additions & 0 deletions src/tagoio_sdk/modules/Resources/AccountDeprecated.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from tagoio_sdk.common.tagoio_module import GenericModuleParams

from .Account import Account
from .Analyses import Analyses
from .Billing import Billing
from .Buckets import Buckets
from .Dashboards import Dashboards
Expand All @@ -19,6 +20,8 @@ class AccountDeprecated(Account):
"""

def __init__(self, params: GenericModuleParams):
self.analysis = Analyses(params)
"""@deprecated moved to Resources().analysis"""
self.buckets = Buckets(params)
"""@deprecated moved to Resources().buckets"""
self.dashboards = Dashboards(params)
Expand Down
2 changes: 1 addition & 1 deletion src/tagoio_sdk/modules/Resources/Analyses.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def uploadScript(self, analysisID: GenericID, fileObj: ScriptFile) -> str:
)
return result

def downloadScript(self, analysisID: GenericID, options: Optional[Dict[Literal["version"], int]] = None) -> Dict[str, Any]:
def downloadScript(self, analysisID: GenericID, options: Optional[Dict[Literal["version"], int]] = None) -> Dict:
"""
Get a url to download the analysis. If `version` is specified in `options`, downloads a specific version.
Expand Down

0 comments on commit fb45f03

Please sign in to comment.