matter

package module
v0.0.0-...-04296a4 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelOpen    = "O"
	ChannelPrivate = "P"
	ChannelDirect  = "D"
	ChannelGroup   = "G"
	// CHANNEL_GROUP_MAX_USERS        = 8
	// CHANNEL_GROUP_MIN_USERS        = 3
	DefaultChannel = "town-square"
)

Channel constants.

View Source
const (
	PostSystemMessagePrefix = "system_"
	PostDefault             = ""
)

Post constants.

View Source
const (
	TeamOpen   string = "O"
	TeamInvite string = "I"
)

Team constants.

View Source
const (
	SocketMaxMessageSize     = 8 * 1024 // 8KB
	PingTimeoutBufferSeconds = 5

	// WEBSOCKET_EVENT_TYPING                                   = "typing"
	// WEBSOCKET_EVENT_POSTED                                   = "posted"
	// WEBSOCKET_EVENT_POST_EDITED                              = "post_edited"
	// WEBSOCKET_EVENT_POST_DELETED                             = "post_deleted"
	// WEBSOCKET_EVENT_POST_UNREAD                              = "post_unread"
	// WEBSOCKET_EVENT_CHANNEL_CONVERTED                        = "channel_converted"
	// WEBSOCKET_EVENT_CHANNEL_CREATED                          = "channel_created"
	// WEBSOCKET_EVENT_CHANNEL_DELETED                          = "channel_deleted"
	// WEBSOCKET_EVENT_CHANNEL_RESTORED                         = "channel_restored"
	// WEBSOCKET_EVENT_CHANNEL_UPDATED                          = "channel_updated"
	// WEBSOCKET_EVENT_CHANNEL_MEMBER_UPDATED                   = "channel_member_updated"
	// WEBSOCKET_EVENT_CHANNEL_SCHEME_UPDATED                   = "channel_scheme_updated"
	// WEBSOCKET_EVENT_DIRECT_ADDED                             = "direct_added"
	// WEBSOCKET_EVENT_GROUP_ADDED                              = "group_added"
	// WEBSOCKET_EVENT_NEW_USER                                 = "new_user"
	// WEBSOCKET_EVENT_ADDED_TO_TEAM                            = "added_to_team"
	// WEBSOCKET_EVENT_LEAVE_TEAM                               = "leave_team"
	// WEBSOCKET_EVENT_UPDATE_TEAM                              = "update_team"
	// WEBSOCKET_EVENT_DELETE_TEAM                              = "delete_team"
	// WEBSOCKET_EVENT_RESTORE_TEAM                             = "restore_team"
	// WEBSOCKET_EVENT_UPDATE_TEAM_SCHEME                       = "update_team_scheme"
	// WEBSOCKET_EVENT_USER_ADDED                               = "user_added"
	// WEBSOCKET_EVENT_USER_UPDATED                             = "user_updated"
	// WEBSOCKET_EVENT_USER_ROLE_UPDATED                        = "user_role_updated"
	// WEBSOCKET_EVENT_MEMBERROLE_UPDATED                       = "memberrole_updated"
	// WEBSOCKET_EVENT_USER_REMOVED                             = "user_removed"
	// WEBSOCKET_EVENT_PREFERENCE_CHANGED                       = "preference_changed"
	// WEBSOCKET_EVENT_PREFERENCES_CHANGED                      = "preferences_changed"
	// WEBSOCKET_EVENT_PREFERENCES_DELETED                      = "preferences_deleted"
	// WEBSOCKET_EVENT_EPHEMERAL_MESSAGE                        = "ephemeral_message"
	// WEBSOCKET_EVENT_STATUS_CHANGE                            = "status_change"
	// WEBSOCKET_EVENT_HELLO                                    = "hello"
	WebsocketAuthenticationChallenge = "authentication_challenge"
)

Websocket constants.

Variables

View Source
var File_matter_proto protoreflect.FileDescriptor

Functions

func RegisterMatterServer

func RegisterMatterServer(s *grpc.Server, srv MatterServer)

func SetLogger

func SetLogger(l Logger)

SetLogger sets logger for the package.

Types

type Channel

