mattermost/python-sdk/build/lib/mattermost_plugin/grpc/hooks_http_pb2.pyi
Nick Misasi 01643af641 debug: add extensive logging to trace hook registration flow
Go side:
- Log hooks returned by Implemented()
- Log each hook name -> ID mapping
- Log OnActivate implementation status
- Log OnActivate call flow

Python side:
- Log Implemented() return value
- Log OnActivate gRPC receipt and handler invocation

This is temporary debug logging to diagnose why OnActivate
isn't being called for Python plugins.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 09:12:22 -05:00

260 lines
11 KiB
Python

"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
See LICENSE.txt for license information.
"""
from collections import abc as _abc
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf.internal import containers as _containers
import builtins as _builtins
import hooks_common_pb2 as _hooks_common_pb2
import sys
import typing as _typing
if sys.version_info >= (3, 10):
from typing import TypeAlias as _TypeAlias
else:
from typing_extensions import TypeAlias as _TypeAlias
DESCRIPTOR: _descriptor.FileDescriptor
@_typing.final
class HTTPHeader(_message.Message):
"""-----------------------------------------------------------------------------
HTTP Header Message
Supports multi-value headers (e.g., Set-Cookie)
-----------------------------------------------------------------------------
HTTPHeader represents a single HTTP header with potentially multiple values.
HTTP allows multiple headers with the same key (e.g., Set-Cookie).
"""
DESCRIPTOR: _descriptor.Descriptor
KEY_FIELD_NUMBER: _builtins.int
VALUES_FIELD_NUMBER: _builtins.int
key: _builtins.str
@_builtins.property
def values(self) -> _containers.RepeatedScalarFieldContainer[_builtins.str]: ...
def __init__(
self,
*,
key: _builtins.str = ...,
values: _abc.Iterable[_builtins.str] | None = ...,
) -> None: ...
_ClearFieldArgType: _TypeAlias = _typing.Literal["key", b"key", "values", b"values"] # noqa: Y015
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
Global___HTTPHeader: _TypeAlias = HTTPHeader # noqa: Y015
@_typing.final
class ServeHTTPRequest(_message.Message):
"""-----------------------------------------------------------------------------
ServeHTTP Request Streaming Messages
Direction: Go server -> Python plugin
-----------------------------------------------------------------------------
ServeHTTPRequest is a streaming message sent from Go to Python.
The first message contains request metadata; subsequent messages contain body chunks.
"""
DESCRIPTOR: _descriptor.Descriptor
INIT_FIELD_NUMBER: _builtins.int
BODY_CHUNK_FIELD_NUMBER: _builtins.int
BODY_COMPLETE_FIELD_NUMBER: _builtins.int
body_chunk: _builtins.bytes
"""Body chunk (may be empty in first message or if no body)"""
body_complete: _builtins.bool
"""Indicates this is the last body chunk.
If true, no more body chunks will follow.
This may be set on the first message if the request has no body.
"""
@_builtins.property
def init(self) -> Global___ServeHTTPRequestInit:
"""Request metadata (set only in first message of stream)"""
def __init__(
self,
*,
init: Global___ServeHTTPRequestInit | None = ...,
body_chunk: _builtins.bytes = ...,
body_complete: _builtins.bool = ...,
) -> None: ...
_HasFieldArgType: _TypeAlias = _typing.Literal["init", b"init"] # noqa: Y015
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
_ClearFieldArgType: _TypeAlias = _typing.Literal["body_chunk", b"body_chunk", "body_complete", b"body_complete", "init", b"init"] # noqa: Y015
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
Global___ServeHTTPRequest: _TypeAlias = ServeHTTPRequest # noqa: Y015
@_typing.final
class ServeHTTPRequestInit(_message.Message):
"""ServeHTTPRequestInit contains HTTP request metadata.
Sent as part of the first ServeHTTPRequest message.
"""
DESCRIPTOR: _descriptor.Descriptor
PLUGIN_CONTEXT_FIELD_NUMBER: _builtins.int
METHOD_FIELD_NUMBER: _builtins.int
URL_FIELD_NUMBER: _builtins.int
PROTO_FIELD_NUMBER: _builtins.int
PROTO_MAJOR_FIELD_NUMBER: _builtins.int
PROTO_MINOR_FIELD_NUMBER: _builtins.int
HEADERS_FIELD_NUMBER: _builtins.int
HOST_FIELD_NUMBER: _builtins.int
REMOTE_ADDR_FIELD_NUMBER: _builtins.int
REQUEST_URI_FIELD_NUMBER: _builtins.int
CONTENT_LENGTH_FIELD_NUMBER: _builtins.int
method: _builtins.str
"""HTTP method (GET, POST, PUT, DELETE, etc.)"""
url: _builtins.str
"""Full URL as string (e.g., "http://localhost:8065/plugins/myid/api/v1/foo?bar=baz")"""
proto: _builtins.str
"""Protocol version (e.g., "HTTP/1.1", "HTTP/2.0")"""
proto_major: _builtins.int
"""Major version number (e.g., 1 for HTTP/1.1)"""
proto_minor: _builtins.int
"""Minor version number (e.g., 1 for HTTP/1.1)"""
host: _builtins.str
"""Host header value (may differ from URL host for virtual hosting)"""
remote_addr: _builtins.str
"""Remote address of the client (e.g., "192.168.1.1:12345")"""
request_uri: _builtins.str
"""The original request URI as received (includes query string)"""
content_length: _builtins.int
"""Content-Length if known, -1 if unknown/chunked"""
@_builtins.property
def plugin_context(self) -> _hooks_common_pb2.PluginContext:
"""Plugin context for this request"""
@_builtins.property
def headers(self) -> _containers.RepeatedCompositeFieldContainer[Global___HTTPHeader]:
"""HTTP headers (supports multi-value headers)"""
def __init__(
self,
*,
plugin_context: _hooks_common_pb2.PluginContext | None = ...,
method: _builtins.str = ...,
url: _builtins.str = ...,
proto: _builtins.str = ...,
proto_major: _builtins.int = ...,
proto_minor: _builtins.int = ...,
headers: _abc.Iterable[Global___HTTPHeader] | None = ...,
host: _builtins.str = ...,
remote_addr: _builtins.str = ...,
request_uri: _builtins.str = ...,
content_length: _builtins.int = ...,
) -> None: ...
_HasFieldArgType: _TypeAlias = _typing.Literal["plugin_context", b"plugin_context"] # noqa: Y015
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
_ClearFieldArgType: _TypeAlias = _typing.Literal["content_length", b"content_length", "headers", b"headers", "host", b"host", "method", b"method", "plugin_context", b"plugin_context", "proto", b"proto", "proto_major", b"proto_major", "proto_minor", b"proto_minor", "remote_addr", b"remote_addr", "request_uri", b"request_uri", "url", b"url"] # noqa: Y015
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
Global___ServeHTTPRequestInit: _TypeAlias = ServeHTTPRequestInit # noqa: Y015
@_typing.final
class ServeHTTPResponse(_message.Message):
"""-----------------------------------------------------------------------------
ServeHTTP Response Streaming Messages
Direction: Python plugin -> Go server
-----------------------------------------------------------------------------
ServeHTTPResponse is a streaming message sent from Python to Go.
The first message contains response metadata; subsequent messages contain body chunks.
RESPONSE STREAMING INVARIANTS:
- Exactly one response-init must be sent (explicitly or implicitly on first body write)
- Status code defaults to 200 if not set before first body write
- Headers are only accepted before the first body write (locked after init)
- Flush may be sent any time after response-init; Go ignores if underlying writer doesn't support it
- body_complete=true signals end of response; no more messages should follow
MESSAGE ORDERING:
1. First message: init (status + headers) with optional body_chunk
2. Subsequent messages: body_chunk and/or flush
3. Final message: body_complete=true (may include final body_chunk)
"""
DESCRIPTOR: _descriptor.Descriptor
INIT_FIELD_NUMBER: _builtins.int
BODY_CHUNK_FIELD_NUMBER: _builtins.int
BODY_COMPLETE_FIELD_NUMBER: _builtins.int
FLUSH_FIELD_NUMBER: _builtins.int
body_chunk: _builtins.bytes
"""Body chunk (may be empty in first message or if no body)
Recommended max chunk size: 64KB
"""
body_complete: _builtins.bool
"""Indicates this is the last body chunk.
If true, no more body chunks will follow.
"""
flush: _builtins.bool
"""Request an immediate flush of buffered response data to the client.
Best-effort: Go will call http.Flusher.Flush() if the underlying
ResponseWriter supports it; otherwise silently ignored.
This matches Go plugin RPC behavior (see plugin/http.go).
"""
@_builtins.property
def init(self) -> Global___ServeHTTPResponseInit:
"""Response metadata (set only in first message of stream)
MUST be present in first message. Status code range must be 100-999.
"""
def __init__(
self,
*,
init: Global___ServeHTTPResponseInit | None = ...,
body_chunk: _builtins.bytes = ...,
body_complete: _builtins.bool = ...,
flush: _builtins.bool = ...,
) -> None: ...
_HasFieldArgType: _TypeAlias = _typing.Literal["init", b"init"] # noqa: Y015
def HasField(self, field_name: _HasFieldArgType) -> _builtins.bool: ...
_ClearFieldArgType: _TypeAlias = _typing.Literal["body_chunk", b"body_chunk", "body_complete", b"body_complete", "flush", b"flush", "init", b"init"] # noqa: Y015
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
Global___ServeHTTPResponse: _TypeAlias = ServeHTTPResponse # noqa: Y015
@_typing.final
class ServeHTTPResponseInit(_message.Message):
"""ServeHTTPResponseInit contains HTTP response metadata.
Sent as part of the first ServeHTTPResponse message.
VALIDATION:
- status_code must be in range 100-999 (per HTTP spec)
- Invalid status codes cause Go to return 500 and log an error
- status_code of 0 defaults to 200 OK
"""
DESCRIPTOR: _descriptor.Descriptor
STATUS_CODE_FIELD_NUMBER: _builtins.int
HEADERS_FIELD_NUMBER: _builtins.int
status_code: _builtins.int
"""HTTP status code (e.g., 200, 404, 500)
Must be in range 100-999. 0 defaults to 200.
Invalid values (< 100 or > 999) will be rejected with 500 error.
"""
@_builtins.property
def headers(self) -> _containers.RepeatedCompositeFieldContainer[Global___HTTPHeader]:
"""HTTP response headers (supports multi-value headers)
Headers are immutable after init is sent.
"""
def __init__(
self,
*,
status_code: _builtins.int = ...,
headers: _abc.Iterable[Global___HTTPHeader] | None = ...,
) -> None: ...
_ClearFieldArgType: _TypeAlias = _typing.Literal["headers", b"headers", "status_code", b"status_code"] # noqa: Y015
def ClearField(self, field_name: _ClearFieldArgType) -> None: ...
Global___ServeHTTPResponseInit: _TypeAlias = ServeHTTPResponseInit # noqa: Y015