Skip to content

Commit 6d70fbd

Browse files
feat/updated-account-class/SDKPY-143 (#52)
* feat: complete Account class implementation with missing methods - Add getAccountInfo, updateAccountInfo, getAccountStatistics methods - Add getLimits method for account resource limits - Add complete type definitions for account operations - Update documentation with comprehensive examples - Add unit tests for all new methods (27 tests passing) * docs: fix Account class documentation formatting and examples Update documentation with proper RST heading underlines and fix Account.edit() code example to include required id parameter. * feat/update-analyses-class-and-enable-regions/SDKPY-144 (#53) * feat: enhance Analyses class with snippet methods and improved documentation Added listSnippets() and getSnippetFile() methods to fetch analysis code examples from TagoIO's public repository. Enhanced all existing methods with comprehensive docstrings following the Account class pattern, including descriptions, references, and practical examples. Updated type definitions to support new snippet functionality with SnippetRuntime, SnippetItem, and SnippetsListResponse types. Expanded test coverage with 8 new test cases and updated RST documentation with detailed method descriptions and code examples. * feat: enhance regions support and Analysis runtime with async execution Expanded regions.py with EU region support, TDeploy project integration, and runtime region caching. Refactored Analysis class to support async/await execution patterns with improved error handling and console service integration. Removed deprecated api_socket.py infrastructure and added JSONParseSafe utility for safer JSON parsing. Updated Analysis type definitions with new constructor params and function signatures. Added comprehensive region tests covering TDeploy and multi-region scenarios. * feat: enhance Analysis class initialization and region handling - Add instance attributes (params, started, _running) for better state management - Fix autostart logic to explicitly check for False instead of falsy values - Fix region configuration to safely handle missing region parameter using .get() This improves the Analysis class initialization by adding proper state tracking and preventing potential KeyError when region is not provided. * feat: update Analysis class to start automatically based on autostart parameter * feat: modify autostart parameter default to True in Analysis class * feat: refactor Analysis class initialization and improve region support Restructured Analysis class to separate initialization from execution flow using new init() method pattern. Modified TagoContext from TypedDict to class for better runtime flexibility. Updated documentation examples to reflect Python runtime instead of Deno. * feat: update Analysis class to correctly assign analysis_id and environment from environment variables
1 parent 5205c65 commit 6d70fbd

24 files changed

Lines changed: 2641 additions & 302 deletions

File tree

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"ignoretz",
99
"PYPI",
1010
"pytest",
11-
"serie_number"
11+
"serie_number",
12+
"Tago"
1213
]
1314
}

docs/source/Device/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ Instance
1212
| **token**: str
1313
| Device Token
1414
15-
| *Optional* **region**: Regions: "usa-1" or "env"
15+
| *Optional* **region**: Regions: "us-e1" or "ue-w1" or "env"
1616
| Region is a optional parameter
1717
1818
.. code-block::
1919
:caption: **Example:**
2020
2121
from tagoio_sdk import Device
2222
23-
myDevice = Device({"token": "my_device_token", "region": "usa-1"})
23+
myDevice = Device({"token": "my_device_token", "region": "us-e1"})
2424
2525
2626

docs/source/Resources/Account/Account_type.rst

Lines changed: 173 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,193 @@
66

77
AccountOptions
88
--------------
9+
910
**Attributes:**
1011

11-
| **user_view_welcome**: bool
12-
| **decimal_separator**: str
13-
| **thousand_separator**: str
14-
| **last_whats_new**: Optional[datetime]
12+
| user_view_welcome: bool
13+
14+
| decimal_separator: str
15+
16+
| thousand_separator: str
17+
18+
| last_whats_new: Optional[datetime]
1519
1620

1721
.. _AccountOpt:
1822

1923
AccountOpt
20-
-----------
24+
----------
25+
2126
**Attributes:**
2227

23-
| **authenticator**: bool
24-
| **sms**: bool
25-
| **email**: bool
28+
| authenticator: bool
29+
30+
| sms: bool
31+
32+
| email: bool
2633
2734

