1111from .content import Content
1212from .context import Context , ContextManager , requires
1313from .groups import Groups
14- from .metrics import Metrics
15- from .oauth import OAuth
14+ from .metrics . metrics import Metrics
15+ from .oauth . oauth import OAuth
1616from .resources import _PaginatedResourceSequence , _ResourceSequence
1717from .system import System
1818from .tags import Tags
@@ -43,18 +43,30 @@ class Client(ContextManager):
4343 ----------
4444 content: Content
4545 Content resource.
46+ environments: Environments
47+ Environments resource.
48+ groups: Groups
49+ Groups resource.
4650 me: User
47- Connect user resource.
51+ Current user resource.
4852 metrics: Metrics
4953 Metrics resource.
5054 oauth: OAuth
5155 OAuth resource.
56+ packages: Packages
57+ Packages resource.
58+ system: System
59+ System resource.
60+ tags: Tags
61+ Tags resource.
5262 tasks: Tasks
5363 Tasks resource.
5464 users: Users
5565 Users resource.
66+ vanities: Vanities
67+ Vanities resource.
5668 version: str
57- Server version.
69+ The server version.
5870 """
5971
6072 @overload
@@ -162,28 +174,21 @@ def __init__(self, *args, **kwargs) -> None:
162174 self ._ctx = Context (self )
163175
164176 @property
165- def version (self ) -> str | None :
177+ def content (self ) -> Content :
166178 """
167- The server version .
179+ The content resource interface .
168180
169181 Returns
170182 -------
171- str
172- The version of the Posit Connect server .
183+ Content
184+ The content resource instance .
173185 """
174- return self ._ctx . version
186+ return Content ( self ._ctx )
175187
176188 @property
177- def me (self ) -> User :
178- """
179- The connected user.
180-
181- Returns
182- -------
183- User
184- The currently authenticated user.
185- """
186- return me .get (self ._ctx )
189+ @requires (version = "2023.05.0" )
190+ def environments (self ) -> Environments :
191+ return _ResourceSequence (self ._ctx , "v1/environments" )
187192
188193 @property
189194 def groups (self ) -> Groups :
@@ -197,40 +202,66 @@ def groups(self) -> Groups:
197202 return Groups (self ._ctx )
198203
199204 @property
200- def tasks (self ) -> Tasks :
205+ def me (self ) -> User :
201206 """
202- The tasks resource interface .
207+ The connected user .
203208
204209 Returns
205210 -------
206- tasks.Tasks
207- The tasks resource instance .
211+ User
212+ The currently authenticated user .
208213 """
209- return Tasks (self ._ctx )
214+ return me . get (self ._ctx )
210215
211216 @property
212- def users (self ) -> Users :
217+ def metrics (self ) -> Metrics :
213218 """
214- The users resource interface.
219+ The Metrics API interface.
220+
221+ The Metrics API is designed for capturing, retrieving, and managing
222+ quantitative measurements of Connect interactions. It is commonly used
223+ for monitoring and analyzing system performance, user behavior, and
224+ business processes. This API facilitates real-time data collection and
225+ accessibility, enabling organizations to make informed decisions based
226+ on key performance indicators (KPIs).
215227
216228 Returns
217229 -------
218- Users
219- The users resource instance.
230+ Metrics
231+ The metrics API instance.
232+
233+ Examples
234+ --------
235+ >>> from posit import connect
236+ >>> client = connect.Client()
237+ >>> content_guid = "2243770d-ace0-4782-87f9-fe2aeca14fc8"
238+ >>> events = client.metrics.usage.find(content_guid=content_guid)
239+ >>> len(events)
240+ 24
220241 """
221- return Users (self ._ctx )
242+ return Metrics (self ._ctx )
222243
223244 @property
224- def content (self ) -> Content :
245+ @requires (version = "2024.08.0" )
246+ def oauth (self ) -> OAuth :
225247 """
226- The content resource interface.
248+ The OAuth API interface.
227249
228250 Returns
229251 -------
230- Content
231- The content resource instance.
252+ OAuth
253+ The oauth API instance.
232254 """
233- return Content (self ._ctx )
255+ return OAuth (self ._ctx , self .cfg .api_key )
256+
257+ @property
258+ @requires (version = "2024.11.0" )
259+ def packages (self ) -> Packages :
260+ return _PaginatedResourceSequence (self ._ctx , "v1/packages" , uid = "name" )
261+
262+ @property
263+ def system (self ) -> System :
264+ return System (self ._ctx , "v1/system" )
234265
235266 @property
236267 def tags (self ) -> Tags :
@@ -255,63 +286,44 @@ def tags(self) -> Tags:
255286 return Tags (self ._ctx , "v1/tags" )
256287
257288 @property
258- def metrics (self ) -> Metrics :
289+ def tasks (self ) -> Tasks :
259290 """
260- The Metrics API interface.
261-
262- The Metrics API is designed for capturing, retrieving, and managing
263- quantitative measurements of Connect interactions. It is commonly used
264- for monitoring and analyzing system performance, user behavior, and
265- business processes. This API facilitates real-time data collection and
266- accessibility, enabling organizations to make informed decisions based
267- on key performance indicators (KPIs).
291+ The tasks resource interface.
268292
269293 Returns
270294 -------
271- Metrics
272- The metrics API instance.
273-
274- Examples
275- --------
276- >>> from posit import connect
277- >>> client = connect.Client()
278- >>> content_guid = "2243770d-ace0-4782-87f9-fe2aeca14fc8"
279- >>> events = client.metrics.usage.find(content_guid=content_guid)
280- >>> len(events)
281- 24
295+ tasks.Tasks
296+ The tasks resource instance.
282297 """
283- return Metrics (self ._ctx )
298+ return Tasks (self ._ctx )
284299
285300 @property
286- @requires (version = "2024.08.0" )
287- def oauth (self ) -> OAuth :
301+ def users (self ) -> Users :
288302 """
289- The OAuth API interface.
303+ The users resource interface.
290304
291305 Returns
292306 -------
293- OAuth
294- The oauth API instance.
307+ Users
308+ The users resource instance.
295309 """
296- return OAuth (self ._ctx , self .cfg .api_key )
297-
298- @property
299- @requires (version = "2024.11.0" )
300- def packages (self ) -> Packages :
301- return _PaginatedResourceSequence (self ._ctx , "v1/packages" , uid = "name" )
310+ return Users (self ._ctx )
302311
303312 @property
304313 def vanities (self ) -> Vanities :
305314 return Vanities (self ._ctx )
306315
307316 @property
308- def system (self ) -> System :
309- return System (self ._ctx , "v1/system" )
317+ def version (self ) -> str | None :
318+ """
319+ The server version.
310320
311- @property
312- @requires (version = "2023.05.0" )
313- def environments (self ) -> Environments :
314- return _ResourceSequence (self ._ctx , "v1/environments" )
321+ Returns
322+ -------
323+ str
324+ The version of the Posit Connect server.
325+ """
326+ return self ._ctx .version
315327
316328 def __del__ (self ):
317329 """Close the session when the Client instance is deleted."""
0 commit comments