Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Merge Active and ApIDictEndpoint to ActiveDict #331

Merged
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
194f07b
merge Active and ApiDict class into ActiveDict
schloerke Nov 12, 2024
c5088a9
Remove `_api.py` file
schloerke Nov 12, 2024
1b1f20e
Store data in `_dict` not `_attrs`. Clean up wording
schloerke Nov 12, 2024
69bfa82
Add in `ResourceDict` class
schloerke Nov 12, 2024
7efb8fa
Update test_api_endpoint.py
schloerke Nov 12, 2024
5998b15
Implement Variant with ResourceDict
schloerke Nov 12, 2024
c91b3d1
Move content item repository to its own file
schloerke Nov 12, 2024
3089b87
Relax type restrictions (explicitly)
schloerke Nov 12, 2024
85f648c
Create `_types` file to hold protocol classes
schloerke Nov 12, 2024
57a7da9
Rename file to private
schloerke Nov 12, 2024
a3263af
Use helper classes for ContentItem and Context
schloerke Nov 13, 2024
dbfbc33
Update _content_repository.py
schloerke Nov 13, 2024
47ec1e3
Update Vanity
schloerke Nov 13, 2024
a1ba953
Cosmetic to Users
schloerke Nov 13, 2024
81ebea9
Helper method
schloerke Nov 13, 2024
df1180c
Job to inherit from ActiveDict
schloerke Nov 13, 2024
45660cf
BundleMetadata
schloerke Nov 13, 2024
8dd6d0b
Overhaul ContentItem
schloerke Nov 13, 2024
b66dc00
Merge branch 'schloerke/324-merge-api-and-resource' into schloerke/me…
schloerke Nov 13, 2024
b525358
post merge updates; Update packages
schloerke Nov 13, 2024
137ba8b
Use `hasattr()` instead of `self.__dict__`
schloerke Nov 13, 2024
f70ebaa
When updating within a ContentItem, use the fully returned result
schloerke Nov 13, 2024
b7ea2fb
Make methods public within module
schloerke Nov 14, 2024
778108f
Update Variants
schloerke Nov 14, 2024
47a7a48
Update ContentPackages and Packages
schloerke Nov 14, 2024
1206e0f
Update Sessions and Session
schloerke Nov 14, 2024
e754475
ActiveFinderSequence now inherits from ActiveSequence
schloerke Nov 14, 2024
f40cfe4
Minor updates and fix tests
schloerke Nov 14, 2024
474af27
Fix len bug
schloerke Nov 14, 2024
17c0270
Update Tasks and Task
schloerke Nov 14, 2024
197d1c0
Remove many debug prints
schloerke Nov 14, 2024
d5d6459
If it hasn't been initialized, use the object repr
schloerke Nov 14, 2024
d1c8b66
Update Permissions
schloerke Nov 14, 2024
074afad
Relax `json=` requirement to `Any`, matching `requests` package
schloerke Nov 14, 2024
faa2d8a
Update associations
schloerke Nov 14, 2024
fbfe8c8
Updated Integrations
schloerke Nov 14, 2024
bacbe85
Update Usage, Visits, and Metrics
schloerke Nov 14, 2024
b5fafdb
Relax return type; Remove ignore statements
schloerke Nov 14, 2024
5f5082d
Update User, Users, ContentItem, me, Content
schloerke Nov 14, 2024
7fd9282
Try using a tuple for base class for better python 3.8 support
schloerke Nov 14, 2024
0d3e9ae
Fix json errors in integration tests
schloerke Nov 14, 2024
890ffd1
Update Vanities
schloerke Nov 14, 2024
42580b9
Update Bundles
schloerke Nov 14, 2024
61eb20e
Update OAuth
schloerke Nov 14, 2024
04eb3fa
Update EnvVars
schloerke Nov 14, 2024
dd88ab2
Update Group/Groups
schloerke Nov 14, 2024
e948f55
Update env.py
schloerke Nov 14, 2024
a1b4440
Remove `resources` file
schloerke Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Create _types file to hold protocol classes
  • Loading branch information
schloerke committed Nov 12, 2024
commit 85f648c561a9851a2b0f45c3f69cce4e028fe4c2
16 changes: 2 additions & 14 deletions src/posit/connect/_api_call.py
Original file line number Diff line number Diff line change
@@ -3,25 +3,13 @@
import posixpath
from typing import TYPE_CHECKING, Protocol

from ._types import ContextP

if TYPE_CHECKING:
from ._json import Jsonifiable
from .context import Context


# Just the same as `.context.py` ContextManager but with `._ctx` attribute, not `.ctx`
class ContextP(Protocol):
_ctx: Context


class ContextCls(ContextP):
"""Class that contains the client context."""

_ctx: Context

def __init__(self, ctx: Context):
self._ctx = ctx


class ApiCallProtocol(ContextP, Protocol):
_path: str

24 changes: 24 additions & 0 deletions src/posit/connect/_types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from __future__ import annotations

from typing import TYPE_CHECKING, Protocol

if TYPE_CHECKING:
from .context import Context


# Just the same as `.context.py` ContextManager but with `._ctx` attribute, not `.ctx`
class ContextP(Protocol):
_ctx: Context


class ContentItemP(ContextP, Protocol):
_path: str


class ContextCls(ContextP):
"""Class that contains the client context."""

_ctx: Context

def __init__(self, ctx: Context):
self._ctx = ctx