slackbotv1

package
v0.0.0-...-6929601 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package slackbotv1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	SlackBotAPI_Event_FullMethodName = "/clutch.bot.slackbot.v1.SlackBotAPI/Event"
)

Variables

View Source
var File_bot_slackbot_v1_slackbot_proto protoreflect.FileDescriptor
View Source
var SlackBotAPI_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "clutch.bot.slackbot.v1.SlackBotAPI",
	HandlerType: (*SlackBotAPIServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Event",
			Handler:    _SlackBotAPI_Event_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "bot/slackbot/v1/slackbot.proto",
}

SlackBotAPI_ServiceDesc is the grpc.ServiceDesc for SlackBotAPI service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterSlackBotAPIHandler

func RegisterSlackBotAPIHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterSlackBotAPIHandler registers the http handlers for service SlackBotAPI to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterSlackBotAPIHandlerClient

func RegisterSlackBotAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SlackBotAPIClient) error

RegisterSlackBotAPIHandlerClient registers the http handlers for service SlackBotAPI to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SlackBotAPIClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SlackBotAPIClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "SlackBotAPIClient" to call the correct interceptors.

func RegisterSlackBotAPIHandlerFromEndpoint

func RegisterSlackBotAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterSlackBotAPIHandlerFromEndpoint is same as RegisterSlackBotAPIHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterSlackBotAPIHandlerServer

func RegisterSlackBotAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SlackBotAPIServer) error

RegisterSlackBotAPIHandlerServer registers the http handlers for service SlackBotAPI to "mux". UnaryRPC :call SlackBotAPIServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSlackBotAPIHandlerFromEndpoint instead.

func RegisterSlackBotAPIServer

func RegisterSlackBotAPIServer(s grpc.ServiceRegistrar, srv SlackBotAPIServer)

Types

type Bot

type Bot struct {

	// bot id
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// if the bot is deleted
	Deleted bool `protobuf:"varint,2,opt,name=deleted,proto3" json:"deleted,omitempty"`
	// bot name
	Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	// timestamp of when the bot app was last updated
	Updated int64 `protobuf:"varint,4,opt,name=updated,proto3" json:"updated,omitempty"`
	// unique identifier of the installed Slack application
	AppId string `protobuf:"bytes,5,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	// image urls of the bot's display picture
	Icons map[string]string `` /* 151-byte string literal not displayed */
	// unique identifier of the workspace where the event occurred
	TeamId string `protobuf:"bytes,7,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty"`
	// contains filtered or unexported fields
}

Information on the bot user

func (*Bot) Descriptor deprecated

func (*Bot) Descriptor() ([]byte, []int)

Deprecated: Use Bot.ProtoReflect.Descriptor instead.

func (*Bot) GetAppId

func (x *Bot) GetAppId() string

func (*Bot) GetDeleted

func (x *Bot) GetDeleted() bool

func (*Bot) GetIcons

func (x *Bot) GetIcons() map[string]string

func (*Bot) GetId

func (x *Bot) GetId() string

func (*Bot) GetName

func (x *Bot) GetName() string

func (*Bot) GetTeamId

func (x *Bot) GetTeamId() string

func (*Bot) GetUpdated

func (x *Bot) GetUpdated() int64

func (*Bot) ProtoMessage

func (*Bot) ProtoMessage()

func (*Bot) ProtoReflect

func (x *Bot) ProtoReflect() protoreflect.Message

func (*Bot) Reset

func (x *Bot) Reset()

func (*Bot) String

func (x *Bot) String() string

func (*Bot) Validate

func (m *Bot) Validate() error

Validate checks the field values on Bot with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Bot) ValidateAll

func (m *Bot) ValidateAll() error

ValidateAll checks the field values on Bot with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in BotMultiError, or nil if none found.

type BotMultiError

type BotMultiError []error

BotMultiError is an error wrapping multiple validation errors returned by Bot.ValidateAll() if the designated constraints aren't met.

func (BotMultiError) AllErrors

func (m BotMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (BotMultiError) Error

func (m BotMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type BotValidationError

type BotValidationError struct {
	// contains filtered or unexported fields
}

BotValidationError is the validation error returned by Bot.Validate if the designated constraints aren't met.

func (BotValidationError) Cause

func (e BotValidationError) Cause() error

Cause function returns cause value.

func (BotValidationError) Error

func (e BotValidationError) Error() string

Error satisfies the builtin error interface

func (BotValidationError) ErrorName

func (e BotValidationError) ErrorName() string

ErrorName returns error name.

func (BotValidationError) Field

func (e BotValidationError) Field() string

Field function returns field value.

func (BotValidationError) Key

func (e BotValidationError) Key() bool

Key function returns key value.

func (BotValidationError) Reason

func (e BotValidationError) Reason() string

Reason function returns reason value.

type Event

type Event struct {

	// the type of event
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// the user id of the user who messaged the bot
	User  string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"`
	BotId string `protobuf:"bytes,3,opt,name=bot_id,json=botId,proto3" json:"bot_id,omitempty"`
	// metadata on the bot
	BotProfile *Bot `protobuf:"bytes,4,opt,name=bot_profile,json=botProfile,proto3" json:"bot_profile,omitempty"`
	// the message text
	Text string `protobuf:"bytes,5,opt,name=text,proto3" json:"text,omitempty"`
	// timestamp associated with the object the event is describing
	Ts string `protobuf:"bytes,6,opt,name=ts,proto3" json:"ts,omitempty"`
	// the channel id of the channel where the event happened
	Channel string `protobuf:"bytes,7,opt,name=channel,proto3" json:"channel,omitempty"`
	// for DM messages, this will be "im"
	ChannelType string `protobuf:"bytes,8,opt,name=channel_type,json=channelType,proto3" json:"channel_type,omitempty"`
	// timestamp associated with the streamed event
	EventTs string `protobuf:"bytes,9,opt,name=event_ts,json=eventTs,proto3" json:"event_ts,omitempty"`
	// unclear what this field is but it's sent as part of the request from the Events API. Seems like it's a mistake
	// and it hasn't been addressed https://github.com/slackapi/python-slack-sdk/issues/736, so we have to support it for
	// now.
	ClientMsgId string `protobuf:"bytes,10,opt,name=client_msg_id,json=clientMsgId,proto3" json:"client_msg_id,omitempty"`
	// unique identifier of the workspace where the event occurred
	// identical to the team field value sent in the outer layer of the request
	Team string `protobuf:"bytes,11,opt,name=team,proto3" json:"team,omitempty"`
	// received when a user interacts with a Block Kit component, schema can vary.
	// https://api.slack.com/reference/block-kit/interactive-components
	Blocks *structpb.Value `protobuf:"bytes,12,opt,name=blocks,proto3" json:"blocks,omitempty"`
	// contains filtered or unexported fields
}

