pr clean up
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
from deprecated import deprecated
|
||||
|
||||
from specklepy.api.credentials import Account
|
||||
from specklepy.api.resources import branch, commit, object, server, stream, user
|
||||
from specklepy.api.resources import branch, commit, object, server, stream, subscriptions, user
|
||||
|
||||
# TODO: re-reference core.api resources
|
||||
from specklepy.api.resources.active_user_resource import ActiveUserResource
|
||||
from specklepy.api.resources.model_resource import ModelResource
|
||||
from specklepy.api.resources.other_user_resource import OtherUserResource
|
||||
@@ -136,7 +135,11 @@ class SpeckleClient(CoreSpeckleClient):
|
||||
self.object = object.Resource(
|
||||
account=self.account, basepath=self.url, client=self.httpclient
|
||||
)
|
||||
self.subscribe = self.subscription
|
||||
self.subscribe = subscriptions.Resource(
|
||||
account=self.account,
|
||||
basepath=self.ws_url,
|
||||
client=self.wsclient,
|
||||
)
|
||||
|
||||
@deprecated(
|
||||
version="2.6.0",
|
||||
|
||||
@@ -8,14 +8,22 @@ from gql.transport.exceptions import TransportServerError
|
||||
from gql.transport.requests import RequestsHTTPTransport
|
||||
from gql.transport.websockets import WebsocketsTransport
|
||||
|
||||
from specklepy.api.resources.project_invite_resource import ProjectInviteResource
|
||||
from specklepy.core.api import resources
|
||||
from specklepy.core.api.credentials import Account, get_account_from_token
|
||||
from specklepy.core.api.resources import branch, commit, object, server, stream, user
|
||||
from specklepy.core.api.resources import (
|
||||
branch,
|
||||
commit,
|
||||
object,
|
||||
server,
|
||||
stream,
|
||||
subscriptions,
|
||||
user,
|
||||
)
|
||||
from specklepy.core.api.resources.active_user_resource import ActiveUserResource
|
||||
from specklepy.core.api.resources.model_resource import ModelResource
|
||||
from specklepy.core.api.resources.other_user_resource import OtherUserResource
|
||||
from specklepy.core.api.resources.project_resource import ProjectResource
|
||||
from specklepy.core.api.resources.project_invite_resource import ProjectInviteResource
|
||||
from specklepy.core.api.resources.subscription_resource import SubscriptionResource
|
||||
from specklepy.core.api.resources.version_resource import VersionResource
|
||||
from specklepy.logging import metrics
|
||||
@@ -267,7 +275,11 @@ class SpeckleClient:
|
||||
self.object = object.Resource(
|
||||
account=self.account, basepath=self.url, client=self.httpclient
|
||||
)
|
||||
self.subscribe = self.subscription
|
||||
self.subscribe = subscriptions.Resource(
|
||||
account=self.account,
|
||||
basepath=self.ws_url,
|
||||
client=self.wsclient,
|
||||
)
|
||||
|
||||
def __getattr__(self, name):
|
||||
try:
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class FileUploadConversionStatus(Enum):
|
||||
QUEUED = 0
|
||||
PROCESSING = 1
|
||||
SUCCESS = 2
|
||||
ERROR = 3
|
||||
|
||||
|
||||
class ProjectVisibility(str, Enum):
|
||||
PRIVATE = "PRIVATE"
|
||||
@@ -14,23 +8,11 @@ class ProjectVisibility(str, Enum):
|
||||
UNLISTEd = "UNLISTED"
|
||||
|
||||
|
||||
class ResourceType(str, Enum):
|
||||
COMMIT = "COMMIT"
|
||||
STREAM = "STREAM"
|
||||
OBJECT = "OBJECT"
|
||||
COMMENT = "COMMENT"
|
||||
|
||||
|
||||
class UserProjectsUpdatedMessageType(str, Enum):
|
||||
ADDED = "ADDED"
|
||||
REMOVED = "REMOVED"
|
||||
|
||||
|
||||
class ProjectCommentsUpdatedMessageType(str, Enum):
|
||||
ARCHIVED = "ARCHIVED"
|
||||
CREATED = "CREATED"
|
||||
UPDATED = "UPDATED"
|
||||
|
||||
|
||||
class ProjectModelsUpdatedMessageType(str, Enum):
|
||||
CREATED = "CREATED"
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
from typing import Any, Optional, Sequence
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class CommentContentInput(BaseModel):
|
||||
blobIds: Optional[Sequence[str]]
|
||||
doc: Any
|
||||
|
||||
|
||||
class CreateCommentInput(BaseModel):
|
||||
content: CommentContentInput
|
||||
projectId: str
|
||||
resourceIdString: str
|
||||
screenshot: Optional[str]
|
||||
viewerState: Optional[Any]
|
||||
|
||||
|
||||
class EditCommentInput(BaseModel):
|
||||
content: CommentContentInput
|
||||
commentId: str
|
||||
|
||||
|
||||
class CreateCommentReplyInput(BaseModel):
|
||||
content: CommentContentInput
|
||||
threadId: str
|
||||
@@ -5,7 +5,7 @@ from pydantic import BaseModel
|
||||
|
||||
class CreateModelInput(BaseModel):
|
||||
name: str
|
||||
description: Optional[str]
|
||||
description: Optional[str] = None
|
||||
projectId: str
|
||||
|
||||
|
||||
@@ -16,11 +16,11 @@ class DeleteModelInput(BaseModel):
|
||||
|
||||
class UpdateModelInput(BaseModel):
|
||||
id: str
|
||||
name: Optional[str]
|
||||
description: Optional[str]
|
||||
name: Optional[str] = None
|
||||
description: Optional[str] = None
|
||||
projectId: str
|
||||
|
||||
|
||||
class ModelVersionsFilter(BaseModel):
|
||||
priorityIds: Sequence[str]
|
||||
priorityIdsOnly: Optional[bool]
|
||||
priorityIdsOnly: Optional[bool] = None
|
||||
|
||||
@@ -5,12 +5,6 @@ from pydantic import BaseModel
|
||||
from specklepy.core.api.models import ProjectVisibility
|
||||
|
||||
|
||||
class ProjectCommentsFilter(BaseModel):
|
||||
includeArchived: Optional[bool]
|
||||
loadedVersionsOnly: Optional[bool]
|
||||
resourceIdString: Optional[str]
|
||||
|
||||
|
||||
class ProjectCreateInput(BaseModel):
|
||||
name: Optional[str]
|
||||
description: Optional[str]
|
||||
@@ -31,18 +25,12 @@ class ProjectInviteUseInput(BaseModel):
|
||||
|
||||
|
||||
class ProjectModelsFilter(BaseModel):
|
||||
contributors: Optional[Sequence[str]]
|
||||
excludeIds: Optional[Sequence[str]]
|
||||
ids: Optional[Sequence[str]]
|
||||
onlyWithVersions: Optional[bool]
|
||||
search: Optional[str]
|
||||
sourceApps: Sequence[str]
|
||||
|
||||
|
||||
class ProjectModelsTreeFilter(BaseModel):
|
||||
contributors: Optional[Sequence[str]]
|
||||
search: Optional[str]
|
||||
sourceApps: Sequence[str]
|
||||
contributors: Optional[Sequence[str]] = None
|
||||
excludeIds: Optional[Sequence[str]] = None
|
||||
ids: Optional[Sequence[str]] = None
|
||||
onlyWithVersions: Optional[bool] = None
|
||||
search: Optional[str] = None
|
||||
sourceApps: Optional[Sequence[str]] = None
|
||||
|
||||
|
||||
class ProjectUpdateInput(BaseModel):
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class ViewerUpdateTrackingTarget(BaseModel):
|
||||
projectId: str
|
||||
resourceIdString: str
|
||||
loadedVersionsOnly: Optional[bool] = None
|
||||
@@ -4,13 +4,10 @@ from typing import Generic, List, Optional, TypeVar
|
||||
from pydantic import BaseModel
|
||||
|
||||
from specklepy.core.api.enums import (
|
||||
FileUploadConversionStatus,
|
||||
ProjectCommentsUpdatedMessageType,
|
||||
ProjectModelsUpdatedMessageType,
|
||||
ProjectUpdatedMessageType,
|
||||
ProjectVersionsUpdatedMessageType,
|
||||
ProjectVisibility,
|
||||
ResourceType,
|
||||
UserProjectsUpdatedMessageType,
|
||||
)
|
||||
|
||||
@@ -102,40 +99,6 @@ class ProjectCollaborator(BaseModel):
|
||||
user: LimitedUser
|
||||
|
||||
|
||||
class ResourceIdentifier(BaseModel):
|
||||
resourceId: str
|
||||
resourceType: ResourceType
|
||||
|
||||
|
||||
class ViewerResourceItem(BaseModel):
|
||||
modelId: Optional[str]
|
||||
objectId: str
|
||||
versionId: Optional[str]
|
||||
|
||||
|
||||
class ViewerResourceGroup(BaseModel):
|
||||
identifier: str
|
||||
items: List[ViewerResourceItem]
|
||||
|
||||
|
||||
class Comment(BaseModel):
|
||||
archived: bool
|
||||
author: LimitedUser
|
||||
authorId: str
|
||||
createdAt: datetime
|
||||
hasParent: bool
|
||||
id: str
|
||||
parent: Optional["Comment"] = None
|
||||
rawText: str
|
||||
replies: ResourceCollection["Comment"]
|
||||
replyAuthors: ResourceCollection[LimitedUser]
|
||||
resources: List[ResourceIdentifier]
|
||||
screenshot: Optional[str]
|
||||
updatedAt: datetime
|
||||
viewedAt: Optional[datetime]
|
||||
viewerResources: List[ViewerResourceItem]
|
||||
|
||||
|
||||
class Version(BaseModel):
|
||||
authorUser: Optional[LimitedUser]
|
||||
createdAt: datetime
|
||||
@@ -146,34 +109,6 @@ class Version(BaseModel):
|
||||
sourceApplication: Optional[str]
|
||||
|
||||
|
||||
class ModelsTreeItem(BaseModel):
|
||||
children: List["ModelsTreeItem"]
|
||||
fullName: str
|
||||
hasChildren: bool
|
||||
id: str
|
||||
model: Optional["Model"] = None
|
||||
name: str
|
||||
updatedAt: datetime
|
||||
|
||||
|
||||
class FileUpload(BaseModel):
|
||||
convertedCommitId: Optional[str]
|
||||
convertedLastUpdate: datetime
|
||||
convertedMessage: Optional[str]
|
||||
convertedStatus: FileUploadConversionStatus
|
||||
convertedVersionId: Optional[str]
|
||||
fileName: str
|
||||
fileSize: int
|
||||
fileType: str
|
||||
id: str
|
||||
model: Optional["Model"] = None
|
||||
modelName: str
|
||||
projectId: str
|
||||
uploadComplete: bool
|
||||
uploadDate: datetime
|
||||
userId: str
|
||||
|
||||
|
||||
class Model(BaseModel):
|
||||
author: LimitedUser
|
||||
createdAt: datetime
|
||||
@@ -226,12 +161,6 @@ class UserProjectsUpdatedMessage(BaseModel):
|
||||
project: Optional[Project]
|
||||
|
||||
|
||||
class ProjectCommentsUpdatedMessage(BaseModel):
|
||||
id: str
|
||||
type: ProjectCommentsUpdatedMessageType
|
||||
comment: Optional[Comment]
|
||||
|
||||
|
||||
class ProjectModelsUpdatedMessage(BaseModel):
|
||||
id: str
|
||||
type: ProjectModelsUpdatedMessageType
|
||||
|
||||
@@ -50,7 +50,7 @@ class Resource(ResourceBase):
|
||||
"""
|
||||
)
|
||||
if len(name) < 3:
|
||||
raise SpeckleException(message="Branch Name must be at least 3 characters")
|
||||
return SpeckleException(message="Branch Name must be at least 3 characters")
|
||||
params = {
|
||||
"branch": {
|
||||
"streamId": stream_id,
|
||||
|
||||
@@ -144,7 +144,7 @@ class Resource(ResourceBase):
|
||||
{ commitCreate(commit: $commit)}
|
||||
"""
|
||||
)
|
||||
params: dict[str, dict[str, Any]] = {
|
||||
params = {
|
||||
"commit": {
|
||||
"streamId": stream_id,
|
||||
"branchName": branch_name,
|
||||
|
||||
@@ -15,7 +15,6 @@ Anonymous telemetry to help us understand how to make a better Speckle.
|
||||
This really helps us to deliver a better open source project and product!
|
||||
"""
|
||||
TRACK = True
|
||||
TRACK_SDK = True
|
||||
HOST_APP = "python"
|
||||
HOST_APP_VERSION = f"python {'.'.join(map(str, sys.version_info[:2]))}"
|
||||
PLATFORMS = {"win32": "Windows", "cygwin": "Windows", "darwin": "Mac OS X"}
|
||||
@@ -68,8 +67,6 @@ def track(
|
||||
):
|
||||
if not TRACK:
|
||||
return
|
||||
if not TRACK_SDK and action == SDK:
|
||||
return
|
||||
try:
|
||||
initialise_tracker(account)
|
||||
event_params = {
|
||||
|
||||
Reference in New Issue
Block a user