|
# retoor <retoor@molodetz.nl>
|
|
|
|
from __future__ import annotations
|
|
|
|
from ..spec import Param
|
|
|
|
|
|
def path(name: str, description: str, required: bool = True) -> Param:
|
|
return Param(name=name, location="path", description=description, required=required)
|
|
|
|
|
|
def query(name: str, description: str, required: bool = False) -> Param:
|
|
return Param(
|
|
name=name, location="query", description=description, required=required
|
|
)
|
|
|
|
|
|
def body(
|
|
name: str, description: str, required: bool = False, type: str = "string"
|
|
) -> Param:
|
|
return Param(
|
|
name=name,
|
|
location="body",
|
|
description=description,
|
|
required=required,
|
|
type=type,
|
|
)
|
|
|
|
|
|
def upload(name: str, description: str) -> Param:
|
|
return Param(name=name, location="file", description=description, required=True)
|
|
|
|
|
|
def confirm() -> Param:
|
|
return Param(
|
|
name="confirm",
|
|
location="body",
|
|
description=(
|
|
"Set to true ONLY after the user has explicitly confirmed this irreversible action. "
|
|
"Leave it unset on the first call: the tool refuses and tells you to confirm with the "
|
|
"user, and only a repeat call with confirm=true actually performs it."
|
|
),
|
|
required=False,
|
|
type="boolean",
|
|
)
|
|
|
|
|
|
ATTACHMENTS = "Comma separated attachment uids returned by upload_file."
|
|
TARGET_TYPE = "Target type, e.g. post, comment, project, gist."
|