type Channel struct {
	ID          string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	CreateAt    int64  `protobuf:"varint,2,opt,name=create_at,json=createAt,proto3" json:"create_at,omitempty"`
	UpdateAt    int64  `protobuf:"varint,3,opt,name=update_at,json=updateAt,proto3" json:"update_at,omitempty"`
	DeleteAt    int64  `protobuf:"varint,4,opt,name=delete_at,json=deleteAt,proto3" json:"delete_at,omitempty"`
	TeamID      string `protobuf:"bytes,5,opt,name=team_id,json=teamId,proto3" json:"team_id,omitempty"`
	Type        string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"`
	DisplayName string `protobuf:"bytes,7,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
	Name        string `protobuf:"bytes,8,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*Channel) Descriptor deprecated

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

Deprecated: Use Channel.ProtoReflect.Descriptor instead.

func (*Channel) GetCreateAt

func (x *Channel) GetCreateAt() int64

func (*Channel) GetDeleteAt

func (x *Channel) GetDeleteAt() int64

func (*Channel) GetDisplayName

func (x *Channel) GetDisplayName() string

func (*Channel) GetID

func (x *Channel) GetID() string

func (*Channel) GetName

func (x *Channel) GetName() string

func (*Channel) GetTeamID

func (x *Channel) GetTeamID() string

func (*Channel) GetType

func (x *Channel) GetType() string

func (*Channel) GetUpdateAt

func (x *Channel) GetUpdateAt() int64

func (*Channel) ProtoMessage

func (*Channel) ProtoMessage()

func (*Channel) ProtoReflect

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

func (*Channel) Reset

func (x *Channel) Reset()

func (*Channel) String

func (x *Channel) String() string

type ChannelsForUserRequest

type ChannelsForUserRequest struct {
	UserID string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"`
	TeamID string `protobuf:"bytes,2,opt,name=teamId,proto3" json:"teamId,omitempty"`
	// contains filtered or unexported fields
}

func (*ChannelsForUserRequest) Descriptor deprecated

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

Deprecated: Use ChannelsForUserRequest.ProtoReflect.Descriptor instead.

func (*ChannelsForUserRequest) GetTeamID

func (x *ChannelsForUserRequest) GetTeamID() string

func (*ChannelsForUserRequest) GetUserID

func (x *ChannelsForUserRequest) GetUserID() string

func (*ChannelsForUserRequest) ProtoMessage

func (*ChannelsForUserRequest) ProtoMessage()

func (*ChannelsForUserRequest) ProtoReflect

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

func (*ChannelsForUserRequest) Reset

func (x *ChannelsForUserRequest) Reset()

func (*ChannelsForUserRequest) String

func (x *ChannelsForUserRequest) String() string

type ChannelsForUserResponse

type ChannelsForUserResponse struct {
	Channels []*Channel `protobuf:"bytes,1,rep,name=channels,proto3" json:"channels,omitempty"`
	// contains filtered or unexported fields
}

func (*ChannelsForUserResponse) Descriptor deprecated

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

Deprecated: Use ChannelsForUserResponse.ProtoReflect.Descriptor instead.

func (*ChannelsForUserResponse) GetChannels

func (x *ChannelsForUserResponse) GetChannels() []*Channel

func (*ChannelsForUserResponse) ProtoMessage

func (*ChannelsForUserResponse) ProtoMessage()

func (*ChannelsForUserResponse) ProtoReflect

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

func (*ChannelsForUserResponse) Reset

func (x *ChannelsForUserResponse) Reset()

func (*ChannelsForUserResponse) String

func (x *ChannelsForUserResponse) String() string

type Client

type Client struct {
	AuthType  string
	AuthToken string
	// contains filtered or unexported fields
}

Client ...

func NewClient

func NewClient(urs string) (*Client, error)

NewClient creates a Client for a the mattermost API.

func (*Client) AddUserToChannel

func (c *Client) AddUserToChannel(ctx context.Context, userID string, channelID string) error

AddUserToChannel adds a user to a channel.

func (*Client) AddUserToTeam

func (c *Client) AddUserToTeam(ctx context.Context, userID string, teamID string) error

AddUserToTeam adds a user to a team.

func (*Client) Channel

func (c *Client) Channel(ctx context.Context, teamID string, id string) (*Channel, error)

Channel finds channel by ID.

func (*Client) ChannelByName

func (c *Client) ChannelByName(ctx context.Context, teamID string, name string) (*Channel, error)

ChannelByName finds channel by name.

func (*Client) ChannelsForUser

func (c *Client) ChannelsForUser(ctx context.Context, userID string, teamID string) ([]*Channel, error)

ChannelsForUser list channels for logged in user. If userID is "", logged in user (me) is used.

func (*Client) CreateChannel

func (c *Client) CreateChannel(ctx context.Context, name string, teamID string) (*Channel, error)

CreateChannel creates a channel.

func (*Client) CreatePost

func (c *Client) CreatePost(ctx context.Context, channelID string, message string) (*Post, error)

CreatePost creates a post.

func (*Client) CreateTeam

func (c *Client) CreateTeam(ctx context.Context, name string, displayName string, typ string) (*Team, error)

CreateTeam creates a team.

func (*Client) CreateUser

func (c *Client) CreateUser(ctx context.Context, user *User) (*User, error)

CreateUser creates a user.

func (*Client) CreateUserWithKey

func (c *Client) CreateUserWithKey(ctx context.Context, key *keys.EdX25519Key) (*User, error)

CreateUserWithKey creates a user with a key.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string, params url.Values) (*http.Response, error)

