Skip to content

Commit

Permalink
Merge pull request #353 from specklesystems/jrm/api-fix
Browse files Browse the repository at this point in the history
Updated version mutation inputs
  • Loading branch information
gjedlicska authored Nov 13, 2024
2 parents 46c18bb + 759cd0e commit a0b39e4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/specklepy/core/api/inputs/version_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@

class UpdateVersionInput(BaseModel):
versionId: str
projectId: str
message: Optional[str]


class MoveVersionsInput(BaseModel):
targetModelName: str
versionIds: Sequence[str]
projectId: str


class DeleteVersionsInput(BaseModel):
versionIds: Sequence[str]
projectId: str


class CreateVersionInput(BaseModel):
Expand Down
16 changes: 12 additions & 4 deletions tests/integration/client/current/test_version_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,13 @@ def test_model_get_with_versions(
assert result.versions.totalCount == 1
assert result.versions.items[0].id == test_version.id

def test_version_update(self, client: SpeckleClient, test_version: Version):
def test_version_update(
self, client: SpeckleClient, test_version: Version, test_project: Project
):
new_message = "MY new version message"
input = UpdateVersionInput(versionId=test_version.id, message=new_message)
input = UpdateVersionInput(
versionId=test_version.id, projectId=test_project.id, message=new_message
)
updated_version = client.version.update(input)

assert isinstance(updated_version, Version)
Expand All @@ -121,7 +125,9 @@ def test_version_move_to_model(
test_model_2: Model,
):
input = MoveVersionsInput(
targetModelName=test_model_2.name, versionIds=[test_version.id]
targetModelName=test_model_2.name,
versionIds=[test_version.id],
projectId=test_project.id,
)
moved_model_id = client.version.move_to_model(input)

Expand All @@ -137,7 +143,9 @@ def test_version_move_to_model(
def test_version_delete(
self, client: SpeckleClient, test_version: Version, test_project: Project
):
input = DeleteVersionsInput(versionIds=[test_version.id])
input = DeleteVersionsInput(
versionIds=[test_version.id], projectId=test_project.id
)

response = client.version.delete(input)
assert response is True
Expand Down

0 comments on commit a0b39e4

Please sign in to comment.