The structure of events vary among types. Full list of event types: https://api.slack.com/events. We will be receiving app_mention events (events that mention the bot) or message.im events (a message posted in a DM with the bot).

func (*Event) Descriptor deprecated

func (*Event) Descriptor() ([]byte, []int)

Deprecated: Use Event.ProtoReflect.Descriptor instead.

func (*Event) GetBlocks

func (x *Event) GetBlocks() *structpb.Value

func (*Event) GetBotId

func (x *Event) GetBotId() string

func (*Event) GetBotProfile

func (x *Event) GetBotProfile() *Bot

func (*Event) GetChannel

func (x *Event) GetChannel() string

func (*Event) GetChannelType

func (x *Event) GetChannelType() string

func (*Event) GetClientMsgId

func (x *Event) GetClientMsgId() string

func (*Event) GetEventTs

func (x *Event) GetEventTs() string

func (*Event) GetTeam

func (x *Event) GetTeam() string

func (*Event) GetText

func (x *Event) GetText() string

func (*Event) GetTs

func (x *Event) GetTs() string

func (*Event) GetType

func (x *Event) GetType() string

func (*Event) GetUser

func (x *Event) GetUser() string

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) ProtoReflect

func (x *Event) ProtoReflect() protoreflect.Message

func (*Event) Reset

func (x *Event) Reset()

func (*Event) String

func (x *Event) String() string

func (*Event) Validate

func (m *Event) Validate() error

Validate checks the field values on Event with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Event) ValidateAll

func (m *Event) ValidateAll() error

ValidateAll checks the field values on Event with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in EventMultiError, or nil if none found.

type EventMultiError

type EventMultiError []error

EventMultiError is an error wrapping multiple validation errors returned by Event.ValidateAll() if the designated constraints aren't met.

func (EventMultiError) AllErrors