Delete request.

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, params url.Values) (*http.Response, error)

Get request.

func (*Client) Head

func (c *Client) Head(ctx context.Context, path string, params url.Values) (*http.Response, error)

Head request.

func (*Client) LoginWithKey

func (c *Client) LoginWithKey(ctx context.Context, key *keys.EdX25519Key) (*User, error)

LoginWithKey logs a user in using an EdX25519 key.

func (*Client) LoginWithPassword

func (c *Client) LoginWithPassword(ctx context.Context, username string, password string) (*User, error)

LoginWithPassword logs a user in with a password.

func (*Client) Logout

func (c *Client) Logout()

Logout clear auth token.

func (*Client) NewWebSocketClient

func (c *Client) NewWebSocketClient() (*WebSocketClient, error)

NewWebSocketClient returns new WebSocketClient.

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, params url.Values, reader io.Reader) (*http.Response, error)

Post request.

func (*Client) PostWithKey

func (c *Client) PostWithKey(ctx context.Context, path string, params url.Values, reader io.Reader, key *keys.EdX25519Key, contentHash string) (*http.Response, error)

PostWithKey request.

func (*Client) PostsForChannel

func (c *Client) PostsForChannel(ctx context.Context, channelID string) (*PostList, error)

PostsForChannel returns posts for channel.

func (*Client) Put

func (c *Client) Put(ctx context.Context, path string, params url.Values, reader io.Reader) (*http.Response, error)

Put request.

func (*Client) SetClock

func (c *Client) SetClock(clock tsutil.Clock)

SetClock sets the clock Now fn.

func (*Client) SetHTTPClient

func (c *Client) SetHTTPClient(httpClient *http.Client)

SetHTTPClient sets the http.Client to use.

func (*Client) TeamByName

func (c *Client) TeamByName(ctx context.Context, name string) (*Team, error)

TeamByName finds team.

func (*Client) Teams

func (c *Client) Teams(ctx context.Context) ([]*Team, error)

Teams ...

func (*Client) TeamsForUser

func (c *Client) TeamsForUser(ctx context.Context, userID string) ([]*Team, error)

TeamsForUser lists teams for user. If userID is "", logged in user (me) is used.

func (*Client) URL

func (c *Client) URL() *url.URL

URL for client.

type ContextLogger

type ContextLogger interface {
	Debugf(ctx context.Context, format string, args ...interface{})
	Infof(ctx context.Context, format string, args ...interface{})
	Warningf(ctx context.Context, format string, args ...interface{})
	Errorf(ctx context.Context, format string, args ...interface{})
}

ContextLogger interface used in this package with request context.

func NewContextLogger

func NewContextLogger(lev LogLevel) ContextLogger

NewContextLogger ...

type CreateChannelRequest

type CreateChannelRequest struct {
	Name   string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	TeamID string `protobuf:"bytes,2,opt,name=teamId,proto3" json:"teamId,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateChannelRequest) Descriptor deprecated

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

Deprecated: Use CreateChannelRequest.ProtoReflect.Descriptor instead.

func (*CreateChannelRequest) GetName

func (x *CreateChannelRequest) GetName() string

func (*CreateChannelRequest) GetTeamID

func (x *CreateChannelRequest) GetTeamID() string

func (*CreateChannelRequest) ProtoMessage

func (*CreateChannelRequest) ProtoMessage()

func (*CreateChannelRequest) ProtoReflect

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

func (*CreateChannelRequest) Reset

func (x *CreateChannelRequest) Reset()

func (*CreateChannelRequest) String

func (x *CreateChannelRequest) String() string

type CreateChannelResponse

type CreateChannelResponse struct {
	Channel *Channel `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateChannelResponse) Descriptor deprecated

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

