1212from .content import Content
1313from .context import Context , ContextManager , requires
1414from .groups import Groups
15- from .metrics import Metrics
16- from .oauth import OAuth
15+ from .metrics . metrics import Metrics
16+ from .oauth . oauth import OAuth
1717from .resources import _PaginatedResourceSequence , _ResourceSequence
1818from .system import System
1919from .tags import Tags
@@ -44,18 +44,30 @@ class Client(ContextManager):
4444 ----------
4545 content: Content
4646 Content resource.
47+ environments: Environments
48+ Environments resource.
49+ groups: Groups
50+ Groups resource.
4751 me: User
48- Connect user resource.
52+ Current user resource.
4953 metrics: Metrics
5054 Metrics resource.
5155 oauth: OAuth
5256 OAuth resource.
57+ packages: Packages
58+ Packages resource.
59+ system: System
60+ System resource.
61+ tags: Tags
62+ Tags resource.
5363 tasks: Tasks
5464 Tasks resource.
5565 users: Users
5666 Users resource.
67+ vanities: Vanities
68+ Vanities resource.
5769 version: str
58- Server version.
70+ The server version.
5971 """
6072
6173 @overload
@@ -163,28 +175,21 @@ def __init__(self, *args, **kwargs) -> None:
163175 self ._ctx = Context (self )
164176
165177 @property
166- def version (self ) -> str | None :
178+ def content (self ) -> Content :
167179 """
168- The server version .
180+ The content resource interface .
169181
170182 Returns
171183 -------
172- str
173- The version of the Posit Connect server .
184+ Content
185+ The content resource instance .
174186 """
175- return self ._ctx . version
187+ return Content ( self ._ctx )
176188
177189 @property
178- def me (self ) -> User :
179- """
180- The connected user.
181-
182- Returns
183- -------
184- User
185- The currently authenticated user.
186- """
187- return me .get (self ._ctx )
190+ @requires (version = "2023.05.0" )
191+ def environments (self ) -> Environments :
192+ return _ResourceSequence (self ._ctx , "v1/environments" )
188193
189194 @property
190195 def groups (self ) -> Groups :
@@ -198,40 +203,66 @@ def groups(self) -> Groups:
198203 return Groups (self ._ctx )
199204
200205 @property
201- def tasks (self ) -> Tasks :
206+ def me (self ) -> User :
202207 """
203- The tasks resource interface .
208+ The connected user .
204209
205210 Returns
206211 -------
207- tasks.Tasks
208- The tasks resource instance .
212+ User
213+ The currently authenticated user .
209214 """
210- return Tasks (self ._ctx )
215+ return me . get (self ._ctx )
211216
212217 @property
213- def users (self ) -> Users :
218+ def metrics (self ) -> Metrics :
214219 """
215- The users resource interface.
220+ The Metrics API interface.
221+
222+ The Metrics API is designed for capturing, retrieving, and managing
223+ quantitative measurements of Connect interactions. It is commonly used
224+ for monitoring and analyzing system performance, user behavior, and
225+ business processes. This API facilitates real-time data collection and
226+ accessibility, enabling organizations to make informed decisions based
227+ on key performance indicators (KPIs).
216228
217229 Returns
218230 -------
219- Users
220- The users resource instance.
231+ Metrics
232+ The metrics API instance.
233+
234+ Examples
235+ --------
236+ >>> from posit import connect
237+ >>> client = connect.Client()
238+ >>> content_guid = "2243770d-ace0-4782-87f9-fe2aeca14fc8"
239+ >>> events = client.metrics.usage.find(content_guid=content_guid)
240+ >>> len(events)
241+ 24
221242 """
222- return Users (self ._ctx )
243+ return Metrics (self ._ctx )
223244
224245 @property
225- def content (self ) -> Content :
246+ @requires (version = "2024.08.0" )
247+ def oauth (self ) -> OAuth :
226248 """
227- The content resource interface.
249+ The OAuth API interface.
228250
229251 Returns
230252 -------
231- Content
232- The content resource instance.
253+ OAuth
254+ The oauth API instance.
233255 """
234- return Content (self ._ctx )
256+ return OAuth (self ._ctx , self .cfg .api_key )
257+
258+ @property
259+ @requires (version = "2024.11.0" )
260+ def packages (self ) -> Packages :
261+ return _PaginatedResourceSequence (self ._ctx , "v1/packages" , uid = "name" )
262+
263+ @property
264+ def system (self ) -> System :
265+ return System (self ._ctx , "v1/system" )
235266
236267 @property
237268 def tags (self ) -> Tags :
@@ -256,63 +287,44 @@ def tags(self) -> Tags:
256287 return Tags (self ._ctx , "v1/tags" )
257288
258289 @property
259- def metrics (self ) -> Metrics :
290+ def tasks (self ) -> Tasks :
260291 """
261- The Metrics API interface.
262-
263- The Metrics API is designed for capturing, retrieving, and managing
264- quantitative measurements of Connect interactions. It is commonly used
265- for monitoring and analyzing system performance, user behavior, and
266- business processes. This API facilitates real-time data collection and
267- accessibility, enabling organizations to make informed decisions based
268- on key performance indicators (KPIs).
292+ The tasks resource interface.
269293
270294 Returns
271295 -------
272- Metrics
273- The metrics API instance.
274-
275- Examples
276- --------
277- >>> from posit import connect
278- >>> client = connect.Client()
279- >>> content_guid = "2243770d-ace0-4782-87f9-fe2aeca14fc8"
280- >>> events = client.metrics.usage.find(content_guid=content_guid)
281- >>> len(events)
282- 24
296+ tasks.Tasks
297+ The tasks resource instance.
283298 """
284- return Metrics (self ._ctx )
299+ return Tasks (self ._ctx )
285300
286301 @property
287- @requires (version = "2024.08.0" )
288- def oauth (self ) -> OAuth :
302+ def users (self ) -> Users :
289303 """
290- The OAuth API interface.
304+ The users resource interface.
291305
292306 Returns
293307 -------
294- OAuth
295- The oauth API instance.
308+ Users
309+ The users resource instance.
296310 """
297- return OAuth (self ._ctx , self .cfg .api_key )
298-
299- @property
300- @requires (version = "2024.11.0" )
301- def packages (self ) -> Packages :
302- return _PaginatedResourceSequence (self ._ctx , "v1/packages" , uid = "name" )
311+ return Users (self ._ctx )
303312
304313 @property
305314 def vanities (self ) -> Vanities :
306315 return Vanities (self ._ctx )
307316
308317 @property
309- def system (self ) -> System :
310- return System (self ._ctx , "v1/system" )
318+ def version (self ) -> str | None :
319+ """
320+ The server version.
311321
312- @property
313- @requires (version = "2023.05.0" )
314- def environments (self ) -> Environments :
315- return _ResourceSequence (self ._ctx , "v1/environments" )
322+ Returns
323+ -------
324+ str
325+ The version of the Posit Connect server.
326+ """
327+ return self ._ctx .version
316328
317329 def __del__ (self ):
318330 """Close the session when the Client instance is deleted."""
0 commit comments