mirror of
https://github.com/mattermost/mattermost.git
synced 2026-02-03 20:40:00 -05:00
Add hooks_common.proto with PluginContext message that mirrors the server/public/plugin/context.go Context struct. This provides session_id, request_id, ip_address, accept_language, and user_agent fields for passing hook invocation context from server to plugins. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
183 lines
5.9 KiB
Go
183 lines
5.9 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
// versions:
|
|
// protoc-gen-go v1.36.6
|
|
// protoc v6.33.4
|
|
// source: hooks_common.proto
|
|
|
|
package pluginapiv1
|
|
|
|
import (
|
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
|
reflect "reflect"
|
|
sync "sync"
|
|
unsafe "unsafe"
|
|
)
|
|
|
|
const (
|
|
// Verify that this generated code is sufficiently up-to-date.
|
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
|
)
|
|
|
|
// PluginContext passes through metadata about the request or hook event.
|
|
// Maps to plugin.Context in Go (server/public/plugin/context.go).
|
|
//
|
|
// This context is passed to hooks that require request-level information,
|
|
// such as session details, request tracing, and client metadata.
|
|
//
|
|
// Note: This is distinct from RequestContext (used in API calls) because
|
|
// hooks receive server-initiated context rather than plugin-initiated context.
|
|
type PluginContext struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
// The session ID of the user making the request, if applicable.
|
|
// Empty for system-initiated hooks not tied to a user session.
|
|
SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
|
|
// A unique identifier for this request, used for tracing and logging.
|
|
// Correlates log entries across the server and plugin boundary.
|
|
RequestId string `protobuf:"bytes,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
|
// The IP address of the client making the request.
|
|
// May be empty for server-initiated hooks.
|
|
IpAddress string `protobuf:"bytes,3,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"`
|
|
// The Accept-Language header from the client request.
|
|
// Used for localization. May be empty.
|
|
AcceptLanguage string `protobuf:"bytes,4,opt,name=accept_language,json=acceptLanguage,proto3" json:"accept_language,omitempty"`
|
|
// The User-Agent header from the client request.
|
|
// Identifies the client software. May be empty.
|
|
UserAgent string `protobuf:"bytes,5,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *PluginContext) Reset() {
|
|
*x = PluginContext{}
|
|
mi := &file_hooks_common_proto_msgTypes[0]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *PluginContext) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*PluginContext) ProtoMessage() {}
|
|
|
|
func (x *PluginContext) ProtoReflect() protoreflect.Message {
|
|
mi := &file_hooks_common_proto_msgTypes[0]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use PluginContext.ProtoReflect.Descriptor instead.
|
|
func (*PluginContext) Descriptor() ([]byte, []int) {
|
|
return file_hooks_common_proto_rawDescGZIP(), []int{0}
|
|
}
|
|
|
|
func (x *PluginContext) GetSessionId() string {
|
|
if x != nil {
|
|
return x.SessionId
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *PluginContext) GetRequestId() string {
|
|
if x != nil {
|
|
return x.RequestId
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *PluginContext) GetIpAddress() string {
|
|
if x != nil {
|
|
return x.IpAddress
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *PluginContext) GetAcceptLanguage() string {
|
|
if x != nil {
|
|
return x.AcceptLanguage
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *PluginContext) GetUserAgent() string {
|
|
if x != nil {
|
|
return x.UserAgent
|
|
}
|
|
return ""
|
|
}
|
|
|
|
var File_hooks_common_proto protoreflect.FileDescriptor
|
|
|
|
const file_hooks_common_proto_rawDesc = "" +
|
|
"\n" +
|
|
"\x12hooks_common.proto\x12\x17mattermost.pluginapi.v1\"\xb4\x01\n" +
|
|
"\rPluginContext\x12\x1d\n" +
|
|
"\n" +
|
|
"session_id\x18\x01 \x01(\tR\tsessionId\x12\x1d\n" +
|
|
"\n" +
|
|
"request_id\x18\x02 \x01(\tR\trequestId\x12\x1d\n" +
|
|
"\n" +
|
|
"ip_address\x18\x03 \x01(\tR\tipAddress\x12'\n" +
|
|
"\x0faccept_language\x18\x04 \x01(\tR\x0eacceptLanguage\x12\x1d\n" +
|
|
"\n" +
|
|
"user_agent\x18\x05 \x01(\tR\tuserAgentBXZVgithub.com/mattermost/mattermost/server/public/pluginapi/grpc/generated/go/pluginapiv1b\x06proto3"
|
|
|
|
var (
|
|
file_hooks_common_proto_rawDescOnce sync.Once
|
|
file_hooks_common_proto_rawDescData []byte
|
|
)
|
|
|
|
func file_hooks_common_proto_rawDescGZIP() []byte {
|
|
file_hooks_common_proto_rawDescOnce.Do(func() {
|
|
file_hooks_common_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_hooks_common_proto_rawDesc), len(file_hooks_common_proto_rawDesc)))
|
|
})
|
|
return file_hooks_common_proto_rawDescData
|
|
}
|
|
|
|
var file_hooks_common_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
|
var file_hooks_common_proto_goTypes = []any{
|
|
(*PluginContext)(nil), // 0: mattermost.pluginapi.v1.PluginContext
|
|
}
|
|
var file_hooks_common_proto_depIdxs = []int32{
|
|
0, // [0:0] is the sub-list for method output_type
|
|
0, // [0:0] is the sub-list for method input_type
|
|
0, // [0:0] is the sub-list for extension type_name
|
|
0, // [0:0] is the sub-list for extension extendee
|
|
0, // [0:0] is the sub-list for field type_name
|
|
}
|
|
|
|
func init() { file_hooks_common_proto_init() }
|
|
func file_hooks_common_proto_init() {
|
|
if File_hooks_common_proto != nil {
|
|
return
|
|
}
|
|
type x struct{}
|
|
out := protoimpl.TypeBuilder{
|
|
File: protoimpl.DescBuilder{
|
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_hooks_common_proto_rawDesc), len(file_hooks_common_proto_rawDesc)),
|
|
NumEnums: 0,
|
|
NumMessages: 1,
|
|
NumExtensions: 0,
|
|
NumServices: 0,
|
|
},
|
|
GoTypes: file_hooks_common_proto_goTypes,
|
|
DependencyIndexes: file_hooks_common_proto_depIdxs,
|
|
MessageInfos: file_hooks_common_proto_msgTypes,
|
|
}.Build()
|
|
File_hooks_common_proto = out.File
|
|
file_hooks_common_proto_goTypes = nil
|
|
file_hooks_common_proto_depIdxs = nil
|
|
}
|