Deprecated: Use CreateChannelResponse.ProtoReflect.Descriptor instead.

func (*CreateChannelResponse) GetChannel

func (x *CreateChannelResponse) GetChannel() *Channel

func (*CreateChannelResponse) ProtoMessage

func (*CreateChannelResponse) ProtoMessage()

func (*CreateChannelResponse) ProtoReflect

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

func (*CreateChannelResponse) Reset

func (x *CreateChannelResponse) Reset()

func (*CreateChannelResponse) String

func (x *CreateChannelResponse) String() string

type Error

type Error struct {
	StatusCode int      `json:"status_code,omitempty"`
	Message    string   `json:"message,omitempty"`
	URL        *url.URL `json:"-"`
	ID         string   `json:"id,omitempty"`
	RequestID  string   `json:"request_id,omitempty"`
}

Error ...

func (Error) Error

func (e Error) Error() string

type Keyring

type Keyring interface {
	EdX25519Key(kid keys.ID) (*keys.EdX25519Key, error)
}

Keyring for service.

type ListenEvent

type ListenEvent struct {
	Post *Post `protobuf:"bytes,1,opt,name=post,proto3" json:"post,omitempty"`
	// contains filtered or unexported fields
}

func (*ListenEvent) Descriptor deprecated

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

Deprecated: Use ListenEvent.ProtoReflect.Descriptor instead.

func (*ListenEvent) GetPost

func (x *ListenEvent) GetPost() *Post

func (*ListenEvent) ProtoMessage

func (*ListenEvent) ProtoMessage()

func (*ListenEvent) ProtoReflect

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

func (*ListenEvent) Reset

func (x *ListenEvent) Reset()

func (*ListenEvent) String

func (x *ListenEvent) String() string

type ListenRequest

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

func (*ListenRequest) Descriptor deprecated

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

Deprecated: Use ListenRequest.ProtoReflect.Descriptor instead.

func (*ListenRequest) ProtoMessage

func (*ListenRequest) ProtoMessage()

func (*ListenRequest) ProtoReflect

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

func (*ListenRequest) Reset

func (x *ListenRequest) Reset()

func (*ListenRequest) String

func (x *ListenRequest) String() string

type LogLevel

type LogLevel int

LogLevel ...

const (
	// DebugLevel ...
	DebugLevel LogLevel = 3
	// InfoLevel ...
	InfoLevel LogLevel = 2
	// WarnLevel ...
	WarnLevel LogLevel = 1
	// ErrLevel ...
	ErrLevel LogLevel = 0
)

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warningf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
}

Logger interface used in this package.

func NewLogger

func NewLogger(lev LogLevel) Logger

NewLogger ...

type LoginRequest

type LoginRequest struct {
	KID string `protobuf:"bytes,1,opt,name=kid,proto3" json:"kid,omitempty"`
	// contains filtered or unexported fields
}

func (*LoginRequest) Descriptor deprecated

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

Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.

func (*LoginRequest) GetKID

func (x *LoginRequest) GetKID() string

func (*LoginRequest) ProtoMessage

func (*LoginRequest) ProtoMessage()

func (*LoginRequest) ProtoReflect

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

func (*LoginRequest) Reset

func (x *LoginRequest) Reset()

func (*LoginRequest) String

func (x *LoginRequest) String() string

type LoginResponse

type LoginResponse struct {
	User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	// contains filtered or unexported fields
}

func (*LoginResponse) Descriptor deprecated

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

Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead.

func (*LoginResponse) GetUser

func (x *LoginResponse) GetUser() *User

func (*LoginResponse) ProtoMessage

func (*LoginResponse) ProtoMessage()

func (*LoginResponse) ProtoReflect

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

func (*LoginResponse) Reset

func (x *LoginResponse) Reset()

func (*LoginResponse) String

func (x *LoginResponse) String() string

type MatterClient

