mirror of
https://github.com/mattermost/mattermost.git
synced 2026-02-03 20:40:00 -05:00
- Create api.proto with PluginAPI service definition covering all 236 methods from server/public/plugin/api.go - Create api_user_team.proto with User, Session, and Team request/response messages with placeholder fields - Create api_channel_post.proto with Channel, Post, and Emoji messages - Create api_kv_config.proto with KV store, config, plugin, and logging messages - Create api_file_bot.proto with File, Upload, and Bot messages - Create api_remaining.proto with Server, Command, Preference, OAuth, Group, SharedChannel, Property, and Audit messages - Add ViewUsersRestrictions to common.proto - Add apiverify tool that parses Go API interface and proto service to ensure parity - Update Makefile with new proto file mappings Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
445 lines
14 KiB
Go
445 lines
14 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: common.proto
|
|
|
|
package pluginapiv1
|
|
|
|
import (
|
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
|
structpb "google.golang.org/protobuf/types/known/structpb"
|
|
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)
|
|
)
|
|
|
|
// Empty is a placeholder message used for methods with no request/response data.
|
|
type Empty struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *Empty) Reset() {
|
|
*x = Empty{}
|
|
mi := &file_common_proto_msgTypes[0]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *Empty) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*Empty) ProtoMessage() {}
|
|
|
|
func (x *Empty) ProtoReflect() protoreflect.Message {
|
|
mi := &file_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 Empty.ProtoReflect.Descriptor instead.
|
|
func (*Empty) Descriptor() ([]byte, []int) {
|
|
return file_common_proto_rawDescGZIP(), []int{0}
|
|
}
|
|
|
|
// StringMap represents a map of string to string values.
|
|
// Used for User.Props, User.NotifyProps, User.Timezone, etc.
|
|
type StringMap struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
Values map[string]string `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *StringMap) Reset() {
|
|
*x = StringMap{}
|
|
mi := &file_common_proto_msgTypes[1]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *StringMap) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*StringMap) ProtoMessage() {}
|
|
|
|
func (x *StringMap) ProtoReflect() protoreflect.Message {
|
|
mi := &file_common_proto_msgTypes[1]
|
|
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 StringMap.ProtoReflect.Descriptor instead.
|
|
func (*StringMap) Descriptor() ([]byte, []int) {
|
|
return file_common_proto_rawDescGZIP(), []int{1}
|
|
}
|
|
|
|
func (x *StringMap) GetValues() map[string]string {
|
|
if x != nil {
|
|
return x.Values
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// RequestContext contains metadata for every RPC request.
|
|
// This MUST be embedded as the first field (tag 1) in every request message.
|
|
// Provides correlation IDs for logging, tracing, and debugging across
|
|
// the Go server and Python plugin boundary.
|
|
type RequestContext struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
// plugin_id is the logical plugin identifier (from manifest.id).
|
|
// Used for routing, logging, and permission checks.
|
|
PluginId string `protobuf:"bytes,1,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"`
|
|
// request_id is a unique identifier for this request.
|
|
// Used to correlate logs across Go server and Python plugin.
|
|
// Should be generated by the caller and propagated through the call chain.
|
|
RequestId string `protobuf:"bytes,2,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
|
// session_id is the optional session identifier for the user making the request.
|
|
// May be empty for plugin-initiated requests not tied to a user session.
|
|
SessionId string `protobuf:"bytes,3,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
|
|
// user_id is the optional user identifier for auditing purposes.
|
|
// May be empty for system-level operations.
|
|
UserId string `protobuf:"bytes,4,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *RequestContext) Reset() {
|
|
*x = RequestContext{}
|
|
mi := &file_common_proto_msgTypes[2]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *RequestContext) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*RequestContext) ProtoMessage() {}
|
|
|
|
func (x *RequestContext) ProtoReflect() protoreflect.Message {
|
|
mi := &file_common_proto_msgTypes[2]
|
|
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 RequestContext.ProtoReflect.Descriptor instead.
|
|
func (*RequestContext) Descriptor() ([]byte, []int) {
|
|
return file_common_proto_rawDescGZIP(), []int{2}
|
|
}
|
|
|
|
func (x *RequestContext) GetPluginId() string {
|
|
if x != nil {
|
|
return x.PluginId
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *RequestContext) GetRequestId() string {
|
|
if x != nil {
|
|
return x.RequestId
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *RequestContext) GetSessionId() string {
|
|
if x != nil {
|
|
return x.SessionId
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *RequestContext) GetUserId() string {
|
|
if x != nil {
|
|
return x.UserId
|
|
}
|
|
return ""
|
|
}
|
|
|
|
// AppError represents an error returned by the Mattermost server.
|
|
// Maps to model.AppError in Go.
|
|
//
|
|
// This is embedded in every response message as field 1 to indicate
|
|
// operation failure. A null/empty AppError indicates success.
|
|
type AppError struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
// A unique error identifier (e.g., "api.user.create.email_taken.app_error")
|
|
// Used for error categorization and i18n lookup.
|
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
|
// Human-readable error message (may be translated)
|
|
// This is the user-facing message.
|
|
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
|
// Internal error details for debugging
|
|
// Contains technical details not shown to end users.
|
|
DetailedError string `protobuf:"bytes,3,opt,name=detailed_error,json=detailedError,proto3" json:"detailed_error,omitempty"`
|
|
// The request ID for tracing
|
|
// Matches RequestContext.request_id for correlation.
|
|
RequestId string `protobuf:"bytes,4,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"`
|
|
// HTTP status code (maps to standard HTTP codes)
|
|
// Examples: 400 (Bad Request), 404 (Not Found), 500 (Internal Server Error)
|
|
StatusCode int32 `protobuf:"varint,5,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
|
|
// The function/method where the error originated (e.g., "UserStore.Get")
|
|
// Useful for debugging and error reporting.
|
|
Where string `protobuf:"bytes,6,opt,name=where,proto3" json:"where,omitempty"`
|
|
// Optional parameters for error message interpolation.
|
|
// Used when the error message is a template requiring variable substitution.
|
|
// Example: {"field": "email", "value": "invalid@"} for validation errors.
|
|
// Uses google.protobuf.Struct for flexible map[string]any representation.
|
|
Params *structpb.Struct `protobuf:"bytes,7,opt,name=params,proto3" json:"params,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *AppError) Reset() {
|
|
*x = AppError{}
|
|
mi := &file_common_proto_msgTypes[3]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *AppError) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*AppError) ProtoMessage() {}
|
|
|
|
func (x *AppError) ProtoReflect() protoreflect.Message {
|
|
mi := &file_common_proto_msgTypes[3]
|
|
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 AppError.ProtoReflect.Descriptor instead.
|
|
func (*AppError) Descriptor() ([]byte, []int) {
|
|
return file_common_proto_rawDescGZIP(), []int{3}
|
|
}
|
|
|
|
func (x *AppError) GetId() string {
|
|
if x != nil {
|
|
return x.Id
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *AppError) GetMessage() string {
|
|
if x != nil {
|
|
return x.Message
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *AppError) GetDetailedError() string {
|
|
if x != nil {
|
|
return x.DetailedError
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *AppError) GetRequestId() string {
|
|
if x != nil {
|
|
return x.RequestId
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *AppError) GetStatusCode() int32 {
|
|
if x != nil {
|
|
return x.StatusCode
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *AppError) GetWhere() string {
|
|
if x != nil {
|
|
return x.Where
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *AppError) GetParams() *structpb.Struct {
|
|
if x != nil {
|
|
return x.Params
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ViewUsersRestrictions restricts which users can be viewed.
|
|
// Maps to model.ViewUsersRestrictions in Go.
|
|
type ViewUsersRestrictions struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
Teams []string `protobuf:"bytes,1,rep,name=teams,proto3" json:"teams,omitempty"`
|
|
Channels []string `protobuf:"bytes,2,rep,name=channels,proto3" json:"channels,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *ViewUsersRestrictions) Reset() {
|
|
*x = ViewUsersRestrictions{}
|
|
mi := &file_common_proto_msgTypes[4]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *ViewUsersRestrictions) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*ViewUsersRestrictions) ProtoMessage() {}
|
|
|
|
func (x *ViewUsersRestrictions) ProtoReflect() protoreflect.Message {
|
|
mi := &file_common_proto_msgTypes[4]
|
|
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 ViewUsersRestrictions.ProtoReflect.Descriptor instead.
|
|
func (*ViewUsersRestrictions) Descriptor() ([]byte, []int) {
|
|
return file_common_proto_rawDescGZIP(), []int{4}
|
|
}
|
|
|
|
func (x *ViewUsersRestrictions) GetTeams() []string {
|
|
if x != nil {
|
|
return x.Teams
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *ViewUsersRestrictions) GetChannels() []string {
|
|
if x != nil {
|
|
return x.Channels
|
|
}
|
|
return nil
|
|
}
|
|
|
|
var File_common_proto protoreflect.FileDescriptor
|
|
|
|
const file_common_proto_rawDesc = "" +
|
|
"\n" +
|
|
"\fcommon.proto\x12\x17mattermost.pluginapi.v1\x1a\x1cgoogle/protobuf/struct.proto\"\a\n" +
|
|
"\x05Empty\"\x8e\x01\n" +
|
|
"\tStringMap\x12F\n" +
|
|
"\x06values\x18\x01 \x03(\v2..mattermost.pluginapi.v1.StringMap.ValuesEntryR\x06values\x1a9\n" +
|
|
"\vValuesEntry\x12\x10\n" +
|
|
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
|
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x84\x01\n" +
|
|
"\x0eRequestContext\x12\x1b\n" +
|
|
"\tplugin_id\x18\x01 \x01(\tR\bpluginId\x12\x1d\n" +
|
|
"\n" +
|
|
"request_id\x18\x02 \x01(\tR\trequestId\x12\x1d\n" +
|
|
"\n" +
|
|
"session_id\x18\x03 \x01(\tR\tsessionId\x12\x17\n" +
|
|
"\auser_id\x18\x04 \x01(\tR\x06userId\"\xe2\x01\n" +
|
|
"\bAppError\x12\x0e\n" +
|
|
"\x02id\x18\x01 \x01(\tR\x02id\x12\x18\n" +
|
|
"\amessage\x18\x02 \x01(\tR\amessage\x12%\n" +
|
|
"\x0edetailed_error\x18\x03 \x01(\tR\rdetailedError\x12\x1d\n" +
|
|
"\n" +
|
|
"request_id\x18\x04 \x01(\tR\trequestId\x12\x1f\n" +
|
|
"\vstatus_code\x18\x05 \x01(\x05R\n" +
|
|
"statusCode\x12\x14\n" +
|
|
"\x05where\x18\x06 \x01(\tR\x05where\x12/\n" +
|
|
"\x06params\x18\a \x01(\v2\x17.google.protobuf.StructR\x06params\"I\n" +
|
|
"\x15ViewUsersRestrictions\x12\x14\n" +
|
|
"\x05teams\x18\x01 \x03(\tR\x05teams\x12\x1a\n" +
|
|
"\bchannels\x18\x02 \x03(\tR\bchannelsBXZVgithub.com/mattermost/mattermost/server/public/pluginapi/grpc/generated/go/pluginapiv1b\x06proto3"
|
|
|
|
var (
|
|
file_common_proto_rawDescOnce sync.Once
|
|
file_common_proto_rawDescData []byte
|
|
)
|
|
|
|
func file_common_proto_rawDescGZIP() []byte {
|
|
file_common_proto_rawDescOnce.Do(func() {
|
|
file_common_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_common_proto_rawDesc), len(file_common_proto_rawDesc)))
|
|
})
|
|
return file_common_proto_rawDescData
|
|
}
|
|
|
|
var file_common_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
|
var file_common_proto_goTypes = []any{
|
|
(*Empty)(nil), // 0: mattermost.pluginapi.v1.Empty
|
|
(*StringMap)(nil), // 1: mattermost.pluginapi.v1.StringMap
|
|
(*RequestContext)(nil), // 2: mattermost.pluginapi.v1.RequestContext
|
|
(*AppError)(nil), // 3: mattermost.pluginapi.v1.AppError
|
|
(*ViewUsersRestrictions)(nil), // 4: mattermost.pluginapi.v1.ViewUsersRestrictions
|
|
nil, // 5: mattermost.pluginapi.v1.StringMap.ValuesEntry
|
|
(*structpb.Struct)(nil), // 6: google.protobuf.Struct
|
|
}
|
|
var file_common_proto_depIdxs = []int32{
|
|
5, // 0: mattermost.pluginapi.v1.StringMap.values:type_name -> mattermost.pluginapi.v1.StringMap.ValuesEntry
|
|
6, // 1: mattermost.pluginapi.v1.AppError.params:type_name -> google.protobuf.Struct
|
|
2, // [2:2] is the sub-list for method output_type
|
|
2, // [2:2] is the sub-list for method input_type
|
|
2, // [2:2] is the sub-list for extension type_name
|
|
2, // [2:2] is the sub-list for extension extendee
|
|
0, // [0:2] is the sub-list for field type_name
|
|
}
|
|
|
|
func init() { file_common_proto_init() }
|
|
func file_common_proto_init() {
|
|
if File_common_proto != nil {
|
|
return
|
|
}
|
|
type x struct{}
|
|
out := protoimpl.TypeBuilder{
|
|
File: protoimpl.DescBuilder{
|
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_common_proto_rawDesc), len(file_common_proto_rawDesc)),
|
|
NumEnums: 0,
|
|
NumMessages: 6,
|
|
NumExtensions: 0,
|
|
NumServices: 0,
|
|
},
|
|
GoTypes: file_common_proto_goTypes,
|
|
DependencyIndexes: file_common_proto_depIdxs,
|
|
MessageInfos: file_common_proto_msgTypes,
|
|
}.Build()
|
|
File_common_proto = out.File
|
|
file_common_proto_goTypes = nil
|
|
file_common_proto_depIdxs = nil
|
|
}
|