eventv2

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventService_Stream_FullMethodName  = "/apis.event.v2.EventService/Stream"
	EventService_Publish_FullMethodName = "/apis.event.v2.EventService/Publish"
)

Variables

View Source
var (
	EventsStreamMessageType_name = map[int32]string{
		0: "EVENTS_STREAM_MESSAGE_TYPE_UNSPECIFIED",
		1: "EVENTS_STREAM_MESSAGE_TYPE_PING",
		2: "EVENTS_STREAM_MESSAGE_TYPE_ERROR",
		3: "EVENTS_STREAM_MESSAGE_TYPE_SUBSCRIBED",
		4: "EVENTS_STREAM_MESSAGE_TYPE_UNSUBSCRIBED",
		5: "EVENTS_STREAM_MESSAGE_TYPE_PUBLISHED",
	}
	EventsStreamMessageType_value = map[string]int32{
		"EVENTS_STREAM_MESSAGE_TYPE_UNSPECIFIED":  0,
		"EVENTS_STREAM_MESSAGE_TYPE_PING":         1,
		"EVENTS_STREAM_MESSAGE_TYPE_ERROR":        2,
		"EVENTS_STREAM_MESSAGE_TYPE_SUBSCRIBED":   3,
		"EVENTS_STREAM_MESSAGE_TYPE_UNSUBSCRIBED": 4,
		"EVENTS_STREAM_MESSAGE_TYPE_PUBLISHED":    5,
	}
)

Enum value maps for EventsStreamMessageType.

View Source
var EventService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "apis.event.v2.EventService",
	HandlerType: (*EventServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Publish",
			Handler:    _EventService_Publish_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Stream",
			Handler:       _EventService_Stream_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "apis/event/v2/api.proto",
}

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

View Source
var File_apis_event_v2_api_proto protoreflect.FileDescriptor

Functions

func RegisterEventServiceServer

func RegisterEventServiceServer(s grpc.ServiceRegistrar, srv EventServiceServer)

Types

type EventServiceClient

type EventServiceClient interface {
	// Stream Events
	// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
	// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
	Stream(ctx context.Context, opts ...grpc.CallOption) (EventService_StreamClient, error)
	// Publish Event
	// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
	// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
	Publish(ctx context.Context, in *PublishEventRequest, opts ...grpc.CallOption) (*PublishEventResponse, error)
}

EventServiceClient is the client API for EventService 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 EventServiceServer

type EventServiceServer interface {
	// Stream Events
	// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
	// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
	Stream(EventService_StreamServer) error
	// Publish Event
	// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
	// buf:lint:ignore RPC_RESPONSE_STANDARD_NAME
	Publish(context.Context, *PublishEventRequest) (*PublishEventResponse, error)
}

EventServiceServer is the server API for EventService service. All implementations should embed UnimplementedEventServiceServer for forward compatibility

type EventService_StreamClient

type EventService_StreamClient interface {
	Send(*EventsStreamRequest) error
	Recv() (*EventsStreamResponse, error)
	grpc.ClientStream
}

type EventService_StreamServer

type EventService_StreamServer interface {
	Send(*EventsStreamResponse) error
	Recv() (*EventsStreamRequest, error)
	grpc.ServerStream
}

type EventTarget

type EventTarget struct {

	// Subscribe to events in a given collection.
	CollectionId *string `protobuf:"bytes,5,opt,name=collection_id,json=collectionId,proto3,oneof" json:"collection_id,omitempty"`
	// Subscribe to events in a given project.
	ProjectId *string `protobuf:"bytes,4,opt,name=project_id,json=projectId,proto3,oneof" json:"project_id,omitempty"`
	// Stream events to a specific layout.
	// Note: when specified, collection_id and project_id are implictly defined. If you choose
	// to define them, you they _must_ match the layout.
	LayoutId *string `protobuf:"bytes,1,opt,name=layout_id,json=layoutId,proto3,oneof" json:"layout_id,omitempty"`
	// contains filtered or unexported fields
}

Targetting for an event Event targetting allows you to listen or publish an event against a specific target. You can assume that: When subscribing, you will receive events for the chosen scope and any higher scope that isn't targetted. This means - An event published against a layoutId can be listened to by targetting the given layoutId, projectId or collectionId - An event published against a collectionId can be subscribed by scoping to any given projectId or layoutId under the collection.