type MatterClient interface {
	Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
	TeamsForUser(ctx context.Context, in *TeamsForUserRequest, opts ...grpc.CallOption) (*TeamsForUserResponse, error)
	ChannelsForUser(ctx context.Context, in *ChannelsForUserRequest, opts ...grpc.CallOption) (*ChannelsForUserResponse, error)
	CreateChannel(ctx context.Context, in *CreateChannelRequest, opts ...grpc.CallOption) (*CreateChannelResponse, error)
	Listen(ctx context.Context, opts ...grpc.CallOption) (Matter_ListenClient, error)
}

MatterClient is the client API for Matter 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 NewMatterClient

func NewMatterClient(cc grpc.ClientConnInterface) MatterClient

type MatterServer

type MatterServer interface {
	Login(context.Context, *LoginRequest) (*LoginResponse, error)
	TeamsForUser(context.Context, *TeamsForUserRequest) (*TeamsForUserResponse, error)
	ChannelsForUser(context.Context, *ChannelsForUserRequest) (*ChannelsForUserResponse, error)
	CreateChannel(context.Context, *CreateChannelRequest) (*CreateChannelResponse, error)
	Listen(Matter_ListenServer) error
	// contains filtered or unexported methods
}

MatterServer is the server API for Matter service. All implementations must embed UnimplementedMatterServer for forward compatibility

func NewService

func NewService(client *Client, kr Keyring) MatterServer

NewService is a service for Matter.

type Matter_ListenClient

type Matter_ListenClient interface {
	Send(*ListenRequest) error
	Recv() (*ListenEvent, error)
	grpc.ClientStream
}

type Matter_ListenServer

type Matter_ListenServer interface {
	Send(*ListenEvent) error
	Recv() (*ListenRequest, error)
	grpc.ServerStream
}

type Post

type Post struct {
	ID        string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	CreateAt  int64  `protobuf:"varint,2,opt,name=create_at,json=createAt,proto3" json:"create_at,omitempty"`
	UpdateAt  int64  `protobuf:"varint,3,opt,name=update_at,json=updateAt,proto3" json:"update_at,omitempty"`
	EditAt    int64  `protobuf:"varint,4,opt,name=edit_at,json=editAt,proto3" json:"edit_at,omitempty"`
	DeleteAt  int64  `protobuf:"varint,5,opt,name=delete_at,json=deleteAt,proto3" json:"delete_at,omitempty"`
	UserID    string `protobuf:"bytes,7,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	ChannelID string `protobuf:"bytes,8,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"`
	Message   string `protobuf:"bytes,12,opt,name=message,proto3" json:"message,omitempty"`
	Type      string `protobuf:"bytes,14,opt,name=type,proto3" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*Post) Descriptor deprecated

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

Deprecated: Use Post.ProtoReflect.Descriptor instead.

func (*Post) GetChannelID

func (x *Post) GetChannelID() string

func (*Post) GetCreateAt

func (x *Post) GetCreateAt() int64

func (*Post) GetDeleteAt

func (x *Post) GetDeleteAt() int64

func (*Post) GetEditAt

func (x *Post) GetEditAt() int64

func (*Post) GetID

func (x *Post) GetID() string

func (*Post) GetMessage

func (x *Post) GetMessage() string

func (*Post) GetType

func (x *Post) GetType() string

func (*Post) GetUpdateAt

func (x *Post) GetUpdateAt() int64

func (*Post) GetUserID

func (x *Post) GetUserID() string

func (*Post) ProtoMessage

func (*Post) ProtoMessage()

func (*Post) ProtoReflect

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

func (*Post) Reset

func (x *Post) Reset()

func (*Post) String

func (x *Post) String() string

type PostList

type PostList struct {
	Order      []string         `protobuf:"bytes,1,rep,name=order,proto3" json:"order,omitempty"`
	Posts      map[string]*Post `` /* 151-byte string literal not displayed */
	NextPostID string           `protobuf:"bytes,3,opt,name=next_post_id,json=nextPostId,proto3" json:"next_post_id,omitempty"`
	PrevPostID string           `protobuf:"bytes,4,opt,name=prev_post_id,json=prevPostId,proto3" json:"prev_post_id,omitempty"`
	// contains filtered or unexported fields
}

func (*PostList) Descriptor deprecated

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

Deprecated: Use PostList.ProtoReflect.Descriptor instead.

func (*PostList) GetNextPostID

func (x *PostList) GetNextPostID() string

func (*PostList) GetOrder

func (x *PostList) GetOrder() []string

func (*PostList) GetPosts

func (x *PostList) GetPosts() map[string]*Post

func (*PostList) GetPrevPostID

