Skip to content

Commit 2a6d61b

Browse files
authored
docs: update api documentation to show all resources (#370)
1 parent 1a2cc55 commit 2a6d61b

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
@@ -12,8 +12,8 @@
1212
from .content import Content
1313
from .context import Context, ContextManager, requires
1414
from .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
1717
from .resources import _PaginatedResourceSequence, _ResourceSequence
1818
from .system import System
1919
from .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."""

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 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 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 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)