Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
19 changes: 19 additions & 0 deletions qfieldcloud_sdk/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,25 @@ def list_projects(ctx: Context, include_public: bool, **opts) -> None:
log("User does not have any projects yet.")


@cli.command()
@click.argument("project_id")
@click.pass_context
def show_project(ctx: Context, project_id: str) -> None:
"""Show QFieldCloud project data."""

project: Dict[str, Any] = ctx.obj["client"].show_project(project_id)

if ctx.obj["format_json"]:
print_json(project)
else:
log("Listing projects…")
if project:
log("Project data:")
log(format_project_table([project]))
else:
log("User does not have access to projects yet.")


@cli.command()
@click.argument("project_id")
@click.option(
Expand Down
21 changes: 21 additions & 0 deletions qfieldcloud_sdk/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,27 @@ def list_projects(
)
return cast(List, payload)

def show_project(
self,
project_id: str,
) -> Dict[str, Any]:
"""Show project data.
Comment thread
suricactus marked this conversation as resolved.
Outdated

Args:
project_id: the project data to list data for
Comment thread
suricactus marked this conversation as resolved.
Outdated

Returns:
A dictionary containing project details.

Example:
```python
client.show_project()
Comment thread
suricactus marked this conversation as resolved.
Outdated
```
"""
payload = self._request_json("GET", f"projects/{project_id}")

return cast(Dict, payload)

def list_remote_files(
self, project_id: str, skip_metadata: bool = True
) -> List[Dict[str, Any]]:
Expand Down