func (x *PostList) GetPrevPostID() string

func (*PostList) ProtoMessage

func (*PostList) ProtoMessage()

func (*PostList) ProtoReflect

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

func (*PostList) Reset

func (x *PostList) Reset()

func (*PostList) String

func (x *PostList) String() string

type Team

type Team struct {
	ID              string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	CreateAt        int64  `protobuf:"varint,2,opt,name=create_at,json=createAt,proto3" json:"create_at,omitempty"`
	UpdateAt        int64  `protobuf:"varint,3,opt,name=update_at,json=updateAt,proto3" json:"update_at,omitempty"`
	DeleteAt        int64  `protobuf:"varint,4,opt,name=delete_at,json=deleteAt,proto3" json:"delete_at,omitempty"`
	DisplayName     string `protobuf:"bytes,5,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
	Name            string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"`
	Type            string `protobuf:"bytes,9,opt,name=type,proto3" json:"type,omitempty"`
	AllowOpenInvite bool   `protobuf:"varint,13,opt,name=allow_open_invite,json=allowOpenInvite,proto3" json:"allow_open_invite,omitempty"`
	// contains filtered or unexported fields
}

func (*Team) Descriptor deprecated

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

Deprecated: Use Team.ProtoReflect.Descriptor instead.

func (*Team) GetAllowOpenInvite

func (x *Team) GetAllowOpenInvite() bool

func (*Team) GetCreateAt

func (x *Team) GetCreateAt() int64

func (*Team) GetDeleteAt

func (x *Team) GetDeleteAt() int64

func (*Team) GetDisplayName

func (x *Team) GetDisplayName() string

func (*Team) GetID

func (x *Team) GetID() string

func (*Team) GetName

func (x *Team) GetName() string

func (*Team) GetType

func (x *Team) GetType() string

func (*Team) GetUpdateAt

func (x *Team) GetUpdateAt() int64

func (*Team) ProtoMessage

func (*Team) ProtoMessage()

func (*Team) ProtoReflect

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

func (*Team) Reset

func (x *Team) Reset()

func (*Team) String

func (x *Team) String() string

type TeamPatch

type TeamPatch struct {
	DisplayName      string `protobuf:"bytes,1,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
	Description      string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
	CompanyName      string `protobuf:"bytes,3,opt,name=company_name,json=companyName,proto3" json:"company_name,omitempty"`
	AllowedDomains   string `protobuf:"bytes,4,opt,name=allowed_domains,json=allowedDomains,proto3" json:"allowed_domains,omitempty"`
	AllowOpenInvite  bool   `protobuf:"varint,5,opt,name=allow_open_invite,json=allowOpenInvite,proto3" json:"allow_open_invite,omitempty"`
	GroupConstrained bool   `protobuf:"varint,6,opt,name=group_constrained,json=groupConstrained,proto3" json:"group_constrained,omitempty"`
	// contains filtered or unexported fields
}

func (*TeamPatch) Descriptor deprecated

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

Deprecated: Use TeamPatch.ProtoReflect.Descriptor instead.

func (*TeamPatch) GetAllowOpenInvite

func (x *TeamPatch) GetAllowOpenInvite() bool

func (*TeamPatch) GetAllowedDomains

func (x *TeamPatch) GetAllowedDomains() string

func (*TeamPatch) GetCompanyName

func (x *TeamPatch) GetCompanyName() string

func (*TeamPatch) GetDescription

func (x *TeamPatch) GetDescription() string

func (*TeamPatch) GetDisplayName

func (x *TeamPatch) GetDisplayName() string

func (*TeamPatch) GetGroupConstrained

func (x *TeamPatch) GetGroupConstrained() bool

func (*TeamPatch) ProtoMessage

func (*TeamPatch) ProtoMessage()

func (*TeamPatch) ProtoReflect

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

func (*TeamPatch) Reset

func (x *TeamPatch) Reset()

func (*TeamPatch) String

func (x *TeamPatch) String() string

type TeamsForUserRequest

type TeamsForUserRequest struct {
	UserID string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId,omitempty"`
	// contains filtered or unexported fields
}

func (*TeamsForUserRequest) Descriptor deprecated

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

Deprecated: Use TeamsForUserRequest.ProtoReflect.Descriptor instead.

func (*TeamsForUserRequest) GetUserID

func (x *TeamsForUserRequest) GetUserID() string

func (*TeamsForUserRequest) ProtoMessage