func (m EventMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (EventMultiError) Error

func (m EventMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type EventRequest

type EventRequest struct {

	// verification token to validate the event originated from Slack
	Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	// if where the event occured is an external shared channel
	IsExtSharedChannel bool `protobuf:"varint,2,opt,name=is_ext_shared_channel,json=isExtSharedChannel,proto3" json:"is_ext_shared_channel,omitempty"`
	// unique identifier of the workspace where the event occurred
	TeamId string `protobuf:"bytes,3,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty"`
	// unique identifier of the installed Slack application
	ApiAppId string `protobuf:"bytes,4,opt,name=api_app_id,json=apiAppId,proto3" json:"api_app_id,omitempty"`
	// TODO: (sperry) if we expand the types of events we suscribe to and their fields vary alot, maybe we should use
	// google.protobuf.Value.
	Event *Event `protobuf:"bytes,5,opt,name=event,proto3" json:"event,omitempty"`
	// indicates which kind of event this is
	Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"`
	// identifier for this specific event, globally unique across all workspaces
	EventId string `protobuf:"bytes,7,opt,name=event_id,json=eventId,proto3" json:"event_id,omitempty"`
	// epoch timestamp in seconds indicating when this event was dispatched
	EventTime int64 `protobuf:"varint,8,opt,name=event_time,json=eventTime,proto3" json:"event_time,omitempty"`
	// an identifier for this specific event, can be used with list of authorizations to obtain a full list of
	// installations of your app that this event is visible to
	EventContext string `protobuf:"bytes,9,opt,name=event_context,json=eventContext,proto3" json:"event_context,omitempty"`
	// describes the installation of the app that the event is visible to
	// https://api.slack.com/apis/connections/events-api#authorizations
	Authorizations *structpb.Value `protobuf:"bytes,10,opt,name=authorizations,proto3" json:"authorizations,omitempty"`
	// randomly generated string used as part of the URL verification handshake,
	// https://api.slack.com/apis/connections/events-api#the-events-api__subscribing-to-event-types__events-api-request-urls__request-url-configuration--verification__url-verification-handshake
	Challenge string `protobuf:"bytes,11,opt,name=challenge,proto3" json:"challenge,omitempty"`
	// sent in the request if we receive more than 30,000 events in 60 minutes
	// https://api.slack.com/apis/connections/events-api#the-events-api__responding-to-events__rate-limiting
	MinuteRateLimited string `protobuf:"bytes,12,opt,name=minute_rate_limited,json=minuteRateLimited,proto3" json:"minute_rate_limited,omitempty"`
	// contains filtered or unexported fields
}

For more details: https://api.slack.com/apis/connections/events-api#the-events-api__receiving-events https://api.slack.com/enterprise/apps/reference#event

func (*EventRequest) Descriptor deprecated

func (*EventRequest) Descriptor() ([]byte, []int)

Deprecated: Use EventRequest.ProtoReflect.Descriptor instead.

func (*EventRequest) GetApiAppId

func (x *EventRequest) GetApiAppId() string

func (*EventRequest) GetAuthorizations

func (x *EventRequest) GetAuthorizations() *structpb.Value

func (*EventRequest) GetChallenge

func (x *EventRequest) GetChallenge() string

func (*EventRequest) GetEvent

func (x *EventRequest) GetEvent() *Event

func (*EventRequest) GetEventContext

func (x *EventRequest) GetEventContext() string

func (*EventRequest) GetEventId

func (x *EventRequest) GetEventId() string

func (*EventRequest) GetEventTime

func (x *EventRequest) GetEventTime() int64

func (*EventRequest) GetIsExtSharedChannel

func (x *EventRequest) GetIsExtSharedChannel() bool

func (*EventRequest) GetMinuteRateLimited

func (x *EventRequest) GetMinuteRateLimited() string

func (*EventRequest) GetTeamId

func (x *EventRequest) GetTeamId() string

func (*EventRequest) GetToken

func (x *EventRequest) GetToken() string

func (*EventRequest) GetType

func (x *EventRequest) GetType() string

func (*EventRequest) ProtoMessage

func (*EventRequest) ProtoMessage()

func (*EventRequest) ProtoReflect

func (x *EventRequest) ProtoReflect() protoreflect.Message

func (*EventRequest) Reset

func (x *EventRequest) Reset()

func (*EventRequest) String

func (x *EventRequest) String() string

func (*EventRequest) Validate

func (m *EventRequest) Validate() error

Validate checks the field values on EventRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*EventRequest) ValidateAll

func (m *EventRequest) ValidateAll() error

ValidateAll checks the field values on EventRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in EventRequestMultiError, or nil if none found.

type EventRequestMultiError

type EventRequestMultiError []error

EventRequestMultiError is an error wrapping multiple validation errors returned by EventRequest.ValidateAll() if the designated constraints aren't met.

func (EventRequestMultiError) AllErrors

func (m EventRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (EventRequestMultiError) Error

func (m EventRequestMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type EventRequestValidationError

type EventRequestValidationError struct {
	// contains filtered or unexported fields
}

EventRequestValidationError is the validation error returned by EventRequest.Validate if the designated constraints aren't met.

func (EventRequestValidationError) Cause

Cause function returns cause value.

func (EventRequestValidationError) Error

Error satisfies the builtin error interface

func (EventRequestValidationError) ErrorName

func (e EventRequestValidationError) ErrorName() string

ErrorName returns error name.

func (EventRequestValidationError) Field

Field function returns field value.

func (EventRequestValidationError) Key

Key function returns key value.

func (EventRequestValidationError) Reason

Reason function returns reason value.

type EventResponse

type EventResponse struct {

	// the request will include the challenge and we respond back with the same challenge to complete the URL verification
	// handshake
	Challenge string `protobuf:"bytes,1,opt,name=challenge,proto3" json:"challenge,omitempty"`
	// contains filtered or unexported fields
}

Respond back to the Slack Events API with the challenge or a 2xx, https://api.slack.com/apis/connections/events-api#the-events-api__responding-to-events

func (*EventResponse) Descriptor deprecated

func (*EventResponse) Descriptor() ([]byte, []int)

Deprecated: Use EventResponse.ProtoReflect.Descriptor instead.

func (*EventResponse) GetChallenge

func (x *EventResponse) GetChallenge() string

func (*EventResponse) ProtoMessage

func (*EventResponse) ProtoMessage()

func (*EventResponse) ProtoReflect

func (x *EventResponse) ProtoReflect() protoreflect.Message

func (*EventResponse) Reset

func (x *EventResponse) Reset()

func (*EventResponse) String

func (x *EventResponse) String() string

func (*EventResponse) Validate

func (m *EventResponse) Validate() error

Validate checks the field values on EventResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*EventResponse) ValidateAll

func (m *EventResponse) ValidateAll() error

ValidateAll checks the field values on EventResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in EventResponseMultiError, or nil if none found.

type EventResponseMultiError

type EventResponseMultiError []error

EventResponseMultiError is an error wrapping multiple validation errors returned by EventResponse.ValidateAll() if the designated constraints aren't met.

func (EventResponseMultiError) AllErrors

func (m EventResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (EventResponseMultiError) Error

func (m EventResponseMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type EventResponseValidationError

type EventResponseValidationError struct {
	// contains filtered or unexported fields
}

EventResponseValidationError is the validation error returned by EventResponse.Validate if the designated constraints aren't met.

func (EventResponseValidationError) Cause

Cause function returns cause value.

func (EventResponseValidationError) Error

Error satisfies the builtin error interface

func (EventResponseValidationError) ErrorName

func (e EventResponseValidationError) ErrorName() string

ErrorName returns error name.

func (EventResponseValidationError) Field

Field function returns field value.

func (EventResponseValidationError) Key

Key function returns key value.

func (EventResponseValidationError) Reason

Reason function returns reason value.

type EventValidationError

type EventValidationError struct {
	// contains filtered or unexported fields
}

EventValidationError is the validation error returned by Event.Validate if the designated constraints aren't met.

func (EventValidationError) Cause

func (e EventValidationError) Cause() error

Cause function returns cause value.

func (EventValidationError) Error

func (e EventValidationError) Error() string

Error satisfies the builtin error interface

func (EventValidationError) ErrorName

func (e EventValidationError) ErrorName() string

ErrorName returns error name.

func (EventValidationError) Field

func (e EventValidationError) Field() string

Field function returns field value.

func (EventValidationError) Key

func (e EventValidationError) Key() bool

Key function returns key value.

func (EventValidationError) Reason

func (e EventValidationError) Reason() string

Reason function returns reason value.

type SlackBotAPIClient

type SlackBotAPIClient interface {
	Event(ctx context.Context, in *EventRequest, opts ...grpc.CallOption) (*EventResponse, error)
}

SlackBotAPIClient is the client API for SlackBotAPI service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type SlackBotAPIServer

type SlackBotAPIServer interface {
	Event(context.Context, *EventRequest) (*EventResponse, error)
}

SlackBotAPIServer is the server API for SlackBotAPI service. All implementations should embed UnimplementedSlackBotAPIServer for forward compatibility

type UnimplementedSlackBotAPIServer

type UnimplementedSlackBotAPIServer struct {
}

UnimplementedSlackBotAPIServer should be embedded to have forward compatible implementations.

func (UnimplementedSlackBotAPIServer) Event

type UnsafeSlackBotAPIServer

type UnsafeSlackBotAPIServer interface {
	// contains filtered or unexported methods
}

UnsafeSlackBotAPIServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SlackBotAPIServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL