Skip to content

Commit 03accf8

Browse files
committed
removes pathinfo options when not needed
1 parent 7eeb054 commit 03accf8

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/posit/connect/content.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class ContentItemOwner(Resource):
3737
class ContentItem(JobsMixin, VanityMixin, Resource):
3838
def __init__(self, /, params: ResourceParameters, **kwargs):
3939
ctx = Context(params.session, params.url)
40-
path = f"v1/content"
41-
pathinfo = kwargs["guid"]
42-
super().__init__(ctx, path, pathinfo, **kwargs)
40+
uid = kwargs["guid"]
41+
path = f"v1/content/{uid}"
42+
super().__init__(ctx, path, **kwargs)
4343

4444
def __getitem__(self, key: Any) -> Any:
4545
v = super().__getitem__(key)

src/posit/connect/jobs.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,21 +127,17 @@ def destroy(self) -> None:
127127

128128

129129
class Jobs(ActiveFinderMethods[Job], ActiveSequence[Job]):
130-
def __init__(self, ctx: Context, path: str, pathinfo: str = "jobs", uid: str = "key"):
130+
def __init__(self, ctx: Context, path: str):
131131
"""A collection of jobs.
132132
133133
Parameters
134134
----------
135135
ctx : Context
136136
The context object containing the session and URL for API interactions
137137
path : str
138-
The HTTP path component for the collection endpoint
139-
pathinfo : str
140-
The HTTP part of the path directed at a specific resource, by default "jobs"
141-
uid : str, optional
142-
The field name used to uniquely identify records, by default "guid"
138+
The HTTP path component for the jobs endpoint (e.g., 'v1/content/544509fc-e4f0-41de-acb4-1fe3a2c1d797')
143139
"""
144-
super().__init__(ctx, path, pathinfo, uid)
140+
super().__init__(ctx, path, "jobs", "key")
145141

146142
def _create_instance(self, path: str, pathinfo: str, /, **kwargs: Any) -> Job:
147143
"""Creates a Job instance.
@@ -291,7 +287,7 @@ def find_by(self, **conditions) -> Optional[Job]:
291287
class JobsMixin(Active, Resource):
292288
"""Mixin class to add a jobs attribute to a resource."""
293289

294-
def __init__(self, ctx, path, pathinfo="", /, **kwargs):
290+
def __init__(self, ctx, path, /, **kwargs):
295291
"""Mixin class which adds a `jobs` attribute to the Active Resource.
296292
297293
Parameters
@@ -305,5 +301,5 @@ def __init__(self, ctx, path, pathinfo="", /, **kwargs):
305301
**attributes : dict
306302
Resource attributes passed
307303
"""
308-
super().__init__(ctx, path, pathinfo, **kwargs)
304+
super().__init__(ctx, path, "", **kwargs)
309305
self.jobs = Jobs(ctx, self._path)

0 commit comments

Comments
 (0)