func (*TeamsForUserRequest) ProtoMessage()

func (*TeamsForUserRequest) ProtoReflect

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

func (*TeamsForUserRequest) Reset

func (x *TeamsForUserRequest) Reset()

func (*TeamsForUserRequest) String

func (x *TeamsForUserRequest) String() string

type TeamsForUserResponse

type TeamsForUserResponse struct {
	Teams []*Team `protobuf:"bytes,1,rep,name=teams,proto3" json:"teams,omitempty"`
	// contains filtered or unexported fields
}

func (*TeamsForUserResponse) Descriptor deprecated

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

Deprecated: Use TeamsForUserResponse.ProtoReflect.Descriptor instead.

func (*TeamsForUserResponse) GetTeams

func (x *TeamsForUserResponse) GetTeams() []*Team

func (*TeamsForUserResponse) ProtoMessage

func (*TeamsForUserResponse) ProtoMessage()

func (*TeamsForUserResponse) ProtoReflect

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

func (*TeamsForUserResponse) Reset

func (x *TeamsForUserResponse) Reset()

func (*TeamsForUserResponse) String

func (x *TeamsForUserResponse) String() string

type UnimplementedMatterServer

type UnimplementedMatterServer struct {
}

UnimplementedMatterServer must be embedded to have forward compatible implementations.

func (*UnimplementedMatterServer) ChannelsForUser

func (*UnimplementedMatterServer) CreateChannel

func (*UnimplementedMatterServer) Listen

func (*UnimplementedMatterServer) Login

func (*UnimplementedMatterServer) TeamsForUser

type User

type User struct {
	ID            string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	CreateAt      int64  `protobuf:"varint,2,opt,name=create_at,json=createAt,proto3" json:"create_at,omitempty"`
	UpdateAt      int64  `protobuf:"varint,3,opt,name=update_at,json=updateAt,proto3" json:"update_at,omitempty"`
	DeleteAt      int64  `protobuf:"varint,4,opt,name=delete_at,json=deleteAt,proto3" json:"delete_at,omitempty"`
	Username      string `protobuf:"bytes,5,opt,name=username,proto3" json:"username,omitempty"`
	Password      string `protobuf:"bytes,6,opt,name=password,proto3" json:"password,omitempty"`
	Email         string `protobuf:"bytes,9,opt,name=email,proto3" json:"email,omitempty"`
	EmailVerified bool   `protobuf:"varint,10,opt,name=email_verified,json=emailVerified,proto3" json:"email_verified,omitempty"`
	Nickname      string `protobuf:"bytes,11,opt,name=nickname,proto3" json:"nickname,omitempty"`
	FirstName     string `protobuf:"bytes,12,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty"`
	LastName      string `protobuf:"bytes,13,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty"`
	Position      string `protobuf:"bytes,14,opt,name=position,proto3" json:"position,omitempty"`
	Roles         string `protobuf:"bytes,15,opt,name=roles,proto3" json:"roles,omitempty"`
	// contains filtered or unexported fields
}

User ...

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetCreateAt

func (x *User) GetCreateAt() int64

func (*User) GetDeleteAt

func (x *User) GetDeleteAt() int64

func (*User) GetEmail

func (x *User) GetEmail() string

func (*User) GetEmailVerified

func (x *User) GetEmailVerified() bool

func (*User) GetFirstName

func (x *User) GetFirstName() string

func (*User) GetID

func (x *User) GetID() string

func (*User) GetLastName

func (x *User) GetLastName() string

func (*User) GetNickname

func (x *User) GetNickname() string

func (*User) GetPassword

func (x *User) GetPassword() string

func (*User) GetPosition

func (x *User) GetPosition() string

func (*User) GetRoles

func (x *User) GetRoles() string

func (*User) GetUpdateAt

func (x *User) GetUpdateAt() int64

func (*User) GetUsername

func (x *User) GetUsername() string

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

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

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

type WebSocketClient

