Skip to content

Commit d75c45e

Browse files
committed
docs: update api documentation to show all resources (#370)
1 parent de67552 commit d75c45e

File tree

16 files changed

+135
-86
lines changed

16 files changed

+135
-86
lines changed

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CURRENT_YEAR ?= $(shell date +%Y)
77
# Quarto settings
88
QUARTO ?= quarto
99
# quartodoc doesn't like py3.8; Run using `--with` as it can conflict with the project's dependencies
10-
QUARTODOC ?= --with "quartodoc==0.8.1" quartodoc
10+
QUARTODOC ?= --no-cache --with "quartodoc==0.8.1" quartodoc
1111

1212
# Netlify settings
1313
NETLIFY_SITE_ID ?= 5cea1f56-7935-4387-975a-18a7905d15ee

docs/_quarto.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,29 @@ quartodoc:
9494
- put
9595
- patch
9696
- delete
97-
- title: Posit Connect Resources
97+
- title: Resources
9898
contents:
9999
- connect.bundles
100100
- connect.content
101+
- connect.env
102+
- connect.environments
101103
- connect.groups
104+
- connect.jobs
105+
- connect.metrics
106+
- connect.metrics.usage
107+
- connect.oauth
108+
- connect.oauth.associations
109+
- connect.oauth.integrations
110+
- connect.oauth.sessions
111+
- connect.packages
102112
- connect.permissions
113+
- connect.repository
114+
- connect.system
115+
- connect.tags
103116
- connect.tasks
104117
- connect.users
105118
- connect.vanities
106-
- title: Posit Connect Metrics
107-
contents:
108-
- connect.metrics
109-
- connect.metrics.usage
110-
- title: External Integrations
119+
- title: Third-Party Integrations
111120
contents:
112121
- connect.external.databricks
113122
- connect.external.snowflake

src/posit/connect/client.py

Lines changed: 84 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
from .content import Content
1212
from .context import Context, ContextManager, requires
1313
from .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
1616
from .resources import _PaginatedResourceSequence, _ResourceSequence
1717
from .system import System
1818
from .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."""

src/posit/connect/env.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Environment variable resources."""
2+
13
from __future__ import annotations
24

35
from typing_extensions import TYPE_CHECKING, Any, Iterator, List, Mapping, MutableMapping, Optional

src/posit/connect/environments.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Environment resources."""
2+
13
from __future__ import annotations
24

35
from abc import abstractmethod
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
# NOTE: The APIs in this module are provided as a convenience and are subject to breaking changes.
1+
"""External integrations.
2+
3+
Notes
4+
-----
5+
The APIs in this module are provided as a convenience and are subject to breaking changes.
6+
"""

src/posit/connect/external/databricks.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
"""
1+
"""Databricks SDK integration.
2+
23
Databricks SDK credentials implementations which support interacting with Posit OAuth integrations on Connect.
34
4-
NOTE: These APIs are provided as a convenience and are subject to breaking changes:
5+
Notes
6+
-----
7+
These APIs are provided as a convenience and are subject to breaking changes:
58
https://github.com/databricks/databricks-sdk-py#interface-stability
69
"""
710

src/posit/connect/external/snowflake.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
"""Snowflake SDK credentials implementations which support interacting with Posit OAuth integrations on Connect.
1+
"""Snowflake SDK integration.
22
3-
NOTE: The APIs in this module are provided as a convenience and are subject to breaking changes.
3+
Snowflake SDK credentials implementations which support interacting with Posit OAuth integrations on Connect.
4+
5+
Notes
6+
-----
7+
The APIs in this module are provided as a convenience and are subject to breaking changes.
48
"""
59

610
from typing_extensions import Optional

src/posit/connect/jobs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Job resources."""
2+
13
from __future__ import annotations
24

35
from typing_extensions import (
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
"""Metric resources."""
2+
13
from .metrics import Metrics as Metrics

0 commit comments

Comments
 (0)