2835
.. _AccountInfo:
2936

3037
AccountInfo
3138
-----------
39+
40+
**Attributes:**
41+
42+
| active: bool
43+
44+
| name: str
45+
46+
| email: str
47+
48+
| country: Optional[str]
49+
50+
| timezone: str
51+
52+
| company: Optional[str]
53+
54+
| newsletter: Optional[bool]
55+
56+
| developer: Optional[bool]
57+
58+
| blocked: bool
59+
60+
| id: :ref:`GenericID`
61+
62+
| language: str
63+
64+
| last_login: Optional[datetime]
65+
66+
| options: :ref:`AccountOptions`
67+
68+
| phone: Optional[str]
69+
70+
| send_invoice: bool
71+
72+
| stripe_id: Optional[str]
73+
74+
| type: str
75+
76+
| plan: str
77+
78+
| created_at: datetime
79+
80+
| updated_at: datetime
81+
82+
| otp: Optional[:ref:`AccountOpt`]
83+
84+
85+
.. _AccountCreateInfo:
86+
87+
AccountCreateInfo
88+
-----------------
89+
90+
Information required to create a new TagoIO account.
91+
92+
**Attributes:**
93+
94+
| name: str
95+
96+
| email: str
97+
98+
| password: str
99+
100+
| cpassword: str
101+
102+
| country: Optional[str]
103+
104+
| timezone: str
105+
106+
| company: Optional[str]
107+
108+
| newsletter: Optional[bool]
109+
110+
| developer: Optional[bool]
111+
112+
113+
.. _OTPType:
114+
115+
OTPType
116+
-------
117+
118+
Type of One-Time Password authentication method.
119+
120+
**Values:**
121+
122+
| "sms" or "email" or "authenticator"
123+
124+
125+
.. _TokenCreateInfo:
126+
127+
TokenCreateInfo
128+
---------------
129+
130+
Information required to create a new account token.
131+
132+
**Attributes:**
133+
134+
| profile_id: :ref:`GenericID`
135+
136+
| email: str
137+
138+
| password: str
139+
140+
| pin_code: str
141+
142+
| otp_type: :ref:`OTPType`
143+
144+
| name: str
145+
146+
147+
.. _LoginCredentials:
148+
149+
LoginCredentials
150+
----------------
151+
152+
Credentials required for account login.
153+
32154
**Attributes:**
33155

34-
| **active**: bool
35-
| **name**: str
36-
| **email**: str
37-
| **country**: Optional[str]
38-
| **timezone**: str
39-
| **company**: Optional[str]
40-
| **newsletter**: Optional[bool]
41-
| **developer**: Optional[bool]
42-
| **blocked**: bool
43-
| **id**: GenericID
44-
| **language**: str
45-
| **last_login**: Optional[datetime]
46-
| **options**: :ref:`AccountOptions`
47-
| **phone**: Optional[str]
48-
| **send_invoice**: bool
49-
| **stripe_id**: Optional[str]
50-
| **type**: str
51-
| **plan**: str
52-
| **created_at**: datetime
53-
| **updated_at**: datetime
54-
| **otp**: Optional[:ref:`AccountOpt`]
156+
| email: str
157+
158+
| password: str
159+
160+
| otp_type: :ref:`OTPType`
161+
162+
| pin_code: str
163+
164+
165+
.. _ProfileListInfoForLogin:
166+
167+
ProfileListInfoForLogin
168+
-----------------------
169+
170+
Profile information returned in login response.
171+
172+
**Attributes:**
173+
174+
| id: :ref:`GenericID`
175+
176+
| name: str
177+
178+
179+
.. _LoginResponse:
180+
181+
LoginResponse
182+
-------------
183+
184+
Response data from account login endpoint.
185+
186+
**Attributes:**
187+
188+
| type: str
189+
190+
| id: :ref:`GenericID`
191+
192+
| email: str
193+
194+
| company: str
195+
196+
| name: str
197+
198+
| profiles: List[:ref:`ProfileListInfoForLogin`]

0 commit comments

Comments
 (0)