type WebSocketClient struct {
	URL                string                  // The location of the server like "ws://localhost:8065"
	APIURL             string                  // The API location of the server like "ws://localhost:8065/api/v3"
	ConnectURL         string                  // The WebSocket URL to connect to like "ws://localhost:8065/api/v3/path/to/websocket"
	Conn               *websocket.Conn         // The WebSocket connection
	AuthToken          string                  // The token used to open the WebSocket connection
	Sequence           int64                   // The ever-incrementing sequence attached to each WebSocket action
	PingTimeoutChannel chan bool               // The channel used to signal ping timeouts
	EventChannel       chan *WebSocketEvent    // The channel used to receive various events pushed from the server. For example: typing, posted
	ResponseChannel    chan *WebSocketResponse // The channel used to receive responses for requests made to the server
	ListenError        error                   // A field that is set if there was an abnormal closure of the WebSocket connection
	// contains filtered or unexported fields
}

WebSocketClient stores the necessary information required to communicate with a WebSocket endpoint. A client must read from PingTimeoutChannel, EventChannel and ResponseChannel to prevent deadlocks from occuring in the program.

func NewWebSocketClient

func NewWebSocketClient(url, authToken string) (*WebSocketClient, error)

NewWebSocketClient constructs a new WebSocket client with convenience methods for talking to the server.

func NewWebSocketClientWithDialer

func NewWebSocketClientWithDialer(dialer *websocket.Dialer, url, authToken string) (*WebSocketClient, error)

NewWebSocketClientWithDialer constructs a new WebSocket client with convenience methods for talking to the server using a custom dialer.

func (*WebSocketClient) Close

func (wsc *WebSocketClient) Close()

Close closes the websocket client. It is recommended that a closed client should not be reused again. Rather a new client should be created anew.

func (*WebSocketClient) Connect

func (wsc *WebSocketClient) Connect() error

Connect creates a websocket connection with the given ConnectUrl. This is racy and error-prone should not be used. Use any of the New* functions to create a websocket.

func (*WebSocketClient) ConnectWithDialer

func (wsc *WebSocketClient) ConnectWithDialer(dialer *websocket.Dialer) error

ConnectWithDialer creates a websocket connection with the given ConnectUrl using the dialer. This is racy and error-prone and should not be used. Use any of the New* functions to create a websocket.

func (*WebSocketClient) GetStatuses

func (wsc *WebSocketClient) GetStatuses()

GetStatuses will return a map of string statuses using user id as the key

func (*WebSocketClient) GetStatusesByIds

func (wsc *WebSocketClient) GetStatusesByIds(userIds []string)

GetStatusesByIds will fetch certain user statuses based on ids and return a map of string statuses using user id as the key

func (*WebSocketClient) Listen

func (wsc *WebSocketClient) Listen()

Listen starts the read loop of the websocket client.

func (*WebSocketClient) SendMessage

func (wsc *WebSocketClient) SendMessage(action string, data map[string]interface{})

SendMessage sens a message.

func (*WebSocketClient) UserTyping

func (wsc *WebSocketClient) UserTyping(channelID, parentID string)

UserTyping will push a user_typing event out to all connected users who are in the specified channel

type WebSocketEvent

type WebSocketEvent struct {
	Event     string
	Data      map[string]interface{}
	Broadcast *WebsocketBroadcast
	Sequence  int64
	// contains filtered or unexported fields
}

WebSocketEvent ...

type WebSocketRequest

type WebSocketRequest struct {
	// Client-provided fields
	Seq    int64                  `json:"seq"`    // A counter which is incremented for every request made.
	Action string                 `json:"action"` // The action to perform for a request. For example: get_statuses, user_typing.
	Data   map[string]interface{} `json:"data"`   // The metadata for an action.
}

WebSocketRequest represents a request made to the server through a websocket.

type WebSocketResponse

type WebSocketResponse struct {
	Status   string                 `json:"status"`              // The status of the response. For example: OK, FAIL.
	SeqReply int64                  `json:"seq_reply,omitempty"` // A counter which is incremented for every response sent.
	Data     map[string]interface{} `json:"data,omitempty"`      // The data contained in the response.
	Error    error                  `json:"error,omitempty"`     // A field that is set if any error has occurred.
}

WebSocketResponse represents a response received through the WebSocket for a request made to the server. This is available through the ResponseChannel channel in WebSocketClient.

type WebsocketBroadcast

type WebsocketBroadcast struct {
	OmitUsers map[string]bool `json:"omit_users"` // broadcast is omitted for users listed here
	UserID    string          `json:"user_id"`    // broadcast only occurs for this user
	ChannelID string          `json:"channel_id"` // broadcast only occurs for users in this channel
	TeamID    string          `json:"team_id"`    // broadcast only occurs for users in this team
}

WebsocketBroadcast ...

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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