Documentation ¶
Overview ¶
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterMessageApiHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterMessageApiHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MessageApiClient) error
- func RegisterMessageApiHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterMessageApiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MessageApiServer) error
- func RegisterMessageApiServer(s grpc.ServiceRegistrar, srv MessageApiServer)
- type AuthData
- type Cursor
- type Cursor_Index
- type Envelope
- func (*Envelope) Descriptor() ([]byte, []int)deprecated
- func (x *Envelope) GetContentTopic() string
- func (x *Envelope) GetMessage() []byte
- func (x *Envelope) GetTimestampNs() uint64
- func (*Envelope) ProtoMessage()
- func (x *Envelope) ProtoReflect() protoreflect.Message
- func (x *Envelope) Reset()
- func (x *Envelope) String() string
- type IndexCursor
- func (*IndexCursor) Descriptor() ([]byte, []int)deprecated
- func (x *IndexCursor) GetDigest() []byte
- func (x *IndexCursor) GetSenderTimeNs() uint64
- func (*IndexCursor) ProtoMessage()
- func (x *IndexCursor) ProtoReflect() protoreflect.Message
- func (x *IndexCursor) Reset()
- func (x *IndexCursor) String() string
- type MessageApiClient
- type MessageApiServer
- type MessageApi_SubscribeClient
- type MessageApi_SubscribeServer
- type PagingInfo
- func (*PagingInfo) Descriptor() ([]byte, []int)deprecated
- func (x *PagingInfo) GetCursor() *Cursor
- func (x *PagingInfo) GetDirection() SortDirection
- func (x *PagingInfo) GetLimit() uint32
- func (*PagingInfo) ProtoMessage()
- func (x *PagingInfo) ProtoReflect() protoreflect.Message
- func (x *PagingInfo) Reset()
- func (x *PagingInfo) String() string
- type PublishRequest
- type PublishResponse
- type QueryRequest
- func (*QueryRequest) Descriptor() ([]byte, []int)deprecated
- func (x *QueryRequest) GetContentTopics() []string
- func (x *QueryRequest) GetEndTimeNs() uint64
- func (x *QueryRequest) GetPagingInfo() *PagingInfo
- func (x *QueryRequest) GetStartTimeNs() uint64
- func (*QueryRequest) ProtoMessage()
- func (x *QueryRequest) ProtoReflect() protoreflect.Message
- func (x *QueryRequest) Reset()
- func (x *QueryRequest) String() string
- type QueryResponse
- func (*QueryResponse) Descriptor() ([]byte, []int)deprecated
- func (x *QueryResponse) GetEnvelopes() []*Envelope
- func (x *QueryResponse) GetPagingInfo() *PagingInfo
- func (*QueryResponse) ProtoMessage()
- func (x *QueryResponse) ProtoReflect() protoreflect.Message
- func (x *QueryResponse) Reset()
- func (x *QueryResponse) String() string
- type SortDirection
- func (SortDirection) Descriptor() protoreflect.EnumDescriptor
- func (x SortDirection) Enum() *SortDirection
- func (SortDirection) EnumDescriptor() ([]byte, []int)deprecated
- func (x SortDirection) Number() protoreflect.EnumNumber
- func (x SortDirection) String() string
- func (SortDirection) Type() protoreflect.EnumType
- type SubscribeRequest
- type Token
- func (*Token) Descriptor() ([]byte, []int)deprecated
- func (x *Token) GetAuthDataBytes() []byte
- func (x *Token) GetAuthDataSignature() *message_contents.Signature
- func (x *Token) GetIdentityKey() *message_contents.PublicKey
- func (*Token) ProtoMessage()
- func (x *Token) ProtoReflect() protoreflect.Message
- func (x *Token) Reset()
- func (x *Token) String() string
- type UnimplementedMessageApiServer
- func (UnimplementedMessageApiServer) Publish(context.Context, *PublishRequest) (*PublishResponse, error)
- func (UnimplementedMessageApiServer) Query(context.Context, *QueryRequest) (*QueryResponse, error)
- func (UnimplementedMessageApiServer) Subscribe(*SubscribeRequest, MessageApi_SubscribeServer) error
- type UnsafeMessageApiServer
Constants ¶
This section is empty.
Variables ¶
var ( SortDirection_name = map[int32]string{ 0: "SORT_DIRECTION_UNSPECIFIED", 1: "SORT_DIRECTION_ASCENDING", 2: "SORT_DIRECTION_DESCENDING", } SortDirection_value = map[string]int32{ "SORT_DIRECTION_UNSPECIFIED": 0, "SORT_DIRECTION_ASCENDING": 1, "SORT_DIRECTION_DESCENDING": 2, } )
Enum value maps for SortDirection.
var File_message_api_v1_authn_proto protoreflect.FileDescriptor
var File_message_api_v1_message_api_proto protoreflect.FileDescriptor
var MessageApi_ServiceDesc = grpc.ServiceDesc{ ServiceName: "xmtp.message_api.v1.MessageApi", HandlerType: (*MessageApiServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Publish", Handler: _MessageApi_Publish_Handler, }, { MethodName: "Query", Handler: _MessageApi_Query_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "Subscribe", Handler: _MessageApi_Subscribe_Handler, ServerStreams: true, }, }, Metadata: "message_api/v1/message_api.proto", }
MessageApi_ServiceDesc is the grpc.ServiceDesc for MessageApi service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterMessageApiHandler ¶
func RegisterMessageApiHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterMessageApiHandler registers the http handlers for service MessageApi to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterMessageApiHandlerClient ¶
func RegisterMessageApiHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MessageApiClient) error
RegisterMessageApiHandlerClient registers the http handlers for service MessageApi to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MessageApiClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MessageApiClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "MessageApiClient" to call the correct interceptors.
func RegisterMessageApiHandlerFromEndpoint ¶
func RegisterMessageApiHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterMessageApiHandlerFromEndpoint is same as RegisterMessageApiHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterMessageApiHandlerServer ¶
func RegisterMessageApiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MessageApiServer) error
RegisterMessageApiHandlerServer registers the http handlers for service MessageApi to "mux". UnaryRPC :call MessageApiServer 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 RegisterMessageApiHandlerFromEndpoint instead.
func RegisterMessageApiServer ¶
func RegisterMessageApiServer(s grpc.ServiceRegistrar, srv MessageApiServer)
Types ¶
type AuthData ¶ added in v1.1.1
type AuthData struct { // address of the wallet WalletAddr string `protobuf:"bytes,1,opt,name=wallet_addr,json=walletAddr,proto3" json:"wallet_addr,omitempty"` // time when the token was generated/signed CreatedNs uint64 `protobuf:"varint,2,opt,name=created_ns,json=createdNs,proto3" json:"created_ns,omitempty"` // contains filtered or unexported fields }
AuthData carries token parameters that are authenticated by the identity key signature. It is embedded in the Token structure as bytes so that the bytes don't need to be reconstructed to verify the token signature.
func (*AuthData) Descriptor
deprecated
added in
v1.1.1
func (*AuthData) GetCreatedNs ¶ added in v1.1.1
func (*AuthData) GetWalletAddr ¶ added in v1.1.1
func (*AuthData) ProtoMessage ¶ added in v1.1.1
func (*AuthData) ProtoMessage()
func (*AuthData) ProtoReflect ¶ added in v1.1.1
func (x *AuthData) ProtoReflect() protoreflect.Message
type Cursor ¶
type Cursor struct { // Making the cursor a one-of type, as I would like to change the way we // handle pagination to use a precomputed sort field. // This way we can handle both methods // // Types that are assignable to Cursor: // *Cursor_Index Cursor isCursor_Cursor `protobuf_oneof:"cursor"` // contains filtered or unexported fields }
Wrapper for potentially multiple types of cursor
func (*Cursor) Descriptor
deprecated
func (*Cursor) GetIndex ¶
func (x *Cursor) GetIndex() *IndexCursor
func (*Cursor) ProtoMessage ¶
func (*Cursor) ProtoMessage()
func (*Cursor) ProtoReflect ¶
func (x *Cursor) ProtoReflect() protoreflect.Message
type Cursor_Index ¶
type Cursor_Index struct {
Index *IndexCursor `protobuf:"bytes,1,opt,name=index,proto3,oneof"`
}
type Envelope ¶
type Envelope struct { ContentTopic string `protobuf:"bytes,1,opt,name=content_topic,json=contentTopic,proto3" json:"content_topic,omitempty"` TimestampNs uint64 `protobuf:"varint,2,opt,name=timestamp_ns,json=timestampNs,proto3" json:"timestamp_ns,omitempty"` Message []byte `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
Envelope encapsulates a message while in transit.
func (*Envelope) Descriptor
deprecated
func (*Envelope) GetContentTopic ¶
func (*Envelope) GetMessage ¶
func (*Envelope) GetTimestampNs ¶
func (*Envelope) ProtoMessage ¶
func (*Envelope) ProtoMessage()
func (*Envelope) ProtoReflect ¶
func (x *Envelope) ProtoReflect() protoreflect.Message
type IndexCursor ¶
type IndexCursor struct { Digest []byte `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"` SenderTimeNs uint64 `protobuf:"varint,2,opt,name=sender_time_ns,json=senderTimeNs,proto3" json:"sender_time_ns,omitempty"` // contains filtered or unexported fields }
This is based off of the go-waku Index type, but with the receiverTime and pubsubTopic removed for simplicity. Both removed fields are optional
func (*IndexCursor) Descriptor
deprecated
func (*IndexCursor) Descriptor() ([]byte, []int)
Deprecated: Use IndexCursor.ProtoReflect.Descriptor instead.
func (*IndexCursor) GetDigest ¶
func (x *IndexCursor) GetDigest() []byte
func (*IndexCursor) GetSenderTimeNs ¶
func (x *IndexCursor) GetSenderTimeNs() uint64
func (*IndexCursor) ProtoMessage ¶
func (*IndexCursor) ProtoMessage()
func (*IndexCursor) ProtoReflect ¶
func (x *IndexCursor) ProtoReflect() protoreflect.Message
func (*IndexCursor) Reset ¶
func (x *IndexCursor) Reset()
func (*IndexCursor) String ¶
func (x *IndexCursor) String() string
type MessageApiClient ¶
type MessageApiClient interface { // Publish a message to the network Publish(ctx context.Context, in *PublishRequest, opts ...grpc.CallOption) (*PublishResponse, error) // Subscribe to a stream of envelopers matching a predicate Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (MessageApi_SubscribeClient, error) // Query the store for messages Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) }
MessageApiClient is the client API for MessageApi 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.
func NewMessageApiClient ¶
func NewMessageApiClient(cc grpc.ClientConnInterface) MessageApiClient
type MessageApiServer ¶
type MessageApiServer interface { // Publish a message to the network Publish(context.Context, *PublishRequest) (*PublishResponse, error) // Subscribe to a stream of envelopers matching a predicate Subscribe(*SubscribeRequest, MessageApi_SubscribeServer) error // Query the store for messages Query(context.Context, *QueryRequest) (*QueryResponse, error) // contains filtered or unexported methods }
MessageApiServer is the server API for MessageApi service. All implementations must embed UnimplementedMessageApiServer for forward compatibility
type MessageApi_SubscribeClient ¶
type MessageApi_SubscribeClient interface { Recv() (*Envelope, error) grpc.ClientStream }
type MessageApi_SubscribeServer ¶
type MessageApi_SubscribeServer interface { Send(*Envelope) error grpc.ServerStream }
type PagingInfo ¶
type PagingInfo struct { // Note: this is a uint32, while go-waku's pageSize is a uint64 Limit uint32 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` Cursor *Cursor `protobuf:"bytes,2,opt,name=cursor,proto3" json:"cursor,omitempty"` Direction SortDirection `protobuf:"varint,3,opt,name=direction,proto3,enum=xmtp.message_api.v1.SortDirection" json:"direction,omitempty"` // contains filtered or unexported fields }
This is based off of the go-waku PagingInfo struct, but with the direction changed to our SortDirection enum format
func (*PagingInfo) Descriptor
deprecated
func (*PagingInfo) Descriptor() ([]byte, []int)
Deprecated: Use PagingInfo.ProtoReflect.Descriptor instead.
func (*PagingInfo) GetCursor ¶
func (x *PagingInfo) GetCursor() *Cursor
func (*PagingInfo) GetDirection ¶
func (x *PagingInfo) GetDirection() SortDirection
func (*PagingInfo) GetLimit ¶
func (x *PagingInfo) GetLimit() uint32
func (*PagingInfo) ProtoMessage ¶
func (*PagingInfo) ProtoMessage()
func (*PagingInfo) ProtoReflect ¶
func (x *PagingInfo) ProtoReflect() protoreflect.Message
func (*PagingInfo) Reset ¶
func (x *PagingInfo) Reset()
func (*PagingInfo) String ¶
func (x *PagingInfo) String() string
type PublishRequest ¶
type PublishRequest struct { Envelopes []*Envelope `protobuf:"bytes,1,rep,name=envelopes,proto3" json:"envelopes,omitempty"` // contains filtered or unexported fields }
Publish
func (*PublishRequest) Descriptor
deprecated
func (*PublishRequest) Descriptor() ([]byte, []int)
Deprecated: Use PublishRequest.ProtoReflect.Descriptor instead.
func (*PublishRequest) GetEnvelopes ¶ added in v1.0.1
func (x *PublishRequest) GetEnvelopes() []*Envelope
func (*PublishRequest) ProtoMessage ¶
func (*PublishRequest) ProtoMessage()
func (*PublishRequest) ProtoReflect ¶
func (x *PublishRequest) ProtoReflect() protoreflect.Message
func (*PublishRequest) Reset ¶
func (x *PublishRequest) Reset()
func (*PublishRequest) String ¶
func (x *PublishRequest) String() string
type PublishResponse ¶
type PublishResponse struct {
// contains filtered or unexported fields
}
Empty message as a response for Publish
func (*PublishResponse) Descriptor
deprecated
func (*PublishResponse) Descriptor() ([]byte, []int)
Deprecated: Use PublishResponse.ProtoReflect.Descriptor instead.
func (*PublishResponse) ProtoMessage ¶
func (*PublishResponse) ProtoMessage()
func (*PublishResponse) ProtoReflect ¶
func (x *PublishResponse) ProtoReflect() protoreflect.Message
func (*PublishResponse) Reset ¶
func (x *PublishResponse) Reset()
func (*PublishResponse) String ¶
func (x *PublishResponse) String() string
type QueryRequest ¶
type QueryRequest struct { ContentTopics []string `protobuf:"bytes,1,rep,name=content_topics,json=contentTopics,proto3" json:"content_topics,omitempty"` StartTimeNs uint64 `protobuf:"varint,2,opt,name=start_time_ns,json=startTimeNs,proto3" json:"start_time_ns,omitempty"` EndTimeNs uint64 `protobuf:"varint,3,opt,name=end_time_ns,json=endTimeNs,proto3" json:"end_time_ns,omitempty"` PagingInfo *PagingInfo `protobuf:"bytes,4,opt,name=paging_info,json=pagingInfo,proto3" json:"paging_info,omitempty"` // contains filtered or unexported fields }
Query
func (*QueryRequest) Descriptor
deprecated
func (*QueryRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead.
func (*QueryRequest) GetContentTopics ¶
func (x *QueryRequest) GetContentTopics() []string
func (*QueryRequest) GetEndTimeNs ¶
func (x *QueryRequest) GetEndTimeNs() uint64
func (*QueryRequest) GetPagingInfo ¶
func (x *QueryRequest) GetPagingInfo() *PagingInfo
func (*QueryRequest) GetStartTimeNs ¶
func (x *QueryRequest) GetStartTimeNs() uint64
func (*QueryRequest) ProtoMessage ¶
func (*QueryRequest) ProtoMessage()
func (*QueryRequest) ProtoReflect ¶
func (x *QueryRequest) ProtoReflect() protoreflect.Message
func (*QueryRequest) Reset ¶
func (x *QueryRequest) Reset()
func (*QueryRequest) String ¶
func (x *QueryRequest) String() string
type QueryResponse ¶
type QueryResponse struct { Envelopes []*Envelope `protobuf:"bytes,1,rep,name=envelopes,proto3" json:"envelopes,omitempty"` PagingInfo *PagingInfo `protobuf:"bytes,2,opt,name=paging_info,json=pagingInfo,proto3" json:"paging_info,omitempty"` // contains filtered or unexported fields }
The response, containing envelopes, for a query
func (*QueryResponse) Descriptor
deprecated
func (*QueryResponse) Descriptor() ([]byte, []int)
Deprecated: Use QueryResponse.ProtoReflect.Descriptor instead.
func (*QueryResponse) GetEnvelopes ¶
func (x *QueryResponse) GetEnvelopes() []*Envelope
func (*QueryResponse) GetPagingInfo ¶
func (x *QueryResponse) GetPagingInfo() *PagingInfo
func (*QueryResponse) ProtoMessage ¶
func (*QueryResponse) ProtoMessage()
func (*QueryResponse) ProtoReflect ¶
func (x *QueryResponse) ProtoReflect() protoreflect.Message
func (*QueryResponse) Reset ¶
func (x *QueryResponse) Reset()
func (*QueryResponse) String ¶
func (x *QueryResponse) String() string
type SortDirection ¶
type SortDirection int32
Sort direction
const ( SortDirection_SORT_DIRECTION_UNSPECIFIED SortDirection = 0 SortDirection_SORT_DIRECTION_ASCENDING SortDirection = 1 SortDirection_SORT_DIRECTION_DESCENDING SortDirection = 2 )
func (SortDirection) Descriptor ¶
func (SortDirection) Descriptor() protoreflect.EnumDescriptor
func (SortDirection) Enum ¶
func (x SortDirection) Enum() *SortDirection
func (SortDirection) EnumDescriptor
deprecated
func (SortDirection) EnumDescriptor() ([]byte, []int)
Deprecated: Use SortDirection.Descriptor instead.
func (SortDirection) Number ¶
func (x SortDirection) Number() protoreflect.EnumNumber
func (SortDirection) String ¶
func (x SortDirection) String() string
func (SortDirection) Type ¶
func (SortDirection) Type() protoreflect.EnumType
type SubscribeRequest ¶
type SubscribeRequest struct { ContentTopics []string `protobuf:"bytes,1,rep,name=content_topics,json=contentTopics,proto3" json:"content_topics,omitempty"` // contains filtered or unexported fields }
Subscribe
func (*SubscribeRequest) Descriptor
deprecated
func (*SubscribeRequest) Descriptor() ([]byte, []int)
Deprecated: Use SubscribeRequest.ProtoReflect.Descriptor instead.
func (*SubscribeRequest) GetContentTopics ¶
func (x *SubscribeRequest) GetContentTopics() []string
func (*SubscribeRequest) ProtoMessage ¶
func (*SubscribeRequest) ProtoMessage()
func (*SubscribeRequest) ProtoReflect ¶
func (x *SubscribeRequest) ProtoReflect() protoreflect.Message
func (*SubscribeRequest) Reset ¶
func (x *SubscribeRequest) Reset()
func (*SubscribeRequest) String ¶
func (x *SubscribeRequest) String() string
type Token ¶ added in v1.1.1
type Token struct { // identity key signed by a wallet IdentityKey *message_contents.PublicKey `protobuf:"bytes,1,opt,name=identity_key,json=identityKey,proto3" json:"identity_key,omitempty"` // encoded bytes of AuthData AuthDataBytes []byte `protobuf:"bytes,2,opt,name=auth_data_bytes,json=authDataBytes,proto3" json:"auth_data_bytes,omitempty"` // identity key signature of AuthData bytes AuthDataSignature *message_contents.Signature `protobuf:"bytes,3,opt,name=auth_data_signature,json=authDataSignature,proto3" json:"auth_data_signature,omitempty"` // contains filtered or unexported fields }
Token is used by clients to prove to the nodes that they are serving a specific wallet.
func (*Token) Descriptor
deprecated
added in
v1.1.1
func (*Token) GetAuthDataBytes ¶ added in v1.1.1
func (*Token) GetAuthDataSignature ¶ added in v1.1.1
func (x *Token) GetAuthDataSignature() *message_contents.Signature
func (*Token) GetIdentityKey ¶ added in v1.1.1
func (x *Token) GetIdentityKey() *message_contents.PublicKey
func (*Token) ProtoMessage ¶ added in v1.1.1
func (*Token) ProtoMessage()
func (*Token) ProtoReflect ¶ added in v1.1.1
func (x *Token) ProtoReflect() protoreflect.Message
type UnimplementedMessageApiServer ¶
type UnimplementedMessageApiServer struct { }
UnimplementedMessageApiServer must be embedded to have forward compatible implementations.
func (UnimplementedMessageApiServer) Publish ¶
func (UnimplementedMessageApiServer) Publish(context.Context, *PublishRequest) (*PublishResponse, error)
func (UnimplementedMessageApiServer) Query ¶
func (UnimplementedMessageApiServer) Query(context.Context, *QueryRequest) (*QueryResponse, error)
func (UnimplementedMessageApiServer) Subscribe ¶
func (UnimplementedMessageApiServer) Subscribe(*SubscribeRequest, MessageApi_SubscribeServer) error
type UnsafeMessageApiServer ¶
type UnsafeMessageApiServer interface {
// contains filtered or unexported methods
}
UnsafeMessageApiServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MessageApiServer will result in compilation errors.