|
# retoor <retoor@molodetz.nl>
|
|
|
|
from __future__ import annotations
|
|
|
|
from ..spec import Action
|
|
from ._shared import ATTACHMENTS, body, confirm, path, query
|
|
|
|
|
|
PROJECTS_ACTIONS: tuple[Action, ...] = (
|
|
Action(
|
|
name="list_projects",
|
|
method="GET",
|
|
path="/projects",
|
|
summary="List projects",
|
|
requires_auth=False,
|
|
params=(
|
|
query("tab", "Projects tab."),
|
|
query("search", "Search project title, description, and author username."),
|
|
query("user_uid", "Filter by owner uid."),
|
|
query("project_type", "Filter by project type."),
|
|
query("before", "Pagination cursor."),
|
|
),
|
|
),
|
|
Action(
|
|
name="view_project",
|
|
method="GET",
|
|
path="/projects/{project_slug}",
|
|
summary="View a project by slug",
|
|
requires_auth=False,
|
|
params=(
|
|
path(
|
|
"project_slug",
|
|
"Exact project slug copied from a /projects/... link in a listing response; do not build it from the title.",
|
|
),
|
|
),
|
|
),
|
|
Action(
|
|
name="create_project",
|
|
method="POST",
|
|
path="/projects/create",
|
|
summary="Create a new project",
|
|
params=(
|
|
body("title", "Project title.", required=True),
|
|
body("description", "Project description.", required=True),
|
|
body("release_date", "Release date."),
|
|
body("demo_date", "Demo date."),
|
|
body("project_type", "Project type."),
|
|
body("platforms", "Supported platforms."),
|
|
body("status", "Project status."),
|
|
body("attachment_uids", ATTACHMENTS),
|
|
),
|
|
),
|
|
Action(
|
|
name="edit_project",
|
|
method="POST",
|
|
path="/projects/edit/{project_slug}",
|
|
summary="Edit an existing project",
|
|
params=(
|
|
path(
|
|
"project_slug",
|
|
"Exact project slug copied from a /projects/... link in a listing response; do not build it from the title.",
|
|
),
|
|
body("title", "Updated project title.", required=True),
|
|
body("description", "Updated project description.", required=True),
|
|
body("release_date", "Updated release date."),
|
|
body("demo_date", "Updated demo date."),
|
|
body("project_type", "Updated project type."),
|
|
body("platforms", "Updated supported platforms."),
|
|
body("status", "Updated project status."),
|
|
),
|
|
),
|
|
Action(
|
|
name="delete_project",
|
|
method="POST",
|
|
path="/projects/delete/{project_slug}",
|
|
summary="Delete a project and all its files (your own, or any project when you are an administrator). Soft delete, confirmation required",
|
|
params=(
|
|
path(
|
|
"project_slug",
|
|
"Exact project slug copied from a /projects/... link in a listing response; do not build it from the title.",
|
|
),
|
|
confirm(),
|
|
),
|
|
),
|
|
Action(
|
|
name="project_set_private",
|
|
method="POST",
|
|
path="/projects/{project_slug}/private",
|
|
summary="Mark a project private (owner-only) or public",
|
|
description=(
|
|
"Set value=true to hide the project from everyone except its owner (and administrators), "
|
|
"or value=false to make it public again. This is a significant change: you MUST ask the "
|
|
"user for explicit confirmation BEFORE calling it, and only pass confirm=true once they "
|
|
"have agreed. Only the project owner may change this."
|
|
),
|
|
params=(
|
|
path("project_slug", "Project slug or uid."),
|
|
body(
|
|
"value",
|
|
"true to make the project private, false to make it public.",
|
|
required=True,
|
|
),
|
|
body(
|
|
"confirm",
|
|
"Must be true, set only after the user has explicitly confirmed.",
|
|
required=True,
|
|
),
|
|
),
|
|
),
|
|
Action(
|
|
name="project_set_readonly",
|
|
method="POST",
|
|
path="/projects/{project_slug}/readonly",
|
|
summary="Mark a project read-only (immutable files) or writable again",
|
|
description=(
|
|
"Set value=true to make every file in the project immutable - no writes, edits, line "
|
|
"edits, moves, deletes, or uploads succeed afterwards, from anyone including you - or "
|
|
"value=false to allow changes again. This is a significant change: you MUST ask the user "
|
|
"for explicit confirmation BEFORE calling it, and only pass confirm=true once they have "
|
|
"agreed. Only the project owner may change this."
|
|
),
|
|
params=(
|
|
path("project_slug", "Project slug or uid."),
|
|
body(
|
|
"value",
|
|
"true to make the project read-only, false to make it writable.",
|
|
required=True,
|
|
),
|
|
body(
|
|
"confirm",
|
|
"Must be true, set only after the user has explicitly confirmed.",
|
|
required=True,
|
|
),
|
|
),
|
|
),
|
|
)
|