func (*EventTarget) Descriptor deprecated

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

Deprecated: Use EventTarget.ProtoReflect.Descriptor instead.

func (*EventTarget) GetCollectionId

func (x *EventTarget) GetCollectionId() string

func (*EventTarget) GetLayoutId

func (x *EventTarget) GetLayoutId() string

func (*EventTarget) GetProjectId

func (x *EventTarget) GetProjectId() string

func (*EventTarget) ProtoMessage

func (*EventTarget) ProtoMessage()

func (*EventTarget) ProtoReflect

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

func (*EventTarget) Reset

func (x *EventTarget) Reset()

func (*EventTarget) String

func (x *EventTarget) String() string

type EventsStreamError

type EventsStreamError struct {

	// The GRPC error code for the event.
	Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	// A mesasage indicating what the error is.
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

Indicates an error with a message sent to the Event API. Tie `correlation_id` on the message sent to the Event API and the `correlation_id` on the parent message to understand which request this error is for.

func (*EventsStreamError) Descriptor deprecated

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

Deprecated: Use EventsStreamError.ProtoReflect.Descriptor instead.

func (*EventsStreamError) GetCode

func (x *EventsStreamError) GetCode() int32

func (*EventsStreamError) GetMessage

func (x *EventsStreamError) GetMessage() string

func (*EventsStreamError) ProtoMessage

func (*EventsStreamError) ProtoMessage()

func (*EventsStreamError) ProtoReflect

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

func (*EventsStreamError) Reset

func (x *EventsStreamError) Reset()

func (*EventsStreamError) String

func (x *EventsStreamError) String() string

type EventsStreamMessageType

type EventsStreamMessageType int32
const (
	EventsStreamMessageType_EVENTS_STREAM_MESSAGE_TYPE_UNSPECIFIED  EventsStreamMessageType = 0
	EventsStreamMessageType_EVENTS_STREAM_MESSAGE_TYPE_PING         EventsStreamMessageType = 1
	EventsStreamMessageType_EVENTS_STREAM_MESSAGE_TYPE_ERROR        EventsStreamMessageType = 2
	EventsStreamMessageType_EVENTS_STREAM_MESSAGE_TYPE_SUBSCRIBED   EventsStreamMessageType = 3
	EventsStreamMessageType_EVENTS_STREAM_MESSAGE_TYPE_UNSUBSCRIBED EventsStreamMessageType = 4
	EventsStreamMessageType_EVENTS_STREAM_MESSAGE_TYPE_PUBLISHED    EventsStreamMessageType = 5
)

func (EventsStreamMessageType) Descriptor

func (EventsStreamMessageType) Enum

func (EventsStreamMessageType) EnumDescriptor deprecated

func (EventsStreamMessageType) EnumDescriptor() ([]byte, []int)

Deprecated: Use EventsStreamMessageType.Descriptor instead.

func (EventsStreamMessageType) Number

func (EventsStreamMessageType) String

func (x EventsStreamMessageType) String() string

func (EventsStreamMessageType) Type

type EventsStreamReconnectRequest

type EventsStreamReconnectRequest struct {

	// Whether the access token needs to be refreshed before reconnecting.
	Reauthenticate bool `protobuf:"varint,1,opt,name=reauthenticate,proto3" json:"reauthenticate,omitempty"`
	// A timestamp indicating when the connection should be reconnected by.
	// If you're maintaining multiple connections, you should reconnect at a random interval within this time range.
	BeforeTimestamp string `protobuf:"bytes,2,opt,name=before_timestamp,json=beforeTimestamp,proto3" json:"before_timestamp,omitempty"`
	// contains filtered or unexported fields
}

Indicate to the client that they should re-open their connection

func (*EventsStreamReconnectRequest) Descriptor deprecated

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

Deprecated: Use EventsStreamReconnectRequest.ProtoReflect.Descriptor instead.

func (*EventsStreamReconnectRequest) GetBeforeTimestamp

func (x *EventsStreamReconnectRequest) GetBeforeTimestamp() string

func (*EventsStreamReconnectRequest) GetReauthenticate

func (x *EventsStreamReconnectRequest) GetReauthenticate() bool

func (*EventsStreamReconnectRequest) ProtoMessage

func (*EventsStreamReconnectRequest) ProtoMessage()

func (*EventsStreamReconnectRequest) ProtoReflect

func (*EventsStreamReconnectRequest) Reset

func (x *EventsStreamReconnectRequest) Reset()

func (*EventsStreamReconnectRequest) String

type EventsStreamRequest

type EventsStreamRequest struct {

	// Optional value to tag any return values with. This can be any string-based value
	// that your are able to track.
	CorrelationId *string `protobuf:"bytes,1,opt,name=correlation_id,json=correlationId,proto3,oneof" json:"correlation_id,omitempty"`
	// Types that are assignable to EventPayload:
	//
	//	*EventsStreamRequest_Subscribe
	//	*EventsStreamRequest_Unsubscribe
	//	*EventsStreamRequest_Publish
	//	*EventsStreamRequest_Ping
	EventPayload isEventsStreamRequest_EventPayload `protobuf_oneof:"event_payload"`
	// contains filtered or unexported fields
}

Payload sent to the event API

func (*EventsStreamRequest) Descriptor deprecated

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

Deprecated: Use EventsStreamRequest.ProtoReflect.Descriptor instead.

func (*EventsStreamRequest) GetCorrelationId

func (x *EventsStreamRequest) GetCorrelationId() string

func (*EventsStreamRequest) GetEventPayload

func (m *EventsStreamRequest) GetEventPayload() isEventsStreamRequest_EventPayload

func (*EventsStreamRequest) GetPing

func (x *EventsStreamRequest) GetPing() string

func (*EventsStreamRequest) GetPublish

func (x *EventsStreamRequest) GetPublish() *PublishEventRequest

func (*EventsStreamRequest) GetSubscribe

func (x *EventsStreamRequest) GetSubscribe() *SubscribePayload

func (*EventsStreamRequest) GetUnsubscribe

func (x *EventsStreamRequest) GetUnsubscribe() *SubscribePayload

func (*EventsStreamRequest) ProtoMessage

func (*EventsStreamRequest) ProtoMessage()

func (*EventsStreamRequest) ProtoReflect

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

func (*EventsStreamRequest) Reset

func (x *EventsStreamRequest) Reset()

func (*EventsStreamRequest) String

func (x *EventsStreamRequest) String() string

type EventsStreamRequest_Ping

type EventsStreamRequest_Ping struct {
	// Initiate a ping-pong message.
	Ping string `protobuf:"bytes,103,opt,name=ping,proto3,oneof"`
}

type EventsStreamRequest_Publish

type EventsStreamRequest_Publish struct {
	// Publish a new event.
	Publish *PublishEventRequest `protobuf:"bytes,102,opt,name=publish,proto3,oneof"`
}

type EventsStreamRequest_Subscribe

type EventsStreamRequest_Subscribe struct {
	// Subscribe to a new event.
	Subscribe *SubscribePayload `protobuf:"bytes,100,opt,name=subscribe,proto3,oneof"`
}

type EventsStreamRequest_Unsubscribe

type EventsStreamRequest_Unsubscribe struct {
	// Unsubscribe from an event.
	Unsubscribe *SubscribePayload `protobuf:"bytes,101,opt,name=unsubscribe,proto3,oneof"`
}

type EventsStreamResponse

type EventsStreamResponse struct {

	// Optional value to tag any return values with.
	// Correlation ID should be used to correlate requests sent down the socket,
	// enabling you to tie a `PUBLISH` to a `PUBLISHED“
	CorrelationId *string `protobuf:"bytes,2,opt,name=correlation_id,json=correlationId,proto3,oneof" json:"correlation_id,omitempty"`
	// Optional session id
	// This is set by sending the `SessionId` header for any HTTP requests
	// and the `sessionId` query parameter for websockets.
	SessionId *string `protobuf:"bytes,3,opt,name=session_id,json=sessionId,proto3,oneof" json:"session_id,omitempty"`
	// Types that are assignable to EventPayload:
	//
	//	*EventsStreamResponse_Event
	//	*EventsStreamResponse_Pong
	//	*EventsStreamResponse_Error
	//	*EventsStreamResponse_Subscribed
	//	*EventsStreamResponse_Unsubscribed
	//	*EventsStreamResponse_Published
	//	*EventsStreamResponse_ReconnectBefore
	EventPayload isEventsStreamResponse_EventPayload `protobuf_oneof:"event_payload"`
	// contains filtered or unexported fields
}

Payload returned from the event API.

func (*EventsStreamResponse) Descriptor deprecated

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

Deprecated: Use EventsStreamResponse.ProtoReflect.Descriptor instead.

func (*EventsStreamResponse) GetCorrelationId

func (x *EventsStreamResponse) GetCorrelationId() string

func (*EventsStreamResponse) GetError

func (x *EventsStreamResponse) GetError() *EventsStreamError

func (*EventsStreamResponse) GetEvent

func (*EventsStreamResponse) GetEventPayload

func (m *EventsStreamResponse) GetEventPayload() isEventsStreamResponse_EventPayload

func (*EventsStreamResponse) GetPong

func (x *EventsStreamResponse) GetPong() string

func (*EventsStreamResponse) GetPublished

func (x *EventsStreamResponse) GetPublished() *PublishEventResponse

func (*EventsStreamResponse) GetReconnectBefore

func (x *EventsStreamResponse) GetReconnectBefore() *EventsStreamReconnectRequest

func (*EventsStreamResponse) GetSessionId

func (x *EventsStreamResponse) GetSessionId() string

func (*EventsStreamResponse) GetSubscribed

func (x *EventsStreamResponse) GetSubscribed() *SubscribePayload

func (*EventsStreamResponse) GetUnsubscribed

func (x *EventsStreamResponse) GetUnsubscribed() *SubscribePayload

func (*EventsStreamResponse) ProtoMessage

func (*EventsStreamResponse) ProtoMessage()

func (*EventsStreamResponse) ProtoReflect

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

func (*EventsStreamResponse) Reset

func (x *EventsStreamResponse) Reset()

func (*EventsStreamResponse) String

func (x *EventsStreamResponse) String() string

type EventsStreamResponse_Error

type EventsStreamResponse_Error struct {
	// Non-blocking streaming error
	Error *EventsStreamError `protobuf:"bytes,201,opt,name=error,proto3,oneof"`
}

type EventsStreamResponse_Event

type EventsStreamResponse_Event struct {
	// Custom event emitted
	Event *PublishEventResponse `protobuf:"bytes,100,opt,name=event,proto3,oneof"`
}

type EventsStreamResponse_Pong

type EventsStreamResponse_Pong struct {
	// Ping payload
	Pong string `protobuf:"bytes,200,opt,name=pong,proto3,oneof"`
}

type EventsStreamResponse_Published

type EventsStreamResponse_Published struct {
	// Publish a new event.
	Published *PublishEventResponse `protobuf:"bytes,204,opt,name=published,proto3,oneof"`
}

type EventsStreamResponse_ReconnectBefore

type EventsStreamResponse_ReconnectBefore struct {
	// Inform the client should reoconnect before a timestamp.
	ReconnectBefore *EventsStreamReconnectRequest `protobuf:"bytes,205,opt,name=reconnect_before,json=reconnectBefore,proto3,oneof"`
}

type EventsStreamResponse_Subscribed

type EventsStreamResponse_Subscribed struct {
	// Subscribe to a new event.
	Subscribed *SubscribePayload `protobuf:"bytes,202,opt,name=subscribed,proto3,oneof"`
}

type EventsStreamResponse_Unsubscribed

type EventsStreamResponse_Unsubscribed struct {
	// Unsubscribe from an event.
	Unsubscribed *SubscribePayload `protobuf:"bytes,203,opt,name=unsubscribed,proto3,oneof"`
}

type PublishEventRequest

type PublishEventRequest struct {

	// Name of the event.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Value of the event. This can be a free-form value which we do not inspect.
	Payload *structpb.Struct `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
	// Metadata associated with the publishing of the event.
	// Typically this is information about _why_ the event happened. Use `payload` for
	// _what_ the event is.
	RequestMetadata *structpb.Value `protobuf:"bytes,4,opt,name=request_metadata,json=requestMetadata,proto3,oneof" json:"request_metadata,omitempty"`
	// Scope the event to a specific target
	Target *EventTarget `protobuf:"bytes,3,opt,name=target,proto3,oneof" json:"target,omitempty"`
	// contains filtered or unexported fields
}

Publish a custom event

func (*PublishEventRequest) Descriptor deprecated

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

Deprecated: Use PublishEventRequest.ProtoReflect.Descriptor instead.

func (*PublishEventRequest) GetName

func (x *PublishEventRequest) GetName() string

func (*PublishEventRequest) GetPayload

func (x *PublishEventRequest) GetPayload() *structpb.Struct

func (*PublishEventRequest) GetRequestMetadata

func (x *PublishEventRequest) GetRequestMetadata() *structpb.Value

func (*PublishEventRequest) GetTarget

func (x *PublishEventRequest) GetTarget() *EventTarget

func (*PublishEventRequest) ProtoMessage

func (*PublishEventRequest) ProtoMessage()

func (*PublishEventRequest) ProtoReflect

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

func (*PublishEventRequest) Reset

func (x *PublishEventRequest) Reset()

func (*PublishEventRequest) String

func (x *PublishEventRequest) String() string

type PublishEventResponse

type PublishEventResponse struct {

	// Name of the event.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Value of the event.
	Payload *structpb.Struct `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
	// Custom scoping parameters.
	Target *EventTarget `protobuf:"bytes,3,opt,name=target,proto3,oneof" json:"target,omitempty"`
	// Metadata associated with the publishing of the event
	RequestMetadata *structpb.Value `protobuf:"bytes,4,opt,name=request_metadata,json=requestMetadata,proto3,oneof" json:"request_metadata,omitempty"`
	// Internal ID of the event.
	Id string `protobuf:"bytes,5,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

Response of an event being forwarded to a subscription. note: if this socket is also the publisher, this payload will be sent twice. Once for `published` and once for `event`. You can use `correlation_id` to identify the published event.

func (*PublishEventResponse) Descriptor deprecated

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

Deprecated: Use PublishEventResponse.ProtoReflect.Descriptor instead.

func (*PublishEventResponse) GetId

func (x *PublishEventResponse) GetId() string

func (*PublishEventResponse) GetName

func (x *PublishEventResponse) GetName() string

func (*PublishEventResponse) GetPayload

func (x *PublishEventResponse) GetPayload() *structpb.Struct

func (*PublishEventResponse) GetRequestMetadata

func (x *PublishEventResponse) GetRequestMetadata() *structpb.Value

func (*PublishEventResponse) GetTarget

func (x *PublishEventResponse) GetTarget() *EventTarget

func (*PublishEventResponse) ProtoMessage

func (*PublishEventResponse) ProtoMessage()

func (*PublishEventResponse) ProtoReflect

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

func (*PublishEventResponse) Reset

func (x *PublishEventResponse) Reset()

func (*PublishEventResponse) String

func (x *PublishEventResponse) String() string

type SubscribePayload

type SubscribePayload struct {

	// Event name to subscribe to for custom events.
	// This can be a wildcard `my_service:*` or multiple events `my_event|my_other_event`.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// The target to subscribe to.
	Target *EventTarget `protobuf:"bytes,2,opt,name=target,proto3,oneof" json:"target,omitempty"`
	// contains filtered or unexported fields
}

Payload to subscribe or unsubscribe from an event

func (*SubscribePayload) Descriptor deprecated

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

Deprecated: Use SubscribePayload.ProtoReflect.Descriptor instead.

func (*SubscribePayload) GetName

func (x *SubscribePayload) GetName() string

func (*SubscribePayload) GetTarget

func (x *SubscribePayload) GetTarget() *EventTarget

func (*SubscribePayload) ProtoMessage

func (*SubscribePayload) ProtoMessage()

func (*SubscribePayload) ProtoReflect

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

func (*SubscribePayload) Reset

func (x *SubscribePayload) Reset()

func (*SubscribePayload) String

func (x *SubscribePayload) String() string

type UnimplementedEventServiceServer

type UnimplementedEventServiceServer struct {
}

UnimplementedEventServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedEventServiceServer) Publish

func (UnimplementedEventServiceServer) Stream

type UnsafeEventServiceServer

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

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

Jump to

Keyboard shortcuts

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