MCPcopy Create free account
hub / github.com/bigdra50/unity-cli / api_schema

Function api_schema

unity_cli/cli/commands/api.py:77–154  ·  view source on GitHub ↗

List static API methods discoverable by 'api call'. Returned entries include fully-qualified type, method name, return type, and parameter signature. Combine filters to narrow the search. Examples: u api schema -t AssetDatabase # All methods on one type u

(
    ctx: typer.Context,
    namespace: Annotated[
        list[str] | None,
        typer.Option("--namespace", "-n", help="Filter by namespace prefix"),
    ] = None,
    type_name: Annotated[
        str | None,
        typer.Option("--type", "-t", help="Filter by type name"),
    ] = None,
    method_name: Annotated[
        str | None,
        typer.Option("--method", "-m", help="Filter by method name"),
    ] = None,
    limit: Annotated[
        int,
        typer.Option("--limit", "-l", help="Max results per page"),
    ] = 100,
    offset: Annotated[
        int,
        typer.Option("--offset", help="Pagination offset"),
    ] = 0,
    offline: Annotated[
        bool,
        typer.Option("--offline", help="Use cached schema only (no Relay)"),
    ] = False,
    no_cache: Annotated[
        bool,
        typer.Option("--no-cache", help="Skip cache, fetch from Relay"),
    ] = False,
    unity_version: Annotated[
        str | None,
        typer.Option("--version", help="Unity version (for offline cache lookup)"),
    ] = None,
    json_flag: Annotated[
        bool,
        typer.Option("--json", help="Output as JSON"),
    ] = False,
)

Source from the content-addressed store, hash-verified

75@api_app.command("schema")
76@handle_cli_errors
77def api_schema(
78 ctx: typer.Context,
79 namespace: Annotated[
80 list[str] | None,
81 typer.Option("--namespace", "-n", help="Filter by namespace prefix"),
82 ] = None,
83 type_name: Annotated[
84 str | None,
85 typer.Option("--type", "-t", help="Filter by type name"),
86 ] = None,
87 method_name: Annotated[
88 str | None,
89 typer.Option("--method", "-m", help="Filter by method name"),
90 ] = None,
91 limit: Annotated[
92 int,
93 typer.Option("--limit", "-l", help="Max results per page"),
94 ] = 100,
95 offset: Annotated[
96 int,
97 typer.Option("--offset", help="Pagination offset"),
98 ] = 0,
99 offline: Annotated[
100 bool,
101 typer.Option("--offline", help="Use cached schema only (no Relay)"),
102 ] = False,
103 no_cache: Annotated[
104 bool,
105 typer.Option("--no-cache", help="Skip cache, fetch from Relay"),
106 ] = False,
107 unity_version: Annotated[
108 str | None,
109 typer.Option("--version", help="Unity version (for offline cache lookup)"),
110 ] = None,
111 json_flag: Annotated[
112 bool,
113 typer.Option("--json", help="Output as JSON"),
114 ] = False,
115) -> None:
116 """List static API methods discoverable by 'api call'.
117
118 Returned entries include fully-qualified type, method name, return type,
119 and parameter signature. Combine filters to narrow the search.
120
121 Examples:
122 u api schema -t AssetDatabase # All methods on one type
123 u api schema -n UnityEditor # Everything under a namespace
124 u api schema -m Refresh # Any method named Refresh
125 u api schema --offline --version 2022.3 # Browse cached schema offline
126 """
127 context: CLIContext = ctx.obj
128 result = context.client.dynamic_api.schema(
129 namespace=namespace,
130 type_name=type_name,
131 method_name=method_name,
132 limit=limit,
133 offset=offset,
134 offline=offline,

Callers

nothing calls this directly

Calls 6

_should_jsonFunction · 0.90
print_jsonFunction · 0.90
print_plain_tableFunction · 0.90
print_successFunction · 0.90
schemaMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected