# Generated from soulfire/server.proto. DO NOT EDIT.
# Generated by protoc-gen-connectrpc-py v0.13.0 with parameter "protobuf=google".
# ruff: noqa: PGH004
# ruff: noqa
# pyright: reportDeprecated=false
# ty: ignore[unused-ignore-comment]
# ty: ignore[deprecated, unused-ignore-comment]
# fmt: off
from __future__ import annotations
from typing import Protocol, TYPE_CHECKING
from connectrpc.client import ConnectClient, ConnectClientSync
from connectrpc.code import Code
from connectrpc.compat import google_protobuf_binary_codec, google_protobuf_codecs
from connectrpc.compression.gzip import GzipCompression
from connectrpc.errors import ConnectError
from connectrpc.method import IdempotencyLevel, MethodInfo, StreamType
from connectrpc.protocol import ProtocolType
from connectrpc.server import ConnectASGIApplication, ConnectWSGIApplication, DEFAULT_READ_MAX_BYTES, Endpoint, EndpointSync
from pyqwest import Client, SyncClient
from .server_pb2 import ServerInfoRequest, ServerInfoResponse, ServerUpdateConfigEntryRequest, ServerUpdateConfigEntryResponse, ServerUpdateConfigRequest, ServerUpdateConfigResponse
if TYPE_CHECKING:
from collections.abc import AsyncGenerator, Iterable, Mapping
from connectrpc.codec import Codec
from connectrpc.compression import Compression
from connectrpc.interceptor import Interceptor, InterceptorSync
from connectrpc.request import Headers, RequestContext
_DEFAULT_CODECS = google_protobuf_codecs()
_PROTO_BINARY_CODEC = google_protobuf_binary_codec()
_GZIP_COMPRESSION = GzipCompression()
[docs]
class ServerService(Protocol):
"""
ServerService provides gRPC methods for managing server-level configuration
in SoulFire. This service handles global settings that affect the entire
SoulFire server instance, including debug logging, plugin configurations,
and other server-wide preferences.
Configuration changes are persisted to a database and trigger runtime hooks
to apply settings immediately (e.g., adjusting log levels for SoulFire,
Minecraft, Netty, gRPC, Hibernate, and Via components).
All methods require appropriate permissions:
- GetServerInfo requires READ_SERVER_CONFIG permission
- UpdateServerConfig requires UPDATE_SERVER_CONFIG permission
- UpdateServerConfigEntry requires UPDATE_SERVER_CONFIG permission
Errors:
- PERMISSION_DENIED: If the caller lacks the required permission
- INTERNAL: If a database or processing error occurs
"""
[docs]
async def get_server_info(self, request: ServerInfoRequest, ctx: RequestContext[ServerInfoRequest, ServerInfoResponse], /) -> ServerInfoResponse:
"""
Retrieves comprehensive server information including current configuration,
all available settings definitions, settings page layouts, and registered plugins.
This method is typically called when initializing a settings UI to obtain:
1. Current configuration values to populate form fields
2. Settings definitions describing each setting's type, constraints, and metadata
3. Page definitions for organizing settings into logical groups
4. Plugin information for displaying registered plugins
Requires: READ_SERVER_CONFIG permission
Returns: ServerInfoResponse with all server configuration and metadata
Errors: PERMISSION_DENIED if caller lacks READ_SERVER_CONFIG permission
INTERNAL if a database error occurs while retrieving configuration
"""
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
[docs]
async def update_server_config(self, request: ServerUpdateConfigRequest, ctx: RequestContext[ServerUpdateConfigRequest, ServerUpdateConfigResponse], /) -> ServerUpdateConfigResponse:
"""
Replaces the entire server configuration with the provided values.
This is a bulk update operation primarily used for profile import functionality.
Use this method when you need to apply a complete configuration snapshot,
such as when importing settings from a saved profile or restoring a backup.
For individual setting changes during normal operation, prefer UpdateServerConfigEntry.
The new configuration is persisted to the database, and runtime hooks are
triggered to apply changes immediately (e.g., log level adjustments).
Requires: UPDATE_SERVER_CONFIG permission
Returns: Empty ServerUpdateConfigResponse on success
Errors: PERMISSION_DENIED if caller lacks UPDATE_SERVER_CONFIG permission
INTERNAL if a database error occurs while saving configuration
"""
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
[docs]
async def update_server_config_entry(self, request: ServerUpdateConfigEntryRequest, ctx: RequestContext[ServerUpdateConfigEntryRequest, ServerUpdateConfigEntryResponse], /) -> ServerUpdateConfigEntryResponse:
"""
Updates a single configuration entry identified by namespace and key.
This is a granular update operation for modifying individual settings.
This is the preferred method for real-time UI interactions where users
modify settings one at a time. It avoids overwriting unrelated settings
and is more efficient than replacing the entire configuration.
If the namespace doesn't exist, it will be created. If the key doesn't
exist within the namespace, it will be added. Existing values are overwritten.
The change is persisted to the database, and runtime hooks are triggered
to apply the new value immediately where applicable.
Requires: UPDATE_SERVER_CONFIG permission
Returns: Empty ServerUpdateConfigEntryResponse on success
Errors: PERMISSION_DENIED if caller lacks UPDATE_SERVER_CONFIG permission
INTERNAL if a database error occurs while saving the entry
"""
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
[docs]
class ServerServiceASGIApplication(ConnectASGIApplication[ServerService]):
def __init__(
self,
service: ServerService | AsyncGenerator[ServerService],
*,
interceptors: Iterable[Interceptor] = (),
read_max_bytes: int | None = DEFAULT_READ_MAX_BYTES,
compressions: Iterable[Compression] | None = None,
codecs: Iterable[Codec] | None = _DEFAULT_CODECS,
) -> None:
super().__init__(
service=service,
endpoints=lambda svc: {
"/soulfire.v1.ServerService/GetServerInfo": Endpoint.unary(
method=MethodInfo(
name="GetServerInfo",
service_name="soulfire.v1.ServerService",
input=ServerInfoRequest,
output=ServerInfoResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
stream_type=StreamType.UNARY,
),
function=svc.get_server_info,
),
"/soulfire.v1.ServerService/UpdateServerConfig": Endpoint.unary(
method=MethodInfo(
name="UpdateServerConfig",
service_name="soulfire.v1.ServerService",
input=ServerUpdateConfigRequest,
output=ServerUpdateConfigResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
stream_type=StreamType.UNARY,
),
function=svc.update_server_config,
),
"/soulfire.v1.ServerService/UpdateServerConfigEntry": Endpoint.unary(
method=MethodInfo(
name="UpdateServerConfigEntry",
service_name="soulfire.v1.ServerService",
input=ServerUpdateConfigEntryRequest,
output=ServerUpdateConfigEntryResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
stream_type=StreamType.UNARY,
),
function=svc.update_server_config_entry,
),
},
interceptors=interceptors,
read_max_bytes=read_max_bytes,
compressions=compressions,
codecs=codecs,
)
@property
def path(self) -> str:
"""Returns the URL path to mount the application to when serving multiple applications."""
return "/soulfire.v1.ServerService"
[docs]
class ServerServiceClient(ConnectClient):
"""
ServerService provides gRPC methods for managing server-level configuration
in SoulFire. This service handles global settings that affect the entire
SoulFire server instance, including debug logging, plugin configurations,
and other server-wide preferences.
Configuration changes are persisted to a database and trigger runtime hooks
to apply settings immediately (e.g., adjusting log levels for SoulFire,
Minecraft, Netty, gRPC, Hibernate, and Via components).
All methods require appropriate permissions:
- GetServerInfo requires READ_SERVER_CONFIG permission
- UpdateServerConfig requires UPDATE_SERVER_CONFIG permission
- UpdateServerConfigEntry requires UPDATE_SERVER_CONFIG permission
Errors:
- PERMISSION_DENIED: If the caller lacks the required permission
- INTERNAL: If a database or processing error occurs
"""
def __init__(
self,
address: str,
*,
codec: Codec | None = _PROTO_BINARY_CODEC,
protocol: ProtocolType = ProtocolType.CONNECT,
accept_compression: Iterable[Compression] | None = None,
send_compression: Compression | None = _GZIP_COMPRESSION,
timeout_ms: int | None = None,
read_max_bytes: int | None = None,
interceptors: Iterable[Interceptor] = (),
http_client: Client | None = None,
) -> None:
super().__init__(
address=address,
codec=codec,
protocol=protocol,
accept_compression=accept_compression,
send_compression=send_compression,
timeout_ms=timeout_ms,
read_max_bytes=read_max_bytes,
interceptors=interceptors,
http_client=http_client,
)
[docs]
async def get_server_info(
self,
request: ServerInfoRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> ServerInfoResponse:
"""
Retrieves comprehensive server information including current configuration,
all available settings definitions, settings page layouts, and registered plugins.
This method is typically called when initializing a settings UI to obtain:
1. Current configuration values to populate form fields
2. Settings definitions describing each setting's type, constraints, and metadata
3. Page definitions for organizing settings into logical groups
4. Plugin information for displaying registered plugins
Requires: READ_SERVER_CONFIG permission
Returns: ServerInfoResponse with all server configuration and metadata
Errors: PERMISSION_DENIED if caller lacks READ_SERVER_CONFIG permission
INTERNAL if a database error occurs while retrieving configuration
"""
return await self.execute_unary(
request=request,
method=MethodInfo(
name="GetServerInfo",
service_name="soulfire.v1.ServerService",
input=ServerInfoRequest,
output=ServerInfoResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
stream_type=StreamType.UNARY,
),
headers=headers,
timeout_ms=timeout_ms,
)
[docs]
async def update_server_config(
self,
request: ServerUpdateConfigRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> ServerUpdateConfigResponse:
"""
Replaces the entire server configuration with the provided values.
This is a bulk update operation primarily used for profile import functionality.
Use this method when you need to apply a complete configuration snapshot,
such as when importing settings from a saved profile or restoring a backup.
For individual setting changes during normal operation, prefer UpdateServerConfigEntry.
The new configuration is persisted to the database, and runtime hooks are
triggered to apply changes immediately (e.g., log level adjustments).
Requires: UPDATE_SERVER_CONFIG permission
Returns: Empty ServerUpdateConfigResponse on success
Errors: PERMISSION_DENIED if caller lacks UPDATE_SERVER_CONFIG permission
INTERNAL if a database error occurs while saving configuration
"""
return await self.execute_unary(
request=request,
method=MethodInfo(
name="UpdateServerConfig",
service_name="soulfire.v1.ServerService",
input=ServerUpdateConfigRequest,
output=ServerUpdateConfigResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
stream_type=StreamType.UNARY,
),
headers=headers,
timeout_ms=timeout_ms,
)
[docs]
async def update_server_config_entry(
self,
request: ServerUpdateConfigEntryRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> ServerUpdateConfigEntryResponse:
"""
Updates a single configuration entry identified by namespace and key.
This is a granular update operation for modifying individual settings.
This is the preferred method for real-time UI interactions where users
modify settings one at a time. It avoids overwriting unrelated settings
and is more efficient than replacing the entire configuration.
If the namespace doesn't exist, it will be created. If the key doesn't
exist within the namespace, it will be added. Existing values are overwritten.
The change is persisted to the database, and runtime hooks are triggered
to apply the new value immediately where applicable.
Requires: UPDATE_SERVER_CONFIG permission
Returns: Empty ServerUpdateConfigEntryResponse on success
Errors: PERMISSION_DENIED if caller lacks UPDATE_SERVER_CONFIG permission
INTERNAL if a database error occurs while saving the entry
"""
return await self.execute_unary(
request=request,
method=MethodInfo(
name="UpdateServerConfigEntry",
service_name="soulfire.v1.ServerService",
input=ServerUpdateConfigEntryRequest,
output=ServerUpdateConfigEntryResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
stream_type=StreamType.UNARY,
),
headers=headers,
timeout_ms=timeout_ms,
)
[docs]
class ServerServiceSync(Protocol):
"""
ServerService provides gRPC methods for managing server-level configuration
in SoulFire. This service handles global settings that affect the entire
SoulFire server instance, including debug logging, plugin configurations,
and other server-wide preferences.
Configuration changes are persisted to a database and trigger runtime hooks
to apply settings immediately (e.g., adjusting log levels for SoulFire,
Minecraft, Netty, gRPC, Hibernate, and Via components).
All methods require appropriate permissions:
- GetServerInfo requires READ_SERVER_CONFIG permission
- UpdateServerConfig requires UPDATE_SERVER_CONFIG permission
- UpdateServerConfigEntry requires UPDATE_SERVER_CONFIG permission
Errors:
- PERMISSION_DENIED: If the caller lacks the required permission
- INTERNAL: If a database or processing error occurs
"""
[docs]
def get_server_info(self, request: ServerInfoRequest, ctx: RequestContext[ServerInfoRequest, ServerInfoResponse], /) -> ServerInfoResponse:
"""
Retrieves comprehensive server information including current configuration,
all available settings definitions, settings page layouts, and registered plugins.
This method is typically called when initializing a settings UI to obtain:
1. Current configuration values to populate form fields
2. Settings definitions describing each setting's type, constraints, and metadata
3. Page definitions for organizing settings into logical groups
4. Plugin information for displaying registered plugins
Requires: READ_SERVER_CONFIG permission
Returns: ServerInfoResponse with all server configuration and metadata
Errors: PERMISSION_DENIED if caller lacks READ_SERVER_CONFIG permission
INTERNAL if a database error occurs while retrieving configuration
"""
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
[docs]
def update_server_config(self, request: ServerUpdateConfigRequest, ctx: RequestContext[ServerUpdateConfigRequest, ServerUpdateConfigResponse], /) -> ServerUpdateConfigResponse:
"""
Replaces the entire server configuration with the provided values.
This is a bulk update operation primarily used for profile import functionality.
Use this method when you need to apply a complete configuration snapshot,
such as when importing settings from a saved profile or restoring a backup.
For individual setting changes during normal operation, prefer UpdateServerConfigEntry.
The new configuration is persisted to the database, and runtime hooks are
triggered to apply changes immediately (e.g., log level adjustments).
Requires: UPDATE_SERVER_CONFIG permission
Returns: Empty ServerUpdateConfigResponse on success
Errors: PERMISSION_DENIED if caller lacks UPDATE_SERVER_CONFIG permission
INTERNAL if a database error occurs while saving configuration
"""
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
[docs]
def update_server_config_entry(self, request: ServerUpdateConfigEntryRequest, ctx: RequestContext[ServerUpdateConfigEntryRequest, ServerUpdateConfigEntryResponse], /) -> ServerUpdateConfigEntryResponse:
"""
Updates a single configuration entry identified by namespace and key.
This is a granular update operation for modifying individual settings.
This is the preferred method for real-time UI interactions where users
modify settings one at a time. It avoids overwriting unrelated settings
and is more efficient than replacing the entire configuration.
If the namespace doesn't exist, it will be created. If the key doesn't
exist within the namespace, it will be added. Existing values are overwritten.
The change is persisted to the database, and runtime hooks are triggered
to apply the new value immediately where applicable.
Requires: UPDATE_SERVER_CONFIG permission
Returns: Empty ServerUpdateConfigEntryResponse on success
Errors: PERMISSION_DENIED if caller lacks UPDATE_SERVER_CONFIG permission
INTERNAL if a database error occurs while saving the entry
"""
raise ConnectError(Code.UNIMPLEMENTED, 'Not implemented')
[docs]
class ServerServiceWSGIApplication(ConnectWSGIApplication):
def __init__(
self,
service: ServerServiceSync,
interceptors: Iterable[InterceptorSync] = (),
read_max_bytes: int | None = DEFAULT_READ_MAX_BYTES,
compressions: Iterable[Compression] | None = None,
codecs: Iterable[Codec] | None = _DEFAULT_CODECS,
) -> None:
super().__init__(
endpoints={
"/soulfire.v1.ServerService/GetServerInfo": EndpointSync.unary(
method=MethodInfo(
name="GetServerInfo",
service_name="soulfire.v1.ServerService",
input=ServerInfoRequest,
output=ServerInfoResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
stream_type=StreamType.UNARY,
),
function=service.get_server_info,
),
"/soulfire.v1.ServerService/UpdateServerConfig": EndpointSync.unary(
method=MethodInfo(
name="UpdateServerConfig",
service_name="soulfire.v1.ServerService",
input=ServerUpdateConfigRequest,
output=ServerUpdateConfigResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
stream_type=StreamType.UNARY,
),
function=service.update_server_config,
),
"/soulfire.v1.ServerService/UpdateServerConfigEntry": EndpointSync.unary(
method=MethodInfo(
name="UpdateServerConfigEntry",
service_name="soulfire.v1.ServerService",
input=ServerUpdateConfigEntryRequest,
output=ServerUpdateConfigEntryResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
stream_type=StreamType.UNARY,
),
function=service.update_server_config_entry,
),
},
interceptors=interceptors,
read_max_bytes=read_max_bytes,
compressions=compressions,
codecs=codecs,
)
@property
def path(self) -> str:
"""Returns the URL path to mount the application to when serving multiple applications."""
return "/soulfire.v1.ServerService"
[docs]
class ServerServiceClientSync(ConnectClientSync):
"""
ServerService provides gRPC methods for managing server-level configuration
in SoulFire. This service handles global settings that affect the entire
SoulFire server instance, including debug logging, plugin configurations,
and other server-wide preferences.
Configuration changes are persisted to a database and trigger runtime hooks
to apply settings immediately (e.g., adjusting log levels for SoulFire,
Minecraft, Netty, gRPC, Hibernate, and Via components).
All methods require appropriate permissions:
- GetServerInfo requires READ_SERVER_CONFIG permission
- UpdateServerConfig requires UPDATE_SERVER_CONFIG permission
- UpdateServerConfigEntry requires UPDATE_SERVER_CONFIG permission
Errors:
- PERMISSION_DENIED: If the caller lacks the required permission
- INTERNAL: If a database or processing error occurs
"""
def __init__(
self,
address: str,
*,
codec: Codec | None = _PROTO_BINARY_CODEC,
protocol: ProtocolType = ProtocolType.CONNECT,
accept_compression: Iterable[Compression] | None = None,
send_compression: Compression | None = _GZIP_COMPRESSION,
timeout_ms: int | None = None,
read_max_bytes: int | None = None,
interceptors: Iterable[InterceptorSync] = (),
http_client: SyncClient | None = None,
) -> None:
super().__init__(
address=address,
codec=codec,
protocol=protocol,
accept_compression=accept_compression,
send_compression=send_compression,
timeout_ms=timeout_ms,
read_max_bytes=read_max_bytes,
interceptors=interceptors,
http_client=http_client,
)
[docs]
def get_server_info(
self,
request: ServerInfoRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> ServerInfoResponse:
"""
Retrieves comprehensive server information including current configuration,
all available settings definitions, settings page layouts, and registered plugins.
This method is typically called when initializing a settings UI to obtain:
1. Current configuration values to populate form fields
2. Settings definitions describing each setting's type, constraints, and metadata
3. Page definitions for organizing settings into logical groups
4. Plugin information for displaying registered plugins
Requires: READ_SERVER_CONFIG permission
Returns: ServerInfoResponse with all server configuration and metadata
Errors: PERMISSION_DENIED if caller lacks READ_SERVER_CONFIG permission
INTERNAL if a database error occurs while retrieving configuration
"""
return self.execute_unary(
request=request,
method=MethodInfo(
name="GetServerInfo",
service_name="soulfire.v1.ServerService",
input=ServerInfoRequest,
output=ServerInfoResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
stream_type=StreamType.UNARY,
),
headers=headers,
timeout_ms=timeout_ms,
)
[docs]
def update_server_config(
self,
request: ServerUpdateConfigRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> ServerUpdateConfigResponse:
"""
Replaces the entire server configuration with the provided values.
This is a bulk update operation primarily used for profile import functionality.
Use this method when you need to apply a complete configuration snapshot,
such as when importing settings from a saved profile or restoring a backup.
For individual setting changes during normal operation, prefer UpdateServerConfigEntry.
The new configuration is persisted to the database, and runtime hooks are
triggered to apply changes immediately (e.g., log level adjustments).
Requires: UPDATE_SERVER_CONFIG permission
Returns: Empty ServerUpdateConfigResponse on success
Errors: PERMISSION_DENIED if caller lacks UPDATE_SERVER_CONFIG permission
INTERNAL if a database error occurs while saving configuration
"""
return self.execute_unary(
request=request,
method=MethodInfo(
name="UpdateServerConfig",
service_name="soulfire.v1.ServerService",
input=ServerUpdateConfigRequest,
output=ServerUpdateConfigResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
stream_type=StreamType.UNARY,
),
headers=headers,
timeout_ms=timeout_ms,
)
[docs]
def update_server_config_entry(
self,
request: ServerUpdateConfigEntryRequest,
*,
headers: Headers | Mapping[str, str] | None = None,
timeout_ms: int | None = None,
) -> ServerUpdateConfigEntryResponse:
"""
Updates a single configuration entry identified by namespace and key.
This is a granular update operation for modifying individual settings.
This is the preferred method for real-time UI interactions where users
modify settings one at a time. It avoids overwriting unrelated settings
and is more efficient than replacing the entire configuration.
If the namespace doesn't exist, it will be created. If the key doesn't
exist within the namespace, it will be added. Existing values are overwritten.
The change is persisted to the database, and runtime hooks are triggered
to apply the new value immediately where applicable.
Requires: UPDATE_SERVER_CONFIG permission
Returns: Empty ServerUpdateConfigEntryResponse on success
Errors: PERMISSION_DENIED if caller lacks UPDATE_SERVER_CONFIG permission
INTERNAL if a database error occurs while saving the entry
"""
return self.execute_unary(
request=request,
method=MethodInfo(
name="UpdateServerConfigEntry",
service_name="soulfire.v1.ServerService",
input=ServerUpdateConfigEntryRequest,
output=ServerUpdateConfigEntryResponse,
idempotency_level=IdempotencyLevel.UNKNOWN,
stream_type=StreamType.UNARY,
),
headers=headers,
timeout_ms=timeout_ms,
)